Skip to content

Commit 74a0ae4

Browse files
Merge master into feat/taxonomy-publishing
2 parents c945819 + f078ff6 commit 74a0ae4

29 files changed

+3672
-2092
lines changed

.github/workflows/check-branch.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Comment PR
11-
if: github.base_ref == 'master' && github.head_ref != 'staging'
11+
if: github.base_ref == 'master' && github.head_ref != 'developement'
1212
uses: thollander/actions-comment-pull-request@v2
1313
with:
1414
message: |
15-
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
15+
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the development branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
1616
- name: Check branch
17-
if: github.base_ref == 'master' && github.head_ref != 'staging'
17+
if: github.base_ref == 'master' && github.head_ref != 'development'
1818
run: |
19-
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
19+
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the development branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
2020
exit 1
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Ensures package.json and CHANGELOG.md are bumped compared to the latest tag when relevant files change.
2+
name: Check Version Bump
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- 'package.json'
8+
- 'CHANGELOG.md'
9+
10+
jobs:
11+
version-bump:
12+
name: Version & Changelog bump
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22.x'
24+
25+
- name: Check version bump
26+
run: |
27+
set -e
28+
PKG_VERSION=$(node -p "require('./package.json').version.replace(/^v/, '')")
29+
if [ -z "$PKG_VERSION" ]; then
30+
echo "::error::Could not read version from package.json"
31+
exit 1
32+
fi
33+
git fetch --tags --force 2>/dev/null || true
34+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
35+
if [ -z "$LATEST_TAG" ]; then
36+
echo "No existing tags found. Skipping version-bump check (first release)."
37+
exit 0
38+
fi
39+
LATEST_VERSION="${LATEST_TAG#v}"
40+
LATEST_VERSION="${LATEST_VERSION%%-*}"
41+
if [ "$(printf '%s\n' "$LATEST_VERSION" "$PKG_VERSION" | sort -V | tail -1)" != "$PKG_VERSION" ]; then
42+
echo "::error::Version bump required: package.json version ($PKG_VERSION) is not greater than latest tag ($LATEST_TAG). Please bump the version in package.json."
43+
exit 1
44+
fi
45+
if [ "$PKG_VERSION" = "$LATEST_VERSION" ]; then
46+
echo "::error::Version bump required: package.json version ($PKG_VERSION) equals latest tag ($LATEST_TAG). Please bump the version in package.json."
47+
exit 1
48+
fi
49+
CHANGELOG_VERSION=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CHANGELOG.md | head -1)
50+
if [ -z "$CHANGELOG_VERSION" ]; then
51+
echo "::error::Could not find a version entry in CHANGELOG.md (expected line like '## [v1.0.0](...)')."
52+
exit 1
53+
fi
54+
if [ "$CHANGELOG_VERSION" != "$PKG_VERSION" ]; then
55+
echo "::error::CHANGELOG version mismatch: CHANGELOG.md top version ($CHANGELOG_VERSION) does not match package.json version ($PKG_VERSION). Please add or update the CHANGELOG entry for $PKG_VERSION."
56+
exit 1
57+
fi
58+
echo "Version bump check passed: package.json and CHANGELOG.md are at $PKG_VERSION (latest tag: $LATEST_TAG)."

.github/workflows/sca-scan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ jobs:
1313
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1414
with:
1515
args: --all-projects --fail-on=all
16+
json: true
17+
continue-on-error: true
18+
- uses: contentstack/sca-policy@main

.github/workflows/unit-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- master
66
- main
7-
- staging
87
- development
98
jobs:
109
build-test:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,7 @@ tsconfig.json
6868
.dccache
6969
dist
7070
jsdocs
71-
.early.coverage
71+
.early.coverage
72+
# Snyk Security Extension - AI Rules (auto-generated)
73+
.cursor/rules/snyk_rules.mdc
74+
.vscode/settings.json

