Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v1.21.1](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.1) (2025-05-12)
- Fix
- Fixed unexpected fallback_locale behavior during direct locale updates.

## [v1.21.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.0) (2025-05-05)
- Enhancement
- Region support added
Expand Down
7 changes: 6 additions & 1 deletion lib/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ export const update = (http, type, params = {}) => {
delete json.deleted_at
delete json.updated_at
delete json.updated_by
delete json.updated_at

// If param has data for this entity type, merge it with the json object
if (param && param[type]) {
Object.assign(json, param[type])
}

if (type) {
updateData[type] = json
if (type === 'entry') updateData[type] = cleanAssets(updateData[type])
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/management",
"version": "1.21.0",
"version": "1.21.1",
"description": "The Content Management API is used to manage the content of your Contentstack account",
"main": "./dist/node/contentstack-management.js",
"browser": "./dist/web/contentstack-management.js",
Expand Down
4 changes: 2 additions & 2 deletions sanity-report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs'

dotenv.config()

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

Expand All @@ -26,7 +26,7 @@ console.log(`Pending Tests: ${pendingTests}`)
console.log(`Total Duration: ${durationInMinutes}m ${durationInSeconds.toFixed(2)}s`)

const slackMessage = `
*JavaScript CMA Report*
*JavaScript CMA Report DX-2896 (fallback locale update) *
• Total Suites: *${totalSuites}*
• Total Tests: *${totalTests}*
• Passed Tests: *${passedTests}*
Expand Down
23 changes: 20 additions & 3 deletions test/sanity-check/api/locale-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ describe('Locale api Test', () => {
.catch(done)
})

it('should get and update a language Hindi - India', done => {
it('should get and update a language Hindi - India with fallback locale en-at', done => {
makeLocale('hi-in')
.fetch()
.then((locale) => {
locale.fallback_locale = 'en-at'
return locale.update()
// locale.fallback_locale = 'en-at'
return locale.update({ locale: { fallback_locale: 'en-at' } })
})
.then((locale) => {
expect(locale.code).to.be.equal('hi-in')
Expand All @@ -111,6 +111,23 @@ describe('Locale api Test', () => {
.catch(done)
})

it('should get and update a language Hindi - India with fallback locale en-us', done => {
makeLocale('hi-in')
.fetch()
.then((locale) => {
locale.fallback_locale = 'en-us'
return locale.update()
})
.then((locale) => {
expect(locale.code).to.be.equal('hi-in')
expect(locale.name).to.be.equal('Hindi - India')
expect(locale.fallback_locale).to.be.equal('en-us')
expect(locale.uid).to.be.not.equal(null)
done()
})
.catch(done)
})

it('should delete language: Hindi - India', done => {
makeLocale('mr-in')
.delete()
Expand Down
Loading