Skip to content

Commit 144ee25

Browse files
Merge pull request #388 from contentstack/staging
DX | 07-07-2025 | Release
2 parents f1ed45b + dd078da commit 144ee25

File tree

12 files changed

+53
-46
lines changed

12 files changed

+53
-46
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ tsconfig.json
6767
.next
6868
.dccache
6969
dist
70-
jsdocs
70+
jsdocs
71+
.early.coverage

.husky/pre-commit

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
#!/usr/bin/env sh
2-
# Pre-commit hook to run Snyk and Talisman scans, completing both before deciding to commit
2+
# Pre-commit hook to run lint, Snyk and Talisman scans, completing all before deciding to commit
33

44
# Function to check if a command exists
55
command_exists() {
66
command -v "$1" >/dev/null 2>&1
77
}
88

9+
# Allow bypassing the hook with an environment variable
10+
if [ "$SKIP_HOOK" = "1" ]; then
11+
echo "Skipping lint, Snyk and Talisman scans (SKIP_HOOK=1)."
12+
exit 0
13+
fi
14+
15+
# Run ESLint check first
16+
echo "Running ESLint check..."
17+
npm run lint
18+
lint_exit_code=$?
19+
20+
if [ $lint_exit_code -ne 0 ]; then
21+
echo "ESLint check failed. Please fix the linting issues and try again."
22+
echo "You can run 'npm run format' to auto-fix most issues."
23+
exit 1
24+
fi
25+
26+
echo "ESLint check passed."
27+
928
# Check if Snyk is installed
1029
if ! command_exists snyk; then
1130
echo "Error: Snyk is not installed. Please install it and try again."
@@ -18,12 +37,6 @@ if ! command_exists talisman; then
1837
exit 1
1938
fi
2039

21-
# Allow bypassing the hook with an environment variable
22-
if [ "$SKIP_HOOK" = "1" ]; then
23-
echo "Skipping Snyk and Talisman scans (SKIP_HOOK=1)."
24-
exit 0
25-
fi
26-
2740
# Initialize variables to track scan results
2841
snyk_failed=false
2942
talisman_failed=false
@@ -63,7 +76,7 @@ if [ "$snyk_failed" = true ] || [ "$talisman_failed" = true ]; then
6376
exit 1
6477
fi
6578

66-
# If both scans pass, allow the commit
67-
echo "All scans passed. Proceeding with commit.cd ."
79+
# If all checks pass, allow the commit
80+
echo "All checks passed (ESLint, Snyk, Talisman). Proceeding with commit."
6881
rm -f snyk_output.log talisman_output.log
6982
exit 0

.talismanrc

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
fileignoreconfig:
2-
- filename: .github/workflows/secrets-scan.yml
3-
ignore_detectors:
4-
- filecontent
5-
- filename: package-lock.json
6-
checksum: 9d0340f9359927d477fe8ab4650642c068c592be63fb817651d866849e0dbbc2
7-
- filename: .husky/pre-commit
8-
checksum: 5baabd7d2c391648163f9371f0e5e9484f8fb90fa2284cfc378732ec3192c193
2+
- filename: .husky/pre-commit
3+
checksum: 52a664f536cf5d1be0bea19cb6031ca6e8107b45b6314fe7d47b7fad7d800632
4+
- filename: test/sanity-check/api/user-test.js
5+
checksum: 6bb8251aad584e09f4d963a913bd0007e5f6e089357a44c3fb1529e3fda5509d
96
version: ""
10-
fileignoreconfig:
11-
- filename: test/unit/globalField-test.js
12-
checksum: 25185e3400a12e10a043dc47502d8f30b7e1c4f2b6b4d3b8b55cdc19850c48bf
13-
version: "1.0"
14-
fileignoreconfig:
15-
- filename: lib/stack/index.js
16-
checksum: 6aab5edf85efb17951418b4dc4402889cd24c8d786c671185074aeb4d50f0242
17-
- filename: test/sanity-check/api/stack-test.js
18-
checksum: 198d5cf7ead33b079249dc3ecdee61a9c57453e93f1073ed0341400983e5aa53
19-
version: "1.0"
20-
fileignoreconfig:
21-
- filename: test/sanity-check/api/previewToken-test.js
22-
checksum: 9a42e079b7c71f76932896a0d2390d86ac626678ab20d36821dcf962820a886c
23-
- filename: lib/stack/deliveryToken/index.js
24-
checksum: 51ae00f07f4cc75c1cd832b311c2e2482f04a8467a0139da6013ceb88fbdda2f
25-
- filename: lib/stack/deliveryToken/previewToken/index.js
26-
checksum: b506f33bffdd20dfc701f964370707f5d7b28a2c05c70665f0edb7b3c53c165b
27-
version: "1.0"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
## [v1.22.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.22.0) (2025-07-07)
3+
- Enhancement
4+
- AWS-AU Region support added
5+
- Fix
6+
- Fixed branch header conflits
27
## [v1.21.7](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.7) (2025-06-30)
38
- Fix
49
- Fixed Request-URI Too Large error

