Skip to content

Commit 027f8b0

Browse files
authoredMay 7, 2025
Merge pull request #342 from contentstack/development
DX | 12-05-2025 | Release
2 parents 37088e7 + 40645a8 commit 027f8b0

File tree

6 files changed

+34
-8
lines changed

6 files changed

+34
-8
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [v1.21.1](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.1) (2025-05-12)
4+
- Fix
5+
- Fixed unexpected fallback_locale behavior during direct locale updates.
6+
37
## [v1.21.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.0) (2025-05-05)
48
- Enhancement
59
- Region support added

‎lib/entity.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ export const update = (http, type, params = {}) => {
155155
delete json.deleted_at
156156
delete json.updated_at
157157
delete json.updated_by
158-
delete json.updated_at
158+
159+
// If param has data for this entity type, merge it with the json object
160+
if (param && param[type]) {
161+
Object.assign(json, param[type])
162+
}
163+
159164
if (type) {
160165
updateData[type] = json
161166
if (type === 'entry') updateData[type] = cleanAssets(updateData[type])

‎package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/management",
3-
"version": "1.21.0",
3+
"version": "1.21.1",
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",

‎sanity-report.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import fs from 'fs'
55

66
dotenv.config()
77

8-
const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf-8')
8+
const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf8')
99
const mochawesomeReport = JSON.parse(mochawesomeJsonOutput)
1010
const report = `./mochawesome-report/sanity-report.html`
1111

‎test/sanity-check/api/locale-test.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ describe('Locale api Test', () => {
9494
.catch(done)
9595
})
9696

97-
it('should get and update a language Hindi - India', done => {
97+
it('should get and update a language Hindi - India with fallback locale en-at', done => {
9898
makeLocale('hi-in')
9999
.fetch()
100100
.then((locale) => {
101-
locale.fallback_locale = 'en-at'
102-
return locale.update()
101+
// locale.fallback_locale = 'en-at'
102+
return locale.update({ locale: { fallback_locale: 'en-at' } })
103103
})
104104
.then((locale) => {
105105
expect(locale.code).to.be.equal('hi-in')
@@ -111,6 +111,23 @@ describe('Locale api Test', () => {
111111
.catch(done)
112112
})
113113

114+
it('should get and update a language Hindi - India with fallback locale en-us', done => {
115+
makeLocale('hi-in')
116+
.fetch()
117+
.then((locale) => {
118+
locale.fallback_locale = 'en-us'
119+
return locale.update()
120+
})
121+
.then((locale) => {
122+
expect(locale.code).to.be.equal('hi-in')
123+
expect(locale.name).to.be.equal('Hindi - India')
124+
expect(locale.fallback_locale).to.be.equal('en-us')
125+
expect(locale.uid).to.be.not.equal(null)
126+
done()
127+
})
128+
.catch(done)
129+
})
130+
114131
it('should delete language: Hindi - India', done => {
115132
makeLocale('mr-in')
116133
.delete()

0 commit comments

Comments
 (0)