{"_id":"@kentico/gatsby-source-kontent","_rev":"91-b1900862a8f22a0c9f3a3a8cc46b62ca","name":"@kentico/gatsby-source-kontent","dist-tags":{"preview-functionality":"4.1.0-beta7","items-feed":"4.3.0-beta1","vnext-alpha":"6.0.0-vnext.4","vnext":"6.0.0-vnext.5","gatsbyv3":"7.0.0-beta.1","alpha":"7.3.0-alpha.0","beta":"8.1.0-beta.1","latest":"8.1.0"},"versions":{"4.0.0-beta1":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta1","keywords":["kentico-cloud","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta1","maintainers":[{"name":"makma","email":"martinm@kentico.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"56be90a7816517ed7c62c45f64463a8cbf2ee686","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta1.tgz","fileCount":15,"integrity":"sha512-7o55F72nL+I5FYYK0CX5a1lUfacIlS3xEaHfqFGTLQJm81YNQBtcVekI2BZ8otbbFx2uBz4an2LvRKit9UVlDA==","signatures":[{"sig":"MEQCIANZ0rZYAckgAIPAylRNXVl0nJUVVKdH2mtV08OUM+ONAiBxoaQkJhJqJhOldPT7kdDeXk4eYMJt6DgQJeoSb+aToA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46453,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoHfwCRA9TVsSAnZWagAA4pgP/iy3JrfYyJTxReQYfZ5C\nLkwA6/FJ5QkosffnzGIrtdCRE9/skuEDn8ho7osZOIIb1ZxanXkMmOi1Ks0k\nyoWSy6r6DurfxWuIL8RnhhqNQk6Mg5t1IBdQOoMPsL1qpJwXSfAbczEIiMp0\nmWYOcwj4gKWK/VqrXuW5TxIGnso93sVsAu2bz5xMlP5wEYkfHrykiPmbLPK5\nuSgYCHft2tdkRyq1RVF1XOLTADFyZjyau7gIJWVnlTFDJalkiAvk8LNdDgav\nybhC3Vc8c2aWhqtkihjZeaYaU47ildHpeQ3wtUAsKsG2VphAsfzrX16jQB/3\n1apOcNcxoTi1LC+QNL/fy6Ac2VBX5sgOKXmm4jSWgFF+oHLvOTokG5gxail6\nnZKnsm3WmxB5ZgRdc4LbOaG3kjvlGa76TTwBcEaELTKdNgF88W8WhFgvh/A5\nKhIGirQzHxLsr0ZmWdJenQV8uM73reXaFAJ2i42/KXps2Pq66bm/nl8tjFhs\nbVIpWYc5K5jr6aB3z6xnXo1PQnMOqCUlSKAYtQZF8t1qKvSbGHzAhjJpB+pN\n1wKYFV+Je+pkdVpMyaDvw0sGsWLwKA4rpeKvvQYROOEpjnenTTzWSUydhpWG\nGoQYFocw8IEQTuDIESTdtGATXbKOEL9thCCDXfxSfSeTuvXSzAFOCLHttTnO\nR9W2\r\n=JEo6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"34b17b72b06879032ea530c4a9f7bd16d84b4547","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.4.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"10.15.3","dependencies":{"rxjs":"^6.4.0","react":"^16.8.3","lodash":"^4.17.11","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^7.0.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.0.0"},"peerDependencies":{"gatsby":">=2.1.18"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta1_1570797552167_0.5065183129033406","host":"s3://npm-registry-packages"}},"4.0.0-beta2":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta2","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta2","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"e5e8532a11eb7831d4b5acfa4c5851154b97eaf4","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta2.tgz","fileCount":15,"integrity":"sha512-ihBfRB0eoj2+I29GJJqSsxrPRGwrJM8u9TdOV0nCd8PQgazuu4R7QlnYJemxndqtmpdZjolaoQZM/0+Y5iW2bg==","signatures":[{"sig":"MEUCIQDXlSlcjxa7XBsjMLy9IKIZ+lBsbk021js2+AM2zodN4AIgeQf5xcy9t3rH8MsGRTNdpz9nmOINM+vmaBmwexeUGfE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduCbdCRA9TVsSAnZWagAA9G4P/12FLJqRXdXhxV9Vb5Mu\nGLZ2cogqb/e5i0Jz3wPYaiONfIQU2U5ZzfDeWR6fY/xJDK3DfxXksR2lvLJ4\n5He9+65txA2+m7gJcOw/3rNskrkhjDlCl65tUnDrRZANtlyj78pafuq9zXGL\nbfvAETxLX1MbH9oj9xfwcN+wyu61f9nTx86bXNhfh/v6ccmxczNbY1n18Tbt\nP2xWpuoTuD5sXfcuBlmlv0m2NLnydmj7XWJ+ZjaCka8+kLQOxb3T2N4x8hV4\nGpnqfrQDa3XMP8eJ12tZ/2a4z4del3brnUp1/PaG+9OOPBpKi/QTMqp+d1ld\nqSl6Zd7jE4G4UZSt3icYmPJJpbl4HKCUiOb/6a8ZDkcanbFBLKmFrqK0OGXV\nW4Ih0d9VKyTUzn+w8jEafELV0PxfrMwNimNnbh3Lq+naKBA6Kb5p+RS2gQKQ\nYTDKR6aOJIPSoOj7CX7gREQsZnavcXN8g38BMMccj6E0ps5ablbnHrk9DG/r\nMBA9oHS78D0M71qDquuK6Ocb9EDIdLvt9uB2AEh5jBM09/BvjSe24VZgKNQh\n9FXM9qLWncCv5cP1WPVEgovsHDj/871fIelchL4vj2lJEK1ZX9F1f88yHlEM\nEebq2KkChFUBFU65qoIbUqE8yI/3W7SX5WAAmBHwjt9mQ0QUE83dPDFK9HOs\nkxDW\r\n=Gvhg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai.com) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n> :bulb: Notice the encapsulation into the `... on Node` [GraphQL inline fragment](https://graphql.org/learn/queries/#inline-fragments). This prevent failing creating GraphQL model when this field does not contain i.e. Blog post (`KontentItemBlogpostReference`) linked item.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on Node {\n              __typename\n              ... on KontentItemBlogpostReference {\n                elements {\n                  title {\n                    value\n                  }\n                }\n              }\n              ... on KontentItemProjectReference {\n                elements {\n                  project_name {\n                    value\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n            ... on Node {\n            __typename\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"1bcede0ec46f0c807df010d5b5faba80a81323e1","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.0","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.0.1","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.11","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.1.18"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta2_1572349660788_0.8043011882205702","host":"s3://npm-registry-packages"}},"4.0.0-beta3":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta3","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta3","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"11bcf4c1541ec3a5c04cbde4f1988e98b78995e2","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta3.tgz","fileCount":16,"integrity":"sha512-ktYNoPPshW+HzMeC12M8BsT/dzQzLJpxszuB6176GkA7J74qvHWyKRicdiLSTJRMN4WOuhpt1eeecGkHblnd1w==","signatures":[{"sig":"MEQCIH6IaL6fMdoshvEylwyodwlgwhe7ck7THuBVodZ+pm4dAiAHRu0g0d7+4pUj8Qfxa0Xcv81dnUrxHhaPKjGrJj2NUQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyW1FCRA9TVsSAnZWagAADxcQAIOpQ3elwe7RgWVJ1Hah\niN7VWDg4pTv3vkWsu3GyArXfJitRHhWObcbtwR/qLNwTj2DJxu6qyfNxch0x\nnMLNVaYHqmnGDDG6jdUL+LDFrt/UbM0DXlMIyK0f2UBHZyf24qWhz1fEqMde\nYufXv1jLShuFU0EjM6mGffKFmJ1jya3xxV94x6VMXK8JbEPj9nEAd4J+U+CD\nPmY0ReI4i+8f+kAZJEtjYAUF7Gq32l9zk8ds+TqKmbk1O/lORtKQeqz9f9qY\nNkQ+JgyZRHcivfUu8n85Ej1dlMNfmXvmi/dWwq3pG4twhZe/nCt0E0DWlrdC\n8LvqTn2ZV6IK9H8rnGG0hKgy9jAUrajEHSVbQjpUaWa6DtdJI3WajZEy6OGj\ntenlPs4rjNHt2fmXvh0RzTvoGW5Hgp8IgIebExEi5YAmswloEcZeU9v8RhKZ\nMpv12f/18f3nc8lV3nJwa0ZWk8g7cWq4KtZPN0qNEGqlnrrfTNbOXCJ0OJ+q\n7T1chZUZolHESh3cofFw128F9OkvV14jbdn4aOEshjVL2iyQjA0/BB7HSQ8S\nLE3GB+Fnwk02/DLRwNfn2vul+ISxDz171uWgmM0xPHDwJMLyJotmp9qCN/d4\nU9hdDCKA4aFaAU0uUYypim0kl+Hw016cDn5+EfVVEZCJNh0FWa1H6WREz0Na\n32Ww\r\n=AskQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n> :bulb: Notice the encapsulation into the `... on Node` [GraphQL inline fragment](https://graphql.org/learn/queries/#inline-fragments). This prevent failing creating GraphQL model when this field does not contain i.e. Blog post (`KontentItemBlogpostReference`) linked item.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on Node {\n              __typename\n              ... on KontentItemBlogpostReference {\n                elements {\n                  title {\n                    value\n                  }\n                }\n              }\n              ... on KontentItemProjectReference {\n                elements {\n                  project_name {\n                    value\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n            ... on Node {\n            __typename\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"91079e0f8fdebc6fbe8777a54b5e22e8a5474d02","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.1.18"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta3_1573481796860_0.6063560775383148","host":"s3://npm-registry-packages"}},"4.0.0-beta4":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta4","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta4","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"45f2b4225b89effb972f22c1eb88cf6d5dd69286","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta4.tgz","fileCount":16,"integrity":"sha512-VfabYf2IRW1rAkVM+2rPXLvhpugXp5sEWP5BEPj6n2VoUQMgdDUUmstz8g939TGEQzaY9D0pj1NXHIxPBUHOlg==","signatures":[{"sig":"MEUCICMif2BltZTu10bsA/CX/BLjI/T5bFy95W1lFnPwGFHwAiEAgxVt+XNs2EN0WpBcQq4jnlkE1QZ3H8zN2BOfKJG4gw4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":52027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzVRdCRA9TVsSAnZWagAAePMQAJKmCX7Ta/Mka5/GsNQL\ndcd2Uj2JkJgo8BgYNo2FBMWgYr8/twytqmOdguyaIwlxbo9aZCgVshj4vLEh\nTg6sIUyCrN1HQcvidyHh0JfFI46h4GPB2DHiRmuz3y/72v16/Qxqo8rE9oOJ\nTr1/Oybc7uoCvn6+brzvSgdCRF05XLxZPK6F3eJ7HkwSEfzgvI3YHD8eL3pe\neYIlI+ddtW3IQuII+c6zwAsYuJzuY57RDX6FpQceKR5QjiFW9jpHx6j/3fDr\nBp4CroUXJMLkdB6bqtaNV2xUFcYJjHs6zVmU2txZmqUW8zaaOhMD6jMGszLM\n2CpRCeN75/HUP2IqzriCPKkfM9PDAFW6cj73TDkFN894vz9rRLT/i7qBvkV0\n3hiiaZslJePLORVgFPsMOh+rtVgIoLLVzxqbEPesHsNF3MZ1iyHPqG8l2cZf\nPQjGcDrn1j9BBLnZt46wRTCGla6+N2DmrpmkTYJHlsyg+QtievdOkXiCNAUx\nWaNgLpsEVglwjSvnJzgB2YxMHaD9WPX5L+AS8bOC2DVKlJB4NkoizqaApmPH\nqFYG0Wm+ZAwrVKqBoeiqPUYdf2TzJkiiOOdn9P/h4dLEuLYHnnKPC3TKiExh\nOxKXZgg9414qVY1r5eJoGA+kChiqb2ZOvj5Qw+IO13qC//BDtY9tSt/+AhNZ\nBaoN\r\n=lzte\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"dcd978e0728f155367f13f4efb833fa4939369d2","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta4_1573737565110_0.7437846063972184","host":"s3://npm-registry-packages"}},"4.1.0-beta1":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta1","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta1","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"09252cb47bf86f00a7818bbccc4a6565cb41474b","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta1.tgz","fileCount":16,"integrity":"sha512-GjNc8XgEB1MKwHerpU5e1wra36mUCISd5sUwcACpoKZS+YTp/gbsZImV9jIZNTv8lZnfHpNXkojglICrSC7sYg==","signatures":[{"sig":"MEUCICvebfwHDY1r8xvL/9Et7ahSYbC9/yied/tLSo2poIiZAiEAhhkdy+t+stPTA9estcG4iO7q6U5rXgOqB9rWsl2szmI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55885,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1Qf7CRA9TVsSAnZWagAAtxUP/iBNOCWszC8yeKFRzG+M\nbkU2v+JaVftKYj51NpzxwZn+ho8kq2lhJFOFgTXxnZhlfXfmemaT5TRnldyo\nk9jQlZOp0/gN4TWmqL5zWjtgxffQUSWxwjFBeSBtnsX3A6pjlvdcjbyxuJWX\nnS5GD85tIJtC9Wq8qtHCg1z0G7R5D/f2zch9vChNwpPdKv+IRk9VbGuavNS8\nYifa1Ctad0B1zvJ9fq6QcPF45u51ZwqLyiLDn2ZT9Q40036XD2f4p8D5Fxn5\ng3Xs94EDb17Fzamw+gNUzVjOs/MV84Y4voyGACfcSufG/GsiKukt6ndR7EW2\now12NedgJkd458UTbgo4EKRpheaTODSJ75Zm9UwyPpMkk3tAmOa4+lbKFx0n\nrZEViRO5WRdLysY4hImjmpBCGc7fJrSTp7MomE35WjlsGYy5jUKDzKGBg9zw\nWdDxKvujSNvw5TNj975kJV9TcDorUs6DYpbg+Ug4+dgJs0TDcL7Q8tPxUwEG\nuokN8VENYtxWNKYzfWIrbuSxq5TMcj+fKmPb3H64e5aU5BmvpdpQc5XiH6UR\nawf31uA8AmDo6YPaoShBonPZa/303M+H0U/fddpj7p5oPtF4tJut9tAjqelx\nZHrBXH6yFXzosd6aRuYtV/7FApRT7su3HbafDbTZ75E0sxf2MsZBR5y3QE/i\ndhw3\r\n=pJON\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"b1ce2ec4d072063cdffccb1db50ddfbb831d6ea0","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta1_1574242299009_0.8957568431974938","host":"s3://npm-registry-packages"}},"4.1.0-beta2":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta2","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta2","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"727e17b1745e3264a82d51d38dec808854a9841a","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta2.tgz","fileCount":16,"integrity":"sha512-xuYVoUAX+N2Zi+9YaMI00DMkdHpEBJBnuPDjpA6E+FMNBTcgmnGgGGC4UjYATtj6y440WcNldb4u9rYdKPNZcA==","signatures":[{"sig":"MEUCIQDloDhaTDMZYUZVGKRUXomPhY1yE2hVEcnfiCTN07WO1gIgXRMEDJPtNGkkr24OGnaHPOKvks3CipsVF5DIyFzR4us=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56011,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1ZmECRA9TVsSAnZWagAAB9IP/RGo8ocnYmEhr288m+qO\nd1TdaTrUJ22+RTOQq1gJzi4bqIFsdAkbvXa8+84/8GHbbKu74utUSBDSDg0C\n1+ooLoYNQVE4hdhWQ1yhI6BTYdkpSXn3LP2Pp40Q/LCljGf5TgnQNyRb6OQj\nAns4/Waf1wGQ2Cm5QR/yFRTkpAmn9E+JmBmQRmNUmaCXfP9bmUJkanT7Qgyp\np0YLGX0/HFgx/tWv1lJkhKOyF2BhPodJzR9GBLiDar+idxGHo60+tev97ogz\nI8pWRO6Qu2bs+CiF+B+5SoTw5upHS7iQyj5jZv7ovhZm97Qryx5zG2xsR9Hz\n+EjpZO9K9pSGcy2xFzry7w9sR+BXqgqigeardS0q5QRYxKI4kCekkgPw/k0N\nGqZnhddzeUj9YVFJ+epmozXuCCtwBcc/53j1ppigZxSiCsMY2iAzU3Gm8tOn\nEsHF3BEnx83MqwKW0VCXBlJQYjjypLvIc/SC0/S9wlTN8ameQ3zfc+W7RtJV\nq21y6NGe1ne49LHdYCIN/EX+6hkUa4Np0ZTp7mz0HWZeFRSb3e2+JZWr9oim\nGzCxyql+4nqVj73rRtJ7rzT9cqs7FeyWUpeKTRNhtDgk1GyudUEFJGj7wuRi\nAGY/nZ2NtmIo20krKKc/ikn9lxGmqymVhVV9+jbYc4ywe6jQO8BYRlTwcmLB\nHeb/\r\n=WCiV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"da45155090e9e0e711c54321dd342af48740022e","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta2_1574279555940_0.5316193882978917","host":"s3://npm-registry-packages"}},"4.1.0-beta4":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta4","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta4","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"8f7daf0540694658b03f5daf9310692ac1b100bb","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta4.tgz","fileCount":16,"integrity":"sha512-8ef9cDUQD8fB3p3FD0gzdsh7vSGCrNmLnpKAQ3yEPog6lDvsSxvzxdUbDmoSJkXR5HgqEOejDJx4kVZoRUriFg==","signatures":[{"sig":"MEUCIQDJn806N7dDiEGLLfGnY/ZWVSOIrJQWG+cGvXiRjanxmwIgdJrFaa2G51/HCmEh+unK9Q9YMbbGfQOR5LV6yfjBw+Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56369,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1pMkCRA9TVsSAnZWagAAqSoP/25yxH7/STUkEEn06am4\nb4BqdcxIJg1iC5bLa5d5wAtarWP6JvWq0XSJGCesKib5KYQZ5rLrQ1Da5tVO\nCJe98iB3xkUtjtAKLxwjs+GZS84SOU/tC7MjVsbe89mL7sIhkqo6xr1bxT5O\nzAWdvcCzTwIb2STSIpQ2LepX4klAcdnNHZ3VHqIJKxGLzhe6MPVskEBAQKUA\nfwvTOvtzEwpcuFT294jp2EmeEylFln133kkX5J6enW3j3Xh9rzjA7X+m214f\nBN2MXnVoxZajsyx8jfPa5jj6IE2bxovAWPRfjibBtECBI3p0BQKq/c2+y+nW\nyVImhj78w/eiriXzj/K6ybPsger7pM4dc6YSoVU+3ujTPYo8IgkSZ+/0bv37\nPIvPrxZlkCtdJYLb5wZPER0xkHPQtRNmly+Ys4b2ZmRMvWXG0HO0DRgvSPQN\nGb9EGQ4H5gRHm+GTrxC8MPQAckGRPP0dBN8bdX/25kg74QIWdq5CvC07LWTq\ncdoHmfpSpySW8utjW+jyRwFQBA6Vwl05lCC+lPjoCkPNW9h06VNjekjno7pQ\nxEqej0a7fou3ZPcolHcHgFIdK+hzSh013loYx9VtZ9wy9QBp51plqD25ITfZ\nqIyja59Q7GT6XG90CA41ss/kStMGe52JG55BkzCSNk4SMjmLNsTudK7aR+HW\nFREd\r\n=NP51\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"221be9a12368908e5bad9aee17482394a5fe3bf4","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta4_1574343459857_0.8803879628409064","host":"s3://npm-registry-packages"}},"4.1.0-beta5":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta5","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta5","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"549988821b345f28bd4e9da7d144492731f9c7d4","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta5.tgz","fileCount":16,"integrity":"sha512-NDlq0imIa/izjQGiOgyBZ+1j4/F8geGXXcdXvWS/JANpgcakp8je8TZCb83CCSsOiWz1UaZZVpIibbtntyVKww==","signatures":[{"sig":"MEUCICywK8GbHm/mNJhV/Z0u3nzqh9TB5dCSjwbvSaJDkEDoAiEAmDf8AJoVanYZXlLhz+VR8lKKoyEPtV8GUikGb0p7gfA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56454,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1rtFCRA9TVsSAnZWagAAHE8QAJBDZP8XmJMjLqCecds5\nj8GWSgL0y1s7DGJUrE4aCPGMG8c6Rvf0+I2jBOSaS4t78DKnjKCuenLdKA+X\nwEpSuUC3o2MLP1zbCsk2Im0wk5Q26eQWmD0K+i1hHQ2c8LxvEgBV3caVg89L\nmtq8TywnvMjR56DOo9Rt3hLYAjkVsPZXzuxkgAdZEQNrgZMJA6a3X60NtvpN\nSaeB3KU0QRgxMFMOiLkfPFDHUQUMXQbHkTof1LjM4ExyjTM0DWZwRs6FMrmb\nzr2FpTZ3iQsXZQHIuROTrTsFAEyE8o+jk48f8Btc5xwWqhtF5OeS9Kr0l2xW\n80yEKVEhfEqEAIiJGNgQMD4oKVvDkNoBYNAFpBGDZdyHteDb+l0a+uBc1L9M\nZZONnlHa3/H6cI8GM/i+KSpBOd/6Jg9WG/qqSCkYIjD1lD0DcOl4vjyJe9q0\nC5fRFGJlJT/fg1pY4TXxtsXO1T1wW00oNshx5Lhmu/Hdll7IZl48IlQMiL0n\nAVvsEmUQXM3arI+onn4mtMsIj+Iw/5YDphQAMZEnoqDyFcMXAwyz1zQj8TH2\n2f3H3CoDCqcDXRgNmmjPx4gsm9sVCgJ4B+96xSrLipAAdKvSy4/UqZsPLpz2\nnnfZBu8Gb4yv1tM5RgMX8oOdlHPhY/US3/c6OfIwI485UTBXRckT3OIxyQEr\nZ0LJ\r\n=paT/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"28098c41725dce6abb5c4086d43c6f74e620f8b7","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.12.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.1.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta5_1574353732595_0.09008639443767574","host":"s3://npm-registry-packages"}},"4.1.0-beta6":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta6","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta6","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"44ee2dc0035bdf8a4dbf8bf4eb392af36eb346cc","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta6.tgz","fileCount":17,"integrity":"sha512-60oxyLXm7kS5fzOdvBcxio88BOVO67AHH2spLX8k813a70hLLjBS+1U+FgZl8J/87+8PHQaRHLCvgZrGj/raVg==","signatures":[{"sig":"MEUCIQCKCP/CmQ8JG0J2axrBQhVDSzOryFLL3avlum+Fx1ZEJwIgGI6jLwoMw5RwxoTovRkcerTgpamgHct0KRUZ9B1+4+o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4nQxCRA9TVsSAnZWagAA5KIP/0qwBJBUKNPp/87oj749\nnarjHKTA12OPaBGQyyylQQiQDH1tAcOKO1Gj7A4aD1NA5vBXa1opq+9Ulknj\n9GY+Zdn+Ht0TqLEiiOYG/0ykE5FXVSBYE1GaL7jnxH84smG837Bv+XTDRftr\n9nLdeUYW6hgUXFo8Zk64lInSjUKbl0nYPs7zq2ejt4ILiCtHtmEkEHxYoeG4\noeFURky6AN9Ej7EylXGEkcc9UXyOlgL4Solg52azDPBOa/DqJqF0LvFNw8xH\nUw3bsy71T9Ikf/3Rh+Y9WUPYLnIwNm93grEj4tbNEHwiwif2Kg/jUy9ts0Zg\nfnlpOhfXNHrxPPgdrGq9Q/De1A1op2w7suYCWXd57OAmncR1+fHJFQIvkZVg\nJMzbMK1qkOwKH5Sh4X7BlD4fjfTnlXGA50/9bodiP4AlH2nCM9b59aPidOo0\nl1H8BFX26OaGySMxkz1zljWvsBFf/wuYuoLdxQaP/0zSlhR/AsUlqNynEtx9\nmAlQDS+p2r5QHad0cyCb7e+QxOjmNuwCkddKTUkhfEDc9VawtOChaE1gUruO\nS0yc1E8JYsoVQS6/sDNXLhwhD2yL4LQdlyPY5thYi/HBBNVPjxNkwSRD6/FU\n+EoLxRIITcOPRvXmGqY3DUzSyllS9IlpldZ+3N8db5UdJqzTJ+4uQu6XmomI\nTtJz\r\n=Pena\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"ba63bfa1dbc3caad584e2c39d3f318aee56e4d9b","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.2.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta6_1575121969294_0.40946831830768415","host":"s3://npm-registry-packages"}},"4.1.0-beta7":{"name":"@kentico/gatsby-source-kontent","version":"4.1.0-beta7","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.1.0-beta7","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"83ed4432cf94f4002a06467f28c66cc2f863d55b","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.1.0-beta7.tgz","fileCount":17,"integrity":"sha512-HMOzth1WIS8/3dFMfbfabkzyAmhiJYt1GqVizn3+r1RgTv8DrmDXQ+1JsihaW1eUDD6XSSJXs380q2+L4caK8A==","signatures":[{"sig":"MEUCIQDHMuKF/qBzooyNJLsfUBBhEiSJrgm/bX8NFShsy91TqwIgHHFEmHWhkyKa82b3taLThbEWHnE5pAk9AamE+PKA+5c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":59712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd8eQCCRA9TVsSAnZWagAAJ6YP/RDln+GVp9lfCKpWVFEB\nUgf+mH8BVbutT8cSddfpMuFHzEfPWFYWnSx/3mDjsnITp2EzXpz/5gAAnsF/\nSR+GkPqWi1Y9dlKGNOs1RPn/WiRPlk7iDHg6DuHVhXt82yfOW/TURZfo9Kkr\nsomlw3Tg2KYzRmU8jFD6ewlFPZfSP8TGh+zyrRYsAQEXw45RVoETt9I5r95b\nT+81ttQRZO9s0zj6VUKimvgN+6fkQi3XiYjHEZuz3SpiAhxgUhGwdVMiVix6\nOcIJtHN3cbseoaNmukw3vo22KB/xc1v2w2UjBT9c+k3TeBOd97bcGa21D5p6\nGagbEP/n+tCtvUTJ7qQKkiN10kS0AH9CVIKDfBSjtSf0xaIq2MtfsMVEVg1t\naTSOUOtZ9J6GZobaZH8FjLcMuTrLyxC+rDfeA+2zomQzK0bW9Ckp7S7Lhnnp\nCElIPLpWzz09fIvNnKfRPUkqR4y1ZVPrE/Djif3FxdXQVNp8OD911C8UHfrj\n0GhwBv7d6ZNJixro21Z2rLkyp3BBtqnVHbvVH1dmgHNEkPtx97rUykJ5BOq/\nSd7ATBBvKW2oziR0yJlPY7gXrld5Ii8YD7AJ5QEPKGxFYHSY6TkN9/qczUvJ\npvN3DICwx0d5MK2xCs3TkUadK6QJqHBECd3Zydh5//UGBU/qMsi4c4xlMQkz\nXVNN\r\n=I0Xv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\n### Install plugin to your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package,\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n    **Configuration object**\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `prefered_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `prefered language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-cloud/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"5e87f8a1a1ef78b96caaa4ed350b9f0b65f0dfa8","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.1","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.3.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"^5.14.1","gatsby":"^2.17.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.1.0-beta7_1576133634238_0.021760954459308923","host":"s3://npm-registry-packages"}},"4.0.0-beta5":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta5","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta5","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"a33af62445bd3e58b2090c2ae4b1921d359e8efe","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta5.tgz","fileCount":16,"integrity":"sha512-R9pWQtC5gQrk37kII0P5uHA0ALypT6ObU2XWOsHyAmqltVgAIZZAUzprq+Sl+fd/11lAdfGRvrwm9TracvffeA==","signatures":[{"sig":"MEQCICsnRgRIGZuM8eZqh/wVdg0DhKV4ivd3kMnykgVwMab2AiBEw3J+KFO5x8DucPVetGHbRfSf/PrRS4GhbQtztA53eA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55255,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+mE8CRA9TVsSAnZWagAAgccP+gPz2AF26zlTmISzh8NH\nIXaZL64bjHPk1dOUN7JvDNDvUif3MJMeUmIaOxXGU7nU36KgOP87YSUCuEqo\n8RAHwIjRjGmwq4xevsdsSPchxaMG63mSQHxxW1HbXOOOjAw0aqp6n7AxeqZj\n1ITNOignXpbnTv3Pc78uNkgSD21yU/rwlS+3VF05Ob7VhJlA5mgxce/aiVis\nY8WoHnFAyDdUej69gPFfaDGh0DznxT0aqAbU64MFhM0KIFXNbXqtzD9SlSNI\nWUYC8jh866Q72rEDZwSTfxNJ1aXvX5MQEbMw8OR+Nkim1CvhmOF9dCinyy4m\nRraFu0hFbk3bBCKnQpzEydWDOBbp2TXeUQUWEKpDaQF9rbz2VcoQyCBrFmuX\ngMIQ700kUYB6B8nXFsIFqRvQLRuiSejEM5kkGX72agu9SpgtS6a4+GGagQMH\npKPN4XUItiDC3TNw12tOqSQkw2RTFsyskrO8VN2tzyFQqif9I8Rbvqk4jiA5\nj/sIH0JSTwUX6wx6ndltXi+kZMSIGm9S3HW21EQ3Iu/EaM88/RXwkYS2p+6t\n5TLfFojZgeVH/k5f1TtR/pALIC4RCy2bALyvrOS9Fwik7k0+pRY3UzD82xzJ\nWaskZSB4FAIVUZn53tN+8LV3rl3j3tPjlCzVqavKwPegkRasJg4OMaJWNgB5\ngKrL\r\n=R/qD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items queries\n\nThere are two queries (`allKontentItem` and `kontentItem`) allows to load content items from unified endpoint regardless of type.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"bdabcb4f6e93e51329e03dd0932e2c8e8ffa076a","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.4.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.18.11"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta5_1576689980066_0.8872715466560006","host":"s3://npm-registry-packages"}},"4.0.0-beta6":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0-beta6","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0-beta6","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"141504495f53c11e1e4ecdd67f56158cf57b0d24","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0-beta6.tgz","fileCount":16,"integrity":"sha512-lGtCtRy/Cpu6FM7TQuY+7bQgHIf4qw+ExAyxHup4rfkL8fB7czAnzmOeYJBsnAl4kxFqExv1B3UJj7MTVLL5mg==","signatures":[{"sig":"MEYCIQDfBDSK1LWZw/J5dBYrN1s5G5xQAw7gw9S2095hJt1WLAIhANM/eol5ITaYsXjxdv+w58Au1xiH2TL+9rU0JpaqAsrR","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55534,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+7OwCRA9TVsSAnZWagAAS7IP/RzL2QohQKH/4uxsdjUL\nXL5PFlpjbTzQhZ9Effsfo5e1a/d2IaqOX+2RYnT/+UGAVEuSKiQoQ0xgIFCD\n6eBBYvtPidpfAgOJeBrxVCGufP1gEr82317Ibv+EzmMeYGPKb92lbceV8rp/\nthIzbs/rVx13PfKhQwhhbK1r+e0XYjiphJ5xLnYFqS7xdZoL6lGWMbtg93Ru\nnWwWyb8tVafUkdEPwCTQqbMToDt8UBLDOVFaXGjC0F71wLnljA+Y4OoF0Due\nqOQ2+Um7pjLfYJPaveSWJNgIeKdnPH6MyItkdL0XrRSgxKQMHoJkS+bvPl1g\nKA6wFP7Gj2yZOecKurf0rcO58dyEAQSktv4KaB9iBmPCFGifkYEiEbnWMqsG\n9WU36dCUMH2qGsQtljQGQjmnWF6nQb87dt2u1IDFddNZ7hZpKfC8RQ52uOJh\nQVB2FHcYQ044s/0u56YWhawvH5+4YA9ZsQuhP9HTP0Ng5Ph67YBw/qvgxu8A\nsToL24ZobakJo6D40GSaaHyDTtwUPQ6Cm4Rz5E7cQO6Rmrl1J3TWfgSf12uU\nn4AyzbNvzeMdltX/b6RQWGgloCVknRGVd9m50sv9NzUGxLc1i0z5qbgd05a4\nbq52k4haKCOLBP1rRy+5CN7o+q8WC8KG9FyAnn3fz3LFQ76QVW3OGrGXHccG\nBcTE\r\n=Q7DQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\n> :warning: This version is still in beta phase, it is possible that some adjustments might cause other breaking changes. For  previous version snapshots see [Previous versions](#Previous-versions) section.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n    ```javascript\n    module.exports = {\n      ...\n      plugins: [\n        ...\n        {\n          resolve: `@kentico/gatsby-source-kontent`,\n          options: {\n            deliveryClientConfig: { // Configuration object\n              projectId: `XXX`,\n              typeResolvers: []\n            },\n            languageCodenames: [ // example configuration\n              `default`, // default language\n            ]\n          }\n        }\n        ...\n      ]\n      ...\n    }\n    ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items and types queries\n\nQueries `allKontentItem` and `kontentItem` allow to load content items from unified endpoint regardless of type.\nQueries `allKontentType` and `kontentType` allow to load content types from unified endpoint.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n  allKontentType {\n    nodes {\n      elements {\n        codename\n        name\n        type\n        taxonomyGroup\n        options {\n          codename\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"8ec94bbefe2b291d348dd9cc7d1006f9c56b1423","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.5.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.1.18","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0-beta2"},"peerDependencies":{"gatsby":">=2.18.15"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0-beta6_1576776623860_0.7476200400715562","host":"s3://npm-registry-packages"}},"4.0.0":{"name":"@kentico/gatsby-source-kontent","version":"4.0.0","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.0.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"3be8bb6bbde6b64cc3b5a1c985a88abceaa9df1a","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.0.0.tgz","fileCount":16,"integrity":"sha512-EQbtZffUvxh6pnMMb6RO3o3sOZEtU1Vho3AyQZWCzPZBEEUFr0hYEMiazlMs6udRrULpl6hFecjo6IW6Pqn/cA==","signatures":[{"sig":"MEUCIBFcy+Tp2QRCQ4NxKb1s/McSpe5xh8hzGTnO+V2+r4CCAiEAtbGzpck2yNCaSMxswJTK9566JWQNYOUQ7zXeiEIxpCE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55309,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd/JcBCRA9TVsSAnZWagAAGScQAIbSQ86/rD8mPa2Prgv5\nEJ/hneLjfQoo8g2KgdN6vdT7bfnAxQOXeJcm3oXRoRMslAJlp8ZPFBdIyvaD\nqD16x1r1U1RmQxZCJu2Q1sbcs1MQYD4nkfyM8LpQi2djvTSrxrIy8E2K3gNb\nam9YWYfU/2oZrXtsloXE+IZINvmM/c637WDPvoeuFlgBUzjegQ2mdaoFPWQc\nuzP2IeNFKHFzXTsIa+Ar2HqzJC/3w5gPxNUnMi8yBUJIV0TTVzuZBu9GM1kj\nFgG1JHppLCE9spig6MIcLfmoqqv4cORFJcDE+/Jqiy2qw03Yj6xfQAs/jCsa\nfgUx8AF6kJBA3+2N7mVjGSHcXxZyQJXZmR49yh/3d2IjAIiJdtg66GVewruM\ndKzzCHAJB3xxQdCv4LXZTwYbiWuqsO0CYeSiGssHY972UnECu71wmNTk6eih\nZ6wdUF+Svlr0aa8bG5zGcQ/tIRZU04QYflu+mmaf5cKfEGob8IYxEOEKZGbf\nfV/QgBuCAUbPnJpVIyitgfkYdGeq54fWrS52/ThOS2D9wT7nLXBMg+wW9z/w\nxUF+6VHideNyGiJkJ8qYkMJg5Ugi0F7fsZYPaxSseLVJUpgRNutWaxLFZbPj\nR7sVgcD/vX4fLyE1D4rGWez0MKSVEU3srFovxiKLJpn2/fxJ6bC3C0p9Otq6\nGTLR\r\n=b1cp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"198975ded68b289cc01112590330e8ecefa01d7f","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.5.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.18.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.18.15"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.0.0_1576834817043_0.4295492832091077","host":"s3://npm-registry-packages"}},"4.2.0":{"name":"@kentico/gatsby-source-kontent","version":"4.2.0","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.2.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"ecbbde70d79551d2347f9066dde82de5833b85bf","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.2.0.tgz","fileCount":17,"integrity":"sha512-hoPVeRRUFLHS4T8UkB2RagOrPuMmLXDP/ShMKcjy4qSWHws+gcBUWAztB/1zYvmA4Fbal1tUONLFBGHWjH53uQ==","signatures":[{"sig":"MEQCIFkMTrBTQebtv9dTO0BmHgVR1X+Rv3YH3jSHXOJ+eR2QAiBZ6JMkZMhdK7gT82MgyEh02eHq30tak8os3exWrWHyHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58923,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHx68CRA9TVsSAnZWagAAobYP/jw9O1xhHSwoIY9ryfc1\ng3DUkXeeMqB0GdlWoZofhw7MbLG/6oySO5IGWHljdes80hHVc+t8+zLyRX8H\nwjhy1BKjznTu2eFTjhdvyrg8JLRl8ohZ36bZldRoN+0tOAD3ZUoXHJUn5tV+\nTDX5X3CIU1oPnwTq8ZGvezOEitWQa6Lb6H1cy+XuMMIszkRg/qU4us+jOJum\ngrXQ8RJ2bQUpbrUfjaEEiUgjkoeK5saazKJQFu8/2zI6kJLVO5m2VdXLJvhO\n7FbkT2Bwn+GRSVbtbohuYlSi1aFSoYbgU1I846wvWaDFECNU3jlqZOp8Hmoh\nTfTcA9Mpn+47Qg4tAbPjvQXjLyK02YKBQSMsRJL9WYrkvD72+63U6VRrd8iR\nlY7cX3CaNRR/zRPRFqkCCVEBhIAzhyuCc1VP5ynnJG9rvX8/j25jeyPFExYe\nT8CfFXt1QwGvRCL5MD3DjAZjXXlkLM/RZUz8gtbA04huQoMXc6UWUuzspa5L\nJZdZndFWsCAC+yXqvyFrNzGwOl5sT2iyV4Z3KLufy0SVU3TmxQgJw1I6KnjL\nMBHoKbUczPfAmHtMW9SuxWhWntX1+ZcVXx5MMn88/Up2kCL2fpb5drZbd/83\nmjmNMpXTQYrosm3WDmjLHvnS5OhtRMe8jqCDhrKH+wvpwHSVMP8gbsoO2BVU\nEw0O\r\n=54hp\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"0f66f703ffad912018bba932dec3142f00506d65","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.6.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^8.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.18.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.18.15"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.2.0_1579097788419_0.9015463338197107","host":"s3://npm-registry-packages"}},"4.3.0-beta1":{"name":"@kentico/gatsby-source-kontent","version":"4.3.0-beta1","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.3.0-beta1","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"a5fee1eb7d0670a22993c6b7526e3a29de38ee09","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.3.0-beta1.tgz","fileCount":17,"integrity":"sha512-Tz1c3ObIyZKortCWTuDCTREEOZVrh130k5CJYJHZ3LTsxet2qFMz9u49XSGgcE9/w2jB1EjtDH6GawMEEif/BA==","signatures":[{"sig":"MEUCIC4dDdixtqGmLj+9iIFNMuFR1zpn+A/crP2kGH6zi3ImAiEA4eBwSBhQmUK0BQ6NDvRlWbd+f2D/yuJehbzH5wIXnNA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58881,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeJwI+CRA9TVsSAnZWagAAA0AP/02WoQfqXxeWe+h0lJk3\ns/DyVqqAR8kqDA/WJtKBJO/NQ8jcx6XvcWRgxuDb6vlC5lkcrBfZdz/UBvlA\niRcxaLGBi629Q7Gd2bFz9nKwxGsBMg/95/z8CJf5t7ppfF33A7NM3CuphmjU\nlQwY/WPT2TwppMJuJlcU0QMRF9ukWrCsgSX6nyEeGrPjAqVKKzdDvmkeMnxO\nBRPgGIZmSSZ5x7LffeSDI6Rnw9nOwpnq2Sq85/Vz+3sLku8H7I/yx+YrCqyE\njpDvTuOqBq6YuHGD7PdKKW2OQ5RLrK8iYz6zha7hcJge2c1novfEi6BHlDio\nGBG59VvI1gs5q3shxnoXDKwxOy3ntE2gh4HQHSGIe7GpiyV0GeK0QlRC280Y\nJUu5s1Fb2QwlbiCqt/3vlfVTWDiNJ0G75MWtosRL2W9vQaNBZzLoXseGH/WY\nkeMxYw+75IQBJ9o9HaEK1TiVxNg7EqW2hQ0WLnTYu5J2hifyLUNyatOVSeAj\nDTyMRPesh81zyDvIDR28ksihvv3C610fYDk8vZSj4thR4HqQtqSzaXRl0t1o\npzhYIJKdf4DJkUN/gKal4TcTGKClJYYHJCDF1FMDEwHhnTtqaCll/Wrl+RYP\nQmyasZZdLayyhdS4DNOkYRsCqzVkMcktElrOA1rSvN0f5PnA+tkUUWRuzk9C\nkZpq\r\n=rvOt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n  ```javascript\n  module.exports = {\n    ...\n    plugins: [\n      ...\n      {\n        resolve: `@kentico/gatsby-source-kontent`,\n        options: {\n          deliveryClientConfig: { // Configuration object\n            projectId: `XXX`,\n            typeResolvers: []\n          },\n          languageCodenames: [ // example configuration\n            `default`, // default language\n          ]\n        }\n      }\n      ...\n    ]\n    ...\n  }\n  ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parting support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Taxonomy support\n\nEach taxonomy group can be returned as a nested group of taxonomy terms. To retrieve the `Personas`, the following graphQL can be used:\n\n<details><summary>Query to recieve the personas taxonomy group</summary>\n\n```gql\nquery MyQuery {\n  allKontentTaxonomyPersonas {\n    nodes {\n      terms {\n        terms {\n          codename\n          name\n        }\n        name\n        codename\n      }\n      system {\n        codename\n        name\n      }\n    }\n  }\n}\n```\n\nThis would result in the following response:\n\n```json\n{\n  \"data\": {\n    \"allKontentTaxonomyPersonas\": {\n      \"nodes\": [\n        {\n          \"terms\": [\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"barista\",\n                  \"name\": \"Barista\"\n                },\n                {\n                  \"codename\": \"cafe_owner\",\n                  \"name\": \"Cafe owner\"\n                }\n              ],\n              \"name\": \"Coffee expert\",\n              \"codename\": \"coffee_expert\"\n            },\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"coffee_lover\",\n                  \"name\": \"Coffee lover\"\n                },\n                {\n                  \"codename\": \"coffee_blogger\",\n                  \"name\": \"Coffee blogger\"\n                }\n              ],\n              \"name\": \"Coffee enthusiast\",\n              \"codename\": \"coffee_enthusiast\"\n            }\n          ],\n          \"system\": {\n            \"codename\": \"personas\",\n            \"name\": \"Personas\"\n          }\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items and types queries\n\nQueries `allKontentItem` and `kontentItem` allow to load content items from unified endpoint regardless of type.\nQueries `allKontentType` and `kontentType` allow to load content types from unified endpoint.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n  allKontentType {\n    nodes {\n      elements {\n        codename\n        name\n        type\n        taxonomyGroup\n        options {\n          codename\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"84be520765dc967e5b4b389421ab86ea192cc7bc","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.6.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.18.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.18.15"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.3.0-beta1_1579614782015_0.86023671705008","host":"s3://npm-registry-packages"}},"4.3.0":{"name":"@kentico/gatsby-source-kontent","version":"4.3.0","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.3.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"888c195904c726d489e099702260b29e02e32d41","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.3.0.tgz","fileCount":17,"integrity":"sha512-c9LY0fLx+Jw49I6ByZWLSvGqqC0q/A0Axnl3vxQCkZD8VlY76rpr3v39zk3yE1RYVvvC/lssq9sGiSr621xUMQ==","signatures":[{"sig":"MEYCIQCxJ58vCCkeGwNBrW/uRLra7yNG6WtuB6ecLOSEH+Dy9AIhALAy10UnsjP/y7AEv7Z44oVAzkP5EWLk3xp3z3g5AzBw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":58869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKYZ1CRA9TVsSAnZWagAAuIYP/jNPXuVrp8caMXHfY9lm\nu7R/enJjzxa8BUK47MpfqApCy0YKYHJgywxMV/IaG2itrBWnaFAsVrzT1X3w\npqfOIwwb6DjbNc3D+sw9Oe93A0R+c1lk2N5QJ3pzk1O2KQu45PomMWI3Btf0\n5X0MBJs4w2Eb00vmro4nb09kcrIK0zH4JIGQmmG45SjaQEqWhwg6Fse6Vori\nUcH1i5Q0mkiZMQhOKQld9vFkPzqXNq86uyFT4DzW4ZFrsFb98hckdMoGQOsL\n60CdGOEoAAwZ8E6drI+xcQEABZiHz3FZidLZEtgvKNgFzEHoL5UJituzcaW5\nhnvtOuARI8AoTnLwkLq0J0/cpM08ClRJU0qJoFG8nCJm232wn2Nw0QrnzWHh\nyEkSBb31VTxdkdzICGuj69SBKE+tJzaD8rmqNgjZT1OKkieph69Nmmya9Dcz\nmXy3yfMP/6PYAlGCOHK8q3IUp4EDGMfwryZP2VHtFm2HcukC0KQTooQ9Ch8x\nuFp7XGa/gofSb92z88OxjhOG6W0O/CRsH+dOn4PsAVqW+tN5YZsJoM3cEYES\nvyDmhgdeFoMiIaD95hry/S3QMt8cYHmxkkkzLJwRRGHOqYcybvaxvJlaAi4B\nu6qFNvY8e8mEgfiCbSiAtq8aNoI0VzJ/UxKUucSYBBYFW10IjLyP8rcUTc8U\necUr\r\n=bq0B\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"6b49bb5ed2109d921b68c9a9b17c67fea4df5ff0","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.6","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.7.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.18.15","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.18.15"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.3.0_1579779700620_0.8657742845583629","host":"s3://npm-registry-packages"}},"4.4.0":{"name":"@kentico/gatsby-source-kontent","version":"4.4.0","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@4.4.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"802c754fb58c02126d69aa254f5bc774b0671d96","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-4.4.0.tgz","fileCount":17,"integrity":"sha512-uX1iK1rgeshd284ep7Ld9hYjPIhFN6ie70QOGHK7iSZEuSNd4VD33ynTr9F6hYQgb2gM56bW1V3VriRAMIlzUw==","signatures":[{"sig":"MEQCIGq8iDG997Tna8wnIFT7HABdE9oRb5UTWLdFlCS10lZeAiATTtsKXvPRsKLrxY1ZjnhkrLFgqFN5ZFUI60oHwJ66iA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeX63ECRA9TVsSAnZWagAAx6wP/iYU75UcQR0CmoElvIND\nE2IDj6LCAnXwE148/wynbHeuM9XkJjUdkUgyCgs3UAkpR33Pc4WCI17SSb4/\n8G4RZMcxAIfLVjO6lAa2h+1S1Nl9UFKxzfXmaObYBxqC7qYxrDbrqg0gn3ld\nzdly9rhGei81mqzwnWfGVogEY5VJOGF7a05No+Sejq6rVnzq+e+NdvwilAve\nxxygzn6Tg1ws1KTdCI+wVeFpTttpCiB9IBTkhsMSKt1WLJE3KOnVN6x9rpo3\nJrifoaxkfioeirJa0m1V0G+OQp7ZnwlmOMC37EJd+YgLg154drgYC6XtaePv\nS4KsOMz080/upBK0MAqWfKcByonljs7OgwHqpszmrTxP/5qKLImvdMYyHK7D\neYjrogfRkkFF1ZuMAYvsSF1Dq4fL82HB92IUEMFrQ+Ppy1rSt9RhpOQQ1pxA\n1H4bKGYCbT/hJidQMimeL79RJA1j4AOEhxCf6lvH8VYgqCGhHwZfAbj+SgLZ\nPGyXXVZCNehcTyBDr5iLxa3U/nz8ofG0O27S+qdHcRmlJk+R6olC5Pdvs57D\nM/tThFrgxHjuxz8Nfc4qdpUKg6SCmJ7pZPLRdBBvGV1y4uhMGI1McNJdqdXd\nw+bS/XiCRUQX5ZnqhM7qbhWNS6CaU4BbAUGEylPKTdOydGjhVLP1Br1zU19n\nQ8rB\r\n=logR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"0f760a18e3505ddac848f8e6e8e95cf5ec9f8435","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.7","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.9.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","change-case":"^3.1.0","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.19.28","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.19.28"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_4.4.0_1583328708215_0.7207409683200754","host":"s3://npm-registry-packages"}},"5.0.0-beta1":{"name":"@kentico/gatsby-source-kontent","version":"5.0.0-beta1","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@5.0.0-beta1","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"9f41ec0f92739afdd94c0d78762b1dbb4b7385c9","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-5.0.0-beta1.tgz","fileCount":17,"integrity":"sha512-Kfhklc6aA7ij6b29CrSpZSD1HJ32loOwkXRbQ4u5Y6WNayL1igCvdD6goAIioNNkPN3082PaGR7N0PceqQRkuQ==","signatures":[{"sig":"MEQCIEeqQL/yuc4eOW+YbD4xiUOXHVhW3I43nki54CcS+sA5AiA3r0iUECAcfPvo4gVGjY1xta3OwcAYheIcyO0XM/9dmQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":62470,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeaQAPCRA9TVsSAnZWagAAYE0P/1FzIPkI50R20ynZh0C9\nWNeV9giPa2mb4SCTR01K6dv9KiQWg2k5kvG/rWXpZ30OtaakgfyJ0GlHd/aV\n46U3/sMvCuIPqyD+dRh0D1lDdqyOag1yTJi8qeZOdiLbMXVREy6d7QQCUb7q\nPOYfs3JKmaoPwihV58ngkpdDbNh5q+fz2vZhpK3e7m5ld3ayT2sUzPtpIuN7\nhGu35dOjtx58Nur5BfhO/01btFlG/5KOCLtS0h2+vtVgX6ce9Qa4LDa0GZ+X\n7MH99kmnzTvB18rSoURhWnzZNIWHqimhLEL59lUKFAHZySveEPuEUw5u1M6b\nWFQnVDqaoifFtqWPyHVN4F7xbts6sFdMJ7iO4u0H+zctzgyoNllvuCibrwpr\nLdd9fpxwI4Gsa26rQ9Bv6sHKVaYIAkjwKyrVuqkoVu3dY2OC25SJGWDStCtD\nDhqtEhJkzt3726TLi/amjhEDTIH7eqEHqBJceTUan66CsVLQtaGfdOAk1aNG\ndTyZlMkbhDhSIjVq+99tjuJdV1VtQdnkGzbjXI0aoljWSZYsrWF2LKyd3Yn7\nd4J+EOPWhmZkmdeHleW5oHQ024IqCm/EdsjvoZyJ3PTUYg2S3XCzSqVK4MjT\nxXdnqOUEEYpDhh8yBgRy7tJx5UDHxe6RWyAeO4IMcnn+ebDY/gtM7wwIKkOe\nc8+K\r\n=UKki\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n  ```javascript\n  module.exports = {\n    ...\n    plugins: [\n      ...\n      {\n        resolve: `@kentico/gatsby-source-kontent`,\n        options: {\n          deliveryClientConfig: { // Configuration object\n            projectId: `XXX`,\n            typeResolvers: []\n          },\n          languageCodenames: [ // example configuration\n            `default`, // default language\n          ]\n        }\n      }\n      ...\n    ]\n    ...\n  }\n  ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parsing support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Taxonomy support\n\nEach taxonomy group can be returned as a nested group of taxonomy terms. To retrieve the `Personas`, the following graphQL can be used:\n\n<details><summary>Query to recieve the personas taxonomy group</summary>\n\n```gql\nquery MyQuery {\n  allKontentTaxonomyPersonas {\n    nodes {\n      terms {\n        terms {\n          codename\n          name\n        }\n        name\n        codename\n      }\n      system {\n        codename\n        name\n      }\n    }\n  }\n}\n```\n\nThis would result in the following response:\n\n```json\n{\n  \"data\": {\n    \"allKontentTaxonomyPersonas\": {\n      \"nodes\": [\n        {\n          \"terms\": [\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"barista\",\n                  \"name\": \"Barista\"\n                },\n                {\n                  \"codename\": \"cafe_owner\",\n                  \"name\": \"Cafe owner\"\n                }\n              ],\n              \"name\": \"Coffee expert\",\n              \"codename\": \"coffee_expert\"\n            },\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"coffee_lover\",\n                  \"name\": \"Coffee lover\"\n                },\n                {\n                  \"codename\": \"coffee_blogger\",\n                  \"name\": \"Coffee blogger\"\n                }\n              ],\n              \"name\": \"Coffee enthusiast\",\n              \"codename\": \"coffee_enthusiast\"\n            }\n          ],\n          \"system\": {\n            \"codename\": \"personas\",\n            \"name\": \"Personas\"\n          }\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items and types queries\n\nQueries `allKontentItem` and `kontentItem` allow to load content items from unified endpoint regardless of type.\nQueries `allKontentType` and `kontentType` allow to load content types from unified endpoint.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n  allKontentType {\n    nodes {\n      elements {\n        codename\n        name\n        type\n        taxonomyGroup\n        options {\n          codename\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n* [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"7837677dbed0c12c2630218ecc4b10324bcc6863","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.13.7","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.10.1","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.1.0","eslint":"^5.14.1","gatsby":"^2.19.28","cross-env":"^5.2.0","@babel/cli":"^7.2.3","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.19.28"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_5.0.0-beta1_1583939599282_0.33247170372720114","host":"s3://npm-registry-packages"}},"5.0.0-beta2":{"name":"@kentico/gatsby-source-kontent","version":"5.0.0-beta2","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@5.0.0-beta2","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"0f062ad82d4889b1c38176332b6edb4ba9de7e6e","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-5.0.0-beta2.tgz","fileCount":17,"integrity":"sha512-7v5/UU7y8pl6Xhbxi1ymOT3wAMbMALFUD3KTCnC+/NMDXMPCZIup5TUpAZGSl4NgnkTJPDUPOpwDmwalrt8zwQ==","signatures":[{"sig":"MEYCIQDflWn6vf9O4OpN5sg40SCLaBY04SaoprXmRHB6xSkZgAIhAMK+iy8UUWXB3rX+bhP5h4CMfNiurmk2avjuXPaFNba5","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":62480,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJege3SCRA9TVsSAnZWagAAUvMP/2sJ0qTYgKg1FDUpR+yg\nxLbYQL1QBQW/QD3Pr/n2QoCDT4f+LDSm7d/BFILBBHQ84K0x6X3B7/2auM1n\neV04drPwfd6irA93lEJOlnrSNPfFpPBEabjqhftC3gJT4SYYz0Maf918LVD1\nS1lrZe9QaC3YnBjOTVrrMvVZ+ASmlBzugXnLB5/HF6KX2iT81Nussxs6PCCM\nsq75U1/IfB1/mYNFRIFqV769BQu/bSdKUvMgOAAIYoVWGU3z+q3LbYVfh2Ye\nuoajLyMqI8ZqqzZhFumaicu1bgVzAVdHUOGrC86vA+Na2U3hkEYeRf8sEmew\niablINxo+nCIdqOLwxK7wq3LxYcI5Ka8V2zifYhhG11ycnN319BqbRSyTYpp\n/YXp21UYr0KXwr17/Vd87M5wZaEmwJ1wNFke7VVk9Fw6hxLqpFIWmBJges4n\nIczolH5ABZEmEeSi0uga5+O9bG9jLuL5Xw3kG8mrxTnkxGrSPeLnFvB3rk/e\nmvmupIxbvm/Iegivj1YULhR2J1sSe+PhlFB06g5wcgaDgUQPO5W+o9CA8Yd6\nBbxlDgNmqqb9evxnrt0l+S9tfEngYH1wknwplWzPnCwUEEEmifJO55OxQFBZ\nYuAl/wxjcxDhCui3ac4O//D75SNfjJUg1HHTpVyLAvxF5yCwO4nY48LDToHZ\nRh4h\r\n=Xo09\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n  ```javascript\n  module.exports = {\n    ...\n    plugins: [\n      ...\n      {\n        resolve: `@kentico/gatsby-source-kontent`,\n        options: {\n          deliveryClientConfig: { // Configuration object\n            projectId: `XXX`,\n            typeResolvers: []\n          },\n          languageCodenames: [ // example configuration\n            `default`, // default language\n          ]\n        }\n      }\n      ...\n    ]\n    ...\n  }\n  ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parsing support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Taxonomy support\n\nEach taxonomy group can be returned as a nested group of taxonomy terms. To retrieve the `Personas`, the following graphQL can be used:\n\n<details><summary>Query to recieve the personas taxonomy group</summary>\n\n```gql\nquery MyQuery {\n  allKontentTaxonomyPersonas {\n    nodes {\n      terms {\n        terms {\n          codename\n          name\n        }\n        name\n        codename\n      }\n      system {\n        codename\n        name\n      }\n    }\n  }\n}\n```\n\nThis would result in the following response:\n\n```json\n{\n  \"data\": {\n    \"allKontentTaxonomyPersonas\": {\n      \"nodes\": [\n        {\n          \"terms\": [\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"barista\",\n                  \"name\": \"Barista\"\n                },\n                {\n                  \"codename\": \"cafe_owner\",\n                  \"name\": \"Cafe owner\"\n                }\n              ],\n              \"name\": \"Coffee expert\",\n              \"codename\": \"coffee_expert\"\n            },\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"coffee_lover\",\n                  \"name\": \"Coffee lover\"\n                },\n                {\n                  \"codename\": \"coffee_blogger\",\n                  \"name\": \"Coffee blogger\"\n                }\n              ],\n              \"name\": \"Coffee enthusiast\",\n              \"codename\": \"coffee_enthusiast\"\n            }\n          ],\n          \"system\": {\n            \"codename\": \"personas\",\n            \"name\": \"Personas\"\n          }\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items and types queries\n\nQueries `allKontentItem` and `kontentItem` allow to load content items from unified endpoint regardless of type.\nQueries `allKontentType` and `kontentType` allow to load content types from unified endpoint.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n  allKontentType {\n    nodes {\n      elements {\n        codename\n        name\n        type\n        taxonomyGroup\n        options {\n          codename\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n* [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"894b791c07df38c7a7cb4ba3f1adc84227f81ed6","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.14.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.12.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.1.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^25.2.4","eslint":"^5.14.1","gatsby":"^2.19.28","cross-env":"^5.2.0","@babel/cli":"^7.8.4","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.19.28"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_5.0.0-beta2_1585573329887_0.6362889306525186","host":"s3://npm-registry-packages"}},"5.0.0-beta3":{"name":"@kentico/gatsby-source-kontent","version":"5.0.0-beta3","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@5.0.0-beta3","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"50c5016b592a202052417827190189f43b5f5dcd","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-5.0.0-beta3.tgz","fileCount":17,"integrity":"sha512-tDdYEbvi0Hw9Xzt7IdukZHaNSBiZDxFDce0zrdunzPj3eQaJH/gFbgNEZnrRqMcpMy/2lGU14PA3SZXyQzkjYw==","signatures":[{"sig":"MEQCIErHHsZYZ9nUK1vZaqe1q/JIekrZEO55d20CKfCQhlVfAiB5gZPkJubG7bavjfRTmQFnrak9Z/3TaWbGp2GexR88tg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":62480,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehfVmCRA9TVsSAnZWagAA7HAP/3Ylwfs2SQ2hy4QNAsjl\nCz2hYtN4ezG8uqoCTp1Wt3wBmAuNb9GOg6w9e53S0VZpIX6WTzgr5eGDPq+I\n8t+KPRTYaUYxgiiF6+3sibZQJ3vlzGcgeu8aIR63LsLurzYm7PQAtd7wmSDA\nwt5HDJ1nOZW6m735tlGdQGpmJs8UEXfIstBiypOTSJDLRgp7+4K/d7QDZPZq\nQvrcO/gQ8+OwjVQlQ4vc8sXW2TVVfKSWK0CTJXtaJIdA1ALiDKiqeult6gVs\nx/yuKG5wLueu1ihyj7oHLN2Ob4mU3Nl5sHgwhMHNqvYHGmGpM03QzdaIlqZQ\nky5WZkL4wIhMi1JjDRqwx53k7vEbA2lAI/mUPvtPwnJrHa0yTKUU8s0NpUXV\nal5uZXv02tRk/+pfVevYEYCRpHDbhtiWo2tB6Qns2JHc5eyc/HXUDGgniaA5\nbAjNusYJXH8dMIUHx37YS5uARZD8DjoZND5PPsN/C9haWewqpVnEF0uj+04v\nBCRDoIRuS7O/3ZGfrqLGX/d5UUPrleT/vt5cKkNE2bxMXhnHjEZg4UKxiwT+\n1d953uKIf2crAFlWyjdoGyqsmrwvqAdmqtPuGQaad+wnTKB81gGxDvm/gb5D\n+5hMFwOsTd90ZwYpTNmZFZpjGsir39gsNbHDCtgCVNqZpkPtY8Tjmvi9ahZa\nr4U/\r\n=Hr0O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![Build Status](https://api.travis-ci.com/Kentico/gatsby-source-kontent.svg?branch=master)](https://travis-ci.com/Kentico/gatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/maintainability)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7938a5343f835709527/test_coverage)](https://codeclimate.com/github/Kentico/gatsby-source-kontent/test_coverage)\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/#5-sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) Delivery API.\n\n## Get started\n\nYou can use the plugin in any of the following ways:\n\n### A) Use the Kentico Kontent sourcing guide\n\nIf you are new to the Gatsby ecosystem. The best way to start with using Gatsby & Kentico Kontent is to follow the official [sourcing guide for Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kentico-kontent/). To learn more about sourcing from headless CMSs see the [Gatsby docs overview page](https://www.gatsbyjs.org/docs/headless-cms/).\n\n### B) Install the plugin in your existing Gatsby project\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n    ```sh\n    npm install --save @kentico/gatsby-source-kontent\n    ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n    > The source plugin uses the [Kentico Kontent SDK](https://github.com/Kentico/kontent-delivery-sdk-js/tree/v8.0.0#kentico-kontent-delivery-sdk) in the background.\n\n    * `deliveryClientConfig`* - [Kentico Kontent client configuration object](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#client-configuration) of the JS SDK (like Preview API, Secure API, etc.).\n    * `languageCodenames`* - array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n    * `enableLogging` - enable logging of the source plugin. Turned off by default.\n    * `includeRawContent` - allows to include `internal.content` property as a part fo the GraphlQL model. Turned off by default.\n\n      \\* required property\n\n#### Configuration object\n\n  ```javascript\n  module.exports = {\n    ...\n    plugins: [\n      ...\n      {\n        resolve: `@kentico/gatsby-source-kontent`,\n        options: {\n          deliveryClientConfig: { // Configuration object\n            projectId: `XXX`,\n            typeResolvers: []\n          },\n          languageCodenames: [ // example configuration\n            `default`, // default language\n          ]\n        }\n      }\n      ...\n    ]\n    ...\n  }\n  ```\n\n1. Run `gatsby develop` and data from Kentico Kontent are provided in Gatsby GraphQL model.\nAll Kentico Kontent content element values reside inside of the `elements` property of `KontentItem` nodes.\n\n### C) Scaffold your project using the Gatsby Kentico Kontent starter site\n\nUse the [gatsby-starter-kontent](https://github.com/Kentico/gatsby-starter-kontent) starter site, which includes this source plugin.\n\n* [Gatsby gallery](https://www.gatsbyjs.org/starters/Kentico/gatsby-starter-kontent/)\n\n## Features\n\nThe plugin creates GraphQL nodes for all Kentico Kontent content types, content items, and its language variants.\n\nThe node names are prefixed with `Kontent`. More specifically, content type nodes are prefixed by `KontentType` and content items and their language variants are prefixed with `KontentItem`.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/lib/models/item/content-item.class.ts) produces with **modifications** described in following subsections.\n\nGraphQL nodes of content items contain the ordinary `system` and `elements` properties. However, the properties inside `elements` always have an internal structure that the aforementioned [Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/lib/models/item/item-models.ts#L85) produces with **modifications** described in following section.\n\n### Content item <-> content type relationships\n\nThis relationship is captured in the `contentItems` navigation property of all `KontentType` nodes. In the opposite direction, in all `KontentItem` nodes, it can be found in the `contentType` navigation property.\n\n<details><summary>Example</summary>\n\nYou can use the [GraphiQL](https://github.com/graphql/graphiql) interface to experiment with the data structures produced by the source plugin. For instance, you can fetch a content item of the *Project reference* type (by querying `allKontentItemProjectReference`) and use the `contentType` navigation property to get a full list of all of the elements in the underlying content type. Like so:\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        name___teaser_image__name {\n          value\n        }\n      }\n      contentType {\n        elements {\n          name\n          codename\n          type\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n### Language fallbacks\n\nGatsby source plugin is including GraphQL nodes by the language fallbacks configuration. As a part of that, there is a `preferred_language` property allowing to distinguish whether the fallback has been used or not.If the fallback is used `preferred language` is set to the desired language codename, but `system.language` value is using the actual culture that has been used (the fallback one). If the values are same, fallback is was not used.\n\n### Language variant relationships\n\nThis relationship is captured by the `otherLanguages` navigation property of all content item nodes in other language.\n\n<details><summary>Example</summary>\n\nFor instance, you can get the names of all content items of the *Speaking engagement* type (by querying `KontentItemSpeakingEngagement`) in their default language as well as other languages all at once:\n\n```gql\n{\n  allKontentItemSpeakingEngagement (filter: {preferred_language: {eq: \"default\"}}) {\n    nodes {\n      elements {\n        name {\n          value\n        }\n      }\n      otherLanguages {\n        elements {\n          name {\n            value\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nreturns in case of two languages\n\n```json\n{\n  \"data\": {\n    \"allKontentItemSpeakingEngagement\": {\n      \"nodes\": [\n        {\n          \"elements\": {\n            \"name\": \"Speaking engagement\"\n          },\n          \"otherLanguages\": [\n            {\n              \"elements\": {\n                \"name\": \"Hablando de compromiso\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n> [Other Languages](https://github.com/Kentico/gatsby-source-kontent/issues/84) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Linked items elements relationships\n\nEach Linked items element does differ from classic JS SDK structure. They are replaced by [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the *Linked items* element.\n\n<details><summary>Example</summary>\n\nShould a *Linked items* element in KC contain items of only *one* type, you'll be able to specify elements and other properties of that type directly (under the `related_project_references.linked_items` in the following example). However, once you add linked items of multiple types, you'll have to specify their properties using the `... on [type name]` syntax (so called \"inline fragments\" in the GraphQL terminology).\n\nThe `related_project_refereces.linked_items` will give you the full-fledged Gatsby GraphQL nodes with all additional properties and links.\n\n```gql\n{\n  allKontentItemProjectReference {\n    nodes {\n      elements {\n        related_project_references {\n          name\n          type\n          itemCodenames\n          linked_items {\n            ... on KontentItemBlogpostReference {\n              elements {\n                title {\n                  value\n                }\n              }\n            }\n            ... on KontentItemProjectReference {\n              elements {\n                project_name {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> :bulb: When you are modelling linked items, make sure you have no element with the same codename of different type. In case you had some, they would be omitted from the model and the following warning is logged during model generation.\n\n```plain\nKontentItemArticle.elements.related_articles.linked_items[].elements.manufacturer.value:\n - type: array<object> # THIS IS CHECK BOX ELEMENT\n   value: [ { name: 'Aerobie', codename: 'aerobie' } ]\n - type: string # THIS IS TEXT ELEMENT\n   value: 'Hario'\n```\n\n### Custom element parsing support\n\nCustom element is now supported including [custom element models definition](https://github.com/Kentico/kontent-delivery-sdk-js/blob/v8.0.0/DOCS.md#using-custom-models-for-custom-elements). SO besides of the raw value property `value` it is possible to parse it and include it in the GraphQL model.\n\n> External properties are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Taxonomy support\n\nEach taxonomy group can be returned as a nested group of taxonomy terms. To retrieve the `Personas`, the following graphQL can be used:\n\n<details><summary>Query to recieve the personas taxonomy group</summary>\n\n```gql\nquery MyQuery {\n  allKontentTaxonomyPersonas {\n    nodes {\n      terms {\n        terms {\n          codename\n          name\n        }\n        name\n        codename\n      }\n      system {\n        codename\n        name\n      }\n    }\n  }\n}\n```\n\nThis would result in the following response:\n\n```json\n{\n  \"data\": {\n    \"allKontentTaxonomyPersonas\": {\n      \"nodes\": [\n        {\n          \"terms\": [\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"barista\",\n                  \"name\": \"Barista\"\n                },\n                {\n                  \"codename\": \"cafe_owner\",\n                  \"name\": \"Cafe owner\"\n                }\n              ],\n              \"name\": \"Coffee expert\",\n              \"codename\": \"coffee_expert\"\n            },\n            {\n              \"terms\": [\n                {\n                  \"codename\": \"coffee_lover\",\n                  \"name\": \"Coffee lover\"\n                },\n                {\n                  \"codename\": \"coffee_blogger\",\n                  \"name\": \"Coffee blogger\"\n                }\n              ],\n              \"name\": \"Coffee enthusiast\",\n              \"codename\": \"coffee_enthusiast\"\n            }\n          ],\n          \"system\": {\n            \"codename\": \"personas\",\n            \"name\": \"Personas\"\n          }\n        }\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n### Rich text resolution\n\nWith following features, it is possible to resolve rich text [into the HTML string](#embedded-JS-SDK-resolution), that could be injected to the site. For more complex scenarios, it is possible to use the raw `value` property in combination with [`linked_items`](#content-items-in-rich-text-elements-relationships), [`links`](#links-in-rich-text-elements), and [`images`](#images-in-rich-text-elements) property.\n\n#### Embedded JS SDK resolution\n\nSince [Kentico Kontent Delivery SDK](https://github.com/Kentico/kontent-delivery-sdk-js/#kentico-kontent-delivery-sdk) could resolve [links](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#url-slugs-links) and also [linked items and components](https://github.com/Kentico/kontent-delivery-sdk-js/blob/master/DOCS.md#resolving-content-items-and-components-in-rich-text-elements) in rich text elements by implementing the resolvers, Kentico Kontent Gatsby source plugin is enriching the rich text elements in GraphQL model by `resolvedData` property containing `html` property with the resolved value and for the url slug elements, there is a `resolvedUrl` property containing resolved link from the link resolver.\n\n<details><summary>`summary` rich text element example</summary>\n\n```gql\n{\n  ...\n    node {\n      elements {\n        summary {\n          value // NORMAL value\n          resolvedData {\n            html // resolved output\n            linkedItemCodenames // only inline liked items codenames\n            componentCodenames // only content component codenames\n          }\n          linkedItemCodenames // inline linked items + content components codenames\n        }\n      }\n    }\n  ...\n}\n```\n\n</details>\n\n#### Content items and components in Rich text elements\n\nAs with the previous example, all rich text element containing [inline content items](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-content-items-in-the-rich-text-element) or [components](https://docs.kontent.ai/tutorials/write-and-collaborate/structure-your-content/structuring-editorial-articles-with-components#a-using-components-in-the-rich-text-element) have an accompanying `linked_items` property which is referencing them.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          linked_items {\n          ... on KontentItemBlogpostReference {\n            elements {\n              title {\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Links in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `links` property.\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          links {\n            codename\n            linkId\n            type\n            urlSlug\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n#### Images in Rich text elements\n\nAll rich text properties with content items linked in the element also have an accompanying `images` property.\n\n<details><summary>Example</summary>\n\n```gql\n{\n  allKontentItemBlogpostReference {\n    nodes {\n      elements {\n        summary {\n          value\n          images {\n            imageId\n            description\n            url\n            width\n            height\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [Resolved Data in Rich text elements](https://github.com/Kentico/gatsby-source-kontent/issues/85) are not automatically generated [using Schema API](docs/UPGRADE.md#schema-definition-api--all-items-query).\n\n### Reverse link relationships\n\nAll nodes have a `usedByContentItems` property that reflects the other nodes in which the given node is used as linked content in *Linked items* or *Rich text* elements.\n\n### All items and types queries\n\nQueries `allKontentItem` and `kontentItem` allow to load content items from unified endpoint regardless of type.\nQueries `allKontentType` and `kontentType` allow to load content types from unified endpoint.\n\n<details><summary>Example</summary>\n\n```gql\nquery {\n  allKontentItem {\n    nodes {\n      system {\n        type\n        name\n      }\n    }\n  }\n  allKontentType {\n    nodes {\n      elements {\n        codename\n        name\n        type\n        taxonomyGroup\n        options {\n          codename\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nResponse\n\n```json\n{\n  \"data\": {\n    \"allKontentItem\": {\n      \"nodes\": [\n        {\n          \"system\": {\n            \"type\": \"about_us\",\n            \"name\": \"About us\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we roast our coffees\"\n          }\n        },\n        {\n          \"system\": {\n            \"type\": \"fact_about_us\",\n            \"name\": \"How we source our coffees\"\n          }\n        },\n        ...\n      ]\n    }\n  }\n}\n```\n\n</details>\n\n## Development prerequisites\n\n* [Node.js](https://nodejs.org/) with NPM installed\n\n## Debugging\n\nTo get a smooth debugging experience, you can temporarily copy the content of this repository [directory](https://github.com/Kentico/gatsby-source-kontent) of the source plugin to the `/plugins/@kentico/gatsby-source-kontent` directory of your project and run `npm install` and `npm run build` there. Then your project would use this local source plugin. Or you could configure [local plugin manually](https://www.gatsbyjs.org/docs/loading-plugins-from-your-local-plugins-folder/).\n\n*Note:* It might be necessary to remove */.cache*, */node_modules*, */package-lock.json* and *run npm* install again.\n\n## Troubleshoot\n\nWhen you change the structure of the data, or the data itself and then `gatsby develop`, or `gatsby build` command raise an error about the Gatsby presumes the old data structure. Try to remove `.cache` folder and run the command again, it is quite usual that Gatsby is caching the information about the content structure and does not clear it.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](/docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n* [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n* [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n* [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n* [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n* [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n* [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n* [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n* [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n* [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n* [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n* [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n* [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n* [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n* For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n* For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## Feedback & Contributing\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/gatsby-source-kontent?pixel)\n","engines":{"node":">=10.0.0"},"gitHead":"436da5dba129a4415e86633265f04a2ce82d7b74","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.14.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.12.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.1.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^25.2.4","eslint":"^5.14.1","gatsby":"^2.19.28","cross-env":"^5.2.0","@babel/cli":"^7.8.4","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.19.28"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_5.0.0-beta3_1585837414231_0.1058303235800706","host":"s3://npm-registry-packages"}},"6.0.0-vnext.1":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-vnext.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-vnext.1","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent/tree/vNext/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"9e605927592b062ba6bfdb10339f1bfe24c5941b","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-vnext.1.tgz","fileCount":16,"integrity":"sha512-lnoF5IDj3vheoCHtwoHJBu5ZigZarWPhDhwr5UcU1HFJ8mFqPIcvGx7oLNvx7yXtr3Abm8sT8fYtIQbkjo/C3Q==","signatures":[{"sig":"MEUCIQC4QkEVuU4cyDnAyvvybvc7Vpv/tMTEYneuOCtSdIpwewIgJABNdnF7ZHc8VGanc87csXZydj5ZIsxJCz523Mx8WPU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41765,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeh0VeCRA9TVsSAnZWagAA9TUP/AtmDN6Cd86TQ7+ANEQB\nMFX37m8q53EzwCpXCbQAlqn7UmqQq0PL92LvyFsNLYEZpfQuqYINeFle+lCb\nIWrGREeaXSRI0MiiuQehv39ylrlKt8HcJLScKXViZ4Uf7qyYDH24/TDoScJg\nW0bkdjUgzTh4sBK+f+H1ampd5I4dXNLjpu8Ds5dwKYwgOOuiar+Ydn4Kr0wO\nJtQaT0nrm0GNQrR5IB6cghGlYMuCkR0Mq45CUnGE+864a62jLpF1gNbDW/kh\nMLTun3+nW6hMkrdK4M2BEMj4b1hsX0DSlx6d/Uah5Cw/JH6HjwIoQ4S2vlCd\nYpaxC7TRDbchdqsOwH9EXFjyXKnlaom7XxSfBAf2WkQgPknyqJnQmGMBhUdW\na8bhXOENBrgfy/+f2JVJSmeDpuqRdbvgenbLs5y7tV4ylR2ik7Me3DIlFY1+\nYA4+J7aQuz2ZKc8EeIMEuQNM4liorynB4R9fnuyWymyTPFXdVYXl9/WzDp1N\ne6KHIMh3FK8fDQDpceqF6VhNtdU+I22dVR4YVVdsGn9EjhuPBCm69LlETrjp\n86QyMUf9ERc5g5oTTGTFTYTpKcf6AaFHQs0zWLKR6S0AkjGBP5CF8eC2tCum\nHQVAfXdEmIKV4og6sONX3AKlmCovCaQN7dUk3GLszRRnnAQHVCo3W+Scpydq\naWYD\r\n=oUfP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n## Description\n\n(vNext) Source plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## When do I use this plugin\n\n> Include stories about when this plugin is helpful and/or necessary.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // For preview/secured API key - depends on usePreviewUrl setting\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n      },\n    },\n    /// ...\n  ],\n};\n```\n\n### Learning Resources (optional)\n\n> If there are other tutorials, docs, and learning resources that are necessary or helpful to someone using this plugin, please link to those here.\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data (source plugins only)\n\n> If this is a source plugin README, source plugins ought to allow people to query for data within their Gatsby site. Please include code examples to show how to query for data using your source plugin.\n> If this is a theme that requires data in a specific format in order to match an existing query, include those examples here.\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## How to contribute\n\n> If you have unanswered questions, would like help with enhancing or debugging the plugin, it is nice to include instructions for people who want to contribute to your plugin.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"c2afed0f4545d97b6a60bf876abc4c6252e4cfa7","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-vnext.1_1585923422079_0.40625019546978836","host":"s3://npm-registry-packages"}},"5.0.0":{"name":"@kentico/gatsby-source-kontent","version":"5.0.0","keywords":["kentico-kontent","gatsby-source-plugin","Kentico","Kentico Kontent","GatsbyJS","gatsby","gatsby-plugin"],"author":{"url":"https://github.com/Simply007","name":"Ondřej Chrastina","email":"ondrej.chrastina@kentico.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@5.0.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"contributors":[{"name":"Jan Lenoch","email":"janl@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"9515c90c4b4fae8fb268817c39b1a892a30ac579","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-5.0.0.tgz","fileCount":17,"integrity":"sha512-IyXjE95wuRdUTIacU8ooNKBL8oeN4HLvsGx2KZuT1OXAkrHW4NfxMUd2nCd0cJnuK2lu50x5BPZ6GEguS1Do+g==","signatures":[{"sig":"MEYCIQDkse6d/zxrlz4r+I4D7vt9H6pReeY/C9SuNpy6NknMbQIhAPNoL6BZrTbOoIZ4ydXVp7Ut3GRX/yLEjFxIw5tVbhY3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63059,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelbxrCRA9TVsSAnZWagAAT10P/iBzBTuIZMBIV1H2/mJw\nlKidpK59jmWbQ96eymQdtRs9e7oD+ALbO5bd4wK7jd8oPhjRM7AFDqcAXtOh\nkPKIQ0Ii5Nwww4RDfKbKhwLC4v87Xo8wWDXvqGftdN1+MdsLOcdkq4zV2FIq\n6QcRpVfQFW28nwLV+8kDBXxEesndQrNxW8VuMRoKo4dJan6LrJ/tRMTvVt5N\n/OzWWRUiY49sMo/wnfbyT/aYriIbXM+nHoA4iqx/0Jy9ABJgax9o/rRqBhJx\n9/bzuHFVptPDj8Yo8FFRW1kP+4DTOJWHIA0CzQ7SD2xsF1pjh4oewManeA0R\n/j5k8PPaKRONyz/13mRIYceWwJa5+tAJMFkNb6vPdq7y3bpyCT2HAlDEppW8\nkfnc8T79fBYgAG7okbmxn51JgHvSlRryvyHHnQv4OmmGIyjUGADpBolljIiZ\nSJGn0aFfm1QUpgYFssrpYunInu3of4SXq1dhnMHhsfMr9hEMBuSRkVoJKwoc\niqmKsmtIVME3hQCnDRFVLgFRtUvPMd/7xGBo6vlL0I1TdHB1cAcF47oHfH4B\npffsUhWixi0MM+3eN5jCUzXgBaqjpfxLH7a5eGhdbXUrOcUyyk1qcsGOiTbd\nTvwgYE6XuVgEoREsAzoHSSjpsbD0JO1kBK2vYXEdqk7Ke42BS8uuEJEDLguW\nEZ/R\r\n=q04O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./gatsby-node.js","engines":{"node":">=10.0.0"},"gitHead":"bbe8ebdc8ffeb994f7ec5a487dbf17763d9e4440","private":false,"scripts":{"lint":"eslint src","test":"jest","build":"babel src --out-dir ./ --ignore **/__tests__","watch":"babel -w src --out-dir ./ --ignore **/__tests__","prepare":"cross-env NODE_ENV=production && npm run build","coverage":"jest --config jest.coverage.config.js ","lint:fix":"eslint src --fix"},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"6.14.4","description":"Gatsby source plugin for Kentico Kontent","directories":{},"_nodeVersion":"13.12.0","dependencies":{"rxjs":"^6.5.3","react":"^16.8.3","lodash":"^4.17.15","flatted":"^2.0.0","react-dom":"^16.8.3","json-stringify-safe":"^5.0.1","@kentico/kontent-delivery":"^9.1.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.2.4","eslint":"^5.14.1","gatsby":"^2.19.28","cross-env":"^5.2.0","@babel/cli":"^7.8.4","babel-core":"^6.26.3","babel-jest":"^24.1.0","@babel/core":"^7.3.3","babel-eslint":"^10.0.1","@babel/polyfill":"^7.2.5","@babel/preset-env":"^7.3.1","eslint-plugin-node":"^8.0.1","regenerator-runtime":"^0.13.1","eslint-config-google":"^0.12.0","babel-preset-gatsby-package":"^0.1.3","@kentico/kontent-test-http-service-js":"^2.1.0"},"peerDependencies":{"gatsby":">=2.19.28"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_5.0.0_1586871402832_0.5602928453181326","host":"s3://npm-registry-packages"}},"6.0.0-vnext.2":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-vnext.2","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-vnext.2","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent/tree/vNext/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"fc7a629dfdda3f69317d41c522c79bde8ac5baee","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-vnext.2.tgz","fileCount":18,"integrity":"sha512-Ff78x6HezKA0SDnsTo49L7vEZfzoS+evuipiQF2msSpScpjvMKDWJFBOXeSDmeSCBTDy5w6S34fNwfCtDKnV4Q==","signatures":[{"sig":"MEYCIQCA/WzKEG7zPwkAyC/uXVsxmyiuszOlxXNufJyUYNdjawIhAOhcpXOcuIxSo4Pq+Y26gC0spy1lvdaAysbeuG6sbLuq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71594,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepn94CRA9TVsSAnZWagAAGhkP/17L+0elxv+m5Um3FCFW\n312wx4sd0e5lTerXR6p4ywW029p1oCwTz0Q4neV2+Ro/WGBEYRsbxAdPXYCh\nCcG5NZ7EVjcdbcVA781xIf5JjEwFCYZQUown2ByMoeeTE/QMBByU00mt5hyQ\n2geMEJT/A/KubnQolmUJz09qzWlmi/P059muUqLgFlf7ygVD3mVjRhZAqmgQ\nefeg8ca1bNo/pSyxrIA2VGMBmAIB9mdUuWFT3K+XncqQT1R2c1f+9h4v0FKU\naIxDfofhrqi1jVc/4hy/0Vnngc+3FEJ3ll8ucKXG+p966W1ON64qy+v4FsMI\nfA+HAUI8S82JB10QFXcASeqHevYRGivVBUhFxWHMGXSYB6lKnm8aVAoOZyGu\nIbaTKtXCDuqbQ+vYTEYOKq8GKojJNVemRVEXHuC7y2rMWgyptuRIR5tSGHSX\ns7D7EtIK/9n0y2skuPl+5A00o26np1GF6YVVOruI9NcVdR0aWRtJAjQ+bjqb\n6QPfS696T9yDg49e8AHc8XMjmC8t9NEJ0rxYU7gf3Sq2qjD6ce86p8UQEdzL\nkcjKfbEnMBNVslbfeEXATvEpG/02Z4gwIjYWM+ZLAovXU+0DkhgNk1VopegA\nGXU1Fo6diVA+XuYLv0QtyOwPAO5uzaxYXgZCJnJ6vgeQ98cwtDgF23uTGpId\nAsJI\r\n=BhOV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n## Description\n\n(vNext) Source plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## When do I use this plugin\n\n> Include stories about when this plugin is helpful and/or necessary.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // For preview/secured API key - depends on usePreviewUrl setting\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\n### Learning Resources (optional)\n\n> If there are other tutorials, docs, and learning resources that are necessary or helpful to someone using this plugin, please link to those here.\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data (source plugins only)\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n- [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n- [Using Gatsby with Kontent\n  ](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"82d29884c1097b8c9d836c0c00f26f2e34d89ccb","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-vnext.2_1587969912335_0.15073983227476218","host":"s3://npm-registry-packages"}},"6.0.0-vnext.3":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-vnext.3","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-vnext.3","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent/tree/vNext/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"8aa64f9b9d8241e8738bc0e1f4709e0a3bf784a0","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-vnext.3.tgz","fileCount":18,"integrity":"sha512-GtwQk+W5RWX76xHq95ETADQD+t7pAq+s5BeQwoiUZM/HJ8cvEm/Cl4R4kCs4oUPx2pMqs+tr7obpPWm/52XQ6g==","signatures":[{"sig":"MEQCIEtEl1+Zn32WCMOavz76EaOzn6OD3F4C6iR1tc28cPCLAiAIT9hsErL+3X9fVd+F8ToCch+WWORy3as9J5bjTf75UQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":71509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepqn5CRA9TVsSAnZWagAAveoQAIc+IGKGeNfcexyr2SP0\nYFe7VhvGWKQSndqJStU5cIlu7ZFDNBphvUS1Rs/goElOwtM8i8qFcJyp8QM5\ni6RCDzEUfdbd+jpfcpTQAsOKo8XxMWsh92e9uDpob24Ypn8g36MExLifcIvk\n3eHFOZzwyJDVlYbsD4UiqneLR/UCdixAm6YwiKhUwUbP9sChIdeddaAq0aNe\niFBmh6Pt8n82HL5ANOuKkEJEhH3Ftd6NPWx8x+h4oq0MAn6B0KyYaSCpM1md\nxNFhhMfVhmTYm0PrJrVsd6JstlsHf6e4B1r3z2NfMhvq4ZSbdwaPM14APz6N\nmn11EjCxRsW+YJJgYEBA4vWnvsIyp8THpHyA5FKZsw+cb6Z7se6D3dDS8BAX\n1oikD7n9bXk/Bdn3RiinuxmvdC41TNcvGAosEMUoWpaymxIXJWB0029anNCP\naXgqNgbPaTCPelKmoPKbrFt8/OUmFk4eC19oXU3AXg2/GKoplmNKpBRT08lv\n9tfLb5vDl7H4ebdSP/fdDYbGfD6Io/JUvF5tbhK0kodmGjO/CoDebVPaXQRU\nSegA3UrkROkFgL4ENSeHYCD/wlcC2ipr6FXm8todvDYWyA+Qv/8o7fg5LhNP\nRM44Rk7uJC3yPzIW5L8UXnrmMnF+pAUiYb5T7hOMiO+KYLsALg/oiQ+fi1ec\n/52C\r\n=zXdr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n## Description\n\n(vNext) Source plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## When do I use this plugin\n\n> Include stories about when this plugin is helpful and/or necessary.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // For preview/secured API key - depends on usePreviewUrl setting\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\n### Learning Resources (optional)\n\n> If there are other tutorials, docs, and learning resources that are necessary or helpful to someone using this plugin, please link to those here.\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data (source plugins only)\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n- [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n- [Using Gatsby with Kontent\n  ](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"4273ebfd99f6d5ea750195f3ed2d08a0374292dd","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-vnext.3_1587980793191_0.48202032633984304","host":"s3://npm-registry-packages"}},"6.0.0-vnext.4":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-vnext.4","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-vnext.4","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent/tree/vNext/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"ccb0d7a9752a28a227d364a017b0c0ab8573c544","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-vnext.4.tgz","fileCount":18,"integrity":"sha512-00EroLR3gIxgxW9+diDmZ06T5GQ4/j1n7dVWmkcVXS4pujG6MSiaL+AtT8whbWg62UFjzpPzs5ixR0hRrzFm6Q==","signatures":[{"sig":"MEUCIQCCKC93cKwDHeoVsNKFYR8/M9HHYaRiCYR2PYgsp4qkWgIgfLt0OO5hITphmEyvSZIUbbsQE6jlDPmbiL7Dx9+sqL4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":72194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeptaxCRA9TVsSAnZWagAAfxEP/R7nTUqlSPVuCmr8DFQE\noqxJm3MjA8jmEKlMFELjdjzSBd6uy4r/Vvv/IFIg57LNysbTdGtZ1dCm0AG2\nmIDLvfYL1nFC7++7f07Ua8MoPDniJEJaiBsuCM2/F0DIgn3eWOEfNxgCyziT\nYT5CqEBqYc/4gns1eB7ZscA31s/EqdlBmkSt29yaq8OIExK5N7oD7hiKftw2\nFepkBELkKLrjM690w4moOezVtkeOI9T0tFE7IUeh8IbImODGUFcjrrvKNGnS\nr7L4+wdTH7LiUZf4HsonI2w8eCotc4L9fEURn3UEhKD1PNt5a1IXiXEljIIW\nh2rjkprY+8Zq61eOdxYCdKt9jROfcLeehEQLGZSeGlTPFqYb5fEzGtTqPWN2\neiRp2oMY+RePNAN3pvztkUKlqCIn4jXWKKIO05oq3g3vt9W0tIIwQj8huBqG\n2lrdng0wq4WIfN1SeAf2Alkmf9aDMZRtea3Jo1ZL4E/HoncuyMcf6Y9rYYDH\naMsXpHe3AlyhBbprCrFa7BTsvdgWTDbe0UV/wjDoENckbU/1KYVCAdOR+TrR\n3HgD/8wsVR9F7N7VPHQCZtNCd9m4DU5uBHynw6M9u17abpMb3DarmBXIe7bE\nB58CiFQzFx/5TRGOlbnitUZ1sZygNOPb6jYPG9tD5wTBZ0ThosgbQo4OX0bF\n++jL\r\n=ou9s\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n## Description\n\n(vNext) Source plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## When do I use this plugin\n\n> Include stories about when this plugin is helpful and/or necessary.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // For preview/secured API key - depends on usePreviewUrl setting\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\n### Learning Resources (optional)\n\n> If there are other tutorials, docs, and learning resources that are necessary or helpful to someone using this plugin, please link to those here.\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data (source plugins only)\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n- [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n- [Using Gatsby with Kontent\n  ](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"a224042cba13941eb605076e7fe2d70b81e2efde","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-vnext.4_1587992241023_0.9962288359595366","host":"s3://npm-registry-packages"}},"6.0.0-vnext.5":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-vnext.5","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-vnext.5","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/gatsby-source-kontent/tree/vNext/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/gatsby-source-kontent/issues"},"dist":{"shasum":"e1c5f48bc06084991b987b7c6a8e5948881e55b2","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-vnext.5.tgz","fileCount":34,"integrity":"sha512-q+ujQWKlAQ90O2mCynAOb8bNEAX98X8IDpwAAoLehy3/e1rH/PDWMaV7aEXMC3hb98QOu0YpMxIOCZbR+SFXsw==","signatures":[{"sig":"MEUCIQDEChcSiDtnWOqAzD0k7WhqcfJSVIXexR7vB4/GG96UewIgEMjZBn3neHLHat6b8lrnMkj6FjU/IgcHOe+fl3vn96U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":749135,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJespPXCRA9TVsSAnZWagAArdYQAKL7iVznGveHXaq99b8F\nYICPt3XZgL0PnLOII+13N8pPR5Kl2BthpCJcKFVKHCVku5JzRgoWVaB+zyYg\n0s7l2U0AEjM235mSS0ympSIRZZAVmQXlXFYCgUoOG0BMMz1OcSa1Im7hMGi0\nE1+v1PSgTqOInd59C5jcqA1PR8wkAEJ9m2E3t96efAOhGOxEUuwg0BWlWhTT\nTB2NaM+ISE1XDfIFYr7/IkpbHNAIDUCUlSu9ySwEZZYNiJuRrS9wKw1b7Z7S\nPkHSHwPsNL6i9qvX95L21bgCcuOK1aLCDN4QbjCL+gDQUoXMDedoSJ4GxgbI\nYt+D4A53fYiMpjTkRt8bQ+t0tJCVIzDe5phMJYiASmCADiDHGfIhBrNPCI46\n6jamUEVTtQIYwepmcc6zkUXtFomsxLKsiVy6Q+48qgLEtz2KnEtD4I/tY8r9\nsgBnag0qepLmO6ixLcwKCeermvlpCySwWJWErrLljFk2CTs0/YOwHSI7fK/a\nsrYq2tU9MZFRwrUO9ozOEotmvussrvSHNg1irjx7JBGZY6FEpMkxcr7njJjv\nIT1MoUnzRQbw+Q4Tj8+Hj0XWUYbjw8A7j+CYYBY81bhHPYVPL5a7vyTK3ANy\nQDfASH1Y34VM0KgLnZLcI8g2q1EA17xmHbqK/bS1vFsb3iawPeEP0QCjz5K+\nbaDP\r\n=BxlD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n## Description\n\n(vNext) Source plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## When do I use this plugin\n\n> Include stories about when this plugin is helpful and/or necessary.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\n### Learning Resources (optional)\n\n> If there are other tutorials, docs, and learning resources that are necessary or helpful to someone using this plugin, please link to those here.\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data (source plugins only)\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain you Gatsby site on [Gatsby Cloud](https://gatsbyjs.com), use will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the tutorial](./docs/GATSBY-CLOUD.md) for more information. All webhook notification that are not mentioned in the tutorial will be ignored by the plugin.\n\nPlease note that change in taxonomies or content types require manual rebuild of the site, because these structural data affects GraphQL schema.\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n- [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/)\n- [Using Gatsby with Kontent\n  ](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"97d22e175f0e4970fa591160ad18454e5866c0b2","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/gatsby-source-kontent.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-vnext.5_1588761559452_0.428963856689621","host":"s3://npm-registry-packages"}},"6.0.0-6.0.0-beta.1.0":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0-6.0.0-beta.1.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0-6.0.0-beta.1.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"016ea3c956efb5aa3df9fd943efd482b6d716d41","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0-6.0.0-beta.1.0.tgz","fileCount":34,"integrity":"sha512-knB7zYDkbcD0MN+b3GF+Z43OISUE+JAaFXaQH2yPzhBpTdjYi/ROnQzwR72Ldgg2beksWiEcvTsd9lUJ6S/pJw==","signatures":[{"sig":"MEQCIFJURjBTUn5keW/5oOKw9RN0Vs1ZNwMg91LhaIFMrARNAiBvcDNtS0ae33oy2Bc/PoZ4NSiKpmavHRw8olWUDUnJ4Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":751938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeu6CcCRA9TVsSAnZWagAAtcoP/3nSgV2e7DgVCvD+5nYK\nXLuIWwiUm9KJi9nYrx/XAst40yEAdKCA/Hifa4Y+m7UKCUxY+MoeYtZwyFSF\ndnDRNMS5IMQCbrWG8P/ntqdH9kA3lbrWgt4C5wdasDByf84cYcy+9HYuzVdx\nJIv7TmRqR1cljX+keO7G4OVwkWyzlmDv8IG85V/JP/c4TE3aCseWZyWqnhQi\nmXmEfPf1IDqhJXC/2tF0Ck0ZD3Wc17n3RR2UzvvmIA2CrPLA4qIAgcOTFi7g\nofHdpvS3WgpVN8TXsS9/ZWLpxu4hu7yp+12siKkW+KOP+83BCmDurJl+V+xc\neHP4T5EOGNaMa9lz8xD4jei5mauCwyEVnpR+H8Qjuhx1L+zyfNi/HNYG9d6G\nLtX61d7ucwecsrt9eZz/Pr3Thut0oMe0oGSP+9GJFLQMocFqu4RW7gvY/di+\njlYKjFIxsRhOpFnY74+q/X89znYA2QzBragcCjm4OW3F5vQBuraoDsqpEDsK\nCdRE6ERKx76TElKX1pzCVem9yTRXveO8bXNEArnbjyW/QvES9XAJ+9evpvvO\ns0wrnKnl7j3dg0OwPzpG/QU3KebPJ3dyNmhWSn7bY+bp8acywRHT5J+rEdJ+\nzlbnpLW7psb4u8Pd2MTegapD2ofxVLVt4Q3/Gpcv1MXZDTcZQN8eBz4lYm3Q\nrxoG\r\n=2ZJj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain you Gatsby site on [Gatsby Cloud](https://gatsbyjs.com), use will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the tutorial](./docs/GATSBY-CLOUD.md) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nPlease note that change in taxonomies or content types require manual rebuild of the site, because these structural data affects GraphQL schema.\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz/) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com/)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk) [[Source code](https://github.com/mattnield/mattnield-gatsby)]\n- [NetConstruct agency website](https://www.netconstruct.com/)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n- [Using Gatsby Image with Kentico Kontent](https://rshackleton.co.uk/articles/using-gatsby-image-with-kentico-kontent) by [@rshackleton](https://github.com/rshackleton)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"9240b14e0fc174f2b9b07c6720e6d3e5edcf71ca","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0-6.0.0-beta.1.0_1589354651543_0.7402640509487701","host":"s3://npm-registry-packages"}},"6.0.0":{"name":"@kentico/gatsby-source-kontent","version":"6.0.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.0","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"973edd8786126e25ff13a0a9d5e3c936160d1149","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.0.tgz","fileCount":34,"integrity":"sha512-8qmmQpJU6TajKQ6PDzQT57oIAlwTja5FLxdRtxmuu00bpWYlopyARvYiUa2E1Z/EAB+XRkSsuzpiClfo//YxSA==","signatures":[{"sig":"MEUCIQDFmzp47Cb+6so7MnfKYziirR2DETWuspLgnmZ9n0undAIgBNWXvTNuRmkrgnTZngeZ3N8mBrrMnT3yye2NHeSJZJg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":751966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeu6svCRA9TVsSAnZWagAAS9IP/RfABnX2qgebQNjfJuta\nqW80qxZeYL8LvYZD7IyOxO1EeekfulSP9R/blfGcV7fOBQ6rmRNjfTVesiDS\n/83s2f5UXmbJzhqcuMLpohmqQQyj0/eanLfH8/E19RvKQJwYQk0uEKGz+7bX\n//swOsoKnXzGNeouO5mm57MWADInHCiOCD+LLyLEvQTEbgfJh0efEc+alzkl\nkdBkwshk40crANMY7jtaT5IiDYvyd+92WFvFDVFsctDCZMVp2GPBQ9X2+ADr\neMVEkqrQdm+Cw2v/PuOk3b2qIdbWs2iOce7EFsiwrKugRoMofUS4C9MkheQH\nQVhNmsgsS9XYndxaHHrhgp/BSmK0BL6uPgF5hHn98p46lYiFx7dskVVDgnpc\nXPzZDESliKG3vD8GAZxZHZOKU0WtrjDT0kZsGQpZg/knnXFbNCDCDuw/aNNw\nla4Ok/G0/OGgiFJUUJtlci6YuUHPXxpz3IUOdGHFc6ZGLx9Q24oeomzyGggI\ngjwJ+bT9NkLlcc03F3LxNjNcSrvzRwRdyfgRmu0+aEJ9COzD5X2HEulEz97S\nlBaeWZPkh48qDvpYcmr7w5hCDrDSE6bBYwrXtF0M74rsQLsFLQZUmWaCU9k/\nOXda8aImEKsP96MO5NsB/1DLoaT0Ov5gPKv7opV1bCcRkuxFBid9rz4ISw7r\nkoH+\r\n=UJr6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"e26ad686bea7d8b3aeade81927bb214cc4af1387","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.0_1589357358673_0.6811006658163827","host":"s3://npm-registry-packages"}},"6.0.1":{"name":"@kentico/gatsby-source-kontent","version":"6.0.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.0.1","maintainers":[{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"michalpaukert","email":"michalp2@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"f82dd879c19d8031fb0ee8aff4c9e3ea4b537c5b","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.0.1.tgz","fileCount":34,"integrity":"sha512-qk4hsNwKGNnvZbfrMToc7y+QN1BbgexSSOl/omNbWnhUi9jm8/bP3/B3lVhntV9yEf0ZVVJO7Yfpl25PsVPPlg==","signatures":[{"sig":"MEUCIGMixw1Ub5I6WQ/cMKG7n8UjJQPZRWIIsE1eigVuyBcPAiEAksEpBbq7fAZem9Z/slQW2DEk8hLdLWoMyA0NayvSmHs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":751166,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewlBtCRA9TVsSAnZWagAAYJ8QAJqcrTim2WvFLc0aiO51\n82zllzub1blxusgc+rjqJXAJD2cZ/spGmy0mkrDdfZir2X8GR6r9SF7sRaX5\nv+1RF/iru/6xdPl4LV5/90tnm5/2L9TUfxW5zdiql18v8ncLedO1LzHE3RJ6\nazIrYti4hrE3vsSdx0BlV8TJuieoOgVRLQgNSVaZZVdo8C2+gNQOej9/WBAO\n/y6q2jltPox3TldG88+LBvoF+OOzIsIvAjVc6QcLME3CHuWdSvJr4NiHQSBH\nxcCBvcoe2bf100Bozo1AzQkrfQpCbSqCI8PuwPVZE0RdM2YCj/8EeV7aM6Nw\nT/dQTXk5UTLHcjOmHroGHo+USqMkbahegcK3M8vu+DYxI6UpgjBBLEhWVeK2\nq/gHAwqjBzU1oiDOEaT1+oiZDO/Cprq8BOdKW83X/s0mGq89cF39so5wJyzs\nUCEpBayzeuTAoWGhHRsrTlADhCx5I6VxxYzQuKK/XcJ+e3RWfc8wOHZ4Y2KR\nQU5rH0+unCTEXYTiz3tdEOawcOrMjDFEOmYB9axXCYdqocEHmYqyHD4X3aLL\n8rJ7bdB+Fyb2PgwtLbCl0MsmhNO23wq/fx04nEUI1xGRR6SoLE8cK2X0WiGb\njfMxQR7j0YIocbyXAlwyqSDJO2GaxEci6wUpFaZ9o3WoeL8vhkAxhY3cjltN\nBbJd\r\n=5Bpg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"4eee63d4a9d9c9a2416e44d16959f6ea9fe8368f","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.0.1_1589792877407_0.7854732256694983","host":"s3://npm-registry-packages"}},"6.1.0-beta.0":{"name":"@kentico/gatsby-source-kontent","version":"6.1.0-beta.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.1.0-beta.0","maintainers":[{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"6ad837e337ddb456ca117a60509b25dd4c18d3ac","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.1.0-beta.0.tgz","fileCount":34,"integrity":"sha512-4OkpPDntkSm74iGUGWrDZQbegIgESgtZ3MgWQbavWL1fzDk/BUPOjosIRYVGHK4bJDIF9rm6dRA0eQWBmsydrw==","signatures":[{"sig":"MEQCIG8VoOTNU4YWLEt5D7EjYwN06b4ORbNb06lum1i3A7vLAiBm+fIlAqj+KLCD2hjbZWGIxPX15xyb1I/DjCXJUtbdKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":753929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcv6oCRA9TVsSAnZWagAAuMMP/0rSQH5/Jkr+BM6ZeKnF\nztXrDVli18nPoEq+/MrHZRO5Yo3CB1uB9OsqoznbmY7VmMzrAC/u92jLmXWA\ngjWVjxGgSzItChW3nxL4YXRXlmilrJDjhyFoWJTdISYOzHppD+cYJ6+pyOP0\nkOosBnj+qa78RUWFGrVAj5MB8/EJYvdVTuWlAX1nVRkP5oQdLf3HOrWSqnDf\nMjNXxgGMOwVQ/iP4NVo94v1+mJRRBNPnmQ8bqCruWtl15YYmVDe/tlQL6otL\nq3og0pNH46SEOFaPmMl0R63HvTajCWvJNKz8i8scgYo74NkgEwvvqX+4p04h\npypGiQOEqoNItBsLXbpUlR9I8wNq+v3ayeN13s5JHtfUPlfM3PDwb/DG8MFa\n89X7eZzhT7mOCjKUeQR8OYPLQwFfBgLYv5QlweQczAMFfzRQUdczykdfYZeQ\nEMkAgUXmaY2WTO101d8B7wgTlwa+1NlNdStmeL4rwGSSJwjzAd8WtxuSW+cL\nsWlhngKqsDXEHLmzmeCD5fT9L6QcYbNmCuo4bQA3EFagAKT7ChCcMIeqmAjn\n4pqmxt9UVLPtot8lYdF5X2AuwqXZ/T7qC0B9q7i/K/qUq/ZBfQULDGjK8l6L\nUMUT6crFsx5elxoJO6cBtA9Qar8r2jzACV1+Dsf5LbnugqEkS3za59JdNxRl\nLOIr\r\n=Oj7u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n- [Using Gatsby Image with Kentico Kontent](https://rshackleton.co.uk/articles/using-gatsby-image-with-kentico-kontent) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/kontent-gatsby-packages/packages/gatsby-source-kontent?pixel)\n","gitHead":"9d2cd9cc10115b7fd673737556f1b399db1b948e","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.1.0-beta.0_1601371816473_0.506606782337534","host":"s3://npm-registry-packages"}},"6.1.0":{"name":"@kentico/gatsby-source-kontent","version":"6.1.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.1.0","maintainers":[{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"fd9478f35e525f0b3c324ceb9699056774c128d2","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.1.0.tgz","fileCount":34,"integrity":"sha512-JDoOlwvdOiX8l8Fr0ZD46DdYKeo5JgwgahRpbHcvvrBs4uRkmfdP1y4p9VTqfl3XwiLnpc0L70n6yCLHo5rM1g==","signatures":[{"sig":"MEUCIQCeKqAIavavoNG4Xcq6QUJt06N4dRTsspWbG98yH2l3SgIgJZCyssu5+MbAGgjQzcmOPsqU1n4LrZmYOAT6QHSvZD8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":754003,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcwPECRA9TVsSAnZWagAAeLcQAIhFsijRSAeac1aqzgkY\nZIZgh13kYW0KophjHTbhjVEgO3CA2GWeaPjjaGGPgyejjWSJNkRvA4cqFTRr\nQ9zT0Cruwa4ZatwUhgLT3FBxJXetgUIxgBajwfa6nWRzSKoQ8EwOC7KspVRV\nHmaC1TwVgms4CQXyx32MoFpBEwetANE6aSWEsnWhfUvFGe0854GUtmlb+KRP\nEidcdNq5GDn1s7Onyox3GuEKILnrcJc80zfB1uiDq8782WMLOhsra8EZaQsb\nhmrO7yF+9VS66kVd4ZocwcG323PvbHueZv8UF634q1CKXtZD6LGtMfKSALzh\ncneuBlFkwytMMTP5t7foKsn3h97BW4UnuTQuOEAyC6tW/Axa0NOdultufeoC\nel4vZDpdBN3RfLKeQ4WzI03X7ZQShdEpnaxwiFXhhxNYxzZPlM/1UPLyvD5H\nWzB4asNZfYHe/OS1FVOtPhVfqv8hQmsCUrM4Lv+tBV5GIDtxAB8JYL2HBqUb\n4AfnVkdkStC6HlpuAyvtX6eo5sXBLQBUt2B3/xT6vePt54De1NZdatzsDgfM\nRaMro1Odn58iZcHs+uh1yrwpKIXZairNM8HymlQ2uxHK5/Avy39RImlhAPfU\nwmZpxZ+sE2ZNMLwlOvdI6zoYkz7l5AenUTmFdUxKYLlskbd2sNC+MvqZcMiF\njuJN\r\n=FjYk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"52595ab303526c22827d130cabe0d68def4c38c1","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.1.0_1601373123729_0.5190537695769102","host":"s3://npm-registry-packages"}},"6.2.0":{"name":"@kentico/gatsby-source-kontent","version":"6.2.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.2.0","maintainers":[{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"d11da29511cff53213c602f2480093f7df3c8289","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.2.0.tgz","fileCount":34,"integrity":"sha512-NSCM5NU6mn++5N+hse2SJgM+uMw+hxR8nqGDEN74JfWdz5Do7DUf2hG4CfzsJ7m6HZj0g4o/R7UYO++EVU69mA==","signatures":[{"sig":"MEYCIQDAIg9G4lqtWcF8W2AI9jaENeF5n9VdiQ7kogeo43NbuwIhANt8ONAlMwS5jUxcThtkInAxWfgRFPZHPpeGQn6vfQPw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":754460,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhVjgCRA9TVsSAnZWagAAaMcQAI9NAkXKEaLtgqQih96+\nBLMzSIxX53NW0G297LExI1oAlcadASUedUShuXMvV2ksaJBllF8hHDCATbo2\n6b/Ig5VUns8BP/4bhjg9HehACJG/sJFqM8KKorvKjlVkFnqzCg0aw+HE1ogT\nX9T3STY1Xhfumqh0xS9yX3l+gjArWoPGAY87aiXs8CV6XC2VrxZkVlTeELjq\n+lI02q+c/YoF7XaWsmZL+tu1H+zl8EcOggVW9yiLBxKYRMhnxbCKf/2ebLi8\nl3gR4wbttVGUkqzE7C3vWoHKATJU0usBtBOCATpEs62Ghy32CPTP8Bn++//j\nyaQB18ochJPQy5Mh8fjrk/G8+aT+EKDNVkJ1/W0qvzFisY1L8n+yqZ86rsIy\nyoe8NG0nQCnBUzOyneg9rG0WwiDlIMIdQZ8rImzVU4N+Pvrfj5bKTf/9vChy\ncC6WqB12kly65G0NfjMz3pswxMyBjevKmwtWXqP/ciAVSQUF4lf6tIza7q4N\nt0PZP4B0Vqdkee6jZGhnfoqJBR5sq/D4N1yywmjuhIC/zcPxieyi0420pk2I\nly1zfFEgxXvhPnrOilISCutNMAWG6Ep9CHBbspKDLVdN34HE85nKipQqGZWY\nNgKqFGG6UNmDQFbM3sPBYSQs4CxENZOqTbNBNcYioJqAWNgXk8SiQZ6Me+j1\nOW4d\r\n=DZQd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"8de6f81ff40a76353636d6b0da9c57a640a90e44","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.20.8","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.2.0_1602574559865_0.6890499130896959","host":"s3://npm-registry-packages"}},"6.3.0":{"name":"@kentico/gatsby-source-kontent","version":"6.3.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.0","maintainers":[{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"8a20a1954977dd2a0dee2fd6491280add640c39a","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.0.tgz","fileCount":36,"integrity":"sha512-oeFggy/k4OGqklJIjY9iLZ9RXiniAdFEhIBxgjGX72PC7ftOXlWfUGmh+5chhBrU3zNz+bs7CtezhRznrZecsQ==","signatures":[{"sig":"MEUCIQCWE1W2Dh9H5X8m+c7543BLyvjXugvwJSolbKyaNhRMygIgPDVOGqVLLhDjlbv+QPyzKEAUxPepy3lWNjX5WVbGPuU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf+CghCRA9TVsSAnZWagAANn8P/iY0K9zHF/tOOW1jd+X1\nexo0uigLtobgoLPEMVVKR7mD07PTdm7/cnI6WaLQxffdkMFiFbZYDIfEYRwR\nfytxBzHGIq93Hm05krUqzqwoy8YfeEzPPAQl/A4OaOPLPL/m8OXK6vWTneQa\nzk9x2DPU94T8n9SM5mtDwKbgbG+PTgBh6Gbr3LvuhNh2pM+SAcgrSKbOlYeD\nic0gMdT5UiI3tyoMfnSM3Hi6o6ladCv0UZftrJuEk3/WCrpOe/tbEBu2enbP\nQC2PJgok/tAOvRxenrfQ/Oyh/8RerW6BsPEofzC0I9IunKS74nk30Z/U+iiS\nv8vKR8fO1pjzVVki8qo6raIFUoqN4XEFrGtRwOp2nDgQZM71XO3+r49uXyG2\n+UXFJK6i+lnxU2a8vRZ0PECI0xnQjlWA5mX2C4qu1eMMC1087KXp3IA5lRhQ\nOlGz6uk1xPMpw3bkDIGqzY14QPxLcyceyGvHFThv1sxJYsgEHrqSAXurghIG\n6RSTSrl5QcnoxM6cADP5CZb/fvLRSX3SO7Spw28bkk4zfzCOmFDSRqHJdzeF\nQd2qYxM95J/22IRAuhbYD1tdKF/GJ34frs94Jo1s7wTSaO5D311E1G/5v9Nc\ntt0GukJY9wdWHSnx2qmuYcGSC5uDcCl8RVaHp13kOhCEUYlVFXUpW0KUPkVQ\nQhSG\r\n=yJaq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"eb69a0c90b3c6cf2e03d19a4a27de711a8442df2","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.19.2","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.1.2","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.28.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.0_1610098721020_0.30774530404711653","host":"s3://npm-registry-packages"}},"6.3.1":{"name":"@kentico/gatsby-source-kontent","version":"6.3.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.1","maintainers":[{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"af6eb68ddd3aeadaab76a2e704e0eb1c5fd003b6","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.1.tgz","fileCount":36,"integrity":"sha512-yOjwUpiT2VxXVN60OAsc7Q5IBjtpcQzDvOLHFFubGSqKPsq1xel7tJEn9BJRz7gWjvIKI0YDlpqvVHX/MxVP4g==","signatures":[{"sig":"MEUCIQD3zVyw+kfA+4nlTMlJrDTs+DjDFIk2Re88xhkcfeYz4gIgLEbH9/mGNutCPrJTnw/79eYLtGCvoMGz+j0H4QIM8iM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756794,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJA/tCRA9TVsSAnZWagAAp1MP/3SQXwxOte+FHZcXYvAO\nbbE2mzCccj20ytXp9RDPuzbxVKbCUrojyMEWFsIi8CwtT9i9QHIZYxpIMl1V\nJHydMx+EX33nJZ3cgL5f+sn46aQOZV4BHjo7yyF5zDv4OCCwqCu3rbO3FZU3\nrEe8eqrlh6kyRk8ncQC265GgvskQEb2BTnx/jDhJCH3wLuXCpdaFBv446ld1\nz0k1lvf6BuT3lrvbsguTPsYsJGA4jSFWd6x9Yf6qXodvERI2MtEDCE4209Sc\n42Pd/EbYWfAGSZQzCY916kCq6XsHLOnmvJo0COCvwcsGHv4Czk80tP9n2Jpq\nUx5a9x3wc1Ald7MfiN3WXPploUKQLTBBYpzzhMNv7N6s6ENh3Rn3mKBwNgzV\nbJtTVLfmyvNhzv87VCpsB49ki+B/wd2Wo7NzU4lQIn8sNuXJlvy4PJS8npP/\n3dOf/BIyauOIgBAwDC+kSiG0H6/SY+aX7GXOn1YQYpDi4ob0mzpeal+4gBvM\nHebHoFOyNTlcNlw+kL8xdJaAPViToWszoJfKevTdhlLdRGvZEoXE8pqtzCXb\nagMZ2PZYEZ6Bc1K2Ut5B29YWK/lFjBiY7B1aDyjE/1ftf++WusVz3ZReOOw2\nJCZ2IVjcUllHD4239Cfmn/7oOv3e3WUXoO10gXJagE99gO0L1abifZ/2H1qQ\n7SUa\r\n=zZPu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"539ac6f69444b742e5015d02e8420cd23df120c9","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.28.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.1_1612976109325_0.4824894432436422","host":"s3://npm-registry-packages"}},"6.3.2-alpha.0":{"name":"@kentico/gatsby-source-kontent","version":"6.3.2-alpha.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.2-alpha.0","maintainers":[{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"561e5ffdadc4c7d237e6aa6f98021ab2fc6b35c8","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.2-alpha.0.tgz","fileCount":35,"integrity":"sha512-8JJWox6ItTby1A/C5rk3l3Dj4Y17bQQApTYVWizr+/RddG+qNR8b4MquPJ4WHyFoSkVlWW9sZSIZU6ismihadg==","signatures":[{"sig":"MEUCIQCAGA+kURMZ7impnlQtGPW3qLVnUhPslq1VLAF4eWrygAIgL3MYLLhOrr4d+O3p4TFzDWknXaz/Cy3WS+Kem+dP2fs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756891,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLnsGCRA9TVsSAnZWagAA7pYQAJhCaTmf/9chuylilllp\nhxp/gJMWqVfT9dh2CcVSHHaOnmM3kXlwqNHu/oJ0wCvZJC+QZXa9KSlYNFbs\nwzQZ/zi1JBjAdiiE6HH8zikK3tUZPsUKg+JjxqOtUm2k6SQQu2061Lx6vF+L\nWeTSGffwapBx4GN7LfHV/abrgPDHPTSR8TkTYMujNQL9XlCQDmZq78K18aLf\n3NaPgdBEEH7wBB03n8Ku/+1Nf3/qZXqjoUXMQSyjm875fj2kYOqHU0MJUcvy\nNgzP+NFDw6jEKcp9AkVmi2ygc/vS+HF5ChNJFX7OnmKe8ADHGghiSMJrwfnq\nvDK1kafNoy8pL2DUIX7+DOG1p/nAFb7b6db7S4AcYC5SJ7YDNNN10cYhybSX\njA/zPjyhFAxpFJocxYTasDEx64zjfPlGHfXcRVlCK4aVvsfRfJqDzS1hMWwt\n/VNPwJ7I2mm9Y+axHP8HYDJ9GY9KxUwlrFuqOxfKAezJFPHDfrYLzZDrI8U1\nAF4/FkopZ1BbHu0uoPMFyfylON9uqXHXk3fG1eujwRwOlsd9d2FQZTMLyqgv\n+KoKI6aVIF67pr2TK/drYRVSy4MUwTN9L2MtkbZc6dhJAwEgykYT+5YOk8vk\n2aTq0HEEClVN21ojVLz39NTL73ywLaL/rtgUsnP6gDl1A4RQw2RifzX270wq\nLywd\r\n=0Med\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n- [Using Gatsby Image with Kentico Kontent](https://rshackleton.co.uk/articles/using-gatsby-image-with-kentico-kontent) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n\n![Analytics](https://kentico-ga-beacon.azurewebsites.net/api/UA-69014260-4/Kentico/kontent-gatsby-packages/packages/gatsby-source-kontent?pixel)\n","gitHead":"ca82b4ca57229406aed43679cc9d4330fcf5ce92","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.28.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.2-alpha.0_1613658885533_0.24487524883865874","host":"s3://npm-registry-packages"}},"6.3.2-alpha.1":{"name":"@kentico/gatsby-source-kontent","version":"6.3.2-alpha.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.2-alpha.1","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"6e023c1f0275b21f40fd6d08996dc7f52d4f62df","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.2-alpha.1.tgz","fileCount":35,"integrity":"sha512-1MBAJScSEJD2wJbPgNXfyjK2w8eA80gQKBZpUahj09UzxzIXEuooBbw/Mhyw5sXhe1GpS8KfjbuMfyFOCJommw==","signatures":[{"sig":"MEQCIHnbyxN+k/2fTRXUBhIAzngSIUM2opxnbAem+RcSe9bXAiBbEInlw7S/r4mYtM0vHlAL/C+K6rb8r/j5JHy8LXYh6w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756198,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP0qNCRA9TVsSAnZWagAANZ4P/2Y0SL5r0Smj8wu7JoK0\nMQETD930lzQQbTEHLJvSrau5s3CTBUD2TLBrUUsU46xfceW57HBKdMYzUTtK\nwkgDZ/PS438x6EEfsp2CM+H2AaWmABmWbyBzkIthFc7i//RBwYb6ujZXWC+a\njafZtwnNeuNciFBCVKX0VjhwZVDplgLJkew+ON5ycf9vQ6tkmBFwdX+NnEnv\nA9FUnW2gC8tkrC63Qrw+NlN9xFe2AjVEsSD6hn7jiSWeEvUTq9J/7w9honca\nr3GNXR152w+RSw6ovji0RYxDqRIN3/karqMWyZ8eJHtDmSr4i2zDhClsxCZ2\ntU+59V4REdCaOadKsMtsm+GyvfiWyMExkD6e9+QONxuNly2HtuOHWaMROiy+\noUIJjZtHRQI9GNKbzK84EV1rWrp0XY8WC2khG2vXZtCJTyHZLvzEg+Cthum/\nLY1U6Z/2cW9ymCUFkM155P27HR76BrJmGGGIzIVlMt8c6Fq+ivojDKdwgl0d\n4BBUCsBBlzD9zVL6zbltrL6gG71YVpVfphEri+L/rN0Bf6qAuQ6reluSYXrk\nFZQao5tEjYiHvRPOZDaRmxU8XzwI9WQ0rSMiS6qGfTwWpT2iv401Xquh8gYg\nUCZttpn1WPFwWdYKvfcJXwTzPnhEDtFjmlMzPRqzwvMjsisdjbnPzw0bu1/u\nARyO\r\n=9joI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n- [Using Gatsby Image with Kentico Kontent](https://rshackleton.co.uk/articles/using-gatsby-image-with-kentico-kontent) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"812c3b6b50d06e1ac1e7d91b4b13cfbe9c1ea640","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.2-alpha.1_1614760588927_0.005731045726851125","host":"s3://npm-registry-packages"}},"6.3.2-alpha.2":{"name":"@kentico/gatsby-source-kontent","version":"6.3.2-alpha.2","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.2-alpha.2","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"7fba7a11fff8840a72ba13b4217647bd2122a3a3","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.2-alpha.2.tgz","fileCount":35,"integrity":"sha512-Wtvy2Qgyo/kXEFmGsRK2IpM3Va3N8A9/SDc+2QcFfDSX0zSxeNHkamj0XoEDl2nXCkALG0fhtwCqgrhgsmqLaA==","signatures":[{"sig":"MEQCIC35pr8KkN9T7kMYQkPX/x+E31n/bQFb02R9ZbVSG4M5AiACSidziZtVvMuJWHkxb8mYRvncyyR1UWRimOe3hAaUNg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756220,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQO1qCRA9TVsSAnZWagAA90oP/jqyfyMHpK1h2jcUy1aa\nHjzSwnfwkEqEaelpvLmUDmY9Jdg0OMVy+TK8V5qBCYd7LsYZyHl8ZCad+dy5\nYhXQleon735T17+O8D6jik5/bkcfSTmqgrvk6NgbWzzn+ISpp6wU9Xl+M96y\nD6NL0QBvAcQYS8IYCFyyJIW4ugYmv5LbrKXTcQ7vu3NTHSD5f/ToeSRC26M+\nGfjwMQRjzCRuk/g2H9uuxak1+cKSW5DNJpJ/FfCRXi+jObI0krsFwOhwgJVG\nD0TZkPD1l3Qa2m2hleLYKj4OVLktBIkP1o++jIZLuksiiIr1Tj6Em0lvMyUV\n7XMszK2qT6UH9ARrpc5EfVEb2Be3X/UiZuRlYyzxMU6Hiu+J3rC32HNOnZZq\np2x3DZNX15mlCknHQIY0OKFgHEItbTKtfqGQUwTOARgLtvTCE24VrTnGMce5\nGHKUsDCxAi0mtQh1SWc5FN2Z2aMO8nG7JVLAy3dzFTzTu+kICkXtlQ5fYIoZ\nzvhWLmmXyMEnw4CfQReWubuAIvy8jCLZhRQLAcNznBBYbh4Pr0oX8rYO4NIz\nRV0iOi74Ba8M3yqB7EKZvHS7Zup/DKC+mVuEECakO2lkL2M17zIY4u1q10yo\nIEdPv8AYMqvLlRBVK5BGeFEWLDE3Vi6cSFW9CTuGfh3H8SNbPDfUvJyyUTMS\nE/bL\r\n=ILHs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v2) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n- [Using Gatsby Image with Kentico Kontent](https://rshackleton.co.uk/articles/using-gatsby-image-with-kentico-kontent) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"ed40edd56e276d17261eed39fb53a7573e1ff0d4","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.2-alpha.2_1614867817797_0.7397479109753506","host":"s3://npm-registry-packages"}},"6.3.3":{"name":"@kentico/gatsby-source-kontent","version":"6.3.3","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.3","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"53e7c8b48faad84164243ecf83c94c32d8d6cd57","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.3.tgz","fileCount":35,"integrity":"sha512-JJmcmM0Wob0urMiV1jiHiST4xx8JLKvh1SuMltitIznbMSnwzqPY7NPLX4uZm850DIZZAc7Xhc2qUgSe+x1hXQ==","signatures":[{"sig":"MEYCIQDBHbcV/fehD7n1DkYoT6bvoSJK7EjHDMRGEpwxz9G3fQIhALBV6bCzrCE7Upwp1GYnA1qEoPenm60Fi7ieB5/Ls3ut","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":757237,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgU3ByCRA9TVsSAnZWagAA07sQAIh2bvLZAz6GOGnVZjC+\ncBuKesoIowpoOYiKQQNpGGOv+OgBKLN867pFZRN4gwTekktRcdTNPBMNUgHE\nhS6Xgf221XmNvGpVx0lHdREQ5rsbN09seUiUMWeSJRfKp/fEgZvTDZmJ/vsN\nSzr9v/acgpVS5dhpHbKmHsvTp61jIan3thDlygpWutfAO21SzDLE2Lh0EshZ\nw0uRRvHIWtJ/jbA9rA7mbY15qYlrJCEzQ3ECH52Pg774Q6YTvc2q6zHlyYcF\nXPvteUOkWK0dZqUvy4gJZkZtrqpa4+b4LmpJiira3VnLv/UYoSBR01+I4wkt\nXPTcS3bDjNdpkeqTB7gPYWxQAZpCuToH8knY6hEBXvFU1Qeq3I7ZQ7RCEtLD\nTvFQ3CWMsJKCaYaZfLmL8+qlrkwEGtkh0E2JttT4qXO6TBF1hLZvizH1/UtD\nGSueAwbkepJwmwt3m7Q5Qq4cbMiRbXi3ITkjnXAwrWJPHuUiSEaM8vLGNNUe\nW6JB2hZziWGQSsEmlJFyOrKm4nIIqDjpkDbT4fZM9O+4Klj3o9Lb5QeKcJTV\nkgkKFj44b4Yr/QPS4LZ1CaGUZrhTx6p3ptaJVZJRqxFnxEvx//3F6eQySS2C\n9FMN9Su2gZMOuk7lzy5fhYN8EAvBtkCVS0arcAiv3UL8wnwCJ5jrvAV7HYTD\ne0Cu\r\n=bysK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"76ce0fb39fe5224ab481cdb0bd4c757d88eb28bb","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"makma","email":"martinm@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.15.1","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.28.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.3_1616081009762_0.3802850760599503","host":"s3://npm-registry-packages"}},"7.0.0-beta.0":{"name":"@kentico/gatsby-source-kontent","version":"7.0.0-beta.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.0.0-beta.0","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"0244c39aedd76ebb9f03df7597e4e7a1d8fcfae6","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.0.0-beta.0.tgz","fileCount":35,"integrity":"sha512-Pek3dW4xwLGgZnY7khR63Mhvy4jj/cHPWo+7/SU67aCdcGrF5vQk1Ss98njg4XTBXpjYQRl0BrRTeo/Z6XkE4g==","signatures":[{"sig":"MEQCIBftTtDSoB16V5glzEpiO9xjiz6ZupxAdkanHpfMg4cEAiAcsoU7OlErk9As7rTpncvOXsaghVqT3Z42gacn4/22ig==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":757019,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgU3eICRA9TVsSAnZWagAAnPMP/jUD+2vEZxX44Uc8FXje\nA5rIWH5AFkUaq+I1G7WubG93Pkt0zrHj5Or3luSK/JiFXFTkUxQFlLqL1eVo\n5BkKr5z51dYWCZ48KhJye+KVEmkL5vfubd2CRW3/TBFYTob2+5QxIODdHH3r\nzzsS6dvogHQ9aWU3C8/OAJMlsB8rjBV5cVcbQQPa7cfKaU7xw0E6lciBoCu9\nFve7iDzLDfDetdOL9+3iTmhjsfzTkF/LtwqCmVvcB0XsR/tgOBExQzqGHaUb\nlPHEt97wNp18fRNlU7SmJlzNXgTM0F5ABD1mBfGHHDSlVxo7bGXFZ09uvxxJ\n5N3lKRdgIwNiowZRKr6DQAxPHWfLlXB33c2QJ4xyIdhNyerYnE2SJo0gTy9l\nj3NvhEWrwcoEC/ZG/Dr2EzKjBbi+3MO2uYDWXONN+VwRoiUE+E56DfdsE8JT\noOXBTwMFAq/uFIx+xJx2PWc9iuKFdk2OM05qJ8fF/8CYRwDsJuLrrW1vi7nK\nY6rdtPX47FOoStH9loU0BP0xC0qbKCl6zbx7997vn50Xjwh0WEec12qUdflO\nvUzF/WT5qfCl2csVppa/2vxAbQO//TPZFqMNshAXyxARBc/ndiP15bKImleV\nCVg3zjmY6RlWFjQMeSL6QXwYaqCiCI6xZOx18vRoyeH2A414a/50q2nGD7i5\ncV9R\r\n=0au9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"0ee8d7d9885374df13ccd82d79634ae91dec9b3b","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"makma","email":"martinm@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.15.1","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.0.0-beta.0_1616082823532_0.5959762931119397","host":"s3://npm-registry-packages"}},"6.3.5":{"name":"@kentico/gatsby-source-kontent","version":"6.3.5","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@6.3.5","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"01a26ae5500db125d547e46162048cddb7ff9d10","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-6.3.5.tgz","fileCount":35,"integrity":"sha512-fMN+dIT8ycjcFnCos0ISYv8uBdS0Gzcxl2LL/Mh7Q68qJVJhyYXWOH/DbuWg7UfOnWVzpUpF7HXJ1TQsbE/opg==","signatures":[{"sig":"MEQCIH8YNjhpYKFCOtn9Phfi9YtiJ3QaTAf5SE4nPq0OS/3vAiA+faGPG7txunNjD1Kjuop3PVl1ofaR2zfXWWU1JJKE0g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756400,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgVJDNCRA9TVsSAnZWagAAHkMP/RvStiXCSqYPsZvVHtf5\nRls0rCDpdSWmDUNK/Lb4MT3O08Qvgo/Zv/IJheTMcLv5J0bkELlGrKOeP3y2\nUbnWnphRUq9v9Z/+0qICFePyMK6w29Y+uveCN2d50hOrnHcce/c8ozd/nm4G\ndWjm4GJK1+BQ31TIX0wVImZSbCQrl0E0K2n98axD80CgtdEJ1ANV8PfLNgJn\nRc5MsXl7OJM7/XINSa3VcezWjFQU3Kctn3+A/vhKVc1HpA5uC0ZwSk92IPNz\nLRCzOTBjNI/6+3DrgmBY3KPyRLr8z8V9LFhpEdlKLBi4EVWbsBmzK5lzsWTa\nyP7yM7S0KCMzp0iMENH6F0yg7vMaRS3pDb0HR6bGMIlNEcbC2eMNMxW2FL8z\na50yUII06kXFOgSPG3/m8SCCqGOgkHSvVG2kK5Aerf1Y4lejvJn/A2+/xoSK\nF/bKfy5RnNdmy2o6laShDpnd0z67u+6USXe3Vdg1vZl/5kFTQaDLcKKK5fQs\nSwiLwJ3aSIPdgKOQcrSv8WwdAQahm2AxbXWEn8c+LyYdW/FWVe4lkrGaMSwK\n33TiF4feT6nT82hAmQWgU6BX/tKg9ZARsMSY6vOQoYCzivwq+uoHLt/F/7Zw\nJ1bUgbZsMMH0Ajio+XeHw95dj6c5EjID435+BIXF0N+NdRHjcWDOm3TNus5T\nIUiA\r\n=3bYR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"c01f7ae2576a7cf22dc6492736d5fba1319e9483","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"2.28.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^1.1.1","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^2.20.8"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_6.3.5_1616154828544_0.45271703016631304","host":"s3://npm-registry-packages"}},"7.0.0-beta.1":{"name":"@kentico/gatsby-source-kontent","version":"7.0.0-beta.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.0.0-beta.1","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"8157645c59bd23726111adeb06f3a82d190f4ed3","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.0.0-beta.1.tgz","fileCount":35,"integrity":"sha512-sdT5GG/cox4L29CqQJ2nYXozdhnizrrpQ0twkYx8bLk1PT+JaroI5rrzBqnk2XcP9s2mZLx8vXwJR8P0UofH0w==","signatures":[{"sig":"MEYCIQDG0Nu4b2dv2B3R9b9/srXYIqyMK0rEUJWHdrPo42JU0AIhAOsSqYj9iTyZ3ENa16tadgd6V3KxBr7zbQImmYr15qW/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756365,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiBS1CRA9TVsSAnZWagAAeSkP/RGSe+PlB+QxBPCIL/6O\nHNpQ+rcn+gDi42tLGSfJ+jqYRMzp4IH4HOVQdSdzSmoYI4Gq5PDdpJwB9QR8\nS/z9m529I747Qyiy3+lYe1YBK0R9I12LKFKrmkZvishg8oNQOsRQSzeCdJUv\nks6vR6AFk5YAerA3vR1gimt/RulgvefNjLyz1pjpxw/ciEb/+CO5Guo/SI79\nl+vuWlgefflmRN6KiT+P42SknzOAPNlhRBocot8zfgb8PxO0Xu2sOXLpRMCw\ntZCY5NB1sYIy5O2MI4fvDTLDSADJuQsuyu5WNDSrizuW3vdwxWXbGb9Er4Xb\nzOZbCwLy5xVNbJjYCLD+6MEPRiflahsGfonRLEf9lqSfOrmvut52xlhW38U6\nPC7ZMAwPEjH6fM+LLqy87RT20djO4n98VjQvVeNiSYPaHybHaEXr69MoX/rB\nNYCFCPL/HzifhbE5efZUch6i9Qz5UKoLDtlnwlC97dCKxhJ6ZxnnlECjT2N5\npUOY75LStR4LOSmw76PkjKvc3k06efJUTHkGrx93HnZXJ5O3ADXTefQ7eSyE\n29WzBNVnXWKywJS1DtYm/jfwZCQQDXxWYsNaUUCLadbgD/GR+TtUDF02jiR9\nQwr9h0vCCpnrA34CDxde9NpLvPO+LZbAjlFcKsFm1T0eNOA/7u4M7Lbxo6wx\nMUSX\r\n=PuKY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"4ae6e5af58e40ac3cfef4906a3ef15ad4c01a31b","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.0.0-beta.1_1619530932574_0.5004806102223487","host":"s3://npm-registry-packages"}},"7.0.0":{"name":"@kentico/gatsby-source-kontent","version":"7.0.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.0.0","maintainers":[{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"ondrej.chrastina@kentico.com"},{"name":"rocky.intel","email":"rocky.intel@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"makma","email":"martinm@kentico.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"2d1d99a31365cd2e9aef828944ba7428327b21db","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.0.0.tgz","fileCount":35,"integrity":"sha512-Z+3s14XyyXNJ1o3hv9zs+a2kEhMIWALeRXTlVzl5noGb2nXSzCe5kB1qI6KJPhnSo9Rc4IOg8QaX83hyckoAEg==","signatures":[{"sig":"MEYCIQD8tl+wsTOX3uVOaS4ur2rP1/26dZ/UxXETl38IU3avHgIhAOxnWpnNhuDJGFtI91zB+mNdrXvA5wq65cVOk2ocxBQk","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":756358,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkogLCRA9TVsSAnZWagAAlgwP/Rj5Mb4B5CCLcdRlnmR2\nC5zbmfGDRrjsDC3GaItaGryjae2m/ZRe9uUH2WtN6pmafkoAzBFy2GXk/fGo\nxbvL0h7k5l5Nb81CILFg6LGwdju+0wsyxXKZQUImOKjVUWE4QFRlL73Na9I7\n9gmb8GuertaY+Sm26TsXDY3WDSqrPwnuRw72+zzZIkJeZ41bJ1zu6746GyJV\nsyymu/TIA+1AGEC0ENkMPF+LM9yCigVvzAXC7RWzQupluZe3zC1P8K1JAI3T\nhWqOq/V14Hxe8C9r3Jc+QP5MPJesc3l4aJ9hAcZrvfqswudKTqXhyYI1Jkl+\nVV2VHUzVKRvl4Qao+cpE/83KUOpluMh7JVOvs2hQ7A553M7ib0afnKZNyw45\nwvtqg98s2h7cfnuaRwvCAjTXr0CsMJaffYvBUrHL1b25cUVLUmTOYehRfBtL\nl/Zl6xRRh/9NHI+J9SbZqPoYTIO+7pBPG2CLj0fpLvgzuje/AWR/MPOWUipK\nwdk5eXHzy8JENPh+Tku8HAlVafofmC8o24VuH7azysaMR3024BDw5xk7VsNr\nCLUAknr2OVvzGsIVohXFiwKqYHONRebHY2Q7unhuyn3v/GJKGY3+L0SgdM1N\nK1p8AbPC2BpHCJe/IkNtIGPpH3P5LPbAMBAIDyt+nSy1wbM51CWidsdy0KPc\nPNua\r\n=+PLP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"0bbb75419a030c097fff2808aef3e1013154b0c7","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"ondrej.chrastina@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.13.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"12.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.0.0_1620215818957_0.6154868162408322","host":"s3://npm-registry-packages"}},"7.1.0-alpha.0":{"name":"@kentico/gatsby-source-kontent","version":"7.1.0-alpha.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.1.0-alpha.0","maintainers":[{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"10acdb04fbc62aaec78eff2ad586093fe07f2f51","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.1.0-alpha.0.tgz","fileCount":35,"integrity":"sha512-+AGK1Z5pKQIFhJDb8qbYD8yicJNC7WSfsJK6EBdRTWnGRvRljid6EG2N+qDZtwQUWJiMqnF4VOLM0cjkAekY+Q==","signatures":[{"sig":"MEUCIBUCS12/NCQPa6d02u/PYrYxIdIT29V50zZNNI/IVbe0AiEAncnAe1U/K9IDBmym5oVNoTplZnmM3gbzwTkmIVy0xc4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":760367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg7aiVCRA9TVsSAnZWagAAZVYP/3PxTR/P/YRssRF+gj1x\nnvCPAk3jnmGZjGlv+IAIlSxZaCEpm575IJL4FFLcDFinyVOug3lUg4UhiyE+\ngI1e9jLRvh+A8Zx9hJYi8S3Wt/1vFoRAO+tolyUxvmRZk/fv9cZ1JhbIICqA\ndce3qKYFCsrZMNuPbtvTwYx/Nj5TyGhm9rbOWm5dtk8TMWpBXrfTO24qPN/d\nEZzqcfp4+a/LJ/9o67my3XbTOACGufA1FO0g6Jjl2zrdQ1YQ+zF9R4gfUid5\nSS/F/eIehNbcNRksKrK9iGEYxhv+8M88e2C8kVYhRojQnMdSiG1wBVHwqbxG\nbtUxAZdoOwj737nD1sZc10AQlYebjgTaDP6/z2cmV3wt5X94IRSxm3haS22V\nJe0JZqsDZdG91VNfsJMNKt+asssJl0xGclCyfZCvkMA8w/I8LQmkPCHW4c03\n8eV03AcmM+2ym+9QevjzAqUBcZMhqVWJtx/iIpMZVsWRdA/Nff2kHcL3ihb3\nTi3LeTruJApOlAZgl0AErVqCLySb4jXb949DKVZ+G349Pco5zAYVxF62M0ht\nvmvBN0yxTDrBFPuLscc5YHhpdzpJKTdihhA0d+up/xpvwA+86fNSk7YInOh/\nZUumObJ6aGQLZBiKpWPmsG8cInO44QwLypCxtqxyXen6fEuGXoAMCsi9t4rI\nEEJk\r\n=U4o3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\r\n\r\n## Description\r\n\r\nSource plugin for Kentico Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","gitHead":"bdd9464966fbf479d33d79510e1ac128f87cb6c4","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.17.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.1.0-alpha.0_1626187924578_0.12593589396009186","host":"s3://npm-registry-packages"}},"7.1.0-beta.0":{"name":"@kentico/gatsby-source-kontent","version":"7.1.0-beta.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.1.0-beta.0","maintainers":[{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"aeb25d74e5096eac67be60ad59e03a1e4f70a3d2","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.1.0-beta.0.tgz","fileCount":36,"integrity":"sha512-V2GLphkQEGzvZDLC2GHUVnZ4l//ruZvJ2/5e/1NNpyoO69zCBIEC3YOtFfLLX6zBHihc+n0yd7FXm2+ffh4GMQ==","signatures":[{"sig":"MEQCIEOBXmJFolwirFh72fTfvHGoweJut2RdUHFv91yG1fGSAiA6gRe3At0mRwxfqYjiD0Qxx5QHlUU4u32Gda5Hk90sWg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1426664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9WNUCRA9TVsSAnZWagAAJzQP/iwkJ0SiWJR6ZcoL8Efm\nQihkozZPWmeRYRxOCJWD5XjimyaXYS4hyriwF3ly7tzVlez0gH/ZE9TfFn6d\n1wGoZeuEL5pMqDo3b8wQk2gSy3s61L7kV4206ehVUg34kYYIq6zGADnDehgR\ngB74k3DopgwtuyDy4GxlPpPXry3KZY/sjwt2i/esL8hnys8DX38c4wvHy4vz\nqt2NjP/ZReZf0UdJituPmpaymBdymjeLkGUvR33a8n4h14fb1+zbfSphdV/A\nosVrRDfxGRM2iP4PWtgi9fqx4y/6j3Ljeh7c+pE5VtWhD0e0goP6MrtS43DV\ngoLtu21FmEdkCfPxc7WgwVIGzOkHByTprVfFqSod9HBTTAE+RNPuoWCaZ/Bb\nClfvY7pRhxEMGx9mjrW5a50ce6BWh0Epgr0DbZjJZ8YS4lqs5dkeV8spxICn\n480fkSP2gULgsOXWMcQR5lHnJfBO0SgdLoyYw56dzKfaH9CDS5ZX4JivB7t0\nfYuypwU4apkoT3I0Sg1TERFYf87EvMlC/AJ9POTaNehk4w8m7T1YQxa1R6YV\npP7Ko9O6sxX3V6YxY69h9wKD2b8/5mx0IfqyxygItxIMP1Les4lCf/8yBbGk\nAV3J1aUwsNrRbNL1YlOsu/8IUMtqJI4Y/lHK5ve/jP9Xqyuewe6SA5NiRQTE\nvpnG\r\n=zTKK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n- `experimental`:\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        },\n        experimental: {\n          managementApiTriggersUpdate: true // opt-out by default\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Experimental workflow change handling\n\nThe source plugin is able to handle the workflow change of Kentico Kontent as an experimental feature. This allows your editor in Kentico Kontent decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\n\nTo allow the feature you need to:\n\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\n\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\n\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"4892ae434f0c246d7fcb5d0e9838eb8ecc82ced1","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.16.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.1.0-beta.0_1626694483927_0.668655725812946","host":"s3://npm-registry-packages"}},"7.2.0-beta.0":{"name":"@kentico/gatsby-source-kontent","version":"7.2.0-beta.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.2.0-beta.0","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"66d77fcb59c4fe61d394c756428e029a0280b169","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.2.0-beta.0.tgz","fileCount":36,"integrity":"sha512-f5KX40z+a6gdz3NmKZFMMJhElZ4X3uNANtZX2C2ZbUTfMlhuAKir+GfgFxkiiuviCaueY70uzbc3EtqTlFKUBA==","signatures":[{"sig":"MEUCIGdjAIbk1AISCoxhYQwl+gSeEOTQVEZe/QQSF5hBti97AiEA/a0MMRYKUuyVVzL8lfJWPxE236TUtbKfM8u5JEUIT4M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1427560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCVLECRA9TVsSAnZWagAAnf0P/2oab0dbhe491x7wG9Qw\nJbo2i3Gp0Lgebfuxdu6OnphC8VAT3ET5vN2DArg7OeXuBx3lyxXQ5CFbUCFS\nfplqejZ+vk8DPQG4r70qI+mx8FdeCznZcQ4cdMpEdEKN+WgBuKf8Sln94URJ\nIiC7AouR1ErMxVqMKVXuXJ4j4nlvwjsCew/8+5kHg2sPHr99R0RDj6ivgqv+\nohf9686uFAxwzG0IH8LyNzHw3Zx/1M41+omuneOWamelfpBDggh0Alj9Dj7V\n5xj62QF6Qub9jVRMR2WAKT/xv7x1AQTVwWjvkiwna4ECUCw83tquwwaJKROQ\nrLShfBIa2/TrDMJd33qc3v8pxSJG182bQotFqkOBB8KK9Dc47enJfGaOsiOB\n5gexXNOr+tCLP40YTb5rVk4HVGwUvZydEMA7mtLR+5I05jTAQqRz3l2o7szm\nZmZxPqXB0HM3Yh5gzKPlEFWYtt5fUy45NQPR+wdTbwX7Rh+zeKEk4FD7+8Gd\ngRTWWp0Gq99fDepUMFRyYJ0XVAJrE8ni3NQbWSPgCvVAJg+kFcsmnaEWpbut\nz3KvZZ6KnN2dZxzCp7EbGe3D4Zh9gNCAnzoGwOXSP/Mj4TqxQhmeIFMf8QBp\n6PSq2wfneg11/ytujHpf7YWek9YTCX6Vpufgxfr+9MlN/yy25t0KyFdXiC1d\nlWzs\r\n=Kke/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\n\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\n\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\n\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\n\n## Description\n\nSource plugin for Kentico Kontent REST Delivery API.\n\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\n\n## How to install\n\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\n\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\n\n   ```sh\n   npm install --save @kentico/gatsby-source-kontent\n   ```\n\n1. Configure the plugin in `gatsby-config.js` file.\n\n   ```js\n   module.exports = {\n     plugins: [\n       {\n         resolve: '@kentico/gatsby-source-kontent',\n         options: {\n           projectId: '<ProjectID>', // Fill in your Project ID\n           languageCodenames: [\n             'default', // Languages in your project (Project settings -> Localization),\n           ],\n         },\n       },\n     ],\n   };\n   ```\n\n## Available options\n\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\n- `proxy`:\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\n- `experimental`:\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\n  \\* required property\n\n### Logging\n\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\n\n## Examples of usage\n\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\n\n```js\nmodule.exports = {\n  plugins: [\n    /// ...\n    {\n      resolve: '@kentico/gatsby-source-kontent',\n      options: {\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\n        languageCodenames: [\n          'default', // Or the languages in your project (Project settings -> Localization),\n          'Another_language',\n        ],\n        includeTaxonomies: true, // opt-out by default\n        includeTypes: true, // opt-out by default\n        usePreviewUrl: true, // false by default\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\n        proxy: {\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\n        },\n        experimental: {\n          managementApiTriggersUpdate: true // opt-out by default\n        }\n      },\n    },\n    /// ...\n  ],\n};\n```\n\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\n\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\n\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\n\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\n\n### Learning Resources\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n## Delivery API alternations\n\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\n\n### Preferred language\n\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\n\n### Linked items as links\n\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\n\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\n\nLinked Items element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        friends {\n          value {\n            ... on kontent_item_person {\n              id\n              elements {\n                name_and_surname {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRich text element\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          modular_content { // inline linked items as well as content components\n            ... on kontent_item_website {\n              id\n              elements {\n                name {\n                  value\n                }\n                url {\n                  value\n                }\n              }\n            }\n          }\n          value\n        }\n      }\n    }\n  }\n}\n```\n\n### Rich text images and links\n\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\n\n```json\n{\n  \"bio\": {\n    \"type\": \"rich_text\",\n    \"name\": \"Bio\",\n    \"images\": {\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\n        \"description\": null,\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\n        \"width\": 1600,\n        \"height\": 1065\n      }\n    },\n    \"links\": {\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\n        \"codename\": \"developer_community_site\",\n        \"type\": \"website\",\n        \"url_slug\": \"\"\n      }\n    },\n    \"modular_content\": [],\n    \"value\": \"...\"\n  }\n}\n```\n\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\n\n```gql\nquery PersonQuery {\n  allKontentItemPerson {\n    nodes {\n      elements {\n        bio {\n          images {\n            # Object transformed to array\n            image_id\n            url\n            description\n            height\n            width\n          }\n          links {\n            # Object transformed to array\n            codename\n            type\n            url_slug\n            link_id # Newly generated property from object keys\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Types' `elements` property\n\nElements property is transformed from object to array.\n\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\n\n```json\n{\n  \"system\": {\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n    \"name\": \"Website\",\n    \"codename\": \"website\",\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\n  },\n  \"elements\": {\n    \"url\": {\n      \"type\": \"text\",\n      \"name\": \"URL\"\n    },\n    \"name\": {\n      \"type\": \"text\",\n      \"name\": \"Name\"\n    },\n    \"description\": {\n      \"type\": \"rich_text\",\n      \"name\": \"Description\"\n    }\n  }\n}\n```\n\nAnd here is the example how the source plugin transforms the data.\n\nQuery\n\n```gql\n{\n  kontentType(system: { name: { eq: \"Website\" } }) {\n    system {\n      codename\n      id\n      last_modified\n      name\n    }\n    elements {\n      name\n      codename\n      type\n    }\n  }\n}\n```\n\nResult\n\n```json\n{\n  \"data\": {\n    \"kontentType\": {\n      \"system\": {\n        \"codename\": \"website\",\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\n        \"name\": \"Website\"\n      },\n      \"elements\": [\n        {\n          \"name\": \"URL\",\n          \"codename\": \"url\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Name\",\n          \"codename\": \"name\",\n          \"type\": \"text\"\n        },\n        {\n          \"name\": \"Description\",\n          \"codename\": \"description\",\n          \"type\": \"rich_text\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## How to query for data\n\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\n\n### Querying Kontent Items\n\nExample is showcasing how to query type `article`.\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\n\n```gql\nquery ArticleQueries {\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\n    nodes {\n      elements {\n        title {\n          value # title of article (text element)\n        }\n        content {\n          # content element (rich text)\n          value # plain html\n          images {\n            image_id\n            url\n            description\n          }\n          links {\n            link_id\n            url_slug\n            codename\n            type\n          }\n          modular_content {\n            # inline linked items and components data\n            ... on kontent_item_author {\n              id\n              elements {\n                name {\n                  value\n                }\n                avatar_image {\n                  value {\n                    url\n                    description\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n        tags {\n          # tags element (linked items)\n          value {\n            ... on kontent_item_tag {\n              elements {\n                title {\n                  value\n                }\n                slug {\n                  value\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Types\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Types {\n  allKontentType {\n    nodes {\n      Type: system {\n        # system information about the type\n        name\n        codename\n      }\n      elements {\n        # type's elements information\n        name\n        codename\n        type\n        options {\n          # filled in case the element is multiple choice\n          codename\n          name\n        }\n        taxonomy_group # filled in case the element is taxonomy\n      }\n    }\n  }\n}\n```\n\n### Querying Kontent Taxonomies\n\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\n\n```gql\nquery Taxonomies {\n  allKontentTaxonomy {\n    nodes {\n      system { # system information about the type\n        name\n        codename\n      }\n      terms { # taxonomy terms\n        codename\n        name\n        terms { # terms are nested according to the model\n          codename\n          name\n          # terms ...\n        }\n      }\n    }\n  }\n}\n```\n\n## How to integrate with Gatsby Cloud\n\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\n\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\n\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\n\n### Experimental workflow change handling\n\nThe source plugin is able to handle the workflow change of Kentico Kontent as an experimental feature. This allows your editor in Kentico Kontent decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\n\nTo allow the feature you need to:\n\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\n\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\n\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\n\n### Gatsby preview updates\n\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\n\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\n\n## How to use Web Spotlight with Gatsby\n\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\n\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\n\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\n\n### Step by step guide\n\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\n\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\n\n## How to run tests\n\nThe package is using [Jest](http://jest.org/) framework for testing.\n\nTo run all tests, there is an npm script prepared.\n\n```sh\nyarn test # run all tests in the repository\n```\n\n## How to develop locally\n\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\n\n```sh\nyarn watch\n```\n\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\n\n## Tracking usage\n\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\nIf you think that tracking should be optional feel free to raise the feature or pull request.\n\n## Further information\n\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\n\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\n\n### Running projects\n\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\n- [NetConstruct agency website](https://www.netconstruct.com)\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\n\n### Guides and blog posts\n\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\n- [Using Gatsby with Kontent\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\n\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\n\n### Previous versions\n\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\n\n## How to contribute\n\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\n\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\n","gitHead":"691e4e1a1ab42ebbb2cacadaf45322394c7f2ea7","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.16.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.2.0-beta.0_1628000964026_0.6517642795028524","host":"s3://npm-registry-packages"}},"7.2.0":{"name":"@kentico/gatsby-source-kontent","version":"7.2.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.2.0","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"3b8da1014ef992834d37c75370e839709933c06a","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.2.0.tgz","fileCount":36,"integrity":"sha512-bFGr+ofxqO1J3LH2zT1bICPEDg/o/Gy3+DYJpzqQMMjN1xCbf5qjR9d6lbSfyFfPT3p+JDbX6GPaQsh4dwGHrA==","signatures":[{"sig":"MEUCIQDuLekTP+ZcJMq61uaAr9UejfHlVZLgnuDA6WFb1DRfIgIgWCtCH869ya9zGMKekokmRX2DaaibfZwbv1vOQmiN8Vg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1428638,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG2riCRA9TVsSAnZWagAARjoP+QEQEb+J15o8Xdhnagkk\nqPKFCbA7ChvEiJqXrvgWVXeyOxwPrc4xFKvsHa247sKNG37xKhD57eOmr6X+\ncuaVy6bXsK09xJPvCLFp/oXSboPkSTBX5CzocYiQ2iWO8DuBWaV0jccTrIxT\n+kL0dS0Cp6xRQNQVlTl+lUUgVNTTPlbP78GhEv6Cm1wnnrWhAFrLdGNp1tpx\n3U9VHg8cMGIz/NYCDoD3Zi3kgnATDGUEw35p1R9jgLDdS906Nv9c9gzuvlsF\nHGtxJr6lnYozPkNPMf+nTjLmPyxQItSHX6/UOyqQWuN9vPOHmf+OieIvy9rd\nkQ9VhEPqCjS4WGGtKMt7pw/BMTqXwT9s5WFGiwFmXCtL2AMxQW5lVDXOOKpH\npkMfTBm8DBI/DBCjspus3IWs3VVGHA13FlyFzj8aEx1Yg2Zbd9P7UpERQj8W\npMvnRAQ6puTQy+0iPPmwhMqFbKvIQR7wN+DBWABN+rJRvTkUFYkmi7ghxkZb\nXt/naksGrAIHzQOJ3E56WZAIxVVpIzH5vBj27yMrCaLYTGoseAEOOeGkuh62\nb8bbSqU4I0Us8yg2WOzUBEYUCW6suRpovbDz/Q8Hy//u84S9d57WsnWHYN6N\nGKink3Lgxngt//45/42anf3YpqiM5oSbvXDX8xnoOgv+HX4IcoKWkLV/Y5kf\nQW+R\r\n=6s43\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"538ddc09165936f501adf1c696cc5e0fdd31c649","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.17.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.2.0_1629186786014_0.4493444078617672","host":"s3://npm-registry-packages"}},"7.3.0-alpha.0":{"name":"@kentico/gatsby-source-kontent","version":"7.3.0-alpha.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@7.3.0-alpha.0","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"490ea70bda8f1aa7db1837b8e836834730da3b11","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-7.3.0-alpha.0.tgz","fileCount":36,"integrity":"sha512-uLFK63mET4UCD0OIjUMSlM6VOK8H6Dp2vIHFHBVGnPxJLgjwqBki3nCmEzgVkZJwd1OdmqRCpzOqgQ1gB3D+GQ==","signatures":[{"sig":"MEYCIQCpTnnl0rOAiIAt/w0LRvlijJZUC0wX+XxjbV6uGtsDZgIhAPr7l+bOEkkAECLMi+TOfPAL6at4fhxWyvwxZnSgqDiC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1429565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhNhqrCRA9TVsSAnZWagAAXgMQAKSvOgBTSxBgh1AXHC/J\nFHQYye5FbzY11yZ61ja0pygdh4I84ivXXAMwngk5tT6gyq8X3oO6ooAO1a0k\n6xRkZPKAoQSFo0MwtaxCdQ3wwI2AbfIHqqTTePeJ9VyOGM6xXQhUdiPlWkT7\n4iQpRwy9Jjb5Xj4YA1o+Sjsu7MiJRcntuO400xUhcnyZoPrrS5DSm0Zz0BAS\nQGv5GgpsAIN6FI9g4qpf1Jd7ZKLY9WCHx9R7EKnzAmSIm664e+32p0/VlH7w\nPpQkkBLy/i7SUeqF0SPxxU37V4yuCzJmCuBzgBH+uvRUEgFNdVVhQmGxvZeM\nUa9IZmN4sNZyRogyZR0mGyjCayG/3SzTxTNg6+ppRHD4mb060Y1nEBmc2dWG\nz05vZ59GoeX9yzE81fSZf5aFzTFWHJO4S/aSKaj86PPTYTSTOuSyss+JZwIa\nL51w9TGE0aCXZbBPxaORk1xsQ9EeZqJEbMEFzyrGXlfAl9WVbZSJQqK3i8gU\nCQbmgpn4QbKUgCRz2aniE2QmXZyK9uJzZRWkaE3kh4GrRA3GLYTsy5kNo4mP\n8xiCYPeb9R9i09AqxY2w502vH1/CnuZABXyETMjfc7OoRfwGRmbC/HStTCL5\nDPEiCd9veh/czXTQH76insJoXAmanN6GmY5b4UFmj68s35mh5smZBCZXEiS0\nWxQh\r\n=j9aj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kentico Kontent\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\r\n\r\n## Description\r\n\r\nSource plugin for Kentico Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kentico Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty off by default.\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kentico Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kentico Kontent Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kentico Kontent as an experimental feature. This allows your editor in Kentico Kontent decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kentico Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kentico Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kentico Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kentico Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kentico Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kentico Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kentico Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","gitHead":"49568895b8a2b07545cef2671ce10eddf6874015","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (win32)","description":"Source plugin providing Kentico Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.17.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^3.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^2.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_7.3.0-alpha.0_1630935723676_0.9046627050679368","host":"s3://npm-registry-packages"}},"8.0.0-beta.0":{"name":"@kentico/gatsby-source-kontent","version":"8.0.0-beta.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.0.0-beta.0","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"8bd165b31370f00d45e20b74c7d3f2243589d62c","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.0.0-beta.0.tgz","fileCount":36,"integrity":"sha512-xzBOS4CfbVNRZHgnTTlCudfhezUeoBLks1y6XSJTc7vqpM7e06Q1uBGhahBoDKyBCf+m8HAYI7CPJqQG49jx3w==","signatures":[{"sig":"MEUCIQCN/aJRDXtMoyU0HGQLBg+j++tgaTxEStQuEMJSmfd7RQIgdM2a8HbaqUyQuTUOiT6ocQntZErnf0+2w2syRaJNdXQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1429535},"main":"index.js","readme":"# Gatsby source plugin for Kontent by Kentico\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v3 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/174).\r\n\r\n## Description\r\n\r\nSource plugin for Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v3) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kontent as an experimental feature. This allows your editor in Kontent to decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 use [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","gitHead":"b5eb9f80df87f6f4cc47b15bb0dc90c47a428383","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.16.1","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.0.0-beta.0_1634905005151_0.23314896991710365","host":"s3://npm-registry-packages"}},"8.0.0-beta.1":{"name":"@kentico/gatsby-source-kontent","version":"8.0.0-beta.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.0.0-beta.1","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"d361cb4689832abb2c9bb74d90758f77b1906bb0","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.0.0-beta.1.tgz","fileCount":36,"integrity":"sha512-wmEXpVRKVN0PRWnrL1YNX9FebdKOappqNqSwhuWFLdaz3bFwcCHbL2jiEtx4YMAoaPJFjocVDIVDLretdbNPUg==","signatures":[{"sig":"MEUCIE7OWOuirL6YDi1oNR5jZwjsdidIWG29zDrtBFe+6PskAiEAiwACQ8UsT0GxgIMSAF4Ty3ZNi5RQi5whRpgFcFuUUkg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1429743},"main":"index.js","readme":"# Gatsby source plugin for Kontent by Kentico\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v4 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/195).\r\n\r\n## Description\r\n\r\nSource plugin for Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v4) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kontent as an experimental feature. This allows your editor in Kontent to decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n- For version 6 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v6).\r\n- For version 7 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v7).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","engines":{"node":">=14.0.0"},"gitHead":"fc411278563f79fb817b64b15b7704aca5a134e8","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.17.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.0.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.0.0-beta.1_1635168354694_0.8723784680305193","host":"s3://npm-registry-packages"}},"8.0.0-beta.2":{"name":"@kentico/gatsby-source-kontent","version":"8.0.0-beta.2","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.0.0-beta.2","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"cca1bfd4a7f6f45930356da47959af71d122f761","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.0.0-beta.2.tgz","fileCount":36,"integrity":"sha512-BPUW2WYpyHlX3BlPvQjpobqDOiTjC9J4dhCAa6NJ4iSt7VHkRQhJSacFUR+OS4ezpT1QRu2a+mgFZnJRsd4QIQ==","signatures":[{"sig":"MEUCIDjONDYwoOPgO892dqpl2EXsiPkIUfMKKvV8WHq/5lyqAiEAxJW38anJtaVDwsEE2ICcnlz8TfZgME8sXdpQpmwcW+A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1436217,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhm0FZCRA9TVsSAnZWagAANHoP/1WNpvazB5ozWYvNvtLQ\nVpuGiUX32pV6aAXCVPljU7jhDjoAch0Io2Q74TOuKq5GYSyFWKjoqNujWz4k\nHo6fXQPV3u+b2hBdOinoMKRdOA0es2tbNyp5EcMzZF1jsO4WablxYJjQYe28\nps+nc/Cn9P1tF6CSB2HV5F0ztBK9dSBpC5IZ+9+clQY8ifmqYw3xKllNwMNg\nJqHlxxIsAnH6prPfHFLeVtv378GOzP5TSUR/a5ec7PkQwmihAj/AGzhDf+0Y\nD8E8bYfCwdBW8AFDGTGYKpxtc8Qp2LBvPyUpeEhcVeyTYtDi5qWaiW2EYvF5\nSceI9/gXC5WPqyj6mS46h5HNZUjJuZwAJxBfFUAbfjGeLmEG/WXER/7G4sVR\ne15h+b2Lgkz9/1KmPHH4IaSP2oz2jx6N0A81XTkgg/99l8pLgM//FNX6s8nA\nj9fF1j/xP6LoqKH962xpcKmD/tpvABoHaHsl1D7LOjSQ/NzAZqYqloUL3VJi\ntJTPZXpEBtpxy5MQK9HlqI+KMRj+TgYHKEFqSHI0HVt1/5ULkPkbPe03pJkY\ntydE9scihjejmIklpDHCdC6UoeVTEa//CS3b6vFj6ghdKhs0Uh2liPU208oV\n2Z2UpMFfUX5QDS/MBkl+EEBwqSQQN/ioHjDQYZC0spp3WHRFWq9UYYzwyE2C\n9V4l\r\n=n7Rv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kontent by Kentico\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v4 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/195).\r\n\r\n## Description\r\n\r\nSource plugin for Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v4) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kontent as an experimental feature. This allows your editor in Kontent to decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.tech) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n- For version 6 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v6).\r\n- For version 7 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v7).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","engines":{"node":">=14.15.0"},"gitHead":"cb491dc14092e33a9259b99a28a46d55d733b259","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"14.17.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.2.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.0.0-beta.2_1637564761203_0.3777197785071713","host":"s3://npm-registry-packages"}},"8.0.0":{"name":"@kentico/gatsby-source-kontent","version":"8.0.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.tech","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.0.0","maintainers":[{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"9d7481da479a7e786b6438db35afd6140f795688","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.0.0.tgz","fileCount":36,"integrity":"sha512-T0m3LYrCQaewD284l4P2HlgrVduajP+ie6YrPAICQdUfew+jfhzL2KQTxN5s/vqwuZekLgrTlcUnmtYIJxZt7w==","signatures":[{"sig":"MEUCIGmunPq5nNKtu+stOKYHuzCv16HWPY/hJ73uU/AJ2ZlyAiEAx+eGRCI4+IVEMstUNRfRC32TC5gXndKT7utDRcVaHHs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1436210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiBRh+CRA9TVsSAnZWagAAumYP/ikq/Bc19RDEmMY5WGOz\nCTcQNEXHzWeXdWF70oSA8qZ7wJS0A2jyKoJUnZyo0K1rwaIbhuN3NsuCwRlO\nQ8yEqcRl07pXo+Ouuiw2v1UWJ+AhWNMN6ZWw3bPjaC2DHarDAiSKEsF0Co/k\nwDyKEgLWoCySZABU6JiiAXZnkm9U/qciRSE+1AhkdqqnasGapvx581Y5iIH0\niZMtIGwipG0TXdQVLPlN6amPx3OtyDQ7LLBb97RYnc9xSm0oQJWfcfNxJWzZ\noCrOiy9ejprSmUxCWbY5Lz9TSNAmAp5Gg821Hf7kuTQ4Ghpi9M/XhYJ/xT38\nFQnznvMKDopzMO/cPIDx+0AqkccPdLBgnAYgN0OUr7kmMWP7KiLNHwKwBr5A\nve/oerijv9Sey1jJCE+b1n+lJkNzZJQL0ax283sV3JFjYTLfdRrrL5RJv+p7\nRU26D512OkNgtVSboqjQWBD/zCv6wtumUTjzF4C4lDri1sXoNTYccd9vHgeN\nlO3ybXAxwiwUtjOJw5WJdzhsQHngkGX2DxZeLiLR+sCz6qoBQavBC/lS6BMB\nry9S6PSNVF2sSQqqq18DgtlG44Me38k5KPPpEVjgLxLJwQkUrVTiI3crdwDc\nNhMedeh7PXcyr3VMoZBSKkXUGkqm3upREPfJUhVNjk1rnCeLB2qodoLyf2dw\nZv59\r\n=TVuo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","engines":{"node":">=14.15.0"},"gitHead":"72b3e3d428d7bcc36ff03e33054b12750042decf","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"simply007","email":"chrastina.ondra@gmail.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v17.4.0+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"17.4.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.2.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.0.0_1644501117791_0.20044438977012424","host":"s3://npm-registry-packages"}},"8.1.0-beta.1":{"name":"@kentico/gatsby-source-kontent","version":"8.1.0-beta.1","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.dev","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.1.0-beta.1","maintainers":[{"name":"ivannk","email":"ivanK@kentico.com"},{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"41b4aab63b5fd83487f00571b9ddce498e11e00a","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.1.0-beta.1.tgz","fileCount":34,"integrity":"sha512-ua8UzhmXCJM3opOwYYReTtgB9GGhZLqXVHW7udwTcA2UdmVTtAnFtjT0kYtG/pB4AP9EwUHJc1DUYNQV9BCjcQ==","signatures":[{"sig":"MEQCIH0FsBajXES+Z8yXftvarrDjzdrOtFYKANww71bmYJtfAiBXiGvCnc3mxPgICjGad36tAW5okoG0yvfmmADCYVqxKg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1429134,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiuscvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqEmg/7BtZjNKwJs1BrZhR0Uj4QSLQb/iyVB5ZZa0VGtDXsbp7nL9Wg\r\nNktp1vRmdenkVBWBeuDrwIaNs0FWthRDGTdjYTEDj99Uu1RZtq3SzO+uWYGB\r\nDxPHR+beKihqOBIXQWIXCtjepsqa1aevOHbs5Ajyctyrn478fktCW83zH6Dc\r\n53yJ8lqWu7ZmtFnAZBTHKwiKsBh+K1Wtz64IBkl1Fx8EN/n39A+GSJxXqv1q\r\nmzHaIos/9VdQWa7hOCwUTSXb7IFk0LlvnO3S/TgBPKXkUCRaZ4Al3z+Um8/T\r\n+MV4KK923Da/WR4ajPXXncEihaMiUCPv8/J/GOdIWSYKt8e4L83ySit2OoyE\r\nwwa5DOd0ylebQ2cQjjdJX0Rrw34VaJ/QOxA/mJFFWqdweYWULeEzbcsAFd4V\r\npGsWgFwaiSk9t55m36o2TklduvER0yenZrRvocd8O3jGoYg73fRZt0Tf3OXs\r\nDXJ3rjG6CyiVxaDx12XmH4+x3hZdj1oYu13GkTGluRPIOVDNT+mxvII51z/N\r\n0pHxfT6bhZ/7RiDJHw22XnmhuBCjXO4FILjOlaXQzdhGAyLUvOlVH7NTp7K8\r\nM4fFcsIjL/jXuwjXs/jgOk1gjZhbyTa37z7GUkfLnaJSGVFmtB/BE/v4f4zJ\r\n6VhxNUGijksudhYMH27BSMzY8XRM2Ad+u+8=\r\n=HUm5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# Gatsby source plugin for Kontent by Kentico\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v4 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/195).\r\n\r\n## Description\r\n\r\nSource plugin for Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v4) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kontent as an experimental feature. This allows your editor in Kontent to decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.dev) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n- For version 6 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v6).\r\n- For version 7 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v7).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","engines":{"node":">=14.15.0"},"gitHead":"85dc932dfb0475fff19c90243a5940cae2926364","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"ivannk","email":"ivanK@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v16.13.0+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"16.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.2.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.1.0-beta.1_1656407854890_0.6747590176774576","host":"s3://npm-registry-packages"}},"8.1.0":{"name":"@kentico/gatsby-source-kontent","version":"8.1.0","keywords":["gatsby","gatsby-plugin","kontent"],"author":{"url":"https://ondrej.chrastina.dev","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","_id":"@kentico/gatsby-source-kontent@8.1.0","maintainers":[{"name":"ivannk","email":"ivanK@kentico.com"},{"name":"simply007","email":"chrastina.ondra@gmail.com"},{"name":"enngage","email":"ennspassion@gmail.com"},{"name":"janck","email":"janc@kentico.com"},{"name":"kentico_tomasw","email":"tomasw@kentico.com"},{"name":"jirik","email":"jirik@kentico.com"},{"name":"vladislavb-kentico","email":"vladislavb@kentico.com"},{"name":"xp-peterp","email":"peterp@kentico.com"},{"name":"honzabarton","email":"janb@kentico.com"},{"name":"hom3r","email":"beran3@gmail.com"},{"name":"martins1","email":"martins@kentico.com"},{"name":"xperience-npmjs-publisher","email":"NPMJS-pkg-publish@kenticosoftware.onmicrosoft.com"}],"homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"dist":{"shasum":"860dd1e6a63204f2f19aa329d7df9b6c6ba82773","tarball":"https://registry.npmjs.org/@kentico/gatsby-source-kontent/-/gatsby-source-kontent-8.1.0.tgz","fileCount":34,"integrity":"sha512-sT7CWDc/qX+fUWyrswv82xU7eJpDtrmepELKHj+yuK/agDZN904ERi3favzU9Tl/xAwoEdWbbuQLV6ge4DpmLA==","signatures":[{"sig":"MEQCIBkEWhd53sITz5WhGbgEjES1TadxPOpmO/bPyxrNAZsmAiAtMiHt7+D/mwRQyAN8GyY6wtTdFdikS0P8/L0LfgZFjg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1429127,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiuvYSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoTjA/+NdeUm0wFDAROO/6cfvHVStSAchrum1QqiwbCI7zc+43lI9Xk\r\nnK49AGvk/0tW//lOvbd3ajjpMPqfD6h42oEK6Zd6vz2E11s8RDe49PDpdsSA\r\nDGqLOT05YBPbu3K0orTQBFa5v7hjey4T0DNeCTjwIMvv39wsaEN6K6Mog1Yk\r\n33iR9LLTuN6JDN3zR4ply+86QAly+KX7BpLV1lmMS9pAq9L1lGWJoXK3OjGM\r\ni26k/aDlfKwHBBnqMf0hMjvLPamyQLUDMczHfo+YfWZLcn7u5hcb4RdJHCu+\r\nG9vTenIkDL+icV6dHgSLXwuiPgq4L4OACwb28oTnIRR15XbKfdOcnGvNvqrc\r\nzs6EJ/g4Z2qg/LRM6lRYhQzQlqhuli208ycJWWWST+obwruAjvwBoo3C7C5S\r\nmvE5r8L6MtgiwxAiRX8lkAL8ex5QlauqDthuv4WojrPro3iQx7uWpxQWywV8\r\nXKwc/PkXmCcZ/Ok3niIdyFEztT8t04LKN/u5/O8sjjzy0xJI6kJTMW89QJe2\r\nLjJK9R19CmT3lcYq8sfh2tMoOlawXxrlCjaA4Ow5ol3UKJPygSSx20XVCeCh\r\ngTv+BMMFIlR0pzebuL27Tu+vPC7oS/Ol8sQwHKqzpq41kVNYVoB8gieP/i9d\r\nSFCpx70fSmdp6Wr35h633p3gikTBlgBy7T8=\r\n=r+8h\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","engines":{"node":">=14.15.0"},"gitHead":"0032c6d1695cdb47111cc0f7381655a05b943eaa","scripts":{"lint":"eslint **/*.ts","test":"jest","build":"tsc","watch":"tsc -w","format":"prettier --write \"**/*.ts\""},"_npmUser":{"name":"ivannk","email":"ivanK@kentico.com"},"deprecated":"Package has been renamed to @kontent-ai/gatsby-source. Please update your code to use the latest version","repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v16.13.0+x64 (win32)","description":"Source plugin providing Kontent data from REST Delivery API","directories":{},"_nodeVersion":"16.13.0","dependencies":{"axios":"^0.21.1","lodash":"^4.17.15","fs-extra":"^8.1.0","retry-axios":"^2.4.0","@types/fs-extra":"^8.0.1","@kentico/kontent-webhook-helper":"^1.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^24.9.0","eslint":"6.8.0","gatsby":"^4.2.0","ts-jest":"^24.3.0","prettier":"1.19.1","cross-env":"^7.0.2","typescript":"^3.7.5","@types/jest":"24.9.0","@types/node":"13.1.8","ttypescript":"^1.5.10","ts-auto-mock":"^1.5.7","gatsby-core-utils":"^3.0.0","jest-ts-auto-mock":"^1.0.11","@typescript-eslint/parser":"2.16.0","@typescript-eslint/eslint-plugin":"2.16.0"},"peerDependencies":{"gatsby":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-kontent_8.1.0_1656419858407_0.878174721456153","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-10-11T12:39:11.990Z","modified":"2026-08-03T11:32:39.121Z","4.0.0-beta1":"2019-10-11T12:39:12.304Z","4.0.0-beta2":"2019-10-29T11:47:40.915Z","4.0.0-beta3":"2019-11-11T14:16:37.071Z","4.0.0-beta4":"2019-11-14T13:19:25.226Z","4.1.0-beta1":"2019-11-20T09:31:39.222Z","4.1.0-beta2":"2019-11-20T19:52:36.047Z","4.1.0-beta4":"2019-11-21T13:37:39.989Z","4.1.0-beta5":"2019-11-21T16:28:52.859Z","4.1.0-beta6":"2019-11-30T13:52:49.420Z","4.1.0-beta7":"2019-12-12T06:53:54.387Z","4.0.0-beta5":"2019-12-18T17:26:20.222Z","4.0.0-beta6":"2019-12-19T17:30:23.980Z","4.0.0":"2019-12-20T09:40:17.202Z","4.2.0":"2020-01-15T14:16:28.581Z","4.3.0-beta1":"2020-01-21T13:53:02.175Z","4.3.0":"2020-01-23T11:41:40.808Z","4.4.0":"2020-03-04T13:31:48.324Z","5.0.0-beta1":"2020-03-11T15:13:19.453Z","5.0.0-beta2":"2020-03-30T13:02:10.032Z","5.0.0-beta3":"2020-04-02T14:23:34.437Z","6.0.0-vnext.1":"2020-04-03T14:17:02.243Z","5.0.0":"2020-04-14T13:36:42.978Z","6.0.0-vnext.2":"2020-04-27T06:45:12.524Z","6.0.0-vnext.3":"2020-04-27T09:46:33.289Z","6.0.0-vnext.4":"2020-04-27T12:57:21.513Z","6.0.0-vnext.5":"2020-05-06T10:39:19.623Z","6.0.0-6.0.0-beta.1.0":"2020-05-13T07:24:11.749Z","6.0.0":"2020-05-13T08:09:18.986Z","6.0.1":"2020-05-18T09:07:57.575Z","6.1.0-beta.0":"2020-09-29T09:30:16.644Z","6.1.0":"2020-09-29T09:52:04.067Z","6.2.0":"2020-10-13T07:36:00.060Z","6.3.0":"2021-01-08T09:38:41.238Z","6.3.1":"2021-02-10T16:55:09.545Z","6.3.2-alpha.0":"2021-02-18T14:34:45.712Z","6.3.2-alpha.1":"2021-03-03T08:36:29.098Z","6.3.2-alpha.2":"2021-03-04T14:23:37.988Z","6.3.3":"2021-03-18T15:23:29.941Z","7.0.0-beta.0":"2021-03-18T15:53:43.855Z","6.3.5":"2021-03-19T11:53:48.753Z","7.0.0-beta.1":"2021-04-27T13:42:12.781Z","7.0.0":"2021-05-05T11:56:59.125Z","7.1.0-alpha.0":"2021-07-13T14:52:04.732Z","7.1.0-beta.0":"2021-07-19T11:34:44.105Z","7.2.0-beta.0":"2021-08-03T14:29:24.300Z","7.2.0":"2021-08-17T07:53:06.508Z","7.3.0-alpha.0":"2021-09-06T13:42:03.868Z","8.0.0-beta.0":"2021-10-22T12:16:45.352Z","8.0.0-beta.1":"2021-10-25T13:25:55.123Z","8.0.0-beta.2":"2021-11-22T07:06:01.391Z","8.0.0":"2022-02-10T13:51:58.013Z","8.1.0-beta.1":"2022-06-28T09:17:35.173Z","8.1.0":"2022-06-28T12:37:38.605Z"},"bugs":{"url":"https://github.com/Kentico/kontent-gatsby-packages/issues"},"author":{"url":"https://ondrej.chrastina.dev","name":"Ondřej Chrastina","email":"chrastina.ondra@gmail.com"},"license":"MIT","homepage":"https://github.com/Kentico/kontent-gatsby-packages/tree/master/packages/gatsby-source-kontent#readme","keywords":["gatsby","gatsby-plugin","kontent"],"repository":{"url":"git+https://github.com/Kentico/kontent-gatsby-packages.git","type":"git"},"description":"Source plugin providing Kontent data from REST Delivery API","maintainers":[{"email":"filips@kentico.com","name":"filipsnt"},{"email":"peterb@kentico.com","name":"peterbaltaz"},{"email":"danielsed@seznam.cz","name":"danys198"},{"email":"radek.petruska@hotmail.cz","name":"radek.petruska"}],"readme":"# Gatsby source plugin for Kontent by Kentico\r\n\r\n[![Gatsby plugin library](https://img.shields.io/badge/Gatsby%20plugin%20library-%23663399.svg)](https://www.gatsbyjs.org/packages/@kentico/gatsby-source-kontent)\r\n[![Stack Overflow](https://img.shields.io/badge/Stack%20Overflow-ASK%20NOW-FE7A16.svg?logo=stackoverflow&logoColor=white)](https://stackoverflow.com/tags/kentico-kontent)\r\n\r\n[![npm version](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent.svg)](https://badge.fury.io/js/%40kentico%2Fgatsby-source-kontent)\r\n[![npm](https://img.shields.io/npm/dt/%40kentico%2Fgatsby-source-kontent.svg)](https://www.npmjs.com/package/@kentico/gatsby-source-kontent)\r\n\r\n> To see the progress of the Gatsby v4 supported packages - [check out this pull request](https://github.com/Kentico/kontent-gatsby-packages/pull/195).\r\n\r\n## Description\r\n\r\nSource plugin for Kontent REST Delivery API.\r\n\r\nThis repo contains a [Gatsby (v4) source plugin](https://www.gatsbyjs.org/docs/recipes/sourcing-data) that retrieves data from the [Kontent](https://kontent.ai) REST Delivery API.\r\n\r\n## How to install\r\n\r\nGatsby documentation uses `npm` for installation. This is the recommended approach for plugins as well.\r\nThis plugin does not need to use `yarn`, if want to use it in you project, see [the documentation for switching package managers](/docs/gatsby-cli/#how-to-change-your-default-package-manager-for-your-next-project).\r\n\r\n1. Install the [@kentico/gatsby-source-kontent](https://www.npmjs.com/package/@kentico/gatsby-source-kontent) NPM package.\r\n\r\n   ```sh\r\n   npm install --save @kentico/gatsby-source-kontent\r\n   ```\r\n\r\n1. Configure the plugin in `gatsby-config.js` file.\r\n\r\n   ```js\r\n   module.exports = {\r\n     plugins: [\r\n       {\r\n         resolve: '@kentico/gatsby-source-kontent',\r\n         options: {\r\n           projectId: '<ProjectID>', // Fill in your Project ID\r\n           languageCodenames: [\r\n             'default', // Languages in your project (Project settings -> Localization),\r\n           ],\r\n         },\r\n       },\r\n     ],\r\n   };\r\n   ```\r\n\r\n## Available options\r\n\r\n- `projectId`\\* - \\<`string`\\> Project ID from Project settings -> API keys\r\n- `languageCodenames`\\* - \\<`string[]`\\> array of language codenames that defines [what languages a configured for the project](https://docs.kontent.ai/tutorials/develop-apps/get-content/getting-localized-content?tech=javascript#section-project-languages) - the first one is considered as the **default one**. Initial \"Getting started\" project has configured just one language `default`.\r\n- `includeTaxonomies` - \\<`boolean`\\> include [taxonomies](#Querying-Kontent-Taxonomies) to GraphQL model. Turned off by default.\r\n- `includeTypes` - \\<`boolean`\\> include [types](#Querying-Kontent-Types) to GraphQL model. Turned off by default.\r\n- `authorizationKey` - \\<`string`\\> For preview/secured API key - depends on `usePreviewUrl` config. Consider using [dotenv](https://www.npmjs.com/package/dotenv) package for storing keys securely in environment variables.\r\n- `usePreviewUrl` - \\<`boolean`\\> when `true`, \"`preview-deliver.kontent.ai`\" used as [primary domain for data source](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview). Turned off by default.\r\n- `proxy`:\r\n  - `deliveryDomain` - \\<`string`\\> Base url used for all requests. Defaults to `deliver.kontent.ai`.\r\n  - `previewDeliveryDomain` - \\<`string`\\> Base url used for preview requests. Defaults to `preview-deliver.kontent.ai`.\r\n- `includeRawContent` - \\<`boolean`\\> allows to include `internal.content` property as a part fo the GraphQL model. Turned off by default.\r\n- `experimental`:\r\n  - `managementApiTriggersUpdate` - \\<`boolean`\\> allows to handle [workflow step change Management API webhook trigger](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers). Turned off by default.\r\n  - `additionalItemFilterParams` - \\<`string`\\> Additional item [filter parameters](https://docs.kontent.ai/reference/delivery-api#tag/Filtering-content) to reduce the content in GraphQL model. Example `system.collection=marketing&system.workflow_step[neq]=archived` Empty by default.\r\n\r\n  \\* required property\r\n\r\n### Logging\r\n\r\nSince the plugin is using [Gatsby Reporter](https://www.gatsbyjs.org/docs/node-api-helpers/#reporter) for error logging. You could [turn on `--verbose` option](https://github.com/gatsbyjs/gatsby/pull/19199/files) to see the whole error object. Be careful with these options, the output log could contain some sensitive data such as `authorizationKey`.\r\n\r\n## Examples of usage\r\n\r\nAn example showing how to include this plugin in a site's `gatsby-config.js` file.\r\n\r\n```js\r\nmodule.exports = {\r\n  plugins: [\r\n    /// ...\r\n    {\r\n      resolve: '@kentico/gatsby-source-kontent',\r\n      options: {\r\n        projectId: '09fc0115-dd4d-00c7-5bd9-5f73836aee81', // Fill in your Project ID\r\n        languageCodenames: [\r\n          'default', // Or the languages in your project (Project settings -> Localization),\r\n          'Another_language',\r\n        ],\r\n        includeTaxonomies: true, // opt-out by default\r\n        includeTypes: true, // opt-out by default\r\n        usePreviewUrl: true, // false by default\r\n        authorizationKey: '<API KEY>', // for preview/secured API key - depends on `usePreviewUrl` setting - consider using environment variables to store the key securely\r\n        includeRawContent: true, // opt-out by default - include `internal.content` property in the gatsby nodes\r\n        proxy: {\r\n          deliveryDomain: 'custom.delivery.kontent.my-proxy.com',\r\n          previewDeliveryDomain: \"custom.preview.delivery.kontent.my-proxy.com\"\r\n        },\r\n        experimental: {\r\n          managementApiTriggersUpdate: true // opt-out by default\r\n        }\r\n      },\r\n    },\r\n    /// ...\r\n  ],\r\n};\r\n```\r\n\r\nThe plugin creates GraphQL nodes for all Kontent taxonomies, content types, content items language variants.\r\n\r\nThe queries start with `kontentTaxonomy`, `kontentType`, or `kontentItem` prefix (respectively `allKontentTaxonomy`, `allKontentType`, or `allKontentItem`) and their type is `kontent_taxonomy_X`, `kontent_type_X`, or `kontent_item_X` where `X` is a codename of the `taxonomy`, `type`, or `item`.\r\n\r\n> Look at the [How to query for data](#How-to-query-for-data) section for example queries.\r\n\r\nGraphQL nodes produced by the source plugin provide the same structure as [Kontent Delivery REST API](https://docs.kontent.ai/reference/delivery-api), but there are alternations for better usability, you could find more detailed description in [Delivery API alternations](#Delivery-API-alternations) section\r\n\r\n### Learning Resources\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n## Delivery API alternations\r\n\r\nSome of the data from Kontent Delivery API requires to be altered or extended to be usable in Gatsby. There is a list of them with its description.\r\n\r\n### Preferred language\r\n\r\nBesides of `system.language` every Kontent item node contains the property `preferred_language` to distinguish which language version it represents. Using this property, it is easy to distinguish whether the language fallback is used. When `preferred_language` is not the same as `system.language`, Kontent item was not translated to `preferred_language` and the delivery API returned fallback language (`system.language`).\r\n\r\n### Linked items as links\r\n\r\nEach _linked items_ element in **linked items element** as well as in **rich text element** is using [Gatsby GraphQL node references](https://www.gatsbyjs.org/docs/create-source-plugin/#creating-the-relationship) that can be used to traverse to the nodes linked through the use of the _Linked items_ element.\r\n\r\nThe resolution is using the `createFieldExtension` called `languageLink` that is resolving the codenames. [Embedded `@link` extension](https://www.gatsbyjs.org/docs/schema-customization/#foreign-key-fields) is not used because the links have to be resolved by `preferred_language` as well as `system.codename` equality and embedded link resolution allow using only one field to make the links out of the box.\r\n\r\nLinked Items element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        friends {\r\n          value {\r\n            ... on kontent_item_person {\r\n              id\r\n              elements {\r\n                name_and_surname {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nRich text element\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          modular_content { // inline linked items as well as content components\r\n            ... on kontent_item_website {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                url {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n          value\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Rich text images and links\r\n\r\nKontent REST API returns images and links for Rich Text element in the form of the object, not as an array:\r\n\r\n```json\r\n{\r\n  \"bio\": {\r\n    \"type\": \"rich_text\",\r\n    \"name\": \"Bio\",\r\n    \"images\": {\r\n      \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\": {\r\n        \"image_id\": \"fcf07d43-46d4-46ef-a58d-c7bf7a4aecb1\",\r\n        \"description\": null,\r\n        \"url\": \"https://assets-us-01.kc-usercontent.com:443/09fc0115-dd4d-00c7-5bd9-5f73836aee81/0faa87b4-9e1e-41b8-8b38-c107cbb35147/2.jpg\",\r\n        \"width\": 1600,\r\n        \"height\": 1065\r\n      }\r\n    },\r\n    \"links\": {\r\n      \"59002186-1886-48f3-b8ba-6f053b5cf777\": {\r\n        \"codename\": \"developer_community_site\",\r\n        \"type\": \"website\",\r\n        \"url_slug\": \"\"\r\n      }\r\n    },\r\n    \"modular_content\": [],\r\n    \"value\": \"...\"\r\n  }\r\n}\r\n```\r\n\r\nThis wrapper transforms these objects into the arrays. In case of an image the ID of the image is already stored there, in case of link, the id of a link is moved to `linked_id` property. The query then looks like:\r\n\r\n```gql\r\nquery PersonQuery {\r\n  allKontentItemPerson {\r\n    nodes {\r\n      elements {\r\n        bio {\r\n          images {\r\n            # Object transformed to array\r\n            image_id\r\n            url\r\n            description\r\n            height\r\n            width\r\n          }\r\n          links {\r\n            # Object transformed to array\r\n            codename\r\n            type\r\n            url_slug\r\n            link_id # Newly generated property from object keys\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Types' `elements` property\r\n\r\nElements property is transformed from object to array.\r\n\r\nThis is the \"Website\" type sample. As you can see there is `element` property, which is an object in Kontent delivery REST API.\r\n\r\n```json\r\n{\r\n  \"system\": {\r\n    \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n    \"name\": \"Website\",\r\n    \"codename\": \"website\",\r\n    \"last_modified\": \"2019-04-01T18:33:45.0353591Z\"\r\n  },\r\n  \"elements\": {\r\n    \"url\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"URL\"\r\n    },\r\n    \"name\": {\r\n      \"type\": \"text\",\r\n      \"name\": \"Name\"\r\n    },\r\n    \"description\": {\r\n      \"type\": \"rich_text\",\r\n      \"name\": \"Description\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd here is the example how the source plugin transforms the data.\r\n\r\nQuery\r\n\r\n```gql\r\n{\r\n  kontentType(system: { name: { eq: \"Website\" } }) {\r\n    system {\r\n      codename\r\n      id\r\n      last_modified\r\n      name\r\n    }\r\n    elements {\r\n      name\r\n      codename\r\n      type\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nResult\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"kontentType\": {\r\n      \"system\": {\r\n        \"codename\": \"website\",\r\n        \"id\": \"aeabe925-9221-4fb2-bc3a-2a91abc904fd\",\r\n        \"last_modified\": \"2019-04-01T18:33:45.0353591Z\",\r\n        \"name\": \"Website\"\r\n      },\r\n      \"elements\": [\r\n        {\r\n          \"name\": \"URL\",\r\n          \"codename\": \"url\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Name\",\r\n          \"codename\": \"name\",\r\n          \"type\": \"text\"\r\n        },\r\n        {\r\n          \"name\": \"Description\",\r\n          \"codename\": \"description\",\r\n          \"type\": \"rich_text\"\r\n        }\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to query for data\r\n\r\nThis section should help you with the first queries. For further exploring it is recommended to use [GraphiQL explorer](https://www.gatsbyjs.org/docs/running-queries-with-graphiql/) available in gatsby development environment]. If you are using developer environment for the source plugin development, you could experiment according to the [How to develop locally section](#How-to-develop-locally)\r\n\r\n### Querying Kontent Items\r\n\r\nExample is showcasing how to query type `article`.\r\nFor rich text resolution resolution see [Rich text element component](../gatsby-kontent-components/README.md#Rich-text-element-component).\r\nFor url slug resolution see [Rich text element component](../../site/README.md#URL-slug-resolution).\r\n\r\n```gql\r\nquery ArticleQueries {\r\n  allKontentItemArticle(filter: { preferred_language: { eq: \"en-US\" } }) {\r\n    # filtering articles in 'en-US' preferred language (see section `Preferred language` for more information)\r\n    nodes {\r\n      elements {\r\n        title {\r\n          value # title of article (text element)\r\n        }\r\n        content {\r\n          # content element (rich text)\r\n          value # plain html\r\n          images {\r\n            image_id\r\n            url\r\n            description\r\n          }\r\n          links {\r\n            link_id\r\n            url_slug\r\n            codename\r\n            type\r\n          }\r\n          modular_content {\r\n            # inline linked items and components data\r\n            ... on kontent_item_author {\r\n              id\r\n              elements {\r\n                name {\r\n                  value\r\n                }\r\n                avatar_image {\r\n                  value {\r\n                    url\r\n                    description\r\n                    name\r\n                  }\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n        tags {\r\n          # tags element (linked items)\r\n          value {\r\n            ... on kontent_item_tag {\r\n              elements {\r\n                title {\r\n                  value\r\n                }\r\n                slug {\r\n                  value\r\n                }\r\n              }\r\n            }\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Types\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Types {\r\n  allKontentType {\r\n    nodes {\r\n      Type: system {\r\n        # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      elements {\r\n        # type's elements information\r\n        name\r\n        codename\r\n        type\r\n        options {\r\n          # filled in case the element is multiple choice\r\n          codename\r\n          name\r\n        }\r\n        taxonomy_group # filled in case the element is taxonomy\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Querying Kontent Taxonomies\r\n\r\nTo query content types it is required to opt-in this in plugin configuration by using `includeTypes` option in the [configuration.](#Available-options).\r\n\r\n```gql\r\nquery Taxonomies {\r\n  allKontentTaxonomy {\r\n    nodes {\r\n      system { # system information about the type\r\n        name\r\n        codename\r\n      }\r\n      terms { # taxonomy terms\r\n        codename\r\n        name\r\n        terms { # terms are nested according to the model\r\n          codename\r\n          name\r\n          # terms ...\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## How to integrate with Gatsby Cloud\r\n\r\nIf you choose to maintain your Gatsby site on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/), you will need to register two webhooks from Kontent to Gatsby Cloud. Follow [the \"Getting started\" tutorial](https://www.gatsbyjs.com/docs/kontent/getting-started/) for more information. All webhook notifications that are not mentioned in the tutorial will be ignored by the plugin.\r\n\r\nOnce you integrate your site with Gatsby Cloud, you will be able to lavarage the new cool features as Intelligent caching, [true Incremental builds](https://www.gatsbyjs.com/cloud/docs/incremental-builds/), or [Real-time Gatsby preview](https://www.gatsbyjs.com/preview/). Your site will benefit from amazingly fast site (re-)builds! Check out the [willit.build benchmark](https://willit.build/details/type/blog/source/kentico/page-count/8192) for the performance comparison.\r\n\r\n> Please note that change in taxonomies or content types require a complete rebuild of the site, because these structural data affects GraphQL schema.\r\n\r\n### Experimental workflow change handling\r\n\r\nThe source plugin is able to handle the workflow change of Kontent as an experimental feature. This allows your editor in Kontent to decide when to make a preview rebuild rather than automatically trigger rebuild on every auto-save event which can effectively lower the number of rebuilds in the Gatsby Cloud queue. To trigger a gatsby preview incremental build editor needs to change workflow step to the one configured in gatsby preview webhook configuration.\r\n\r\nTo allow the feature you need to:\r\n\r\n1. Allow `managementApiTriggersUpdate` option in the [configuration](#Available-options).\r\n2. Reconfigure your Gatsby preview webhook by registering new event to your for [Management API trigger for workflow step change](https://docs.kontent.ai/reference/webhooks-reference#a-management-api-triggers) to the step you want to react on (and remove the Preview API trigger for \"Preview content item Events to watch\" > \"Create or Update\").\r\n\r\n![Management API trigger for workflow step change](./docs/assets/management-wf-step-change-webhook-configuration.png)\r\n\r\n> Disclaimer - since the Management API triggers should be used in combination with Management API and the source plugin is using Delivery (incl. Preview) API, there is no guarantee that the data will be up-to-date on Delivery/Preview API when Management API trigger is fired - so it can happen that in time of update (handling Management API trigger), there will be old data on Delivery Preview API.\r\n\r\n### Gatsby preview updates\r\n\r\nThe source plugin is capable of handling [Kontent Preview webhooks triggered by Delivery Preview API triggers](https://docs.kontent.ai/reference/webhooks-reference#a-delivery-preview-api-triggers). That means setting `ENABLE_GATSBY_REFRESH_ENDPOINT` environment variable to `true` opens a `/__refresh` endpoint which could be used as a target endpoint to webhook with these triggers.\r\n\r\nIf you want to trigger the whole website rebuilt, it could be done by sending a post request with an empty body. It could be useful i.e. if you want to rebuild the whole site when you are developing locally (`curl -X POST http://localhost:8000/__refresh`).\r\n\r\n## How to use Web Spotlight with Gatsby\r\n\r\n[Web Spotlight](https:/webspotlight.kontent.ai) is an additional tool for [Kontent](https://kontent.ai/) focused on website management. Feel the power of a headless CMS while enabling your content creators to produce and update content in the context of your website.\r\n\r\nYou can find more resources about this tool in the [official documentation](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight), in the [recording of \"Sneak Peek: An introduction to Web Spotlight\" webinar](https://kontent.ai/webinars/on-demand/introduction-web-spotlight), or in the blog post [\"Use Web Spotlight with your existing Kontent projects\"](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\nTo integrate your Gatsby site with Web Spotlight, it is required to do three steps:\r\n\r\n- Prepare the code for the Web Spotlight preview environment by decorating the HTML using [Kontent Smart Link SDK](https://github.com/Kentico/kontent-smart-link#gatsby).\r\n- [Turn on Web Spotlight on your Kontent project](https://docs.kontent.ai/tutorials/set-up-kontent/set-up-your-project/web-spotlight#a-boost-your-web-with-web-spotlight)\r\n- Use newly enabled features to [connect the Kontent project to the preview environment](https://kontent.ai/blog/use-web-spotlight-with-your-existing-kontent-projects).\r\n\r\n### Step by step guide\r\n\r\n**🚀 If you are seeking for some Starter pack with the Guide, you are lucky!**\r\n\r\n- [Implementing Web Spotlight on Kontent Starter Lumen Starter](https://github.com/Kentico/gatsby-starter-kontent-lumen/blob/master/docs/WEB-SPOTLIGHT.md#implementing-web-spotlight)\r\n\r\n## How to run tests\r\n\r\nThe package is using [Jest](http://jest.org/) framework for testing.\r\n\r\nTo run all tests, there is an npm script prepared.\r\n\r\n```sh\r\nyarn test # run all tests in the repository\r\n```\r\n\r\n## How to develop locally\r\n\r\nUse a [development site](../../site/README.md) in development mode. And start watch mode for this repository.\r\n\r\n```sh\r\nyarn watch\r\n```\r\n\r\n> To run complete development environment, follow the [debug section the master readme](../../README.md#development)\r\n\r\n## Tracking usage\r\n\r\nThe package is including tracking header to the requests to Kontent, which helps to identify the adoption of the source plugin and helps to analyze what happened in case of error.\r\nIf you think that tracking should be optional feel free to raise the feature or pull request.\r\n\r\n## Further information\r\n\r\nTo see upgrade instructions see [Upgrade section](./docs/UPGRADE.md).\r\n\r\nFor more developer resources, visit the [Kontent Docs](https://docs.kontent.ai).\r\n\r\n### Running projects\r\n\r\n- [Kentico Developer Community Site](https://kentico.github.io) [[source code](https://github.com/Kentico/kentico.github.io/tree/source)]\r\n- [Kentico Advantage](https://advantage.kentico.com/) [[source code](https://github.com/Kentico/kentico-advantage/tree/source)]\r\n- [Richard Shackleton's Personal portfolio and blog website](https://rshackleton.co.uk/) [[source code](https://github.com/rshackleton/rshackleton.co.uk)]\r\n- [Untools by Adham Amran](https://untools.co) [[source code](https://github.com/amrancz/untools)]\r\n- [Ondřej Chrastina's personal site](http://ondrej.chrastina.dev) [[source code](https://github.com/Simply007/Simply007.github.io)]\r\n- [Aaron Collier's Czech Theather site](https://czechtheater.cz) [[source code](https://github.com/CollierCZ/czechtheater)]\r\n- [NetConstruct agency website](https://www.netconstruct.com)\r\n- [Matt Nield's personal blog site](https://www.mattnield.co.uk)\r\n- [Ilesh Mistry's personal blog site](https://www.ileshmistry.com)\r\n\r\n### Guides and blog posts\r\n\r\n- [Sourcing from Kontent](https://www.gatsbyjs.org/docs/sourcing-from-kontent/)\r\n- [Getting started with Gatsby Cloud and Kontent](https://www.gatsbyjs.com/docs/kontent/getting-started/)\r\n- [Kontent - The fastest headless CMS for Gatsby](https://kontent.ai/gatsby-cms)\r\n- [Kentico Cloud & Gatsby Take You Beyond Static Websites](https://www.gatsbyjs.org/blog/2018-12-19-kentico-cloud-and-gatsby-take-you-beyond-static-websites/) by [@ondrabus](https://github.com/ondrabus)\r\n- [Using Gatsby with Kontent\r\n](https://www.gatsbyjs.com/guides/kentico-kontent/)\r\n- [Rendering Kontent linked content items with React components in Gatsby](https://rshackleton.co.uk/articles/rendering-kentico-cloud-linked-content-items-with-react-components-in-gatsby) by [@rshackleton](https://github.com/rshackleton)\r\n- [Adding and retrieving localized strings from Kontent to GatsbyJS and GraphQL](https://www.gatsbyjs.org/blog/2019-08-13-localised-strings-from-kentico-cloud-gatsbyjs-graphql/)\r\n- [Automated builds with Netlify and Kontent webhooks](https://rshackleton.co.uk/articles/automated-builds-with-netlify-and-kentico-cloud-webhooks) by [@rshackleton](https://github.com/rshackleton)\r\n- [Learning about Gatsby schema customisation with Kontent.ai](https://rshackleton.co.uk/articles/learning-about-gatsby-schema-customisation-with-kontent-ai) by [@rshackleton](https://github.com/rshackleton)\r\n- [Implementing search with Gatsby and Algolia](https://rshackleton.co.uk/articles/implementing-search-with-gatsby-and-algolia) by [@rshackleton](https://github.com/rshackleton)\r\n\r\n> Check out the development site for some hints in the [example section](https://github.com/Kentico/kontent-gatsby-packages/tree/master/site#examples)\r\n\r\n### Previous versions\r\n\r\n- For version 2 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v2).\r\n- For version 3 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v3).\r\n- For version 4 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v4).\r\n- For version 5 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v5).\r\n- For version 6 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v6).\r\n- For version 7 see [this branch](https://github.com/Kentico/gatsby-source-kentico-cloud/tree/v7).\r\n\r\n## How to contribute\r\n\r\nCheck out the [contributing](/CONTRIBUTING.md) page to see the best places for file issues, to start discussions, and begin contributing.\r\n\r\n- _Written according to [Gatsby plugin template](https://www.gatsbyjs.org/contributing/docs-templates/#plugin-readme-template)_\r\n","readmeFilename":"README.md"}