lib/contentstack.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import httpClient from './core/contentstackHTTPClient.js'
1010
const regionHostMap = {
1111
NA: 'api.contentstack.io',
1212
EU: 'eu-api.contentstack.com',
13+
AU: 'au-api.contentstack.com',
1314
AZURE_NA: 'azure-na-api.contentstack.com',
1415
AZURE_EU: 'azure-eu-api.contentstack.com',
1516
GCP_NA: 'gcp-na-api.contentstack.com',

lib/entity.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ export const move = (http, type, force = false, params = {}) => {
313313
try {
314314
let updateData = {}
315315
const json = cloneDeep(this)
316-
delete json.parent_uid
317316
if (type) {
318317
updateData[type] = json
319318
} else {
@@ -328,7 +327,7 @@ export const move = (http, type, force = false, params = {}) => {
328327
if (force === true) {
329328
headers.params.force = true
330329
}
331-
const response = await http.put(`${this.urlPath}/move`, updateData, headers)
330+
const response = await http.put(`${this.urlPath}/move`, param, headers)
332331
if (response.data) {
333332
return new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid, this.taxonomy_uid, http))
334333
} else {

lib/stack/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ export function Stack (http, data) {
168168
this.globalField = (uidOrOptions = null, option = {}) => {
169169
let globalFieldUid = null
170170
let apiVersion = '3.0'
171-
let branch = 'main'
172171
const stackHeaders = { ...this.stackHeaders }
172+
let branch = stackHeaders.branch || http.defaults.headers.branch || 'main'
173173
if (typeof uidOrOptions === 'object' && uidOrOptions !== null) {
174174
option = uidOrOptions
175175
} else {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/management",
3-
"version": "1.21.7",
3+
"version": "1.22.0",
44
"description": "The Content Management API is used to manage the content of your Contentstack account",
55
"main": "./dist/node/contentstack-management.js",
66
"browser": "./dist/web/contentstack-management.js",

test/sanity-check/api/terms-test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,14 @@ describe('Terms API Test', () => {
135135
})
136136

137137
it('should move the term to parent uid passed', done => {
138-
makeTerms(taxonomy.uid, childTerm2.term.uid).fetch()
138+
const term = {
139+
parent_uid: 'term_test_child1',
140+
order: 1
141+
}
142+
makeTerms(taxonomy.uid, childTerm2.term.uid).move({ term, force: true })
139143
.then(async (term) => {
140-
term.parent_uid = null
141-
const moveTerm = await term.move({ force: true })
142-
expect(moveTerm.parent_uid).to.be.equal(null)
144+
expect(term.parent_uid).to.not.equal(null)
143145
done()
144-
return moveTerm
145146
})
146147
.catch(done)
147148
})

0 commit comments

Comments
 (0)