musora-content-services 2.9.5 → 2.10.0
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: PR Conventional Commit Validation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, edited]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
validate-pr-title:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: PR Conventional Commit Validation
|
|
12
|
+
uses: ytanikin/pr-conventional-commits@1.4.1
|
|
13
|
+
with:
|
|
14
|
+
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'
|
|
15
|
+
custom_labels: '{"feat": "feature", "fix": "fix", "docs": "documentation", "test": "test", "ci": "CI/CD", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert", "wip": "WIP"}'
|
|
16
|
+
add_scope_label: 'false'
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.10.0](https://github.com/railroadmedia/musora-content-services/compare/v2.9.5...v2.10.0) (2025-06-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add media type id ([2690e2c](https://github.com/railroadmedia/musora-content-services/commit/2690e2ccbe07474e51327bd6e5919da7fb96ad47))
|
|
11
|
+
* Any content type should be displayed in “Live Streams” Section if marked as livestream ([285dde9](https://github.com/railroadmedia/musora-content-services/commit/285dde92e74ee606410ff1e1b6981ec81d3e524c))
|
|
12
|
+
* MU2-712 Any content type should be displayed in “Live Streams” Section ([3229950](https://github.com/railroadmedia/musora-content-services/commit/3229950fdeea36e67fcdf8b352d0c3d53219821f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **BEH-547:** collection modules updates ([#300](https://github.com/railroadmedia/musora-content-services/issues/300)) ([d07002b](https://github.com/railroadmedia/musora-content-services/commit/d07002b32946d3d03dc9b8f3469863a34d2696b5))
|
|
18
|
+
* null check for buildImageSRC ([f841b46](https://github.com/railroadmedia/musora-content-services/commit/f841b460bd41e0405caf7f2c06dd0c057a5f9aa1))
|
|
19
|
+
|
|
20
|
+
### [2.9.6](https://github.com/railroadmedia/musora-content-services/compare/v2.9.5...v2.9.6) (2025-06-18)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **BEH-547:** collection modules updates ([#300](https://github.com/railroadmedia/musora-content-services/issues/300)) ([d07002b](https://github.com/railroadmedia/musora-content-services/commit/d07002b32946d3d03dc9b8f3469863a34d2696b5))
|
|
26
|
+
* null check for buildImageSRC ([f841b46](https://github.com/railroadmedia/musora-content-services/commit/f841b460bd41e0405caf7f2c06dd0c057a5f9aa1))
|
|
27
|
+
|
|
5
28
|
### [2.9.5](https://github.com/railroadmedia/musora-content-services/compare/v2.9.4...v2.9.5) (2025-06-18)
|
|
6
29
|
|
|
7
30
|
### [2.9.4](https://github.com/railroadmedia/musora-content-services/compare/v2.9.3...v2.9.4) (2025-06-17)
|
package/package.json
CHANGED
|
@@ -35,9 +35,16 @@
|
|
|
35
35
|
* @returns {string} The fully constructed image URL with transformations
|
|
36
36
|
*/
|
|
37
37
|
export function buildImageSRC(url, options = {}) {
|
|
38
|
+
// Return early if url is null, undefined, or empty
|
|
39
|
+
if (!url) {
|
|
40
|
+
return url
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
// Process Sanity URL first if applicable
|
|
39
44
|
if (url.includes('cdn.sanity.io')) {
|
|
40
45
|
url = applySanityTransformations(url, options)
|
|
46
|
+
} else if (url.includes('imagedelivery.net')) {
|
|
47
|
+
return url
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
// Then apply Cloudflare transformations
|
package/src/services/sanity.js
CHANGED
|
@@ -388,8 +388,6 @@ export async function fetchNewReleases(
|
|
|
388
388
|
* .catch(error => console.error(error));
|
|
389
389
|
*/
|
|
390
390
|
export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {}) {
|
|
391
|
-
const liveTypes = getUpcomingEventsTypes(brand)
|
|
392
|
-
const typesString = arrayToStringRepresentation(liveTypes)
|
|
393
391
|
const now = getSanityDate(new Date())
|
|
394
392
|
const start = (page - 1) * limit
|
|
395
393
|
const end = start + limit
|
|
@@ -409,7 +407,7 @@ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {})
|
|
|
409
407
|
"permission_id": permission[]->railcontent_id,
|
|
410
408
|
"isLive": live_event_start_time <= '${now}' && live_event_end_time >= '${now}'`
|
|
411
409
|
const query = buildRawQuery(
|
|
412
|
-
`
|
|
410
|
+
`defined(live_event_start_time) && (!defined(live_event_end_time) || live_event_end_time >= '${now}' ) && brand == '${brand}' && published_on > '${now}' && status == 'scheduled'`,
|
|
413
411
|
fields,
|
|
414
412
|
{
|
|
415
413
|
sortOrder: 'published_on asc',
|
|
@@ -443,7 +441,7 @@ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
|
|
|
443
441
|
const now = getSanityDate(new Date())
|
|
444
442
|
const start = (page - 1) * limit
|
|
445
443
|
const end = start + limit
|
|
446
|
-
const query = `*[_type in [${typesString}] && brand == '${brand}' && status in ['published','scheduled'] && published_on > '${now}']{
|
|
444
|
+
const query = `*[_type in [${typesString}] && brand == '${brand}' && status in ['published','scheduled'] && (!defined(live_event_end_time) || live_event_end_time < '${now}' ) && published_on > '${now}']{
|
|
447
445
|
"id": railcontent_id,
|
|
448
446
|
title,
|
|
449
447
|
"image": thumbnail.asset->url,
|
|
@@ -1414,23 +1412,27 @@ async function fetchRelatedByLicense(railcontentId, brand, onlyUseSongTypes, cou
|
|
|
1414
1412
|
*/
|
|
1415
1413
|
export async function fetchRelatedLessons(railContentId, brand) {
|
|
1416
1414
|
const filterSameTypeAndSortOrder = await new FilterBuilder(
|
|
1417
|
-
`_type==^._type && _type in ${JSON.stringify(typeWithSortOrder)} && brand == "${brand}" && railcontent_id !=${railContentId}
|
|
1415
|
+
`_type==^._type && _type in ${JSON.stringify(typeWithSortOrder)} && brand == "${brand}" && railcontent_id !=${railContentId}`,
|
|
1418
1416
|
).buildFilter()
|
|
1419
1417
|
const filterSameType = await new FilterBuilder(
|
|
1420
|
-
`_type==^._type && !(_type in ${JSON.stringify(typeWithSortOrder)}) && !(defined(parent_type)) && brand == "${brand}" && railcontent_id !=${railContentId}
|
|
1418
|
+
`_type==^._type && !(_type in ${JSON.stringify(typeWithSortOrder)}) && !(defined(parent_type)) && brand == "${brand}" && railcontent_id !=${railContentId}`,
|
|
1421
1419
|
).buildFilter()
|
|
1422
1420
|
const filterSongSameArtist = await new FilterBuilder(
|
|
1423
|
-
`_type=="song" && _type==^._type && brand == "${brand}" && references(^.artist->_id) && railcontent_id !=${railContentId}
|
|
1421
|
+
`_type=="song" && _type==^._type && brand == "${brand}" && references(^.artist->_id) && railcontent_id !=${railContentId}`,
|
|
1424
1422
|
).buildFilter()
|
|
1425
1423
|
const filterSongSameGenre = await new FilterBuilder(
|
|
1426
|
-
`_type=="song" && _type==^._type && brand == "${brand}" && references(^.genre[]->_id) && railcontent_id !=${railContentId}
|
|
1424
|
+
`_type=="song" && _type==^._type && brand == "${brand}" && references(^.genre[]->_id) && railcontent_id !=${railContentId}`,
|
|
1427
1425
|
).buildFilter()
|
|
1428
|
-
const filterNeighbouringSiblings = await new FilterBuilder(`references(^._id)
|
|
1426
|
+
const filterNeighbouringSiblings = await new FilterBuilder(`references(^._id)`, {pullFutureContent: true}).buildFilter()
|
|
1429
1427
|
const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
|
|
1430
1428
|
const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, "genre": genre[]->name`
|
|
1431
1429
|
const queryFieldsWithSort = queryFields + ', sort'
|
|
1432
1430
|
const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && (!defined(permission) || references(*[_type=='permission']._id))]{
|
|
1433
|
-
_type, parent_type, railcontent_id,
|
|
1431
|
+
_type, parent_type, 'parent_id': parent_content_data[0].id, railcontent_id,
|
|
1432
|
+
'for-calculations': *[references(^._id) && !(_type in ['license'])][0]{
|
|
1433
|
+
'siblings-list': child[]->railcontent_id,
|
|
1434
|
+
'parents-list': *[references(^._id)][0].child[]->railcontent_id
|
|
1435
|
+
},
|
|
1434
1436
|
"related_lessons" : array::unique([
|
|
1435
1437
|
...(*[${filterNeighbouringSiblings}][0].child[${childrenFilter}]->{${queryFields}}),
|
|
1436
1438
|
...(*[${filterSongSameArtist}]{${queryFields}}|order(published_on desc, title asc)[0...10]),
|
|
@@ -1439,7 +1441,23 @@ export async function fetchRelatedLessons(railContentId, brand) {
|
|
|
1439
1441
|
...(*[${filterSameType}]{${queryFields}}|order(published_on desc, title asc)[0...10])
|
|
1440
1442
|
,
|
|
1441
1443
|
])[0...10]}`
|
|
1442
|
-
|
|
1444
|
+
let result = await fetchSanity(query, false)
|
|
1445
|
+
|
|
1446
|
+
//there's no way in sanity to retrieve the index of an array, so we must calculate after fetch
|
|
1447
|
+
if (result['for-calculations']['parents-list']) {
|
|
1448
|
+
const calc = result['for-calculations']
|
|
1449
|
+
const parentCount = calc['parents-list'].length
|
|
1450
|
+
const currentParent = (calc['parents-list'].indexOf(result['parent_id']) + 1)
|
|
1451
|
+
const siblingCount = calc['siblings-list'].length
|
|
1452
|
+
const currentSibling = (calc['siblings-list'].indexOf(result['railcontent_id']) + 1)
|
|
1453
|
+
|
|
1454
|
+
delete result['for-calculations']
|
|
1455
|
+
result = {...result, parentCount, currentParent, siblingCount, currentSibling}
|
|
1456
|
+
return result
|
|
1457
|
+
} else {
|
|
1458
|
+
delete result['for-calculations']
|
|
1459
|
+
return result
|
|
1460
|
+
}
|
|
1443
1461
|
}
|
|
1444
1462
|
|
|
1445
1463
|
/**
|