musora-content-services 1.0.48 → 1.0.50

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,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.0.50](https://github.com/railroadmedia/musora-content-services/compare/v1.0.49...v1.0.50) (2024-08-23)
6
+
7
+ ### [1.0.49](https://github.com/railroadmedia/musora-content-services/compare/v1.0.48...v1.0.49) (2024-08-23)
8
+
5
9
  ### [1.0.48](https://github.com/railroadmedia/musora-content-services/compare/v1.0.47...v1.0.48) (2024-08-22)
6
10
 
7
11
  ### [1.0.47](https://github.com/railroadmedia/musora-content-services/compare/v1.0.46...v1.0.47) (2024-08-22)
@@ -111,7 +111,7 @@ module.exports = {
111
111
  <br class="clear">
112
112
 
113
113
  <footer>
114
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
114
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
115
115
  </footer>
116
116
 
117
117
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -111,7 +111,7 @@ You may need to install jest (npm install --save-dev jest)</p>
111
111
  <br class="clear">
112
112
 
113
113
  <footer>
114
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
114
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
115
115
  </footer>
116
116
 
117
117
  <script>prettyPrint();</script>
@@ -656,7 +656,7 @@ initializeService({
656
656
  <br class="clear">
657
657
 
658
658
  <footer>
659
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
659
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
660
660
  </footer>
661
661
 
662
662
  <script>prettyPrint();</script>
@@ -783,7 +783,7 @@
783
783
  <br class="clear">
784
784
 
785
785
  <footer>
786
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
786
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
787
787
  </footer>
788
788
 
789
789
  <script>prettyPrint();</script>
@@ -713,7 +713,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
713
713
  <td class="type">
714
714
 
715
715
 
716
- <span class="param-type">string</span>
716
+ <span class="param-type">Array.&lt;string></span>
717
717
 
718
718
 
719
719
 
@@ -732,7 +732,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
732
732
 
733
733
 
734
734
 
735
- <td class="description last">Additional filters to apply to the query, typically in the format of Sanity GROQ queries.</td>
735
+ <td class="description last">Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock']</td>
736
736
  </tr>
737
737
 
738
738
 
@@ -1896,7 +1896,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
1896
1896
 
1897
1897
  <dt class="tag-source">Source:</dt>
1898
1898
  <dd class="tag-source"><ul class="dummy"><li>
1899
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line608">line 608</a>
1899
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line616">line 616</a>
1900
1900
  </li></ul></dd>
1901
1901
 
1902
1902
 
@@ -2054,7 +2054,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2054
2054
 
2055
2055
  <dt class="tag-source">Source:</dt>
2056
2056
  <dd class="tag-source"><ul class="dummy"><li>
2057
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line809">line 809</a>
2057
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line818">line 818</a>
2058
2058
  </li></ul></dd>
2059
2059
 
2060
2060
 
@@ -2219,7 +2219,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2219
2219
 
2220
2220
  <dt class="tag-source">Source:</dt>
2221
2221
  <dd class="tag-source"><ul class="dummy"><li>
2222
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line715">line 715</a>
2222
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line724">line 724</a>
2223
2223
  </li></ul></dd>
2224
2224
 
2225
2225
 
@@ -2384,7 +2384,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2384
2384
 
2385
2385
  <dt class="tag-source">Source:</dt>
2386
2386
  <dd class="tag-source"><ul class="dummy"><li>
2387
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line679">line 679</a>
2387
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line688">line 688</a>
2388
2388
  </li></ul></dd>
2389
2389
 
2390
2390
 
@@ -2542,7 +2542,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2542
2542
 
2543
2543
  <dt class="tag-source">Source:</dt>
2544
2544
  <dd class="tag-source"><ul class="dummy"><li>
2545
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line658">line 658</a>
2545
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line667">line 667</a>
2546
2546
  </li></ul></dd>
2547
2547
 
2548
2548
 
@@ -2700,7 +2700,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
2700
2700
 
2701
2701
  <dt class="tag-source">Source:</dt>
2702
2702
  <dd class="tag-source"><ul class="dummy"><li>
2703
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line629">line 629</a>
2703
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line637">line 637</a>
2704
2704
  </li></ul></dd>
2705
2705
 
2706
2706
 
@@ -3016,7 +3016,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3016
3016
 
3017
3017
  <dt class="tag-source">Source:</dt>
3018
3018
  <dd class="tag-source"><ul class="dummy"><li>
3019
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line689">line 689</a>
3019
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line698">line 698</a>
3020
3020
  </li></ul></dd>
3021
3021
 
3022
3022
 
@@ -3174,7 +3174,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3174
3174
 
3175
3175
  <dt class="tag-source">Source:</dt>
3176
3176
  <dd class="tag-source"><ul class="dummy"><li>
3177
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line769">line 769</a>
3177
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line778">line 778</a>
3178
3178
  </li></ul></dd>
3179
3179
 
3180
3180
 
@@ -3332,7 +3332,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3332
3332
 
3333
3333
  <dt class="tag-source">Source:</dt>
3334
3334
  <dd class="tag-source"><ul class="dummy"><li>
3335
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line795">line 795</a>
3335
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line804">line 804</a>
3336
3336
  </li></ul></dd>
3337
3337
 
3338
3338
 
@@ -3497,7 +3497,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3497
3497
 
3498
3498
  <dt class="tag-source">Source:</dt>
3499
3499
  <dd class="tag-source"><ul class="dummy"><li>
3500
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line748">line 748</a>
3500
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line757">line 757</a>
3501
3501
  </li></ul></dd>
3502
3502
 
3503
3503
 
@@ -3868,7 +3868,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
3868
3868
 
3869
3869
  <dt class="tag-source">Source:</dt>
3870
3870
  <dd class="tag-source"><ul class="dummy"><li>
3871
- <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line850">line 850</a>
3871
+ <a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line859">line 859</a>
3872
3872
  </li></ul></dd>
3873
3873
 
3874
3874
 
@@ -5035,7 +5035,7 @@ It also includes completion status and progress percentage for each workout by f
5035
5035
  <br class="clear">
5036
5036
 
5037
5037
  <footer>
5038
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
5038
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
5039
5039
  </footer>
5040
5040
 
5041
5041
  <script>prettyPrint();</script>
@@ -201,7 +201,7 @@ export async function fetchContentInProgress(type="all", brand) {
201
201
  <br class="clear">
202
202
 
203
203
  <footer>
204
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
204
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
205
205
  </footer>
206
206
 
207
207
  <script>prettyPrint();</script>
@@ -596,7 +596,7 @@ export async function fetchAll(brand, type, {
596
596
  * The filter options are dynamically generated based on the provided filters, style, artist, and content type.
597
597
  *
598
598
  * @param {string} brand - The brand for which to fetch the filter options.
599
- * @param {string} filters - Additional filters to apply to the query, typically in the format of Sanity GROQ queries.
599
+ * @param {string[]} filters - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock']
600
600
  * @param {string} [style] - Optional style or genre to filter the results. If provided, the query will check if the style exists in the genre array.
601
601
  * @param {string} [artist] - Optional artist name to filter the results. If provided, the query will check if the artist's name matches.
602
602
  * @param {string} contentType - The content type to fetch (e.g., 'song', 'lesson').
@@ -618,7 +618,16 @@ export async function fetchAllFilterOptions(
618
618
  contentType,
619
619
  term
620
620
  ) {
621
- const commonFilter = `_type == '${contentType}' &amp;&amp; brand == "${brand}"${style ? ` &amp;&amp; '${style}' in genre[]->name` : ''}${artist ? ` &amp;&amp; artist->name == '${artist}'` : ''} ${filters ? filters : ''}`;
621
+ const filtersToGroq = filters?.length > 0 ? filters.map(field => {
622
+ let [key, value] = field.split(',');
623
+ if (key === 'difficulty') {
624
+ key = 'difficulty_string';
625
+ }
626
+ return `&amp;&amp; ${key} == "${value}"`;
627
+ }).join(' ')
628
+ : undefined;
629
+
630
+ const commonFilter = `_type == '${contentType}' &amp;&amp; brand == "${brand}"${style ? ` &amp;&amp; '${style}' in genre[]->name` : ''}${artist ? ` &amp;&amp; artist->name == '${artist}'` : ''} ${filtersToGroq ? filtersToGroq : ''}`;
622
631
  const query = `
623
632
  {
624
633
  "meta": {
@@ -642,8 +651,7 @@ export async function fetchAllFilterOptions(
642
651
  }[count > 0]
643
652
  }
644
653
  }
645
- }
646
- }`;
654
+ }`;
647
655
  return fetchSanity(query, true);
648
656
  }
649
657
 
@@ -688,6 +696,7 @@ export async function fetchMethods(brand) {
688
696
  "slug": slug.current,
689
697
  status,
690
698
  "thumbnail": thumbnail.asset->url,
699
+ "thumbnail_logo": logo_image_url.asset->url,
691
700
  title,
692
701
  total_xp,
693
702
  "type": _type,
@@ -976,7 +985,7 @@ function checkSanityConfig(config) {
976
985
  <br class="clear">
977
986
 
978
987
  <footer>
979
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Thu Aug 22 2024 21:43:24 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
988
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Aug 23 2024 16:23:38 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
980
989
  </footer>
981
990
 
982
991
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -549,7 +549,7 @@ export async function fetchAll(brand, type, {
549
549
  * The filter options are dynamically generated based on the provided filters, style, artist, and content type.
550
550
  *
551
551
  * @param {string} brand - The brand for which to fetch the filter options.
552
- * @param {string} filters - Additional filters to apply to the query, typically in the format of Sanity GROQ queries.
552
+ * @param {string[]} filters - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock']
553
553
  * @param {string} [style] - Optional style or genre to filter the results. If provided, the query will check if the style exists in the genre array.
554
554
  * @param {string} [artist] - Optional artist name to filter the results. If provided, the query will check if the artist's name matches.
555
555
  * @param {string} contentType - The content type to fetch (e.g., 'song', 'lesson').
@@ -571,7 +571,16 @@ export async function fetchAllFilterOptions(
571
571
  contentType,
572
572
  term
573
573
  ) {
574
- const commonFilter = `_type == '${contentType}' && brand == "${brand}"${style ? ` && '${style}' in genre[]->name` : ''}${artist ? ` && artist->name == '${artist}'` : ''} ${filters ? filters : ''}`;
574
+ const filtersToGroq = filters?.length > 0 ? filters.map(field => {
575
+ let [key, value] = field.split(',');
576
+ if (key === 'difficulty') {
577
+ key = 'difficulty_string';
578
+ }
579
+ return `&& ${key} == "${value}"`;
580
+ }).join(' ')
581
+ : undefined;
582
+
583
+ const commonFilter = `_type == '${contentType}' && brand == "${brand}"${style ? ` && '${style}' in genre[]->name` : ''}${artist ? ` && artist->name == '${artist}'` : ''} ${filtersToGroq ? filtersToGroq : ''}`;
575
584
  const query = `
576
585
  {
577
586
  "meta": {
@@ -595,8 +604,7 @@ export async function fetchAllFilterOptions(
595
604
  }[count > 0]
596
605
  }
597
606
  }
598
- }
599
- }`;
607
+ }`;
600
608
  return fetchSanity(query, true);
601
609
  }
602
610
 
@@ -641,7 +649,7 @@ export async function fetchMethods(brand) {
641
649
  "slug": slug.current,
642
650
  status,
643
651
  "thumbnail": thumbnail.asset->url,
644
- "thumbnail_logo": logo_image_url.asset->url
652
+ "thumbnail_logo": logo_image_url.asset->url,
645
653
  title,
646
654
  total_xp,
647
655
  "type": _type,