{"_id":"@cosmicjs/gatsby-source-cosmic","_rev":"13-212fe578c2773aacecb12880ad5a87d2","name":"@cosmicjs/gatsby-source-cosmic","dist-tags":{"beta":"1.0.2","next":"2.0.0","latest":"2.0.2"},"versions":{"1.0.1":{"name":"@cosmicjs/gatsby-source-cosmic","version":"1.0.1","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@1.0.1","maintainers":[{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"ee18511fefd203bce827b75591af652892defdbd","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-1.0.1.tgz","fileCount":70,"integrity":"sha512-p3xg6eR4jX9XEUHWR2hF3GEBgOUB/BWHiArgMr6zhSs31Ju6l6niAC8CsUTsFza1cLXCvg5aFswvhbeNaf3Q0w==","signatures":[{"sig":"MEUCIQDNHdn8fAo0Eos3w7JEUVF/VwOXeDvDa1Ww9c5u5ILwEwIgJ1i0mV7AMstwvvybZTVtjS9LgLeT3Ett+YUJi+a6tv8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":97583,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7XkhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrjSQ/+Ka6Bkgz768rC/RXSzQFwfrH8C8U5WOnyy3WkpCOPvIBoemyv\r\nrC6+IeHtoKE5xzBfrDn40Q8j1DaCn1g1QtT3U6vj89E6kINq29dCreZ8dQos\r\nVf8iMpjKCRwxtCUGmtSu0ThPWBsXWhQSAd936pMPfvt/GXl70qR1UuSDA0LF\r\n3kmvhRzlAy8xcszkWz9QVQ6t2G7ZO2/Khk+qb7CPSKWX3cdwvutV86H4GveM\r\nVOJLUI7OP2Hf+pXoaF3u5Zfp+VokzFDKMqJG+wouY6eLqxXX3g4IUjZkzVGq\r\nyeENvgxkLxtNrEQKQBMzoFT9e23fHOaxhRxJZ+RwAmhtfsyUhdPyZQB19U/a\r\nSYDf0xx6TEanVWxC/xFpfiOhdv92eCWmOd5LbsQwEVDWnETpet+j/D4furzk\r\nspw6wcp5OsWOJ9EpyMTYSK+2zu35PiSgx8Dqs+i+EJo6/YhC/np09H2801N2\r\ntggfY1o+rqJCsogW7o/96+PDkuih3mn8RFZFqFT8oespoviEEDyBJ4F5lkIy\r\nhh9GrAUqu5iEsX79aBdnrTUClpwrzyAFAugbxg4UzJSrwi3xE1fbnOniZYHR\r\ngIM4AvpMRNZDsiZOGq19HwMnJZ/bB8HU79Ioiu03Je2KVJSlCWRlQ3mZl/AZ\r\nTgtm9ZfYuwSsmgKPPZ81Nbe4wHPrIxtCfGU=\r\n=o25Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"d4831e238c7c622986266be17420ca1271a22a94","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"8.19.3","description":"Gatsby Source Plugin for building websites using Cosmic JS as a data source","directories":{},"_nodeVersion":"18.13.0","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","cosmicjs":"^4.3.1","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_1.0.1_1676507425337_0.05177471824282476","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@cosmicjs/gatsby-source-cosmic","version":"1.0.2","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@1.0.2","maintainers":[{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"e33c1c25a989ab7933f660fd0ecf7c6c0cd83dd2","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-1.0.2.tgz","fileCount":70,"integrity":"sha512-qabGgQPc3CKqc0MfYDtQMuhUNM0US/jNVTNIWR+IqC6RrdqO4hgYwvyDZQEY5fRZnORFs06zG+0w+TYaMbadOQ==","signatures":[{"sig":"MEYCIQCtALUvpX28B2kdvH1ml/YrHWm5LS0wb1d+dYxOslnzXgIhAOpsqSoNWRNsh3cV0JEHHKWUp+6uyob9CinBgUPfGr3T","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":97593,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj7XpyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrEpRAApMOSVgK9aA3LSfVBdT+Thi72usbpZH3rhpXjXnY/mz+1bb5L\r\nqjUBU+KfDRjHZiTv1+fzTDck03LYmNxMlmc0+TMftZiTY1eiUhVV11ddhTAc\r\nj7U2wxU7u38DwTxKCSiShH7fAHA8RUf0LTCkUDTJJbxog67DTRcB1eqpE1wf\r\ndLLwTeba2ElQO5dWAJznFsx8X2eaA/Wlq2kXlf+6zOZRwmpOUF1E1jnamnmX\r\n6JN/llnsVDdugFGcitrXc9sOZ28wYrt3BOABNgUDx+f2fKdG6f+IL45abcRL\r\nkDeJD8ARY5fVrv3qwuaV5eb8kRhjOMDLdka4CUBt+dKubUT+GajB+zie1W1c\r\nJlcUnRCWIoc7d3sYPKi0erCnA/Qi6OQ1pyF8eONQYuhvrKhYeV07OQINugvw\r\nJOJe0RbHNwvF5OdXS+NfdhgrEeGxhK0SF0iTJJyCaCfb21JoOXRPVCG99th6\r\nJ0fegkqzgfodbITLOClthGsbwBml0l0tJi2vDS2UK2Jmmm6IJuOJ9Mosi0xk\r\n5U4M3CYaxrF2taLFH9nJ+4ciKPS8jVT/j1xY/iSSLfkaRlIQtxBh6zQft41H\r\nXw1h8dVU7jqci04DFFHNBt8/Due6fWq3D7rP6qHalyJLrVpE9BNJOPN0mAGG\r\nT1zENdjhv+exVkomQgWVlDusUNMMouO7mHw=\r\n=xbzy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"# Gatsby Source for Cosmic\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen.github.io/cz-cli/)\n\nSource plugin for fetching data into [Gatsby](https://www.gatsbyjs.org) from [Cosmic](https://cosmicjs.com). Cosmic offers a [Headless CMS](https://cosmicjs.com/headless-cms) for your Gatsby website.\n\n## Quickstart Guide\n\n### 1. Install the plugin\n```\nnpm install --save @cosmicjs/gatsby-source-cosmic\n```\n\n### 2. Configure your plugin\nIn order to configure this plugin you will need your Cosmic bucket slug & corresponding read key. You can find these by [logging into Cosmic](https://app.cosmicjs.com/login) and going to `Your Bucket > Settings > API Access`.\n\nIn your `gatsby-config.js` install the plugin:\n```\nplugins: [\n  {\n    resolve: `gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n],\n```\nThis configuration will automatically detect the object type in your bucket and pull down all published objects into your site's GraphQL database. If you'd like to only fetch a specific set of object types you can do that by specifying their slugs on the plugin config.\n```\n...\noptions: {\n  bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n  readKey: process.env.COSMIC_READ_KEY,\n  objectTypes: ['blog-posts', 'authors'],\n}\n...\n```\n\nThis will allow you to query your Cosmic content data from within Gatsby. For example if you have an object type called `Blog Post` a query might look something like this:\n```\n// src/templates/blog-post.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nYou can read more about querying data, template pages, and other queries in the [Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/querying-data/).\n\n## Advanced configuration\nThis plugin offers a number of other features to allow you to control what data is fetched from your bucket.\n\n### Global Config Options\nThese options can be specified at the top level of your config.\n\n> **Note**: If a matching property is specified on the object level the object level configuration value will be used.\n\nProperty | Required | Type | Default | Description\n--- | --- | --- | --- | ---\n`bucketSlug` | Required | String | n/a | The slug of the cosmic bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv).\n`readKey` | Required | String | n/a | The read key of the cosmic bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv). Access this read key in your bucket under `settings > api access`\n`limit` | Optional | Number | `500` | Controls the default number of objects that are fetched per request. This can be useful if you have especially large objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | `0` | Controls the default depth of the query into object relations.\n`use_cache` | Optional | Bool | `true` | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | `order` | The order that objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | `published` | The publish status of objects pulled from the API. Published will only pull published items while any will pull published & draft objects.\n`objectTypes` | optional | [String \\| Object] | n/a | An array of object types that you would like to pull from your Cosmic bucket. This can be an array of object  type slugs or object configs.\n\n### Object Type Config Options\nObject type config options allow you to more granularly configure how data is pulled from your Cosmic bucket. **Properties set on object types will override options set at the global config level.**\n\nObject type configs can also be used with a combination of slug strings and objects. For example:\n```\noptions: {\n  //...\n  objectTypes: [\n    'blog-posts', \n    {\n      slug: 'authors'\n      // other options...  \n    },\n  ],\n}\n```\n\nProperty | Required | Type | Description\n--- | --- | --- | ---\n`slug` | Required | String | The slug of the object type for this config object.\n`query` | Optional | Object | The query for this object. Learn more about Cosmic's query syntax in our [query documentation](https://docs.cosmicjs.com/api-reference/queries). **IMPORTANT**: Do not include the `type` property in your query. That is handled by the plugin and via the slug property.\n`props` | Optional | String | The properties of the object that you want to be returned by the API. The properties should be formatted as a comma separated string. For example: `props: 'id,title,metadata.author'`. Please reference the [Cosmic API docs](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more details. **Note**: When using this property the `id` prop must be included.\n`limit` | Optional | Number | Controls the default number of objects that are fetched per request. This can be useful if you have especially large objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | Controls the default depth of the query into object relations. **Note**: This may be removed in an upgrade to the version 3 API\n`use_cache` | Optional | Bool | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | The order that objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | The publish status of objects pulled from the API. Published will only pull published items while any will pull published & draft objects.\n\n### Full Object Config Example\n> Please note any values used here are just to demonstrate the properties usage.\n```\nplugins: [\n  {\n    resolve: `gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n      limit: 200,\n      depth: 2,\n      use_cache: true,\n      sort: 'order',\n      objectTypes: [\n        'blog-posts',\n        'customer-announcements',\n        {\n          slug: 'authors',\n          limit: 5,          // Overrides global limit\n          depth: 1,          // Overrides global depth\n          use_cache: true,   // Overrides global use_cache\n          sort: 'random',    // Overrides global sort\n        },\n        {\n          slug: 'products',\n          query: {\n            'metadata.category': {\n              '$in': ['Clothing','Food'],\n            },\n          },\n          props: 'id,title,metadata.price,metadata.image'\n        },\n      ]\n    }\n  },\n],\n```\n\n## How to use Gatsby Image\n> **Note**: `gatsby-image` plugin is a required peer dependency to use these features. \n\nTODO\n\n## Starters\nTODO\n\n---\n## Plugin Development\nInstructions to install this codebase locally.\n  1. `git clone https://github.com/cosmicjs/gatsby-source-cosmic.git`\n  2. `cd gatsby-source-cosmic`\n  3. `npm install`\n      - **Important**: You must be using Node Version 18.13.0 \n  4. `cd example-site`\n  5. `npm install`\n### Commands\nAction | Command\n--- | ---\nRun Linter | `npm run lint`\nAuto Fix Linter Issues | `npm run lint.fix`\nRun Tests | `npm run test`\nDevelop w/Hot Reload | `npm run watch`\nBuild Project | `npm run build`\n\n### Setting up plugin hot(ish) reload\nIf you'd like to use this project locally you can use local file resolution to test out modifications to this project on your local gatsby site.\n\nInstructions:\n  1. Install this codebase with the instructions above.\n  2. In your (local) gatsby site add the plugin config with a local file resolution to the root of this plugin's folder (See example below).\n```\n {\n    // Using local plugin resolution for testing\n    resolve: require.resolve(`../gatsby-source-cosmic`),\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n```\n  3. Open up a terminal window and run either the build or watch commands to bundle the library.\n  4. In another terminal window run `gatsby develop` or `npm run develop` to start your Gatsby Dev Server.\n\n> **Note**: You will need to re-start the Gatsby Dev Server in order to load the changes you make to the plugin. Gatsby does not re-run it's node lifecycle on changes to the underlying plugin code.\n","gitHead":"d88d753139317c27c019747435db8202533382d6","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"8.19.3","description":"Gatsby Source Plugin for building websites using Cosmic JS as a data source","directories":{},"_nodeVersion":"18.13.0","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","cosmicjs":"^4.3.1","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_1.0.2_1676507762786_0.8596429492506956","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@cosmicjs/gatsby-source-cosmic","version":"1.0.3","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@1.0.3","maintainers":[{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"c024770cfbb6a8545d0240bb471a4552b4530993","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-1.0.3.tgz","fileCount":70,"integrity":"sha512-fjFEm+Axx0GilBmZ2kXbUOeWIzNX7G9/xV6kgVH61d47hiP9hQX6I2nRcvXihelAulw/S/jaoYPKeewjVJ+56g==","signatures":[{"sig":"MEUCIQC2LR9vUoqXD0KJolP+n1XrcJiAmfh1Dfp0eLt4OvYMhgIgS3dlLLuLel9AhKU8f/hGENWn7GCJFb6cPDAgfyRIiII=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99762,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkB1KVACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpS5A//RNGOdCHBJF5trl9Qie9JBF3BMX+fFxVzepCd951EDoDzuY+V\r\nlLM4B4ATxNAv/rO1PvmAkyUYkm2mUSrLA4JkiuyWu1qt4iSG6oeWL/cC9D10\r\ngCvJzCPo4+zDedmngSP6Oqst2TIAHQ90kRZYqedEElqc1ZIUUz3W54+LtY7s\r\nRve2u41DxfbASog0f3pmMCFB9sdUHTK43KN367oOvo8sakLMk0mx2ldn129k\r\nc8kVqCnyH9cHa5Kfuuom0/xbf6WoELTXkGCvX66E1EUi+ngPBF4KU3lWa/h3\r\ntseu93XnedXuqLPDcW+dAOS9i0WvaNsCoPxle0zr6pDk5xEBWrn1X01sMe+I\r\nP7gMe2ZcSs02yKyrJok6Ligh8C7tLlHvo/7tgfRqjGyM0jHp/nXh7iFtGX0C\r\nm2nJLsPnj0k/eoYUBvJYeF7rqI2djFp+jAXS0SjStwLR51wYPc9t1PL7zry9\r\nuzcggc94yUb32MeamA6aOjBVuFJFFfiCZVVNA5fEdfObOdOxoqmWbRrZW9bW\r\n5BChHyG7aE3diDeTvz9hfpv7G231S1Luv+cgoon7zt/MFsiSG+wc/F5YSNpI\r\nmYOA54RMnDnhv3EoVedDys19qGnPQ6hhfaosXHVAOfOnxSaiyLM2JTCkRjiU\r\ny7cZEDvoJ/pF8kI8SN52XBLNMHOsxFNHRGI=\r\n=regO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"117d8f9a61057dc74fbc9e9cf23a718fc7dd05eb","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"8.19.3","description":"Gatsby Source Plugin for building websites using Cosmic JS as a data source","directories":{},"_nodeVersion":"18.13.0","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","cosmicjs":"^4.3.1","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_1.0.3_1678201493219_0.2547795132027446","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@cosmicjs/gatsby-source-cosmic","version":"1.0.4","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@1.0.4","maintainers":[{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"24c48bb29fe5136fdafe375e2cfd268e19fcbfee","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-1.0.4.tgz","fileCount":70,"integrity":"sha512-ddmUxxY9UN7S/xIidscz1J1x4rnIY9Ttc0TGqPq4iO2FEfRC9xXELl6Rz4LEvlhO9KWwQkqIcLaf2NCoGvhEag==","signatures":[{"sig":"MEUCIQDbxG6Ph2Jo7VJd29q2cSxa1LGlXXVSOYrYA9GJu25ZTgIgfalEuDCJ4QYHSatdsIkZM0/gV9C0NI7sVDtS1RCUhWA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99713,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkB1ZYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpezhAAo8vr/XZQSvxNRRw6BpO62n7iryG4KQFwZiIBeSyQf1NaFLxN\r\nVv6Wx0EHOZMJPLNjS3httOAfF3bgkOlzrhVwdtIzXH4yYJJJErxzk9tVUruu\r\nA4g7hG/Tjj63OzUVPNWZganKpQN5EORJWXeeBGePyriMbw7jb3oOqgGSMqOJ\r\nhmvN1i+GncdnhYmKTo37Z4t94BsCSyAOpyI2lXncntf302GuUtteXX1OYrTT\r\n7BLejTzRFjo2rFREjdZ444rVrk55Um6bCfTU/pSwY5xDppZ5Q2SHYRg3gsVB\r\nREwiRznuTIN2dPo1ihbIf68yg1jq/BDQx9bd07OmILnvzgc9XcBY0hThnq2f\r\nkvnMH1eZZGw0khFUfGBBhtfm/gM62QYbPe9bo8rPqGNKfppFFO+zh73JBeWm\r\nMEBoiODq5wYkRMkzPiLN/Q0vphFJ8d4dKB9SA9/cmWeyJlws6UuB1keNUS+i\r\nSFEUccfYb5KN11EYAz31Qzsl5fpbpQR+d09eMEEIzsvVXB6u13Isi6EKjtBh\r\neYHeZ/PkfNGc0bdeVBqb9Mqxm2a84bu9Hy9K+9PPHhKRuk8BKcDeQhnMj5Hq\r\nP/ZStmBt16eV9HVP3AbOg8cm1D4/O67h1Am4C52mgf9gEwsMvH8Vp/9hCZ/q\r\nJTYbsniJB8y6zUEqWfp8nG5SLfSyoINy66I=\r\n=Ufc7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"6533b3f67717419fd7b7016744bf4ec54d7d42d4","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"8.19.3","description":"Gatsby Source Plugin for building websites using Cosmic JS as a data source","directories":{},"_nodeVersion":"18.13.0","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","cosmicjs":"^4.3.1","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_1.0.4_1678202455826_0.46401496779531337","host":"s3://npm-registry-packages"}},"0.0.0":{"name":"@cosmicjs/gatsby-source-cosmic","version":"0.0.0","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@0.0.0","maintainers":[{"name":"jazibsawar","email":"jazibsawar@gmail.com"},{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"593de700a7a519fd9b12263e0d93ad9e880ee332","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-0.0.0.tgz","fileCount":70,"integrity":"sha512-ptXzlGkI7C/LAHsHgUWbG1x6ywOZo8uCCaT1ioPjdy19RnuZFf9d7ItxNXvI5HEX1km+HbXm4rIJDIMUciDfuQ==","signatures":[{"sig":"MEQCICI1TEagIPxO9RtgqxUyPRN3qYEkvBGjS816EcUfXprzAiAjV/Owa4JZYTd7FBgpo6vk1lomx5yoDDPKK3QzgrZhJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99592},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"# Gatsby Source for Cosmic\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen.github.io/cz-cli/)\n\nSource plugin for fetching data into [Gatsby](https://www.gatsbyjs.org) from [Cosmic](https://cosmicjs.com). Cosmic offers a [Headless CMS](https://cosmicjs.com/headless-cms) for your Gatsby website.\n\n## Quickstart Guide\n\n### 1. Install the plugin\n```\nnpm install --save @cosmicjs/gatsby-source-cosmic\n```\n\n### 2. Configure your plugin\nIn order to configure this plugin you will need your Cosmic Bucket slug and corresponding read key. You can find these by [logging into Cosmic](https://app.cosmicjs.com/login) and going to `Your Bucket > Settings > API Access`.\n\nIn your `gatsby-config.js` install the plugin:\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n],\n```\nThis configuration will automatically detect the Object type in your Bucket and pull down all published Objects into your site's GraphQL database. If you'd like to only fetch a specific set of Object types you can do that by specifying their slugs on the plugin config.\n```\n...\noptions: {\n  bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n  readKey: process.env.COSMIC_READ_KEY,\n  objectTypes: ['blog-posts', 'authors'],\n}\n...\n```\n\nThis will allow you to query your Cosmic content data from within Gatsby. For example if you have an Object type called `Blog Posts` a query might look something like this:\n```\n// src/templates/blog-post.js\n\nexport const query = graphql`\n  query {\n    allCosmicjsBlogPosts {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nor filter to a specific post like this:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nYou can read more about querying data, template pages, and other queries in the [Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/querying-data/).\n\n## Advanced configuration\nThis plugin offers a number of other features to allow you to control what data is fetched from your Bucket.\n\n### Global Config Options\nThese options can be specified at the top level of your config.\n\n> **Note**: If a matching property is specified on the Object level the Object level configuration value will be used.\n\nProperty | Required | Type | Default | Description\n--- | --- | --- | --- | ---\n`bucketSlug` | Required | String | n/a | The slug of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv).\n`readKey` | Required | String | n/a | The read key of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv). Access this read key in your Bucket under `Settings > API Access`\n`limit` | Optional | Number | `100` | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | `0` | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | `true` | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | `order` | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | `published` | The publish status of Objects pulled from the API. Published will only pull published items while any will pull published & draft objects.\n`objectTypes` | optional | [String \\| Object] | n/a | An array of Object types that you would like to pull from your Cosmic Bucket. This can be an array of Object type slugs or Object configs.\n\n### Object type config options\nObject type config options allow you to more granularly configure how data is pulled from your Cosmic Bucket. **Properties set on Object types will override options set at the global config level.**\n\nObject type configs can also be used with a combination of slug strings and Objects. For example:\n```\noptions: {\n  //...\n  objectTypes: [\n    'blog-posts', \n    {\n      slug: 'authors'\n      // other options...  \n    },\n  ],\n}\n```\n\nProperty | Required | Type | Description\n--- | --- | --- | ---\n`slug` | Required | String | The slug of the Object type for this config Object.\n`query` | Optional | Object | The query for this Object. Learn more about Cosmic's query syntax in our [query documentation](https://docs.cosmicjs.com/api-reference/queries). **IMPORTANT**: Do not include the `type` property in your query. That is handled by the plugin and via the slug property.\n`props` | Optional | String | The properties of the Object that you want to be returned by the API. The properties should be formatted as a comma separated string. For example: `props: 'id,title,metadata.author'`. Please reference the [Cosmic API docs](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more details. **Note**: When using this property the `id` prop must be included.\n`limit` | Optional | Number | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | The publish status of Objects pulled from the API. `published` will only pull published items while `any` will pull published & draft Objects.\n\n### Full Object Config Example\n> Please note any values used here are just to demonstrate the properties usage.\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n      limit: 200,\n      depth: 2,\n      use_cache: true,\n      sort: 'order',\n      objectTypes: [\n        'blog-posts',\n        'customer-announcements',\n        {\n          slug: 'authors',\n          limit: 5,          // Overrides global limit\n          depth: 1,          // Overrides global depth\n          use_cache: true,   // Overrides global use_cache\n          sort: 'random',    // Overrides global sort\n        },\n        {\n          slug: 'products',\n          query: {\n            'metadata.category': {\n              '$in': ['Clothing','Food'],\n            },\n          },\n          props: 'id,title,metadata.price,metadata.image'\n        },\n      ]\n    }\n  },\n],\n```\n\n## Querying for Images\n> **Note**: `gatsby-plugin-image` (^2.25.0) is a required peer dependency to use these features. \n\nImage `metadata` fields create 3 different queryable fields in your GraphQL schema. Here's what those fields would look like in a query:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          metadata {\n            image {\n              gatsbyImageData\n              imgix_url\n              url\n            }\n          }\n        }\n      }\n    }\n  }\n`\n```\n### Image URLs\nThe two image URL properties can be used directly just like any other image resource URLs. However the `imgix_url` property is served by Cosmic's imgix CDN. This URL can be queried with a variety of rendering parameters, please see the [imgix Rendering API](https://docs.imgix.com/apis/rendering) documentation for details.\n\n### Gatsby Image Data\nThe `gatsbyImageData` property is attached to image metadata properties, and can be queried to produce an Object that's directly usable with a `<GatsbyImage>` component. Here's an example using a static query:\n```\nimport React from \"react\"\nimport { useStaticQuery, graphql } from \"gatsby\"\nimport { GatsbyImage, getImage } from \"gatsby-plugin-image\"\n\nexport default function Home() {\n  const data = useStaticQuery(graphql`\n    query {\n      cosmicjsImagePages(slug: {eq: \"test-image-page\"}) {\n        slug\n        metadata {\n          image_level_0 {\n            gatsbyImageData(\n              formats: JPG,\n              placeholder: DOMINANT_COLOR\n            )\n          }\n        }\n      }\n    }\n  `)\n\n  const image = getImage(data.cosmicjsImagePages.metadata.image_level_0.gatsbyImageData)\n\n  return (\n    <div>\n      <h1>Hello world!</h1>\n      <GatsbyImage image={image} alt=\"Test image\" />\n    </div>\n  )\n}\n```\nFor more details on how to query Gatsby image data please see the [Gatsby Image plugin documentation](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image).\n\n## Starters\nTODO\n\n---\n## Plugin Development\nInstructions to install this codebase locally.\n  1. `git clone https://github.com/cosmicjs/gatsby-source-cosmic.git`\n  2. `cd gatsby-source-cosmic`\n  3. `npm install`\n      - **Important**: You must be using Node Version 18.13.0 \n  4. `cd example-site`\n  5. `npm install`\n### Commands\nAction | Command\n--- | ---\nRun Linter | `npm run lint`\nAuto Fix Linter Issues | `npm run lint.fix`\nRun Tests | `npm run test`\nDevelop w/Hot Reload | `npm run watch`\nBuild Project | `npm run build`\n\n### Setting up plugin hot(ish) reload\nIf you'd like to use this project locally you can use local file resolution to test out modifications to this project on your local gatsby site.\n\nInstructions:\n  1. Install this codebase with the instructions above.\n  2. In your (local) gatsby site add the plugin config with a local file resolution to the root of this plugin's folder (See example below).\n```\n {\n    // Using local plugin resolution for testing\n    resolve: require.resolve(`../gatsby-source-cosmic`),\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n```\n  3. Open up a terminal window and run either the build or watch commands to bundle the library.\n  4. In another terminal window run `gatsby develop` or `npm run develop` to start your Gatsby Dev Server.\n\n> **Note**: You will need to re-start the Gatsby Dev Server in order to load the changes you make to the plugin. Gatsby does not re-run it's node lifecycle on changes to the underlying plugin code.\n","gitHead":"96828eba083e45805ff2d1b2b06d1467abce0824","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"6.14.16","description":"Gatsby Source Plugin for building websites using Cosmic as a data source","directories":{},"_nodeVersion":"18.16.1","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","@cosmicjs/sdk":"^1.0.6","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_0.0.0_1687386578077_0.5825391870825558","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@cosmicjs/gatsby-source-cosmic","version":"2.0.0","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@2.0.0","maintainers":[{"name":"jazibsawar","email":"jazibsawar@gmail.com"},{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"8ab358b558018852c31917b62374ff3c1babb346","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-2.0.0.tgz","fileCount":70,"integrity":"sha512-wZFp8H/Usw7EgDqWf/qqMSdf3hfz3uc8R81I9ZQ0xAlMwEtjInWjBcAp3497VKHouYQjZuzArb1CAehH9hgRRQ==","signatures":[{"sig":"MEUCIQCNVw8tXGoNBJki4maBDmMS3/MDJcVOIUkGE1TGrR0jagIgKdQKgRc7ugMsOHF79NTpzqaeiPMrReuXNtqDDwdpyvA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99592},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"# Gatsby Source for Cosmic\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen.github.io/cz-cli/)\n\nSource plugin for fetching data into [Gatsby](https://www.gatsbyjs.org) from [Cosmic](https://cosmicjs.com). Cosmic offers a [Headless CMS](https://cosmicjs.com/headless-cms) for your Gatsby website.\n\n## Quickstart Guide\n\n### 1. Install the plugin\n```\nnpm install --save @cosmicjs/gatsby-source-cosmic\n```\n\n### 2. Configure your plugin\nIn order to configure this plugin you will need your Cosmic Bucket slug and corresponding read key. You can find these by [logging into Cosmic](https://app.cosmicjs.com/login) and going to `Your Bucket > Settings > API Access`.\n\nIn your `gatsby-config.js` install the plugin:\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n],\n```\nThis configuration will automatically detect the Object type in your Bucket and pull down all published Objects into your site's GraphQL database. If you'd like to only fetch a specific set of Object types you can do that by specifying their slugs on the plugin config.\n```\n...\noptions: {\n  bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n  readKey: process.env.COSMIC_READ_KEY,\n  objectTypes: ['blog-posts', 'authors'],\n}\n...\n```\n\nThis will allow you to query your Cosmic content data from within Gatsby. For example if you have an Object type called `Blog Posts` a query might look something like this:\n```\n// src/templates/blog-post.js\n\nexport const query = graphql`\n  query {\n    allCosmicjsBlogPosts {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nor filter to a specific post like this:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nYou can read more about querying data, template pages, and other queries in the [Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/querying-data/).\n\n## Advanced configuration\nThis plugin offers a number of other features to allow you to control what data is fetched from your Bucket.\n\n### Global Config Options\nThese options can be specified at the top level of your config.\n\n> **Note**: If a matching property is specified on the Object level the Object level configuration value will be used.\n\nProperty | Required | Type | Default | Description\n--- | --- | --- | --- | ---\n`bucketSlug` | Required | String | n/a | The slug of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv).\n`readKey` | Required | String | n/a | The read key of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv). Access this read key in your Bucket under `Settings > API Access`\n`limit` | Optional | Number | `100` | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | `0` | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | `true` | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | `order` | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | `published` | The publish status of Objects pulled from the API. Published will only pull published items while any will pull published & draft objects.\n`objectTypes` | optional | [String \\| Object] | n/a | An array of Object types that you would like to pull from your Cosmic Bucket. This can be an array of Object type slugs or Object configs.\n\n### Object type config options\nObject type config options allow you to more granularly configure how data is pulled from your Cosmic Bucket. **Properties set on Object types will override options set at the global config level.**\n\nObject type configs can also be used with a combination of slug strings and Objects. For example:\n```\noptions: {\n  //...\n  objectTypes: [\n    'blog-posts', \n    {\n      slug: 'authors'\n      // other options...  \n    },\n  ],\n}\n```\n\nProperty | Required | Type | Description\n--- | --- | --- | ---\n`slug` | Required | String | The slug of the Object type for this config Object.\n`query` | Optional | Object | The query for this Object. Learn more about Cosmic's query syntax in our [query documentation](https://docs.cosmicjs.com/api-reference/queries). **IMPORTANT**: Do not include the `type` property in your query. That is handled by the plugin and via the slug property.\n`props` | Optional | String | The properties of the Object that you want to be returned by the API. The properties should be formatted as a comma separated string. For example: `props: 'id,title,metadata.author'`. Please reference the [Cosmic API docs](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more details. **Note**: When using this property the `id` prop must be included.\n`limit` | Optional | Number | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | The publish status of Objects pulled from the API. `published` will only pull published items while `any` will pull published & draft Objects.\n\n### Full Object Config Example\n> Please note any values used here are just to demonstrate the properties usage.\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n      limit: 200,\n      depth: 2,\n      use_cache: true,\n      sort: 'order',\n      objectTypes: [\n        'blog-posts',\n        'customer-announcements',\n        {\n          slug: 'authors',\n          limit: 5,          // Overrides global limit\n          depth: 1,          // Overrides global depth\n          use_cache: true,   // Overrides global use_cache\n          sort: 'random',    // Overrides global sort\n        },\n        {\n          slug: 'products',\n          query: {\n            'metadata.category': {\n              '$in': ['Clothing','Food'],\n            },\n          },\n          props: 'id,title,metadata.price,metadata.image'\n        },\n      ]\n    }\n  },\n],\n```\n\n## Querying for Images\n> **Note**: `gatsby-plugin-image` (^2.25.0) is a required peer dependency to use these features. \n\nImage `metadata` fields create 3 different queryable fields in your GraphQL schema. Here's what those fields would look like in a query:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          metadata {\n            image {\n              gatsbyImageData\n              imgix_url\n              url\n            }\n          }\n        }\n      }\n    }\n  }\n`\n```\n### Image URLs\nThe two image URL properties can be used directly just like any other image resource URLs. However the `imgix_url` property is served by Cosmic's imgix CDN. This URL can be queried with a variety of rendering parameters, please see the [imgix Rendering API](https://docs.imgix.com/apis/rendering) documentation for details.\n\n### Gatsby Image Data\nThe `gatsbyImageData` property is attached to image metadata properties, and can be queried to produce an Object that's directly usable with a `<GatsbyImage>` component. Here's an example using a static query:\n```\nimport React from \"react\"\nimport { useStaticQuery, graphql } from \"gatsby\"\nimport { GatsbyImage, getImage } from \"gatsby-plugin-image\"\n\nexport default function Home() {\n  const data = useStaticQuery(graphql`\n    query {\n      cosmicjsImagePages(slug: {eq: \"test-image-page\"}) {\n        slug\n        metadata {\n          image_level_0 {\n            gatsbyImageData(\n              formats: JPG,\n              placeholder: DOMINANT_COLOR\n            )\n          }\n        }\n      }\n    }\n  `)\n\n  const image = getImage(data.cosmicjsImagePages.metadata.image_level_0.gatsbyImageData)\n\n  return (\n    <div>\n      <h1>Hello world!</h1>\n      <GatsbyImage image={image} alt=\"Test image\" />\n    </div>\n  )\n}\n```\nFor more details on how to query Gatsby image data please see the [Gatsby Image plugin documentation](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image).\n\n## Starters\nTODO\n\n---\n## Plugin Development\nInstructions to install this codebase locally.\n  1. `git clone https://github.com/cosmicjs/gatsby-source-cosmic.git`\n  2. `cd gatsby-source-cosmic`\n  3. `npm install`\n      - **Important**: You must be using Node Version 18.13.0 \n  4. `cd example-site`\n  5. `npm install`\n### Commands\nAction | Command\n--- | ---\nRun Linter | `npm run lint`\nAuto Fix Linter Issues | `npm run lint.fix`\nRun Tests | `npm run test`\nDevelop w/Hot Reload | `npm run watch`\nBuild Project | `npm run build`\n\n### Setting up plugin hot(ish) reload\nIf you'd like to use this project locally you can use local file resolution to test out modifications to this project on your local gatsby site.\n\nInstructions:\n  1. Install this codebase with the instructions above.\n  2. In your (local) gatsby site add the plugin config with a local file resolution to the root of this plugin's folder (See example below).\n```\n {\n    // Using local plugin resolution for testing\n    resolve: require.resolve(`../gatsby-source-cosmic`),\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n```\n  3. Open up a terminal window and run either the build or watch commands to bundle the library.\n  4. In another terminal window run `gatsby develop` or `npm run develop` to start your Gatsby Dev Server.\n\n> **Note**: You will need to re-start the Gatsby Dev Server in order to load the changes you make to the plugin. Gatsby does not re-run it's node lifecycle on changes to the underlying plugin code.\n","gitHead":"90969986aeef78d4ff0ba018b6a846f443b68870","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"6.14.16","description":"Gatsby Source Plugin for building websites using Cosmic as a data source","directories":{},"_nodeVersion":"18.16.1","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","@cosmicjs/sdk":"^1.0.6","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_2.0.0_1687386680709_0.5473291322119538","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"@cosmicjs/gatsby-source-cosmic","version":"2.0.1","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@2.0.1","maintainers":[{"name":"jazibsawar","email":"jazibsawar@gmail.com"},{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"c73cfc540f54a5c72a5e3358e00a40d3984e0996","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-2.0.1.tgz","fileCount":70,"integrity":"sha512-B2BzRJS1LYc1leNzFf6kWmkeE/6qUowa4F37AF0apBZop/+3RVz5HpTJWwfYo2YzKkSWLqc/Llz2jMptA3jVAQ==","signatures":[{"sig":"MEQCIHHfZxR07TinAACZfRSs99REUFcaAqswJrvBkgn5FMzcAiBj4PE/PjPcfc4rKcIdk2rtAsq0+nRFSZhf1Y3dmGgy/g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99592},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"2418af36dcfe93cda319b1c5f2d7e4230c6dc5e8","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"6.14.16","description":"Gatsby Source Plugin for building websites using Cosmic as a data source","directories":{},"_nodeVersion":"18.16.1","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","@cosmicjs/sdk":"^1.0.6","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_2.0.1_1687386898725_0.5903366896435198","host":"s3://npm-registry-packages"}},"2.0.2":{"name":"@cosmicjs/gatsby-source-cosmic","version":"2.0.2","keywords":["gatsby","gatsby-plugin","cosmic"],"license":"0BSD","_id":"@cosmicjs/gatsby-source-cosmic@2.0.2","maintainers":[{"name":"jazibsawar","email":"jazibsawar@gmail.com"},{"name":"bargangilo","email":"king.donovan@gmail.com"},{"name":"tonyspiro","email":"tony@cosmicjs.com"}],"homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"dist":{"shasum":"f416f12f80a92b8e1f0e4bfdb0e2341ac1204732","tarball":"https://registry.npmjs.org/@cosmicjs/gatsby-source-cosmic/-/gatsby-source-cosmic-2.0.2.tgz","fileCount":70,"integrity":"sha512-nyXrOAuXxEyeULkBmXrhm05NY2BWQI7MiROn+uA5XwnFZhMqE3V231h2pKduRf/YbZOtFVHLmt+1vJiwcr0XCw==","signatures":[{"sig":"MEYCIQCzir7kPYuCqaCrGDhPeQRo2P51qs6+2kiZJ6Bmvxv+swIhAMXV/wL/FyWNJtZkNgPs0gwMZne+EqU00X3rZTHtwfEa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":105770},"main":"gatsby-node.js","config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"6e47ee423e0bb88880a31294bdf737dafa03d3cd","scripts":{"lint":"eslint src","test":"jest --verbose","babel":"babel","build":"./build.sh","watch":"./watch.sh","prepare":"husky install","lint.fix":"eslint --fix src","semantic-release":"semantic-release --debug"},"_npmUser":{"name":"tonyspiro","email":"tony@cosmicjs.com"},"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"_npmVersion":"6.14.16","description":"Gatsby Source Plugin for building websites using Cosmic as a data source","directories":{},"_nodeVersion":"18.17.0","dependencies":{"async":"^3.2.4","axios":"^1.2.3","lodash":"^4.17.21","graphql":"^15.8.0","fs-extra":"^11.1.0","hash-wasm":"^4.9.0","mime-types":"^2.1.35","@cosmicjs/sdk":"^1.0.6","probe-image-size":"^7.2.3","gatsby-core-utils":"^4.4.0","gatsby-plugin-utils":"^3.18.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","husky":"^8.0.1","react":"^16.14.0","eslint":"^8.32.0","gatsby":"^4.25.3","react-dom":"^16.14.0","@babel/cli":"^7.19.3","commitizen":"^4.2.5","@babel/core":"^7.20.12","@types/jest":"^29.2.0","@babel/types":"7.20.7","semantic-release":"^19.0.5","eslint-plugin-jest":"^27.2.1","gatsby-plugin-image":"^2.25.0","gatsby-plugin-sharp":"^4.25.0","@babel/eslint-parser":"^7.19.1","eslint-plugin-import":"^2.26.0","eslint-plugin-flowtype":"^8.0.3","cz-conventional-changelog":"^3.3.0","eslint-config-airbnb-base":"^15.0.0","@semantic-release/changelog":"^6.0.2","babel-preset-gatsby-package":"^3.4.0"},"peerDependencies":{"gatsby-plugin-image":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/gatsby-source-cosmic_2.0.2_1692123708860_0.5276392872801365","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-02-16T00:30:25.282Z","modified":"2026-06-10T22:27:04.581Z","1.0.1":"2023-02-16T00:30:25.512Z","1.0.2":"2023-02-16T00:36:02.962Z","1.0.3":"2023-03-07T15:04:53.522Z","1.0.4":"2023-03-07T15:20:56.019Z","0.0.0":"2023-06-21T22:29:38.274Z","2.0.0":"2023-06-21T22:31:20.953Z","2.0.1":"2023-06-21T22:34:58.873Z","2.0.2":"2023-08-15T18:21:49.098Z"},"bugs":{"url":"https://github.com/cosmicjs/gatsby-source-cosmic/issues"},"license":"0BSD","homepage":"https://github.com/cosmicjs/gatsby-source-cosmic#readme","keywords":["gatsby","gatsby-plugin","cosmic"],"repository":{"url":"git+ssh://git@github.com/cosmicjs/gatsby-source-cosmic.git","type":"git"},"description":"Gatsby Source Plugin for building websites using Cosmic as a data source","maintainers":[{"email":"tony@cosmicjs.com","name":"tonyspiro"}],"readme":"# Gatsby Source for Cosmic\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen.github.io/cz-cli/)\n\nSource plugin for fetching data into [Gatsby](https://www.gatsbyjs.org) from [Cosmic](https://cosmicjs.com). Cosmic offers a [Headless CMS](https://cosmicjs.com/headless-cms) for your Gatsby website.\n\n## Quickstart Guide\n\n### 1. Install the plugin\n```\nnpm install --save @cosmicjs/gatsby-source-cosmic\n```\n\n### 2. Configure your plugin\nIn order to configure this plugin you will need your Cosmic Bucket slug and corresponding read key. You can find these by [logging into Cosmic](https://app.cosmicjs.com/login) and going to `Your Bucket > Settings > API Access`.\n\nIn your `gatsby-config.js` install the plugin:\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n],\n```\nThis configuration will automatically detect the Object type in your Bucket and pull down all published Objects into your site's GraphQL database. If you'd like to only fetch a specific set of Object types you can do that by specifying their slugs on the plugin config.\n```\n...\noptions: {\n  bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n  readKey: process.env.COSMIC_READ_KEY,\n  objectTypes: ['blog-posts', 'authors'],\n}\n...\n```\n\nThis will allow you to query your Cosmic content data from within Gatsby. For example if you have an Object type called `Blog Posts` a query might look something like this:\n```\n// src/templates/blog-post.js\n\nexport const query = graphql`\n  query {\n    allCosmicjsBlogPosts {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nor filter to a specific post like this:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          content\n          title\n        }\n      }\n    }\n  }\n`\n```\nYou can read more about querying data, template pages, and other queries in the [Gatsby Docs](https://www.gatsbyjs.com/docs/how-to/querying-data/).\n\n## Advanced configuration\nThis plugin offers a number of other features to allow you to control what data is fetched from your Bucket.\n\n### Global Config Options\nThese options can be specified at the top level of your config.\n\n> **Note**: If a matching property is specified on the Object level the Object level configuration value will be used.\n\nProperty | Required | Type | Default | Description\n--- | --- | --- | --- | ---\n`bucketSlug` | Required | String | n/a | The slug of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv).\n`readKey` | Required | String | n/a | The read key of the Cosmic Bucket that you want to pull data from. Best practice is to store this in an ENV variable using [dotenv](https://github.com/motdotla/dotenv). Access this read key in your Bucket under `Settings > API Access`\n`limit` | Optional | Number | `100` | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | `0` | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | `true` | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | `order` | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | `published` | The publish status of Objects pulled from the API. Published will only pull published items while any will pull published & draft objects.\n`objectTypes` | optional | [String \\| Object] | n/a | An array of Object types that you would like to pull from your Cosmic Bucket. This can be an array of Object type slugs or Object configs.\n\n### Object type config options\nObject type config options allow you to more granularly configure how data is pulled from your Cosmic Bucket. **Properties set on Object types will override options set at the global config level.**\n\nObject type configs can also be used with a combination of slug strings and Objects. For example:\n```\noptions: {\n  //...\n  objectTypes: [\n    'blog-posts', \n    {\n      slug: 'authors'\n      // other options...  \n    },\n  ],\n}\n```\n\nProperty | Required | Type | Description\n--- | --- | --- | ---\n`slug` | Required | String | The slug of the Object type for this config Object.\n`query` | Optional | Object | The query for this Object. Learn more about Cosmic's query syntax in our [query documentation](https://docs.cosmicjs.com/api-reference/queries). **IMPORTANT**: Do not include the `type` property in your query. That is handled by the plugin and via the slug property.\n`props` | Optional | String | The properties of the Object that you want to be returned by the API. The properties should be formatted as a comma separated string. For example: `props: 'id,title,metadata.author'`. Please reference the [Cosmic API docs](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more details. **Note**: When using this property the `id` prop must be included.\n`limit` | Optional | Number | Controls the default number of Objects that are fetched per request. This can be useful if you have especially large Objects and are running into issue with the API timing out requests.\n`depth` | Optional | Number | Controls the default depth of the query into Object relations.\n`use_cache` | Optional | Bool | A false value disables the use of the Cosmic API data cache. Please reference the docs [here](https://docs.cosmicjs.com/api-reference/objects#get-objects) for more information.\n`sort` | Optional | Enum (`created_at, -created_at, modified_at, -modified_at, random, order`) | The order that Objects are fetched and inserted into the database. The default (order) allows you to control the order of items from the Cosmic UI.\n`status` | Optional| Enum (`published, any`) | The publish status of Objects pulled from the API. `published` will only pull published items while `any` will pull published & draft Objects.\n\n### Full Object Config Example\n> Please note any values used here are just to demonstrate the properties usage.\n```\nplugins: [\n  {\n    resolve: `@cosmicjs/gatsby-source-cosmic`,\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n      limit: 200,\n      depth: 2,\n      use_cache: true,\n      sort: 'order',\n      objectTypes: [\n        'blog-posts',\n        'customer-announcements',\n        {\n          slug: 'authors',\n          limit: 5,          // Overrides global limit\n          depth: 1,          // Overrides global depth\n          use_cache: true,   // Overrides global use_cache\n          sort: 'random',    // Overrides global sort\n        },\n        {\n          slug: 'products',\n          query: {\n            'metadata.category': {\n              '$in': ['Clothing','Food'],\n            },\n          },\n          props: 'id,title,metadata.price,metadata.image'\n        },\n      ]\n    }\n  },\n],\n```\n\n## Querying for Images\n> **Note**: `gatsby-plugin-image` (^2.25.0) is a required peer dependency to use these features. \n\nImage `metadata` fields create 3 different queryable fields in your GraphQL schema. Here's what those fields would look like in a query:\n```\n// src/pages/about.js\n\nexport const query = graphql`\n  query ($slug: String) {\n    cosmicjsBlogPosts(slug: {eq: $slug}) {\n      edges {\n        node {\n          metadata {\n            image {\n              gatsbyImageData\n              imgix_url\n              url\n            }\n          }\n        }\n      }\n    }\n  }\n`\n```\n### Image URLs\nThe two image URL properties can be used directly just like any other image resource URLs. However the `imgix_url` property is served by Cosmic's imgix CDN. This URL can be queried with a variety of rendering parameters, please see the [imgix Rendering API](https://docs.imgix.com/apis/rendering) documentation for details.\n\n### Gatsby Image Data\nThe `gatsbyImageData` property is attached to image metadata properties, and can be queried to produce an Object that's directly usable with a `<GatsbyImage>` component. Here's an example using a static query:\n```\nimport React from \"react\"\nimport { useStaticQuery, graphql } from \"gatsby\"\nimport { GatsbyImage, getImage } from \"gatsby-plugin-image\"\n\nexport default function Home() {\n  const data = useStaticQuery(graphql`\n    query {\n      cosmicjsImagePages(slug: {eq: \"test-image-page\"}) {\n        slug\n        metadata {\n          image_level_0 {\n            gatsbyImageData(\n              formats: JPG,\n              placeholder: DOMINANT_COLOR\n            )\n          }\n        }\n      }\n    }\n  `)\n\n  const image = getImage(data.cosmicjsImagePages.metadata.image_level_0.gatsbyImageData)\n\n  return (\n    <div>\n      <h1>Hello world!</h1>\n      <GatsbyImage image={image} alt=\"Test image\" />\n    </div>\n  )\n}\n```\nFor more details on how to query Gatsby image data please see the [Gatsby Image plugin documentation](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image).\n\n## Starters\nTODO\n\n---\n## Plugin Development\nInstructions to install this codebase locally.\n  1. `git clone https://github.com/cosmicjs/gatsby-source-cosmic.git`\n  2. `cd gatsby-source-cosmic`\n  3. `npm install`\n      - **Important**: You must be using Node Version 18.13.0 \n  4. `cd example-site`\n  5. `npm install`\n### Commands\nAction | Command\n--- | ---\nRun Linter | `npm run lint`\nAuto Fix Linter Issues | `npm run lint.fix`\nRun Tests | `npm run test`\nDevelop w/Hot Reload | `npm run watch`\nBuild Project | `npm run build`\n\n### Setting up plugin hot(ish) reload\nIf you'd like to use this project locally you can use local file resolution to test out modifications to this project on your local gatsby site.\n\nInstructions:\n  1. Install this codebase with the instructions above.\n  2. In your (local) gatsby site add the plugin config with a local file resolution to the root of this plugin's folder (See example below).\n```\n {\n    // Using local plugin resolution for testing\n    resolve: require.resolve(`../gatsby-source-cosmic`),\n    options: {\n      bucketSlug: process.env.COSMIC_BUCKET_SLUG,\n      readKey: process.env.COSMIC_READ_KEY,\n    }\n  },\n```\n  3. Open up a terminal window and run either the build or watch commands to bundle the library.\n  4. In another terminal window run `gatsby develop` or `npm run develop` to start your Gatsby Dev Server.\n\n> **Note**: You will need to re-start the Gatsby Dev Server in order to load the changes you make to the plugin. Gatsby does not re-run it's node lifecycle on changes to the underlying plugin code.\n","readmeFilename":"README.md"}