.husky/post-checkout

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env sh
2+
# When switching to a branch that doesn't exist on remote (e.g. newly created),
3+
# pull and merge origin/main or origin/master into current branch. Does not push.
4+
5+
# Only run on branch checkout (not file checkout)
6+
if [ "$3" != "1" ]; then
7+
exit 0
8+
fi
9+
10+
# Skip if we don't have a remote
11+
if ! git rev-parse --verify origin 2>/dev/null; then
12+
exit 0
13+
fi
14+
15+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
16+
17+
# Skip main/master/development - no need to merge base into these
18+
case "$CURRENT_BRANCH" in
19+
main|master|development) exit 0 ;;
20+
esac
21+
22+
# Only run when current branch does not exist on origin (treat as new local branch)
23+
if git ls-remote --heads origin "$CURRENT_BRANCH" 2>/dev/null | grep -q .; then
24+
echo "post-checkout: $CURRENT_BRANCH exists on origin, skipping merge."
25+
exit 0
26+
fi
27+
28+
# Prefer main, fallback to master
29+
if git rev-parse --verify origin/main 2>/dev/null; then
30+
BASE=origin/main
31+
elif git rev-parse --verify origin/master 2>/dev/null; then
32+
BASE=origin/master
33+
else
34+
exit 0
35+
fi
36+
37+
echo "New branch detected: merging latest $BASE into $CURRENT_BRANCH (local only, not pushing)..."
38+
git fetch origin
39+
git merge "$BASE" --no-edit --no-ff
40+
echo "Done. Merge is local only; push when ready."

.talismanrc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
fileignoreconfig:
2+
- filename: lib/contentstackClient.js
3+
checksum: f564f6eee5c17dc73abdeab4be226a3b37942893e149d907d2a4ef415c485c5e
24
- filename: test/unit/globalField-test.js
35
checksum: 25185e3400a12e10a043dc47502d8f30b7e1c4f2b6b4d3b8b55cdc19850c48bf
46
- filename: lib/stack/index.js
@@ -9,7 +11,9 @@ fileignoreconfig:
911
ignore_detectors:
1012
- filecontent
1113
- filename: package-lock.json
12-
checksum: 17b5bbabcc58beaa180a7fa931fc3fb407ee0e3447d47da224f60118c0a4c294
14+
checksum: 4a58eb4ee1f54d68387bd005fb76e83a02461441c647d94017743d3442c0f476
15+
- filename: test/unit/ContentstackClient-test.js
16+
checksum: 5d8519b5b93c715e911a62b4033614cc4fb3596eabf31c7216ecb4cc08604a73
1317
- filename: .husky/pre-commit
1418
checksum: 52a664f536cf5d1be0bea19cb6031ca6e8107b45b6314fe7d47b7fad7d800632
1519
- filename: test/sanity-check/api/user-test.js
@@ -26,15 +30,14 @@ fileignoreconfig:
2630
checksum: e8a32ffbbbdba2a15f3d327273f0a5b4eb33cf84cd346562596ab697125bbbc6
2731
- filename: test/sanity-check/api/bulkOperation-test.js
2832
checksum: f40a14c84ab9a194aaf830ca68e14afde2ef83496a07d4a6393d7e0bed15fb0e
29-
- filename: lib/contentstackClient.js
30-
checksum: b76ca091caa3a1b2658cd422a2d8ef3ac9996aea0aff3f982d56bb309a3d9fde
31-
- filename: test/unit/ContentstackClient-test.js
32-
checksum: 974a4f335aef025b657d139bb290233a69bed1976b947c3c674e97baffe4ce2f
3333
- filename: test/unit/ContentstackHTTPClient-test.js
3434
checksum: 4043efd843e24da9afd0272c55ef4b0432e3374b2ca12b913f1a6654df3f62be
3535
- filename: test/unit/contentstack-test.js
3636
checksum: 2597efae3c1ab8cc173d5bf205f1c76932211f8e0eb2a16444e055d83481976c
37+
- filename: test/unit/concurrency-Queue-test.js
38+
checksum: 186438f9eb9ba4e7fd7f335dbea2afbae9ae969b7ae3ab1b517ec7a1633d255e
3739
version: "1.0"
3840

