musora-content-services 2.28.4 → 2.28.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.28.5](https://github.com/railroadmedia/musora-content-services/compare/v2.28.4...v2.28.5) (2025-07-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **nullcheck:** patch for null sanity results and null check in relatedByLicense ([#382](https://github.com/railroadmedia/musora-content-services/issues/382)) ([05a3e06](https://github.com/railroadmedia/musora-content-services/commit/05a3e068d19cac244eda52203e124f6e8603bdf6))
11
+
5
12
  ### [2.28.4](https://github.com/railroadmedia/musora-content-services/compare/v2.28.3...v2.28.4) (2025-07-25)
6
13
 
7
14
  ### [2.28.3](https://github.com/railroadmedia/musora-content-services/compare/v2.28.2...v2.28.3) (2025-07-25)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.28.4",
3
+ "version": "2.28.5",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
File without changes
@@ -565,15 +565,17 @@ export async function fetchContentRows(brand, pageName, contentRowSlug)
565
565
  if (pageName === 'lessons') pageName = 'lesson'
566
566
  if (pageName === 'songs') pageName = 'song'
567
567
  const rowString = contentRowSlug ? ` && slug.current == "${contentRowSlug.toLowerCase()}"` : ''
568
- return fetchSanity(`*[_type == 'recommended-content-row' && brand == '${brand}' && type == '${pageName}'${rowString}]{
568
+ const childFilter = await new FilterBuilder('', {isChildrenFilter: true}).buildFilter()
569
+ const query = `*[_type == 'recommended-content-row' && brand == '${brand}' && type == '${pageName}'${rowString}]{
569
570
  brand,
570
571
  name,
571
572
  'slug': slug.current,
572
- 'content': content[]->{
573
- 'children': child[]->{ 'id': railcontent_id, 'children': child[]->{'id': railcontent_id}, },
573
+ 'content': content[${childFilter}]->{
574
+ 'children': child[${childFilter}]->{ 'id': railcontent_id, 'children': child[${childFilter}]->{'id': railcontent_id}, },
574
575
  ${getFieldsForContentType('tab-data')}
575
576
  },
576
- }`, true)
577
+ }`
578
+ return fetchSanity(query, true)
577
579
  }
578
580
 
579
581
 
@@ -1265,7 +1267,7 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
1265
1267
  *[${filterSongTypesWithSameLicense}]->{${queryFields}}|order(published_on desc, title asc)[0...${count}],
1266
1268
  }[0...1]`
1267
1269
  const results = await fetchSanity(query, false)
1268
- return results['related_by_license'] ?? []
1270
+ return results ? results['related_by_license'] ?? [] : []
1269
1271
  }
1270
1272
 
1271
1273
  /**
@@ -1862,6 +1864,9 @@ export async function fetchSanity(
1862
1864
  console.log('fetchSanity Results:', result)
1863
1865
  }
1864
1866
  let results = isList ? result.result : result.result[0]
1867
+ if (!results) {
1868
+ throw new Error('No results found')
1869
+ }
1865
1870
  results = processNeedAccess
1866
1871
  ? await needsAccessDecorator(results, userPermissions, isAdmin)
1867
1872
  : results