Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fileignoreconfig:
- filename: test/unit/mock/execution-mock.js
checksum: 89d239d37c9d8d0cdb6ac61553a7d2e2d9115a10207f7c0b387c3565c9cb6564
- filename: package-lock.json
checksum: e165fb372305f63445958fa6d660e5837ce419e6ca2284d4aece47b3753e24b1
checksum: c086a7e383c7d43ec08f52b02c288702304a34e88b4f22ab0e4fa96524a77174
- filename: docdash-template/fixtures/documents/probe.js
checksum: e841ecf889d0e82367c53c48ee0b3be8bd68d7babf4777a87ced769f29686ac4
- filename: docdash-template/.travis.yml
Expand Down
21 changes: 11 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Changelog

## [v1.4.1](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.1) (2025-10-28)
- Enhancement: Add region configuration and endpoint retrieval for cloud services
- Enhancement: Support for Azure and GCP regions with multi-cloud endpoint management
- Enhancement: New `getRegionEndpoint` utility function to retrieve region-specific service endpoints
## [v1.4.2](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.2) (2026-01-12)
- Enhancement: Improved error messages

## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.0) (2024-08-25)
## [v1.4.1](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.1) (2026-01-05)
- Fix: Security issues

## [v1.4.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.4.0) (2025-08-25)
- Enhancement: Retry logic to make use of x-ratelimit-remaining header

## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2024-08-11)
## [v1.3.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.3.0) (2025-08-11)
- Enh: Add search function to query apps by names

## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (2024-08-04)
## [v1.2.9](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.9) (2025-08-04)
- Fix: Fixed the Linting issues
- Updated all the dependency to the latest version
- Added Pre-commit hook to run the snyk and talismand scans

## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (2024-05-26)
## [v1.2.8](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.8) (2025-05-26)

- Fix: Added params support to getInstalledApps method for enhanced flexibility

## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (2024-05-15)
## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.7) (2025-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)
## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2025-03-03)
- Update sanity tests

## [v1.2.5](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.5) (2025-01-17)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2012-2025 Contentstack
Copyright (c) 2012-2026 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
60 changes: 39 additions & 21 deletions lib/assets/regions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"na",
"us",
"aws-na",
"aws_na"
"aws_na",
"NA",
"US",
"AWS-NA",
"AWS_NA"
],
"isDefault": true,
"endpoints": {
Expand All @@ -26,8 +30,8 @@
"launch": "https://launch-api.contentstack.com",
"developerHub": "https://developerhub-api.contentstack.com",
"brandKit": "https://brand-kits-api.contentstack.com",
"genAI": "https://ai.contentstack.com",
"personalize": "https://personalize-api.contentstack.com",
"genAI": "https://ai.contentstack.com/brand-kits",
"personalizeManagement": "https://personalize-api.contentstack.com",
"personalizeEdge": "https://personalize-edge.contentstack.com"
}
},
Expand All @@ -39,7 +43,10 @@
"alias": [
"eu",
"aws-eu",
"aws_eu"
"aws_eu",
"EU",
"AWS-EU",
"AWS_EU"
],
"isDefault": false,
"endpoints": {
Expand All @@ -56,8 +63,8 @@
"launch": "https://eu-launch-api.contentstack.com",
"developerHub": "https://eu-developerhub-api.contentstack.com",
"brandKit": "https://eu-brand-kits-api.contentstack.com",
"genAI": "https://eu-ai.contentstack.com",
"personalize": "https://eu-personalize-api.contentstack.com",
"genAI": "https://eu-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://eu-personalize-api.contentstack.com",
"personalizeEdge": "https://eu-personalize-edge.contentstack.com"
}
},
Expand All @@ -69,7 +76,10 @@
"alias": [
"au",
"aws-au",
"aws_au"
"aws_au",
"AU",
"AWS-AU",
"AWS_AU"
],
"isDefault": false,
"endpoints": {
Expand All @@ -86,8 +96,8 @@
"launch": "https://au-launch-api.contentstack.com",
"developerHub": "https://au-developerhub-api.contentstack.com",
"brandKit": "https://au-brand-kits-api.contentstack.com",
"genAI": "https://au-ai.contentstack.com",
"personalize": "https://au-personalize-api.contentstack.com",
"genAI": "https://au-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://au-personalize-api.contentstack.com",
"personalizeEdge": "https://au-personalize-edge.contentstack.com"
}
},
Expand All @@ -98,7 +108,9 @@
"location": "North America",
"alias": [
"azure-na",
"azure_na"
"azure_na",
"AZURE-NA",
"AZURE_NA"
],
"isDefault": false,
"endpoints": {
Expand All @@ -115,8 +127,8 @@
"launch": "https://azure-na-launch-api.contentstack.com",
"developerHub": "https://azure-na-developerhub-api.contentstack.com",
"brandKit": "https://azure-na-brand-kits-api.contentstack.com",
"genAI": "https://azure-na-ai.contentstack.com",
"personalize": "https://azure-na-personalize-api.contentstack.com",
"genAI": "https://azure-na-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://azure-na-personalize-api.contentstack.com",
"personalizeEdge": "https://azure-na-personalize-edge.contentstack.com"
}
},
Expand All @@ -127,7 +139,9 @@
"location": "Europe",
"alias": [
"azure-eu",
"azure_eu"
"azure_eu",
"AZURE-EU",
"AZURE_EU"
],
"isDefault": false,
"endpoints": {
Expand All @@ -144,8 +158,8 @@
"launch": "https://azure-eu-launch-api.contentstack.com",
"developerHub": "https://azure-eu-developerhub-api.contentstack.com",
"brandKit": "https://azure-eu-brand-kits-api.contentstack.com",
"genAI": "https://azure-eu-ai.contentstack.com",
"personalize": "https://azure-eu-personalize-api.contentstack.com",
"genAI": "https://azure-eu-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://azure-eu-personalize-api.contentstack.com",
"personalizeEdge": "https://azure-eu-personalize-edge.contentstack.com"
}
},
Expand All @@ -156,7 +170,9 @@
"location": "North America",
"alias": [
"gcp-na",
"gcp_na"
"gcp_na",
"GCP-NA",
"GCP_NA"
],
"isDefault": false,
"endpoints": {
Expand All @@ -173,8 +189,8 @@
"launch": "https://gcp-na-launch-api.contentstack.com",
"developerHub": "https://gcp-na-developerhub-api.contentstack.com",
"brandKit": "https://gcp-na-brand-kits-api.contentstack.com",
"genAI": "https://gcp-na-brand-kits-api.contentstack.com",
"personalize": "https://gcp-na-personalize-api.contentstack.com",
"genAI": "https://gcp-na-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://gcp-na-personalize-api.contentstack.com",
"personalizeEdge": "https://gcp-na-personalize-edge.contentstack.com"
}
},
Expand All @@ -185,7 +201,9 @@
"location": "Europe",
"alias": [
"gcp-eu",
"gcp_eu"
"gcp_eu",
"GCP-EU",
"GCP_EU"
],
"isDefault": false,
"endpoints": {
Expand All @@ -202,8 +220,8 @@
"launch": "https://gcp-eu-launch-api.contentstack.com",
"developerHub": "https://gcp-eu-developerhub-api.contentstack.com",
"brandKit": "https://gcp-eu-brand-kits-api.contentstack.com",
"genAI": "https://gcp-eu-brand-kits-api.contentstack.com",
"personalize": "https://gcp-eu-personalize-api.contentstack.com",
"genAI": "https://gcp-eu-ai.contentstack.com/brand-kits",
"personalizeManagement": "https://gcp-eu-personalize-api.contentstack.com",
"personalizeEdge": "https://gcp-eu-personalize-edge.contentstack.com"
}
}
Expand Down
10 changes: 2 additions & 8 deletions lib/contentstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,8 @@ import Region from './core/region.js'
* @prop {function=} params.logHandler - A log handler function to process given log messages & errors.
* @example //Set the `logHandler`
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client({ logHandler: (level, data) => {
if (level === 'error' && data) {
const title = [data.name, data.message].filter((a) => a).join(' - ')
console.error(`[error] ${title}`)
return
}
console.log(`[${level}] ${data}`)
} })
* import { logHandler } from '@contentstack/management/core/messageHandler'
* const client = contentstack.client({ logHandler: logHandler })
*
* @prop {function=} params.refreshToken - Optional function used to refresh token.
* @example // OAuth example
Expand Down
17 changes: 9 additions & 8 deletions lib/contentstackClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import error from './core/contentstackError'
import { Marketplace } from './marketplace/index.js'
import { Region } from './contentstack.js'
import { MESSAGES } from './core/messageHandler.js'