3941

4042

43+

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## [v1.28.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.5) (2026-03-02)
4+
- Enh
5+
- Added DAM 2.0 query support
6+
7+
## [v1.27.6](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.5) (2026-02-23)
8+
- Fix
9+
- Skip token refresh on 401 when API returns error_code 161 (environment/permission) so the actual API error is returned instead of triggering refresh and a generic "Unable to refresh token" message
10+
- When token refresh fails after a 401, return the original API error (error_message, error_code) instead of the generic "Unable to refresh token" message
11+
12+
## [v1.27.5](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.5) (2026-02-11)
13+
- Fix
14+
- Concurrency queue: when response errors have no `config` (e.g. after network retries exhaust in some environments, or when plugins return a new error object), the SDK now rejects with a catchable Error instead of throwing an unhandled TypeError and crashing the process
15+
- Hardened `responseHandler` to safely handle errors without `config` (e.g. plugin-replaced errors) by guarding `config.onComplete` and still running queue `shift()` so rejections remain catchable
16+
- Added optional chaining for `error.config` reads in the retry path and unit tests for missing-config scenarios
17+
18+
## [v1.27.4](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.4) (2026-02-02)
19+
- Fix
20+
- Removed content-type header from the release delete method
21+
- Plugin `onResponse` hook is now called for error responses; errors handled by the concurrency queue (e.g. 5xx, retries exhausted) were previously not running plugin hooks
22+
23+
## [v1.27.3](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.3) (2026-01-21)
24+
- Fix
25+
- Skip token refresh and preserve error_code 294 when 2FA is required (error_code 294 with 401 status) to prevent error code conversion from 294 to 401
26+
327
## [v1.27.2](https://github.com/contentstack/contentstack-management-javascript/tree/v1.27.2) (2026-01-12)
428
- Enhancement
529
- Improved error messages

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,39 @@ contentstackClient.stack({ api_key: 'API_KEY', management_token: 'MANAGEMENT_TOK
7171
console.log(contenttype)
7272
})
7373
```
74+
75+
### Host and Region Configuration
76+
You can configure the SDK to use a specific region or custom host for API requests.
77+
78+
#### Region
79+
The SDK supports multiple regions. Valid region values are: `NA`, `EU`, `AU`, `AZURE_NA`, `AZURE_EU`, `GCP_NA`, `GCP_EU`. The default region is `NA`.
80+
81+
```javascript
82+
// Use EU region
83+
contentstackClient = contentstack.client({
84+
authtoken: 'AUTHTOKEN',
85+
region: 'EU'
86+
})
87+
```
88+
89+
#### Custom Host
90+
You can specify a custom host for API requests. If both `host` and `region` are provided, the `host` parameter takes priority.
91+
92+
```javascript
93+
// Use custom host
94+
contentstackClient = contentstack.client({
95+
authtoken: 'AUTHTOKEN',
96+
host: 'api.contentstack.io'
97+
})
98+
99+
// Custom host takes priority over region
100+
contentstackClient = contentstack.client({
101+
authtoken: 'AUTHTOKEN',
102+
region: 'EU',
103+
host: 'custom-api.example.com'
104+
})
105+
```
106+
74107
### Contentstack Management JavaScript SDK: 5-minute Quickstart
75108
#### Initializing Your SDK:
76109
To use the JavaScript CMA SDK, you need to first initialize it. To do this, use the following code:
@@ -124,7 +157,7 @@ contentstackClient.stack({ api_key: 'API_KEY' }).asset().create({ asset })
124157
- [Content Management API Docs](https://www.contentstack.com/docs/developers/apis/content-management-api)
125158

126159
### The MIT License (MIT)
127-
Copyright © 2012-2025 [Contentstack](https://www.contentstack.com/). All Rights Reserved
160+
Copyright © 2012-2026 [Contentstack](https://www.contentstack.com/). All Rights Reserved
128161

129162
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
130163

0 commit comments

Comments
 (0)