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 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
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/jest.config.js CHANGED
File without changes
package/jsdoc.json CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
File without changes
@@ -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}"`
File without changes
package/src/index.d.ts CHANGED
File without changes
package/src/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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 query = `count(*[_type == 'artist']{'lessonsCount': count(*[_type == 'song' && brand == '${brand}' && references(^._id)]._id)}[lessonsCount > 0])`
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
- const query = `count(*[brand == '${brand}' && _type == "play-along"]) `
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
File without changes
File without changes
File without changes
File without changes
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(1000)
68
+ expect(response).toBeGreaterThan(700)
69
69
  }, 10000)
70
70
 
71
71
  test('fetchSanity-WithPostProcess', async () => {
File without changes
File without changes