From 3acf75042fdb6617e4eb317121a165cdf7218c70 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 16 Apr 2025 10:42:47 +0530 Subject: [PATCH 01/19] policy-scan.yml --- .github/workflows/policy-scan.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/policy-scan.yml diff --git a/.github/workflows/policy-scan.yml b/.github/workflows/policy-scan.yml new file mode 100644 index 0000000..13bd362 --- /dev/null +++ b/.github/workflows/policy-scan.yml @@ -0,0 +1,27 @@ +name: Checks the security policy and configurations +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + security-policy: + if: github.event.repository.visibility == 'public' + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@master + - name: Checks for SECURITY.md policy file + run: | + if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi + security-license: + if: github.event.repository.visibility == 'public' + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@master + - name: Checks for License file + run: | + if ! [[ -f "LICENSE" || -f "License.txt" || -f "LICENSE.md" ]]; then exit 1; fi \ No newline at end of file From bcd8bcce994c07796af1d4fecd747284489ed223 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 16 Apr 2025 10:42:56 +0530 Subject: [PATCH 02/19] issues-jira.yml --- .github/workflows/issues-jira.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/issues-jira.yml diff --git a/.github/workflows/issues-jira.yml b/.github/workflows/issues-jira.yml new file mode 100644 index 0000000..7bf0469 --- /dev/null +++ b/.github/workflows/issues-jira.yml @@ -0,0 +1,31 @@ +name: Create Jira Ticket for Github Issue + +on: + issues: + types: [opened] + +jobs: + issue-jira: + runs-on: ubuntu-latest + steps: + + - name: Login to Jira + uses: atlassian/gajira-login@master + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + + - name: Create Jira Issue + id: create_jira + uses: atlassian/gajira-create@master + with: + project: ${{ secrets.JIRA_PROJECT }} + issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} + summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }} + description: | + *GitHub Issue:* ${{ github.event.issue.html_url }} + + *Description:* + ${{ github.event.issue.body }} + fields: "${{ secrets.ISSUES_JIRA_FIELDS }}" \ No newline at end of file From 513a45246b76aa4dc7b1c1db89b2191fe70504b3 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 16 Apr 2025 10:42:57 +0530 Subject: [PATCH 03/19] Delete jira.yml --- .github/workflows/jira.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .github/workflows/jira.yml diff --git a/.github/workflows/jira.yml b/.github/workflows/jira.yml deleted file mode 100644 index 250abc7..0000000 --- a/.github/workflows/jira.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Create JIRA ISSUE -on: - pull_request: - types: [opened] -jobs: - security-jira: - if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Login into JIRA - uses: atlassian/gajira-login@master - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - name: Create a JIRA Issue - id: create - uses: atlassian/gajira-create@master - with: - project: ${{ secrets.JIRA_PROJECT }} - issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} - summary: | - Snyk | Vulnerability | ${{ github.event.repository.name }} | ${{ github.event.pull_request.title }} - description: | - PR: ${{ github.event.pull_request.html_url }} - - fields: "${{ secrets.JIRA_FIELDS }}" - - name: Transition issue - uses: atlassian/gajira-transition@v3 - with: - issue: ${{ steps.create.outputs.issue }} - transition: ${{ secrets.JIRA_TRANSITION }} From 4d4f84c3bb502836535a5af9742525b2b7641ae4 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 16 Apr 2025 10:42:57 +0530 Subject: [PATCH 04/19] Delete sast-scan.yml --- .github/workflows/sast-scan.yml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .github/workflows/sast-scan.yml diff --git a/.github/workflows/sast-scan.yml b/.github/workflows/sast-scan.yml deleted file mode 100644 index 3b9521a..0000000 --- a/.github/workflows/sast-scan.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: SAST Scan -on: - pull_request: - types: [opened, synchronize, reopened] -jobs: - security-sast: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Semgrep Scan - run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto \ No newline at end of file From 34171151cdf383f3f464aacac619bb912fc3f224 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 16 Apr 2025 10:43:02 +0530 Subject: [PATCH 05/19] Updated codeowners From dc14a7cd44de215c73b5d5030509a1b0d8317e0f Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Wed, 23 Apr 2025 21:38:37 +0530 Subject: [PATCH 06/19] policy-scan.yml --- .github/workflows/policy-scan.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/policy-scan.yml b/.github/workflows/policy-scan.yml index 13bd362..ff25923 100644 --- a/.github/workflows/policy-scan.yml +++ b/.github/workflows/policy-scan.yml @@ -24,4 +24,23 @@ jobs: - uses: actions/checkout@master - name: Checks for License file run: | - if ! [[ -f "LICENSE" || -f "License.txt" || -f "LICENSE.md" ]]; then exit 1; fi \ No newline at end of file + expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt") + license_file_found=false + current_year=$(date +"%Y") + + for license_file in "${expected_license_files[@]}"; do + if [ -f "$license_file" ]; then + license_file_found=true + # check the license file for the current year, if not exists, exit with error + if ! grep -q "$current_year" "$license_file"; then + echo "License file $license_file does not contain the current year." + exit 2 + fi + break + fi + done + + if [ "$license_file_found" = false ]; then + echo "No license file found. Please add a license file to the repository." + exit 1 + fi \ No newline at end of file From 3debdf622dbc42ed58d442b392bdc4af199fb2a2 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:06:32 +0530 Subject: [PATCH 07/19] policy-scan.yml From 5f79a9cb4e6d9861221fb33e5966aa0bea397c47 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:06:40 +0530 Subject: [PATCH 08/19] issues-jira.yml From 12e59295daafc1a12f47f4945656da3e689af4b0 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:06:41 +0530 Subject: [PATCH 09/19] secrets-scan.yml --- .github/workflows/secrets-scan.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/secrets-scan.yml diff --git a/.github/workflows/secrets-scan.yml b/.github/workflows/secrets-scan.yml new file mode 100644 index 0000000..049c02f --- /dev/null +++ b/.github/workflows/secrets-scan.yml @@ -0,0 +1,29 @@ +name: Secrets Scan +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + security-secrets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '2' + ref: '${{ github.event.pull_request.head.ref }}' + - run: | + git reset --soft HEAD~1 + - name: Install Talisman + run: | + # Download Talisman + wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman + + # Checksum verification + checksum=$(sha256sum ./talisman | awk '{print $1}') + if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi + + # Make it executable + chmod +x talisman + - name: Run talisman + run: | + # Run Talisman with the pre-commit hook + ./talisman --githook pre-commit \ No newline at end of file From db015faa3c0358ce71429abf1a484e190a08b5a1 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:06:45 +0530 Subject: [PATCH 10/19] Updated codeowners From ad5bcea8a6bf8516ec72f32cf5641911e07f2d29 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 23:34:04 +0530 Subject: [PATCH 11/19] talismanrc file updated --- .talismanrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.talismanrc b/.talismanrc index e05ff54..afb99a8 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,5 +1,8 @@ threshold: medium fileignoreconfig: +- filename: .github/workflows/secrets-scan.yml + ignore_detectors: + - filecontent - filename: test/unit/mock/execution-mock.js checksum: 89d239d37c9d8d0cdb6ac61553a7d2e2d9115a10207f7c0b387c3565c9cb6564 - filename: package-lock.json From 8b8a8adf04971f851594f1f89fe0a61e89e064c2 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 11:47:51 +0530 Subject: [PATCH 12/19] Update base URL path logic in contentstackClient to handle when region and host not provided --- lib/contentstackClient.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/contentstackClient.js b/lib/contentstackClient.js index 356e725..7b99522 100644 --- a/lib/contentstackClient.js +++ b/lib/contentstackClient.js @@ -31,6 +31,10 @@ export default function contentstackClient ({ http }) { if (region && region !== Region.NA) { baseUrlPath = `https://${region}-api.contentstack.com:443/v3/user-session` + } else if (!region && http.defaults.host) { + baseUrlPath = `https://${http.defaults.host}:443/v3/user-session` + } else { + baseUrlPath = `https://api.contentstack.io:443/v3/user-session` } function login (requestBody, params = {}) { From 93376baa0ae3f61a0d365cd9c9b807ff583649e1 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 12:04:08 +0530 Subject: [PATCH 13/19] Bump version to 1.3.0 and update axios dependency to 1.8.3; fix encoding in sanity report file read --- package-lock.json | 12 ++++++------ package.json | 4 ++-- sanity-report-dev11.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index b7caa3e..40cf9b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@contentstack/marketplace-sdk", - "version": "1.2.6", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/marketplace-sdk", - "version": "1.2.6", + "version": "1.3.0", "license": "MIT", "dependencies": { - "axios": "^1.8.2" + "axios": "^1.8.3" }, "devDependencies": { "@babel/cli": "^7.26.4", @@ -4180,9 +4180,9 @@ } }, "node_modules/axios": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", - "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz", + "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", diff --git a/package.json b/package.json index cedd39c..0c4cec3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/marketplace-sdk", - "version": "1.2.6", + "version": "1.3.0", "description": "The Contentstack Marketplace SDK is used to manage the content of your Contentstack marketplace apps", "main": "./dist/node/contentstack-marketplace.js", "browser": "./dist/web/contentstack-marketplace.js", @@ -92,6 +92,6 @@ "webpack-merge": "4.2.2" }, "dependencies": { - "axios": "^1.8.2" + "axios": "^1.8.3" } } diff --git a/sanity-report-dev11.js b/sanity-report-dev11.js index a726572..0c1ec34 100644 --- a/sanity-report-dev11.js +++ b/sanity-report-dev11.js @@ -10,7 +10,7 @@ const user4 = process.env.USER4; const mochawesomeJsonOutput = fs.readFileSync( "./mochawesome-report/mochawesome.json", - "utf-8" + "utf8" ); const mochawesomeReport = JSON.parse(mochawesomeJsonOutput); From c53a93ebce1812113dab3bc9b78dfc1e68e4feed Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 12:04:21 +0530 Subject: [PATCH 14/19] Fix encoding in mochawesome report file read and include region in Slack message header --- sanity-report.mjs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sanity-report.mjs b/sanity-report.mjs index 9e73180..2b775e5 100644 --- a/sanity-report.mjs +++ b/sanity-report.mjs @@ -5,7 +5,7 @@ import fs from 'fs' dotenv.config() -const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf-8') +const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf8') const mochawesomeReport = JSON.parse(mochawesomeJsonOutput) const report = `./mochawesome-report/sanity-report.html` @@ -25,8 +25,16 @@ console.log(`Failed Tests: ${failedTests}`) console.log(`Pending Tests: ${pendingTests}`) console.log(`Total Duration: ${durationInMinutes}m ${durationInSeconds.toFixed(2)}s`) +const host = process.env.DEFAULTHOST || '' +let region = 'AWS-NA' + +const match = host.match(/^([^-]+(?:-[^-]+)*)-api/) +if (match && match[1]) { + region = match[1].toUpperCase() +} + const slackMessage = ` -*JavaScript Marketplace SDK Report* +*JavaScript Marketplace SDK Report - ${region}* • Total Suites: *${totalSuites}* • Total Tests: *${totalTests}* • Passed Tests: *${passedTests}* From 90774fef56c0704edb5e4584d4d899e69181800a Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 12:06:47 +0530 Subject: [PATCH 15/19] Update CHANGELOG for v1.3.0 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d6d5f7..d883792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog + +## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-05-14) + - Fixed base URL path logic in contentstackClient to handle when region and host not provided + ## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-03-03) - Update sanity tests From a9178cdc8441c97c06368681a95f2b0bc2046534 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 13:21:26 +0530 Subject: [PATCH 16/19] update unit test cases --- test/unit/ContentstackClient-test.js | 8 ++++---- test/unit/concurrency-Queue-test.js | 19 ++++++------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/test/unit/ContentstackClient-test.js b/test/unit/ContentstackClient-test.js index 7bd42a1..7608cff 100644 --- a/test/unit/ContentstackClient-test.js +++ b/test/unit/ContentstackClient-test.js @@ -8,7 +8,7 @@ var host = 'http://localhost/' describe('Contentstack Client', () => { beforeEach(function () { - host = 'http://localhost/' + host = 'localhost' axios.defaults.host = host axios.defaults.adapter = 'http' }) @@ -21,7 +21,7 @@ describe('Contentstack Client', () => { it('Contentstack Client login success', done => { var mock = new MockAdapter(axios) - mock.onPost('/user-session').reply(200, { + mock.onPost('https://localhost:443/v3/user-session').reply(200, { user: { authtoken: 'Test Auth' } @@ -37,7 +37,7 @@ describe('Contentstack Client', () => { it('Contentstack Client Logout with Authtoken', done => { var mock = new MockAdapter(axios) - mock.onDelete('/user-session').reply(200, { + mock.onDelete('https://localhost:443/v3/user-session').reply(200, { notice: 'You\'ve logged out successfully' }) ContentstackClient({ http: axios }) @@ -51,7 +51,7 @@ describe('Contentstack Client', () => { it('Contentstack Client Logout', done => { var mock = new MockAdapter(axios) - mock.onDelete('/user-session').reply(200, { + mock.onDelete('https://localhost:443/v3/user-session').reply(200, { notice: 'You\'ve logged out successfully' }) axios.defaults.headers = { diff --git a/test/unit/concurrency-Queue-test.js b/test/unit/concurrency-Queue-test.js index 36550d1..e866e1b 100644 --- a/test/unit/concurrency-Queue-test.js +++ b/test/unit/concurrency-Queue-test.js @@ -130,22 +130,15 @@ describe('Concurrency queue test', () => { }) it('Refresh Token on 401 with 1000 concurrent request', done => { - var mock = new MockAdapter(axios) - mock.onPost('/user-session').reply(200, { - token - }) - const axiosClient = client({ - baseURL: `${host}:${port}`, - authorization: 'Bearer ', + const axiosClient = client({ + baseURL: `${host}:${port}`, + authorization: 'Bearer ', logHandler: logHandlerStub, refreshToken: () => { - return new Promise((resolve, reject) => { - return contentstackClient({ http: axios }).login().then((res) => { - resolve({ authorization: res.token }) - }).catch((error) => { - reject(error) + return Axios.post(`${host}:${port}/user-session`) + .then((res) => { + return { authorization: res.data.token } }) - }) } }) Promise.all(sequence(1003).map(() => axiosClient.axiosInstance.get('/unauthorized'))) From 13ddc62b322b55ca9e95ebd25dec09272ab57284 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 16:59:01 +0530 Subject: [PATCH 17/19] Add region-specific login tests for Contentstack Client --- test/unit/ContentstackClient-test.js | 87 +++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 15 deletions(-) diff --git a/test/unit/ContentstackClient-test.js b/test/unit/ContentstackClient-test.js index 7608cff..6212e6b 100644 --- a/test/unit/ContentstackClient-test.js +++ b/test/unit/ContentstackClient-test.js @@ -4,7 +4,27 @@ import { expect } from 'chai' import { describe, it, beforeEach } from 'mocha' import MockAdapter from 'axios-mock-adapter' import Region from '../../lib/core/region' -var host = 'http://localhost/' +var host = 'localhost' + +describe('Region Test ', () => { + it('Contentstack Client login success with region NA', done => { + var mock = new MockAdapter(axios) + axios.defaults.region = Region.NA + mock.onPost('https://api.contentstack.io:443/v3/user-session').reply(200, { + user: { + authtoken: 'Test Auth' + } + }) + + ContentstackClient({ http: axios }) + .login() + .then((response) => { + expect(response.user.authtoken).to.be.equal('Test Auth') + done() + }) + .catch(done) + }) +}) describe('Contentstack Client', () => { beforeEach(function () { @@ -101,20 +121,57 @@ describe('Contentstack Client', () => { done() }) - it('Contentstack Client login success with region', done => { - var mock = new MockAdapter(axios) - axios.defaults.region = Region.AZURE_NA - mock.onPost('https://azure-na-api.contentstack.com:443/v3/user-session').reply(200, { - user: { - authtoken: 'Test Auth' - } + it('Contentstack Client login success with region AZURE-NA', done => { + var mock = new MockAdapter(axios) + axios.defaults.region = Region.AZURE_NA + mock.onPost('https://azure-na-api.contentstack.com:443/v3/user-session').reply(200, { + user: { + authtoken: 'Test Auth' + } + }) + + ContentstackClient({ http: axios }) + .login() + .then((response) => { + expect(response.user.authtoken).to.be.equal('Test Auth') + done() }) - ContentstackClient({ http: axios }) - .login() - .then((response) => { - expect(response.user.authtoken).to.be.equal('Test Auth') - done() - }) - .catch(done) + .catch(done) + }) + + it('Contentstack Client login success with region AZURE-EU', done => { + var mock = new MockAdapter(axios) + axios.defaults.region = Region.AZURE_EU + mock.onPost('https://azure-eu-api.contentstack.com:443/v3/user-session').reply(200, { + user: { + authtoken: 'Test Auth' + } + }) + + ContentstackClient({ http: axios }) + .login() + .then((response) => { + expect(response.user.authtoken).to.be.equal('Test Auth') + done() + }) + .catch(done) + }) + + it('Contentstack Client login success with region GCP-NA', done => { + var mock = new MockAdapter(axios) + axios.defaults.region = Region.GCP_NA + mock.onPost('https://gcp-na-api.contentstack.com:443/v3/user-session').reply(200, { + user: { + authtoken: 'Test Auth' + } + }) + + ContentstackClient({ http: axios }) + .login() + .then((response) => { + expect(response.user.authtoken).to.be.equal('Test Auth') + done() + }) + .catch(done) }) }) From 6e36896bafce6e7451d2793c1321664923d81808 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 18:15:14 +0530 Subject: [PATCH 18/19] Update version to 1.2.7 in package.json, package-lock.json, and CHANGELOG; modify region variable in sanity-report.mjs --- CHANGELOG.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- sanity-report.mjs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d883792..6ab4efd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-05-14) +## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-05-15) - Fixed base URL path logic in contentstackClient to handle when region and host not provided ## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-03-03) diff --git a/package-lock.json b/package-lock.json index 40cf9b3..f077d0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/marketplace-sdk", - "version": "1.3.0", + "version": "1.2.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/marketplace-sdk", - "version": "1.3.0", + "version": "1.2.7", "license": "MIT", "dependencies": { "axios": "^1.8.3" diff --git a/package.json b/package.json index 0c4cec3..ae09f59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/marketplace-sdk", - "version": "1.3.0", + "version": "1.2.7", "description": "The Contentstack Marketplace SDK is used to manage the content of your Contentstack marketplace apps", "main": "./dist/node/contentstack-marketplace.js", "browser": "./dist/web/contentstack-marketplace.js", diff --git a/sanity-report.mjs b/sanity-report.mjs index 2b775e5..9fcd909 100644 --- a/sanity-report.mjs +++ b/sanity-report.mjs @@ -26,7 +26,7 @@ console.log(`Pending Tests: ${pendingTests}`) console.log(`Total Duration: ${durationInMinutes}m ${durationInSeconds.toFixed(2)}s`) const host = process.env.DEFAULTHOST || '' -let region = 'AWS-NA' +let region = 'NA' const match = host.match(/^([^-]+(?:-[^-]+)*)-api/) if (match && match[1]) { From fe4e66825ee5260b617a14e5385e6a6fa4abfe95 Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Wed, 14 May 2025 18:34:55 +0530 Subject: [PATCH 19/19] add optional chaining for http.defaults.host in contentstackClient --- lib/contentstackClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/contentstackClient.js b/lib/contentstackClient.js index 7b99522..7947011 100644 --- a/lib/contentstackClient.js +++ b/lib/contentstackClient.js @@ -31,7 +31,7 @@ export default function contentstackClient ({ http }) { if (region && region !== Region.NA) { baseUrlPath = `https://${region}-api.contentstack.com:443/v3/user-session` - } else if (!region && http.defaults.host) { + } else if (!region && http?.defaults?.host) { baseUrlPath = `https://${http.defaults.host}:443/v3/user-session` } else { baseUrlPath = `https://api.contentstack.io:443/v3/user-session`