Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
390f863
Merge pull request #2624 from contentstack/main
harshitha-cstk Jun 30, 2026
cb5c04e
fixed snyk issues
Jul 8, 2026
fa84916
reverted pnpm update
Jul 8, 2026
8a5108a
Merge pull request #2636 from contentstack/fix/snyk-issues-0807
shafeeqd959 Jul 8, 2026
51e643b
Merge branch 'main' into back-merge/main-dev
Jul 14, 2026
4a81da7
Merge pull request #2641 from contentstack/back-merge/main-dev
naman-contentstack Jul 14, 2026
00388af
added org plan check
Jun 30, 2026
927d385
fixed org plan check
Jul 1, 2026
d833aa7
removed invalid urls set in region
Jul 20, 2026
b5011fc
org plan check and endpoints auto update in cli config
Jul 23, 2026
02a6f42
ts config source map false
Jul 23, 2026
e8f5c6c
updated plan guard to use plan from package json
Jul 23, 2026
71acdbf
bumped fast uri package
Jul 23, 2026
3c357c7
Merge pull request #2646 from contentstack/feat/org-plan-key-check-v1
shafeeqd959 Jul 24, 2026
ed2ddc9
bumped cli version
Jul 24, 2026
635f176
Merge branch 'development' of github.com:contentstack/cli into feat/o…
Jul 24, 2026
3414018
bumped cli uitlties version in dependencies
Jul 24, 2026
3b9d480
Merge branch 'development' into feat/org-plan-key-check-v1
Jul 24, 2026
ab5bc9d
updated lock file
Jul 24, 2026
6a02730
Merge pull request #2657 from contentstack/feat/org-plan-key-check-v1
shafeeqd959 Jul 24, 2026
803c433
version bump
Jul 27, 2026
56e6edd
update lockfile
Jul 27, 2026
eaa2868
update lockfile
Jul 27, 2026
be32f00
Merge pull request #2662 from contentstack/version/bump-1
cs-raj Jul 27, 2026
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
@@ -1,4 +1,4 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 4c1a45524e9c7278b90eb3dccfb826fc4c8a0bcab22feafa16fadc613179a685
checksum: a4f592e8bcc46e37d9b118deb6ac0c9a452c3392092cf716b16bae6fb037102d
version: '1.0'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"workspaces": [
"packages/*"
]
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-auth/1.8.4 darwin-arm64 node-v22.21.1
@contentstack/cli-auth/1.8.4 darwin-arm64 node-v22.13.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-auth",
"description": "Contentstack CLI plugin for authentication activities",
"version": "1.8.4",
"version": "1.8.5",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"scripts": {
Expand All @@ -15,8 +15,8 @@
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@contentstack/cli-command": "~1.8.4",
"@contentstack/cli-utilities": "~1.18.5",
"@contentstack/cli-command": "~1.8.5",
"@contentstack/cli-utilities": "~1.19.0",
"@oclif/core": "^4.11.4",
"otplib": "^12.0.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-command",
"description": "Contentstack CLI plugin for configuration",
"version": "1.8.4",
"version": "1.8.5",
"author": "Contentstack",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -14,7 +14,7 @@
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@contentstack/cli-utilities": "~1.18.5",
"@contentstack/cli-utilities": "~1.19.0",
"contentstack": "^3.27.0",
"@oclif/core": "^4.11.4"
},
Expand Down Expand Up @@ -62,4 +62,4 @@
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-command/<%- commandPath %>"
},
"repository": "contentstack/cli"
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-command/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class ContentstackCommand extends Command {

get context() {
// @ts-ignore
return this.config.context || {};
return this.config.context || this.config.options?.context || {};
}

get email() {
Expand Down
5 changes: 3 additions & 2 deletions packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.20.5 darwin-arm64 node-v22.21.1
@contentstack/cli-config/1.20.5 darwin-arm64 node-v22.13.1
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -457,7 +457,7 @@ Set region for CLI
```
USAGE
$ csdx config:set:region [REGION] [-d <value> -m <value> --ui-host <value> -n <value>] [--developer-hub <value>]
[--personalize <value>] [--launch <value>] [--studio <value>]
[--personalize <value>] [--launch <value>] [--studio <value>] [--auth-api <value>]

ARGUMENTS
[REGION] Name for the region
Expand All @@ -468,6 +468,7 @@ FLAGS
-m, --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host
and name flags are required
-n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are required
--auth-api=<value> Custom host to set for Auth API
--developer-hub=<value> Custom host to set for Developer hub API
--launch=<value> Custom host to set for Launch API
--personalize=<value> Custom host to set for Personalize API
Expand Down
8 changes: 4 additions & 4 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "1.20.5",
"version": "1.21.0",
"author": "Contentstack",
"scripts": {
"build": "pnpm compile && oclif manifest && oclif readme",
Expand All @@ -14,8 +14,8 @@
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@contentstack/cli-command": "~1.8.4",
"@contentstack/cli-utilities": "~1.18.5",
"@contentstack/cli-command": "~1.8.5",
"@contentstack/cli-utilities": "~1.19.0",
"@contentstack/utils": "~1.9.1",
"@oclif/core": "^4.11.4"
},
Expand Down Expand Up @@ -91,4 +91,4 @@
}
},
"repository": "contentstack/cli"
}
}
18 changes: 18 additions & 0 deletions packages/contentstack-config/src/commands/config/set/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
studio: _flags.string({
description: 'Custom host to set for Studio API',
}),
'auth-api': _flags.string({
description: 'Custom host to set for Auth API',
}),
};
static examples = [
'$ csdx config:set:region',
Expand Down Expand Up @@ -83,6 +86,7 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
let personalizeUrl = regionSetFlags['personalize'];
let launchHubUrl = regionSetFlags['launch'];
let composableStudioUrl = regionSetFlags['studio'];
let authUrl = regionSetFlags['auth-api'];
let selectedRegion = args.region;
if (!(cda && cma && uiHost && name) && !selectedRegion) {
selectedRegion = await interactive.askRegions();
Expand Down Expand Up @@ -113,6 +117,9 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
if (!composableStudioUrl) {
composableStudioUrl = this.transformUrl(cma, 'composable-studio-api');
}
if (!authUrl) {
authUrl = this.transformUrl(cma, 'auth-api');
}
let customRegion: Region = {
cda,
cma,
Expand All @@ -122,6 +129,16 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
personalizeUrl,
launchHubUrl,
composableStudioUrl,
endpoints: {
contentManagement: cma,
contentDelivery: cda,
application: uiHost,
developerHub: developerHubUrl,
launch: launchHubUrl,
personalizeManagement: personalizeUrl,
composableStudio: composableStudioUrl,
auth: authUrl,
},
};
customRegion = regionHandler.setCustomRegion(customRegion);
await authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
Expand All @@ -133,6 +150,7 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
cliux.success(`Personalize URL: ${customRegion.personalizeUrl}`);
cliux.success(`Launch URL: ${customRegion.launchHubUrl}`);
cliux.success(`Studio URL: ${customRegion.composableStudioUrl}`);
cliux.success(`Auth API URL: ${customRegion.endpoints?.auth}`);
} catch (error) {
handleAndLogError(error, { ...this.contextDetails, module: 'config-set-region' });
}
Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-config/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface Region {
personalizeUrl: string;
launchHubUrl: string;
composableStudioUrl: string;
endpoints?: Record<string, string>;
}

export interface Limit {
Expand All @@ -42,4 +43,4 @@ export interface SetRateLimitConfig {

export interface RegionsMap {
[key: string]: Region;
}
}
67 changes: 21 additions & 46 deletions packages/contentstack-config/src/utils/region-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configHandler } from '@contentstack/cli-utilities';
import { getContentstackEndpoint } from '@contentstack/utils';
import { configHandler, resolveCanonicalEndpoints, buildRegionFromEndpoints } from '@contentstack/cli-utilities';
import { Region, RegionsMap } from '../interfaces';

function validURL(str) {
Expand All @@ -23,49 +22,21 @@ function validURL(str) {
* @returns {object} Region object with all necessary URLs
*/
function getRegionObject(regionKey: string): Region {
try {
// getContentstackEndpoint handles all aliases defined in regions.json
const endpoints = getContentstackEndpoint(regionKey) as any;

if (typeof endpoints === 'string') {
throw new Error('Invalid endpoint response');
}

return {
name: regionKey,
cma: endpoints.contentManagement,
cda: endpoints.contentDelivery,
uiHost: endpoints.application,
developerHubUrl: endpoints.developerHub,
launchHubUrl: endpoints.launch,
personalizeUrl: endpoints.personalizeManagement,
composableStudioUrl: endpoints.composableStudio,
};
} catch {
return null;
}
// resolveCanonicalEndpoints handles all aliases defined in regions.json
const endpoints = resolveCanonicalEndpoints(regionKey);
if (!endpoints) return null;
return buildRegionFromEndpoints(regionKey, endpoints) as Region;
}

/**
* Get all available regions dynamically
* This creates a regions object similar to the old hardcoded one but using @contentstack/utils
*/
function getAvailableRegions() {
const regionKeys = [
'NA',
'AWS-NA',
'EU',
'AWS-EU',
'AU',
'AWS-AU',
'AZURE-NA',
'AZURE-EU',
'GCP-NA',
'GCP-EU',
];
const regionKeys = ['NA', 'AWS-NA', 'EU', 'AWS-EU', 'AU', 'AWS-AU', 'AZURE-NA', 'AZURE-EU', 'GCP-NA', 'GCP-EU'];

const regions: RegionsMap = {};

for (const key of regionKeys) {
const regionObj = getRegionObject(key);
if (regionObj) {
Expand Down Expand Up @@ -157,18 +128,22 @@ class UserConfig {
* @returns { object } JSON object with only valid keys for region
*/
sanitizeRegionObject(regionObject) {
const sanitizedRegion = {
cma: regionObject.cma,
cda: regionObject.cda,
uiHost: regionObject.uiHost,
name: regionObject.name,
developerHubUrl: regionObject['developerHubUrl'],
personalizeUrl: regionObject['personalizeUrl'],
launchHubUrl: regionObject['launchHubUrl'],
composableStudioUrl: regionObject['composableStudioUrl'],
// endpoints is the single source of truth — every friendly field (cma, cda, ...,
// authUrl) is derived from it below via buildRegionFromEndpoints, same as named
// regions. Falls back to synthesizing endpoints from the individual raw fields
// when the caller didn't supply one directly.
const endpoints = regionObject['endpoints'] ?? {
contentManagement: regionObject.cma,
contentDelivery: regionObject.cda,
application: regionObject.uiHost,
developerHub: regionObject['developerHubUrl'],
launch: regionObject['launchHubUrl'],
personalizeManagement: regionObject['personalizeUrl'],
composableStudio: regionObject['composableStudioUrl'],
auth: regionObject['authUrl'],
};

return sanitizedRegion;
return buildRegionFromEndpoints(regionObject.name, endpoints);
}
}

Expand Down
81 changes: 80 additions & 1 deletion packages/contentstack-config/test/unit/commands/region.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,86 @@ describe('Region command', function () {
composableStudioUrl: 'https://custom-composable-studio.com',
};
const result = UserConfig.setCustomRegion(customRegion);
expect(result).to.deep.equal(customRegion);
expect(result.cma).to.equal(customRegion.cma);
expect(result.cda).to.equal(customRegion.cda);
expect(result.uiHost).to.equal(customRegion.uiHost);
expect(result.name).to.equal(customRegion.name);
expect(result.developerHubUrl).to.equal(customRegion.developerHubUrl);
expect(result.personalizeUrl).to.equal(customRegion.personalizeUrl);
expect(result.launchHubUrl).to.equal(customRegion.launchHubUrl);
expect(result.composableStudioUrl).to.equal(customRegion.composableStudioUrl);
});

it('should include a matching endpoints object for a custom region without an auth host', function () {
const customRegion = {
cma: 'https://custom-cma.com',
cda: 'https://custom-cda.com',
uiHost: 'https://custom-ui.com',
name: 'Custom Region',
developerHubUrl: 'https://custom-developer-hub.com',
personalizeUrl: 'https://custom-personalize.com',
launchHubUrl: 'https://custom-launch.com',
composableStudioUrl: 'https://custom-composable-studio.com',
};
const result = UserConfig.setCustomRegion(customRegion);
expect(result.endpoints).to.deep.equal({
contentManagement: customRegion.cma,
contentDelivery: customRegion.cda,
application: customRegion.uiHost,
developerHub: customRegion.developerHubUrl,
launch: customRegion.launchHubUrl,
personalizeManagement: customRegion.personalizeUrl,
composableStudio: customRegion.composableStudioUrl,
auth: undefined,
});
});

it('should preserve an explicitly supplied endpoints object for a custom region', function () {
const endpoints = {
contentManagement: 'https://custom-cma.com',
contentDelivery: 'https://custom-cda.com',
application: 'https://custom-ui.com',
auth: 'https://custom-auth.com',
};
const customRegion = {
cma: 'https://custom-cma.com',
cda: 'https://custom-cda.com',
uiHost: 'https://custom-ui.com',
name: 'Custom Region',
endpoints,
};
const result = UserConfig.setCustomRegion(customRegion);
expect(result.cma).to.equal(endpoints.contentManagement);
expect(result.cda).to.equal(endpoints.contentDelivery);
expect(result.uiHost).to.equal(endpoints.application);
expect(result.endpoints).to.deep.equal(endpoints);
});

it('should not fall back to a stale legacy authUrl input once endpoints.auth is supplied', function () {
// endpoints is the single source of truth: a stale/mismatched top-level
// authUrl on the raw input is never used — only endpoints.auth matters.
const customRegion = {
cma: 'https://custom-cma.com',
cda: 'https://custom-cda.com',
uiHost: 'https://custom-ui.com',
name: 'Custom Region',
authUrl: 'https://stale-auth.com',
endpoints: {
contentManagement: 'https://custom-cma.com',
contentDelivery: 'https://custom-cda.com',
application: 'https://custom-ui.com',
auth: 'https://correct-auth.com',
},
};
const result = UserConfig.setCustomRegion(customRegion);
expect(result.endpoints.auth).to.equal('https://correct-auth.com');
});

it('should include the full endpoints passthrough (incl. auth) for named regions', function () {
const result = UserConfig.setRegion('NA');
expect(result.endpoints).to.be.an('object');
expect(result.endpoints.auth).to.equal('https://auth-api.contentstack.com');
expect(result.endpoints.contentManagement).to.equal(result.cma);
});

it('should sanitize region object to only include valid properties', function () {
Expand Down
Loading
Loading