• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 20561370487

29 Dec 2025 12:00AM UTC coverage: 33.231% (+0.2%) from 33.042%
20561370487

push

github

scriptype
Resolve links into node.__links

So CMS can avoid circular references by omitting __links from each node
in contentModel. Find a better way for this omission though.

Extract linking related logic into its own lib/linking.js. And
ContentModelEntryNode implements some linking related methods.

Resolve all links as soon as contentModel subtree is built. The links
are kept all together in nodes's __link attribute. Serialize links into
nodes only during render. Posts need to update their linked-field
facets, so now they do it also just for rendering.

Tests needed for the new linking.js

423 of 3386 branches covered (12.49%)

Branch coverage included in aggregate %.

60 of 80 new or added lines in 7 files covered. (75.0%)

1410 of 2130 relevant lines covered (66.2%)

2845.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/src/cms/api/models/contentModel.js
1
const createContentModelModel = ({ getContentModel }) => {
9✔
2
  return {
216✔
3
    get() {
4
      // TODO: find a nicer way for contentModel to serialize for cms
NEW
5
      return JSON.parse(JSON.stringify(getContentModel(), (key, value) => {
×
NEW
6
        if (key === '__links') {
×
NEW
7
          return undefined
×
8
        }
NEW
9
        return value
×
10
      }))
11
    }
12
  }
13
}
14

15
module.exports = createContentModelModel
9✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc