musora-content-services 2.151.0 → 2.152.1
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 +16 -0
- package/package.json +1 -1
- package/src/services/recommendations.js +17 -34
- package/src/services/sanity.js +1 -1
- package/src/services/sync/run-scope.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.152.1](https://github.com/railroadmedia/musora-content-services/compare/v2.152.0...v2.152.1) (2026-04-09)
|
|
6
|
+
|
|
7
|
+
## [2.152.0](https://github.com/railroadmedia/musora-content-services/compare/v2.151.1...v2.152.0) (2026-04-09)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* use sanity.musora.com cloudflare worker for caching ([#900](https://github.com/railroadmedia/musora-content-services/issues/900)) ([a6302f9](https://github.com/railroadmedia/musora-content-services/commit/a6302f96374fdea152f9fddd3ce8a8512e1c7b17))
|
|
13
|
+
|
|
14
|
+
### [2.151.1](https://github.com/railroadmedia/musora-content-services/compare/v2.151.0...v2.151.1) (2026-04-08)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* broken abort rejection after merge conflict fail ([#909](https://github.com/railroadmedia/musora-content-services/issues/909)) ([e75ebea](https://github.com/railroadmedia/musora-content-services/commit/e75ebeace9f5738d9accf6c546cd343ac7c98855))
|
|
20
|
+
|
|
5
21
|
## [2.151.0](https://github.com/railroadmedia/musora-content-services/compare/v2.149.0...v2.151.0) (2026-04-08)
|
|
6
22
|
|
|
7
23
|
|
package/package.json
CHANGED
|
@@ -32,16 +32,6 @@ export async function fetchSimilarItems(content_id, brand, count = 10) {
|
|
|
32
32
|
if (!content_id) {
|
|
33
33
|
return []
|
|
34
34
|
}
|
|
35
|
-
if (brand === 'playbass') {
|
|
36
|
-
// V2 launch customization for playbass
|
|
37
|
-
const content = (await fetchByRailContentIds([content_id], 'tab-data'))[0] ?? []
|
|
38
|
-
if (!content) {
|
|
39
|
-
return []
|
|
40
|
-
}
|
|
41
|
-
const section = content.page_type === 'song' ? 'song' : ''
|
|
42
|
-
const recs = await recommendations('playbass', {section: section})
|
|
43
|
-
return recs.slice(0, count)
|
|
44
|
-
} else {
|
|
45
35
|
content_id = parseInt(content_id)
|
|
46
36
|
const data = {
|
|
47
37
|
brand: brand,
|
|
@@ -56,8 +46,6 @@ export async function fetchSimilarItems(content_id, brand, count = 10) {
|
|
|
56
46
|
console.error('Fetch error:', error)
|
|
57
47
|
return null
|
|
58
48
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
49
|
}
|
|
62
50
|
|
|
63
51
|
/**
|
|
@@ -79,27 +67,25 @@ export async function rankCategories(brand, categories) {
|
|
|
79
67
|
if (categories.length === 0) {
|
|
80
68
|
return []
|
|
81
69
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const rankedCategories = []
|
|
70
|
+
const data = {
|
|
71
|
+
brand: brand,
|
|
72
|
+
user_id: globalConfig.sessionConfig.userId,
|
|
73
|
+
playlists: categories,
|
|
74
|
+
}
|
|
75
|
+
const url = `/rank_each_list/`
|
|
76
|
+
try {
|
|
77
|
+
const response = await recommenderClient.post(url, data)
|
|
78
|
+
const rankedCategories = []
|
|
92
79
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
return rankedCategories
|
|
100
|
-
} catch (error) {
|
|
101
|
-
console.error('RankCategories fetch error:', error)
|
|
80
|
+
for (const rankedPlaylist of response['ranked_playlists']) {
|
|
81
|
+
rankedCategories.push({
|
|
82
|
+
slug: rankedPlaylist.playlist_id,
|
|
83
|
+
items: rankedPlaylist.ranked_items,
|
|
84
|
+
})
|
|
102
85
|
}
|
|
86
|
+
return rankedCategories
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('RankCategories fetch error:', error)
|
|
103
89
|
}
|
|
104
90
|
|
|
105
91
|
const defaultSorting = []
|
|
@@ -127,9 +113,6 @@ export async function rankItems(brand, content_ids) {
|
|
|
127
113
|
if (content_ids.length === 0) {
|
|
128
114
|
return []
|
|
129
115
|
}
|
|
130
|
-
if (brand === 'playbass') {
|
|
131
|
-
return content_ids
|
|
132
|
-
}
|
|
133
116
|
const data = {
|
|
134
117
|
brand: brand,
|
|
135
118
|
user_id: globalConfig.sessionConfig.userId,
|
package/src/services/sanity.js
CHANGED
|
@@ -1517,7 +1517,7 @@ export async function fetchSanity(
|
|
|
1517
1517
|
}
|
|
1518
1518
|
const perspective = globalConfig.sanityConfig.perspective ?? 'published'
|
|
1519
1519
|
const api = globalConfig.sanityConfig.useCachedAPI ? 'apicdn' : 'api'
|
|
1520
|
-
const baseUrl = `https
|
|
1520
|
+
const baseUrl = `https://sanity.musora.com/${globalConfig.sanityConfig.projectId}/${api}/v${globalConfig.sanityConfig.version}/${globalConfig.sanityConfig.dataset}?perspective=${perspective}`
|
|
1521
1521
|
|
|
1522
1522
|
try {
|
|
1523
1523
|
const encodedQuery = encodeURIComponent(query)
|
|
@@ -19,7 +19,7 @@ export default class SyncRunScope {
|
|
|
19
19
|
// does NOT attempt to pass abort signal to the function
|
|
20
20
|
abortable<T>(fn: () => Promise<T>): Promise<T> {
|
|
21
21
|
if (this.signal.aborted) {
|
|
22
|
-
reject(new SyncAbortError('Operation aborted', { reason: this.signal.reason }))
|
|
22
|
+
return Promise.reject(new SyncAbortError('Operation aborted', { reason: this.signal.reason }))
|
|
23
23
|
}
|
|
24
24
|
return fn()
|
|
25
25
|
}
|