musora-content-services 1.3.1 → 1.3.3
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/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/.yarnrc.yml +1 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.cjs +0 -0
- package/docs/config.js.html +0 -0
- package/docs/index.html +0 -0
- package/docs/module-Config.html +0 -0
- package/docs/module-Railcontent-Services.html +0 -0
- package/docs/module-Sanity-Services.html +0 -0
- package/docs/railcontent.js.html +0 -0
- package/docs/sanity.js.html +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/contentTypeConfig.js +3 -0
- package/src/filterBuilder.js +0 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +0 -0
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +25 -5
- package/src/services/userPermissions.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +1 -1
- package/test/userPermissions.test.js +0 -0
- package/tools/generate-index.cjs +0 -0
package/.prettierignore
CHANGED
|
File without changes
|
package/.prettierrc
CHANGED
|
File without changes
|
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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
|
+
### [1.3.3](https://github.com/railroadmedia/musora-content-services/compare/v1.3.2...v1.3.3) (2025-01-31)
|
|
6
|
+
|
|
7
|
+
### [1.3.2](https://github.com/railroadmedia/musora-content-services/compare/v1.3.1...v1.3.2) (2025-01-30)
|
|
8
|
+
|
|
5
9
|
### [1.3.1](https://github.com/railroadmedia/musora-content-services/compare/v1.3.0...v1.3.1) (2025-01-29)
|
|
6
10
|
|
|
7
11
|
## [1.3.0](https://github.com/railroadmedia/musora-content-services/compare/v1.2.5...v1.3.0) (2025-01-29)
|
package/babel.config.cjs
CHANGED
|
File without changes
|
package/docs/config.js.html
CHANGED
|
File without changes
|
package/docs/index.html
CHANGED
|
File without changes
|
package/docs/module-Config.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/railcontent.js.html
CHANGED
|
File without changes
|
package/docs/sanity.js.html
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/jsdoc.json
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/contentTypeConfig.js
CHANGED
|
@@ -621,6 +621,9 @@ export function filtersToGroq(filters, selectedFilters = []) {
|
|
|
621
621
|
return `instrumentless == ${value}`
|
|
622
622
|
}
|
|
623
623
|
} else if (key === 'difficulty' && !selectedFilters.includes(key)) {
|
|
624
|
+
if(value === 'Introductory'){
|
|
625
|
+
return `(difficulty_string == "Novice" || difficulty_string == "Introductory" )`
|
|
626
|
+
}
|
|
624
627
|
return `difficulty_string == "${value}"`
|
|
625
628
|
} else if (key === 'type' && !selectedFilters.includes(key)) {
|
|
626
629
|
return `_type == "${value}"`
|
package/src/filterBuilder.js
CHANGED
|
File without changes
|
package/src/index.d.ts
CHANGED
|
File without changes
|
package/src/index.js
CHANGED
|
File without changes
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -84,7 +84,7 @@ export async function fetchArtists(brand) {
|
|
|
84
84
|
*[_type == "artist"]{
|
|
85
85
|
name,
|
|
86
86
|
"lessonsCount": count(*[${filter}])
|
|
87
|
-
}[lessonsCount > 0]`
|
|
87
|
+
}[lessonsCount > 0] |order(lower(name)) `
|
|
88
88
|
return fetchSanity(query, true, { processNeedAccess: false })
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -94,12 +94,32 @@ export async function fetchArtists(brand) {
|
|
|
94
94
|
* @returns {Promise<int|null>} - The fetched count of artists.
|
|
95
95
|
*/
|
|
96
96
|
export async function fetchSongArtistCount(brand) {
|
|
97
|
-
const
|
|
97
|
+
const filter = await new FilterBuilder(
|
|
98
|
+
`_type == "song" && brand == "${brand}" && references(^._id)`,
|
|
99
|
+
{ bypassPermissions: true }
|
|
100
|
+
).buildFilter()
|
|
101
|
+
const query = `
|
|
102
|
+
count(*[_type == "artist"]{
|
|
103
|
+
name,
|
|
104
|
+
"lessonsCount": count(*[${filter}])
|
|
105
|
+
}[lessonsCount > 0])`
|
|
98
106
|
return fetchSanity(query, true, { processNeedAccess: false })
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
export async function fetchPlayAlongsCount(brand
|
|
102
|
-
|
|
109
|
+
export async function fetchPlayAlongsCount(brand, {
|
|
110
|
+
searchTerm,
|
|
111
|
+
includedFields,
|
|
112
|
+
progressIds,
|
|
113
|
+
progress,
|
|
114
|
+
}) {
|
|
115
|
+
const searchFilter = searchTerm ? `&& (artist->name match "${searchTerm}*" || instructor[]->name match "${searchTerm}*" || title match "${searchTerm}*" || name match "${searchTerm}*")` :'';
|
|
116
|
+
|
|
117
|
+
// Construct the included fields filter, replacing 'difficulty' with 'difficulty_string'
|
|
118
|
+
const includedFieldsFilter = includedFields.length > 0 ? filtersToGroq(includedFields) : ''
|
|
119
|
+
|
|
120
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
121
|
+
const progressFilter = await getProgressFilter(progress, progressIds)
|
|
122
|
+
const query = `count(*[brand == '${brand}' && _type == "play-along" ${searchFilter} ${includedFieldsFilter} ${progressFilter} ]) `
|
|
103
123
|
return fetchSanity(query, true, { processNeedAccess: false })
|
|
104
124
|
}
|
|
105
125
|
|
|
@@ -1881,7 +1901,7 @@ function getFilterOptions(option, commonFilter, contentType, brand) {
|
|
|
1881
1901
|
filterGroq = `
|
|
1882
1902
|
"difficulty": [
|
|
1883
1903
|
{"type": "All", "count": count(*[${commonFilter} && difficulty_string == "All"])},
|
|
1884
|
-
{"type": "Introductory", "count": count(*[${commonFilter} && difficulty_string == "Introductory"])},
|
|
1904
|
+
{"type": "Introductory", "count": count(*[${commonFilter} && (difficulty_string == "Novice" || difficulty_string == "Introductory")])},
|
|
1885
1905
|
{"type": "Beginner", "count": count(*[${commonFilter} && difficulty_string == "Beginner"])},
|
|
1886
1906
|
{"type": "Intermediate", "count": count(*[${commonFilter} && difficulty_string == "Intermediate" ])},
|
|
1887
1907
|
{"type": "Advanced", "count": count(*[${commonFilter} && difficulty_string == "Advanced" ])},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/initializeTests.js
CHANGED
|
File without changes
|
package/test/lastUpdated.test.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
@@ -65,7 +65,7 @@ describe('Sanity Queries', function () {
|
|
|
65
65
|
test('fetchSongArtistCount', async () => {
|
|
66
66
|
const response = await fetchSongArtistCount('drumeo')
|
|
67
67
|
log(response)
|
|
68
|
-
expect(response).toBeGreaterThan(
|
|
68
|
+
expect(response).toBeGreaterThan(700)
|
|
69
69
|
}, 10000)
|
|
70
70
|
|
|
71
71
|
test('fetchSanity-WithPostProcess', async () => {
|
|
File without changes
|
package/tools/generate-index.cjs
CHANGED
|
File without changes
|