export default function contentstackClient ({ http }) {
/**
Expand All @@ -20,8 +21,8 @@ export default function contentstackClient ({ http }) {
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.login({ email: <emailid>, password: <password> })
* .then(() => console.log('Logged in successfully'))
* client.login({ email: <emailid>, password: <password> })
* .then(() => console.log(MESSAGES.LOGIN_SUCCESS))
*
* client.marketplace()
*/
Expand Down Expand Up @@ -59,8 +60,8 @@ export default function contentstackClient ({ http }) {
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.organization().findAll()
* .then((organization) => console.log(organization))
* client.organization().findAll()
* .then((organization) => console.log(MESSAGES.ORGANIZATION_LOADED))
*
* @example
* import * as contentstack from '@contentstack/management'
Expand All @@ -84,14 +85,14 @@ export default function contentstackClient ({ http }) {
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
* client.logout()
* .then((response) => console.log(response))
* client.logout()
* .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
*
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
* client.logout('AUTHTOKEN')
* .then((response) => console.log(response))
* client.logout('AUTHTOKEN')
* .then((response) => console.log(MESSAGES.API_RESPONSE_SUCCESS))
* */
function logout (authtoken) {
http.defaults.versioningStrategy = 'path'
Expand Down
10 changes: 2 additions & 8 deletions lib/core/contentstackHTTPClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ import clonedeep from 'lodash/cloneDeep'
import Qs from 'qs'
import { ConcurrencyQueue } from './concurrency-queue'
import { isHost } from './Util'
import { httpLogHandler } from './messageHandler.js'

export default function contentstackHttpClient (options) {
const defaultConfig = {
insecure: false,
retryOnError: true,
logHandler: (level, data) => {
if (level === 'error' && data) {
const title = [data.name, data.message].filter((a) => a).join(' - ')
console.error(`[error] ${title}`)
return
}
console.log(`[${level}] ${data}`)
},
logHandler: httpLogHandler,
retryCondition: (error) => {
if (error.response && error.response.status === 429) {
return true
Expand Down
Loading
Loading