musora-content-services 1.0.43 → 1.0.44
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 +2 -0
- package/docs/config.js.html +1 -1
- package/docs/index.html +3 -2
- package/docs/module-Config.html +1 -1
- package/docs/module-Railcontent-Services.html +1 -1
- package/docs/module-Sanity-Services.html +11 -11
- package/docs/railcontent.js.html +1 -1
- package/docs/sanity.js.html +28 -26
- package/package.json +4 -4
- package/src/services/sanity.js +2 -2
- package/test/sanityQueryService.test.js +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.44](https://github.com/railroadmedia/musora-content-services/compare/v1.0.43...v1.0.44) (2024-08-21)
|
|
6
|
+
|
|
5
7
|
### [1.0.43](https://github.com/railroadmedia/musora-content-services/compare/v1.0.42...v1.0.43) (2024-08-20)
|
|
6
8
|
|
|
7
9
|
### [1.0.42](https://github.com/railroadmedia/musora-content-services/compare/v1.0.41...v1.0.42) (2024-08-20)
|
package/docs/config.js.html
CHANGED
|
@@ -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
|
|
114
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 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
|
@@ -93,7 +93,8 @@
|
|
|
93
93
|
<p>https://railroadmedia.github.io/musora-content-services/</p>
|
|
94
94
|
<h2>Run tests</h2>
|
|
95
95
|
<p>Copy .env file from 1Password "musora-content-services .env"
|
|
96
|
-
Run the following to execute the tests
|
|
96
|
+
Run the following to execute the tests
|
|
97
|
+
You may need to install jest (npm install --save-dev jest)</p>
|
|
97
98
|
<pre class="prettyprint source"><code>npm test
|
|
98
99
|
</code></pre></article>
|
|
99
100
|
</section>
|
|
@@ -110,7 +111,7 @@ Run the following to execute the tests</p>
|
|
|
110
111
|
<br class="clear">
|
|
111
112
|
|
|
112
113
|
<footer>
|
|
113
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
114
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
114
115
|
</footer>
|
|
115
116
|
|
|
116
117
|
<script>prettyPrint();</script>
|
package/docs/module-Config.html
CHANGED
|
@@ -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
|
|
659
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 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
|
|
786
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 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>
|
|
@@ -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#
|
|
1899
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line598">line 598</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#
|
|
2057
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line770">line 770</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#
|
|
2222
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line676">line 676</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#
|
|
2387
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line640">line 640</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#
|
|
2545
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line619">line 619</a>
|
|
2546
2546
|
</li></ul></dd>
|
|
2547
2547
|
|
|
2548
2548
|
|
|
@@ -2858,7 +2858,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
2858
2858
|
|
|
2859
2859
|
<dt class="tag-source">Source:</dt>
|
|
2860
2860
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2861
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
2861
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line650">line 650</a>
|
|
2862
2862
|
</li></ul></dd>
|
|
2863
2863
|
|
|
2864
2864
|
|
|
@@ -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#
|
|
3019
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line730">line 730</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#
|
|
3177
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line756">line 756</a>
|
|
3178
3178
|
</li></ul></dd>
|
|
3179
3179
|
|
|
3180
3180
|
|
|
@@ -3339,7 +3339,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
3339
3339
|
|
|
3340
3340
|
<dt class="tag-source">Source:</dt>
|
|
3341
3341
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3342
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3342
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line709">line 709</a>
|
|
3343
3343
|
</li></ul></dd>
|
|
3344
3344
|
|
|
3345
3345
|
|
|
@@ -3710,7 +3710,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'song', 'Love')
|
|
|
3710
3710
|
|
|
3711
3711
|
<dt class="tag-source">Source:</dt>
|
|
3712
3712
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3713
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3713
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line811">line 811</a>
|
|
3714
3714
|
</li></ul></dd>
|
|
3715
3715
|
|
|
3716
3716
|
|
|
@@ -4877,7 +4877,7 @@ It also includes completion status and progress percentage for each workout by f
|
|
|
4877
4877
|
<br class="clear">
|
|
4878
4878
|
|
|
4879
4879
|
<footer>
|
|
4880
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
4880
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:08 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
4881
4881
|
</footer>
|
|
4882
4882
|
|
|
4883
4883
|
<script>prettyPrint();</script>
|
package/docs/railcontent.js.html
CHANGED
|
@@ -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
|
|
204
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 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>
|
package/docs/sanity.js.html
CHANGED
|
@@ -492,7 +492,7 @@ export async function fetchAll(brand, type, {
|
|
|
492
492
|
let sortOrder;
|
|
493
493
|
switch (sort) {
|
|
494
494
|
case "slug":
|
|
495
|
-
sortOrder = "
|
|
495
|
+
sortOrder = "title asc";
|
|
496
496
|
break;
|
|
497
497
|
case "published_on":
|
|
498
498
|
sortOrder = "published_on asc";
|
|
@@ -501,7 +501,7 @@ export async function fetchAll(brand, type, {
|
|
|
501
501
|
sortOrder = "published_on desc";
|
|
502
502
|
break;
|
|
503
503
|
case "-slug":
|
|
504
|
-
sortOrder = "
|
|
504
|
+
sortOrder = "title desc";
|
|
505
505
|
break;
|
|
506
506
|
case "-popularity":
|
|
507
507
|
sortOrder = "popularity desc";
|
|
@@ -608,27 +608,29 @@ export async function fetchAllFilterOptions(
|
|
|
608
608
|
contentType,
|
|
609
609
|
term
|
|
610
610
|
) {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
611
|
+
const commonFilter = `_type == '${contentType}' && brand == "${brand}"${style ? ` && '${style}' in genre[]->name` : ''}${artist ? ` && artist->name == '${artist}'` : ''} ${filters ? filters : ''}`;
|
|
612
|
+
const query = `
|
|
613
|
+
{
|
|
614
|
+
"meta": {
|
|
615
|
+
"totalResults": count(*[${commonFilter}
|
|
616
|
+
${term ? ` && (title match "${term}" || album match "${term}" || artist->name match "${term}" || genre[]->name match "${term}")` : ''}]),
|
|
617
|
+
"filterOptions": {
|
|
618
|
+
"difficulty": [
|
|
619
|
+
{"type": "Introductory", "count": count(*[${commonFilter} && difficulty_string == "Introductory"])},
|
|
620
|
+
{"type": "Beginner", "count": count(*[${commonFilter} && difficulty_string == "Beginner"])},
|
|
621
|
+
{"type": "Intermediate", "count": count(*[${commonFilter} && difficulty_string == "Intermediate" ])},
|
|
622
|
+
{"type": "Advanced", "count": count(*[${commonFilter} && difficulty_string == "Advanced" ])},
|
|
623
|
+
{"type": "Expert", "count": count(*[${commonFilter} && difficulty_string == "Expert" ])}
|
|
624
|
+
][count > 0],
|
|
625
|
+
"instrumentless": [
|
|
626
|
+
{"type": "Full Song Only", "count": count(*[${commonFilter} && instrumentless == false ])},
|
|
627
|
+
{"type": "Instrument Removed", "count": count(*[${commonFilter} && instrumentless == true ])}
|
|
628
|
+
][count > 0],
|
|
629
|
+
"genre": *[_type == 'genre' && '${contentType}' in filter_types] {
|
|
630
|
+
"type": name,
|
|
631
|
+
"count": count(*[${commonFilter} && references(^._id)])
|
|
632
|
+
}[count > 0]
|
|
633
|
+
}
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
636
|
}`;
|
|
@@ -862,10 +864,10 @@ export async function fetchSanity(query, isList) {
|
|
|
862
864
|
if (globalConfig.sanityConfig.debug) {
|
|
863
865
|
console.log("fetchSanity Query:", query);
|
|
864
866
|
}
|
|
865
|
-
|
|
867
|
+
const perspective = globalConfig.sanityConfig.perspective ?? 'published';
|
|
866
868
|
const encodedQuery = encodeURIComponent(query);
|
|
867
869
|
const api = globalConfig.sanityConfig.useCachedAPI ? 'apicdn' : 'api';
|
|
868
|
-
const url = `https://${globalConfig.sanityConfig.projectId}.${api}.sanity.io/v${globalConfig.sanityConfig.version}/data/query/${globalConfig.sanityConfig.dataset}?query=${encodedQuery}`;
|
|
870
|
+
const url = `https://${globalConfig.sanityConfig.projectId}.${api}.sanity.io/v${globalConfig.sanityConfig.version}/data/query/${globalConfig.sanityConfig.dataset}?perspective=${perspective}&query=${encodedQuery}`;
|
|
869
871
|
const headers = {
|
|
870
872
|
'Authorization': `Bearer ${globalConfig.sanityConfig.token}`,
|
|
871
873
|
'Content-Type': 'application/json'
|
|
@@ -935,7 +937,7 @@ function checkSanityConfig(config) {
|
|
|
935
937
|
<br class="clear">
|
|
936
938
|
|
|
937
939
|
<footer>
|
|
938
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
940
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Aug 21 2024 17:33:07 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
939
941
|
</footer>
|
|
940
942
|
|
|
941
943
|
<script>prettyPrint();</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musora-content-services",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "A package for Musoras content services ",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dotenv": "^16.4.5",
|
|
23
23
|
"jest": "^29.7.0",
|
|
24
24
|
"jsdoc": "^4.0.3",
|
|
25
|
-
"standard-version": "^9.5.0"
|
|
25
|
+
"standard-version": "^9.5.0",
|
|
26
|
+
"ts-jest": "^29.2.4"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@babel/preset-env": "^7.25.3",
|
|
29
30
|
"babel-jest": "^29.7.0",
|
|
30
|
-
"docdash": "^2.0.2"
|
|
31
|
-
"ts-jest": "^29.2.4"
|
|
31
|
+
"docdash": "^2.0.2"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/services/sanity.js
CHANGED
|
@@ -445,7 +445,7 @@ export async function fetchAll(brand, type, {
|
|
|
445
445
|
let sortOrder;
|
|
446
446
|
switch (sort) {
|
|
447
447
|
case "slug":
|
|
448
|
-
sortOrder = "
|
|
448
|
+
sortOrder = "title asc";
|
|
449
449
|
break;
|
|
450
450
|
case "published_on":
|
|
451
451
|
sortOrder = "published_on asc";
|
|
@@ -454,7 +454,7 @@ export async function fetchAll(brand, type, {
|
|
|
454
454
|
sortOrder = "published_on desc";
|
|
455
455
|
break;
|
|
456
456
|
case "-slug":
|
|
457
|
-
sortOrder = "
|
|
457
|
+
sortOrder = "title desc";
|
|
458
458
|
break;
|
|
459
459
|
case "-popularity":
|
|
460
460
|
sortOrder = "popularity desc";
|
|
@@ -26,14 +26,16 @@ const {
|
|
|
26
26
|
|
|
27
27
|
describe('Sanity Queries', function () {
|
|
28
28
|
beforeEach(() => {
|
|
29
|
-
const config = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const config = {
|
|
30
|
+
sanityConfig: {
|
|
31
|
+
token: process.env.SANITY_API_TOKEN,
|
|
32
|
+
projectId: process.env.SANITY_PROJECT_ID,
|
|
33
|
+
dataset: process.env.SANITY_DATASET,
|
|
34
|
+
useCachedAPI: process.env.SANITY_USE_CACHED_API || true,
|
|
35
|
+
version: '2021-06-07',
|
|
36
|
+
debug: process.env.DEBUG || false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
37
39
|
initializeService(config);
|
|
38
40
|
});
|
|
39
41
|
|