From 71d92d5f7cc8d99f0b8914c394d91241a6cd009b Mon Sep 17 00:00:00 2001 From: Ankita Dodamani Date: Tue, 18 Mar 2025 14:18:58 +0530 Subject: [PATCH 1/6] chore: removed dependency for publish_details key --- src/fetch.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/fetch.js b/src/fetch.js index 2a4dd6a..0b49f31 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -144,12 +144,6 @@ const getData = async (url, options) => { } reject(data); } else { - if (data.items) { - const filteredData = data?.items.filter(item => { - return item.data.hasOwnProperty('publish_details'); - }); - data.items = filteredData; - } resolve(data); } }) From 8b831b010f1a2a9e6938ce22ea7f8d39195e9f6d Mon Sep 17 00:00:00 2001 From: Ankita Dodamani Date: Tue, 18 Mar 2025 14:38:07 +0530 Subject: [PATCH 2/6] chore: package version bumped --- package-lock.json | 11 ++++++++--- package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 994d110..281a682 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gatsby-source-contentstack", - "version": "5.3.5", + "version": "5.3.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gatsby-source-contentstack", - "version": "5.3.5", + "version": "5.3.6", "license": "MIT", "dependencies": { "@contentstack/utils": "^1.1.3", @@ -12795,6 +12795,7 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "peer": true, "engines": { "node": ">= 4.9.1" } @@ -16084,6 +16085,7 @@ "version": "3.0.8", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz", "integrity": "sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw==", + "peer": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -16095,6 +16097,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -16105,7 +16108,8 @@ "node_modules/hosted-git-info/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "peer": true }, "node_modules/html-entities": { "version": "2.5.2", @@ -24741,6 +24745,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "peer": true, "dependencies": { "mute-stream": "~0.0.4" }, diff --git a/package.json b/package.json index b1813a8..0fa6483 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gatsby-source-contentstack", - "version": "5.3.5", + "version": "5.3.6", "description": "Gatsby source plugin for building websites using Contentstack as a data source", "scripts": { "prepublish": "npm run build", From c0b8c23e207e95a660f40dc09b2f7d04251b7fd0 Mon Sep 17 00:00:00 2001 From: Ankita Dodamani Date: Tue, 18 Mar 2025 14:46:16 +0530 Subject: [PATCH 3/6] chore: update dependencies to latest versions in package-lock.json [audit fix] --- package-lock.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 281a682..acbb926 100644 --- a/package-lock.json +++ b/package-lock.json @@ -556,12 +556,12 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", - "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dependencies": { "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" @@ -2113,9 +2113,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz", - "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", + "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -2154,9 +2154,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" @@ -7799,9 +7799,9 @@ } }, "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.3.tgz", + "integrity": "sha512-iP4DebzoNlP/YN2dpwCgb8zoCmhtkajzS48JvwmkSkXvPI3DHc7m+XYL5tGnSlJtR6nImXZmdCuN5aP8dh1d8A==", "peer": true, "dependencies": { "follow-redirects": "^1.15.6", From a7f6551071e3fcbdb22159a9e65c6a8b67eb695d Mon Sep 17 00:00:00 2001 From: Ankita Dodamani Date: Thu, 20 Mar 2025 12:53:23 +0530 Subject: [PATCH 4/6] chore: updated readme --- README.md | 97 ++++++++++++++++++++----------------------------------- 1 file changed, 35 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index d7f9780..201c999 100644 --- a/README.md +++ b/README.md @@ -20,72 +20,45 @@ Open the gatsby-config.js file from the root directory of your Gatsby project an ```javascript // In your gatsby-config.js -plugins: [ - { - resolve: `gatsby-source-contentstack`, - options: { - // Required: API Key is a unique key assigned to each stack. - api_key: `api_key`, - // Required: Delivery Token is a read-only credential. - delivery_token: `delivery_token`, - - // Required: Environment where you published your data. - environment: `environment`, - - // Optional: Specify branch name. Default it would fetch from "main". - branch: `branch name`, - - // Optional: CDN set this to point to other cdn end point. For eg: https://eu-cdn.contentstack.com/v3 - cdn: `cdn_url`, - - // Recommended: Specify true if you want to fetch/source data parallelly. It enhances the performance on both gatsby build/develop command. - expediteBuild: `boolean_value`, - - // Recommended: Specify true if you want to generate custom schema when the content type models are complex. - enableSchemaGeneration : `boolean_value`, - - // Optional: Specify true if you want to generate optional graphql fields for mandatory Contentstack fields - disableMandatoryFields : `boolean_value`, - - // Optional: Specify a different prefix for types. This is useful in cases where you have multiple instances of the plugin to be connected to different stacks. - type_prefix: `Contentstack`, // (default) - - // Optional: Specify true if you want to download all your contentstack images locally - downloadImages: `boolean_value`, - - // Optional: Specify the content types from which you want the plugin to retrieve data. - contentTypes: [‘blog’,’author’], - // This will fetch the data of the ‘blog’ and ‘author’ content types only. - - // Optional: Specify the content types that the plugin should exclude while fetching data of all content types. - excludeContentTypes: [‘home’,’about’], - // This will fetch the data of all the available content types excluding the ‘home’ and ‘about’ content types. - - // Optional: Include the locales that you want the plugin to fetch data from. - locales: [‘en-us’,’fr-fr’], - // In this case, the plugin will fetch only English (United States) and French (France) language data. - - // Optional: Specify true to convert the JSON-RTE repsonse to HTML. Default it is set to false - jsonRteToHtml: false , - - // Optional: Specify a number to perform http-retries for network failures. By default it is set to 3. - httpRetries: 2, - - //Optional: Specify the number of entries/assets to be fetched per page. Maximum limit accepted is 100. By default it is set to 50. - limit: 50 +module.exports = { + plugins: [ + { + resolve: `gatsby-source-contentstack`, + options: { + api_key: `api_key`, + delivery_token: `delivery_token`, + environment: `environment`, + } + } + ] +}; +``` - //Optional: Specify the header to be passed to Contentstack API - enableEarlyAccessKey: 'x-header-ea' +## Plugin Options + +| Option | Required | Type | Description | Default | Example | +| ---------------------- | -------- | -------- | ---------------------------------------------------------- | ------- | ------- | +| api_key | Required | string | API Key is a unique key assigned to each stack. | N/A | `"api_key"` | +| delivery_token | Required | string | Delivery Token is a read-only credential. | N/A | `"delivery_token"` | +| environment | Required | string | Environment where you published your data. | N/A | `"environment"` | +| branch | Optional | string | Specify branch name. Default it would fetch from "main". | `main` | `"branch name"` | +| cdn | Optional | string | CDN set this to point to other CDN endpoint. | `"https://cdn.contentstack.io/v3"` | `"https://eu-cdn.contentstack.com/v3"` | +| expediteBuild | Recommended | boolean | Specify true if you want to fetch/source data parallelly. | `false` | `true` | +| enableSchemaGeneration | Recommended | boolean | Specify true if you want to generate a custom schema. | `false` | `true` | +| disableMandatoryFields | Optional | boolean | Specify true to generate optional GraphQL fields. | `false` | `true` | +| type_prefix | Optional | string | Specify a different prefix for types. | `Contentstack` | `Contentstack_Stack_A` | +| downloadImages | Optional | boolean | Specify true to download all Contentstack images locally. | `false` | `true` | +| contentTypes | Optional | string[] | Specify the content types to retrieve data from. | | `[‘blog’,’author’]` This will fetch the data of the ‘blog’ and ‘author’ content types only. | +| excludeContentTypes | Optional | string[] | Specify the content types to exclude while fetching data. | | `[‘home’,’about’]` This will fetch the data of all the available content types excluding the ‘home’ and ‘about’ content types.| +| locales | no | string[] | Include the locales that you want to fetch data from. | | `[‘en-us’,’fr-fr’]` In this case, the plugin will fetch only English (United States) and French (France) language data. | +| jsonRteToHtml | no | boolean | Specify true to convert the JSON-RTE response to HTML. | `false` | `true` | +| httpRetries | no | number | Specify the number of HTTP retries for network failures. | `3` | `2` | +| limit | no | number | Specify the number of entries/assets per page (Max: 100). | `50` | `50` | +| enableEarlyAccessKey | no | string | Specify list of headers to be passed to Contentstack API for the key specified in enableEarlyAccessKey. The Value should be a string. In case of multiple headers, separate them with a comma. | | `'x-header-ea'` | +| enableEarlyAccessValue | no | string | Specify list of headers to be passed to Contentstack API for the key specified in enableEarlyAccessKey. The Value should be a string. In case of multiple headers, separate them with a comma: 'header1,header2' | | `'newcda,taxonomy'` | - //Optional: Specify list of headers to be passed to Contentstack API for the key specified in enableEarlyAccessKey. The Value should be a string. In case of multiple headers, separate them with a comma. For eg:'header1,header2' - enableEarlyAccessValue: 'newcda,taxonomy' - }, - }, -] -// Note: access_token is replaced by delivery_token -``` There is a provision to speed up the `gatsby build` process. To do this, you can set the value of the **expediteBuild** to **true**. So when you set the value of this parameter to true, the build process is significantly enhanced as only published assets and entries are synced parallelly. From a46d5145ac97ba94f7f94ba1d7e86f51d1a9e4af Mon Sep 17 00:00:00 2001 From: Ankita Dodamani Date: Thu, 20 Mar 2025 14:58:37 +0530 Subject: [PATCH 5/6] chore: package version bumped to minor --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index acbb926..5edae8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gatsby-source-contentstack", - "version": "5.3.6", + "version": "5.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gatsby-source-contentstack", - "version": "5.3.6", + "version": "5.4.0", "license": "MIT", "dependencies": { "@contentstack/utils": "^1.1.3", diff --git a/package.json b/package.json index 0fa6483..6b2919c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gatsby-source-contentstack", - "version": "5.3.6", + "version": "5.4.0", "description": "Gatsby source plugin for building websites using Contentstack as a data source", "scripts": { "prepublish": "npm run build", From 3719828bf35595abdb403fbcea08ab6e2413a422 Mon Sep 17 00:00:00 2001 From: Ankita Dodamani <115449840+Contentstack-AnkitaD@users.noreply.github.com> Date: Mon, 24 Mar 2025 15:06:42 +0530 Subject: [PATCH 6/6] Added missed key in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 201c999..2553ca7 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ module.exports = { } ] }; +// Note: access_token is replaced by delivery_token ``` ## Plugin Options