musora-content-services 1.0.139 → 1.0.141
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/.github/workflows/node.js.yml +0 -0
- package/CHANGELOG.md +4 -0
- package/README.md +0 -0
- package/babel.config.js +0 -0
- package/docs/config.js.html +1 -1
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +1 -1
- package/docs/module-Config.html +1 -1
- package/docs/module-Railcontent-Services.html +1 -1
- package/docs/module-Sanity-Services.html +19 -19
- package/docs/railcontent.js.html +1 -1
- package/docs/sanity.js.html +68 -39
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/contentTypeConfig.js +0 -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 +6 -2
- package/src/services/contentLikes.js +0 -0
- package/src/services/dataContext.js +6 -6
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +31 -18
- package/test/contentLikes.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/tools/generate-index.js +0 -0
|
File without changes
|
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.141](https://github.com/railroadmedia/musora-content-services/compare/v1.0.140...v1.0.141) (2024-10-17)
|
|
6
|
+
|
|
7
|
+
### [1.0.140](https://github.com/railroadmedia/musora-content-services/compare/v1.0.139...v1.0.140) (2024-10-16)
|
|
8
|
+
|
|
5
9
|
### [1.0.139](https://github.com/railroadmedia/musora-content-services/compare/v1.0.137...v1.0.139) (2024-10-16)
|
|
6
10
|
|
|
7
11
|
### [1.0.138](https://github.com/railroadmedia/musora-content-services/compare/v1.0.137...v1.0.138) (2024-10-15)
|
package/README.md
CHANGED
|
File without changes
|
package/babel.config.js
CHANGED
|
File without changes
|
package/docs/config.js.html
CHANGED
|
@@ -126,7 +126,7 @@ module.exports = {
|
|
|
126
126
|
<br class="clear">
|
|
127
127
|
|
|
128
128
|
<footer>
|
|
129
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
129
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
130
130
|
</footer>
|
|
131
131
|
|
|
132
132
|
<script>prettyPrint();</script>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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/docs/index.html
CHANGED
|
@@ -155,7 +155,7 @@ with <code>npm test -- -t="userContext"</code> or just the contentLike
|
|
|
155
155
|
<br class="clear">
|
|
156
156
|
|
|
157
157
|
<footer>
|
|
158
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
158
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
159
159
|
</footer>
|
|
160
160
|
|
|
161
161
|
<script>prettyPrint();</script>
|
package/docs/module-Config.html
CHANGED
|
@@ -828,7 +828,7 @@ initializeService({
|
|
|
828
828
|
<br class="clear">
|
|
829
829
|
|
|
830
830
|
<footer>
|
|
831
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
831
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
832
832
|
</footer>
|
|
833
833
|
|
|
834
834
|
<script>prettyPrint();</script>
|
|
@@ -1435,7 +1435,7 @@
|
|
|
1435
1435
|
<br class="clear">
|
|
1436
1436
|
|
|
1437
1437
|
<footer>
|
|
1438
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
1438
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1439
1439
|
</footer>
|
|
1440
1440
|
|
|
1441
1441
|
<script>prettyPrint();</script>
|
|
@@ -1242,7 +1242,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'coach-lessons', 'Love'
|
|
|
1242
1242
|
|
|
1243
1243
|
<dt class="tag-source">Source:</dt>
|
|
1244
1244
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1245
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
1245
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1028">line 1028</a>
|
|
1246
1246
|
</li></ul></dd>
|
|
1247
1247
|
|
|
1248
1248
|
|
|
@@ -2042,7 +2042,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'coach-lessons', 'Love'
|
|
|
2042
2042
|
|
|
2043
2043
|
<dt class="tag-source">Source:</dt>
|
|
2044
2044
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2045
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
2045
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1271">line 1271</a>
|
|
2046
2046
|
</li></ul></dd>
|
|
2047
2047
|
|
|
2048
2048
|
|
|
@@ -3110,7 +3110,7 @@ fetchAllFilterOptions('myBrand', '', 'Rock', 'John Doe', 'coach-lessons', 'Love'
|
|
|
3110
3110
|
|
|
3111
3111
|
<dt class="tag-source">Source:</dt>
|
|
3112
3112
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3113
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3113
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1225">line 1225</a>
|
|
3114
3114
|
</li></ul></dd>
|
|
3115
3115
|
|
|
3116
3116
|
|
|
@@ -3276,7 +3276,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
3276
3276
|
|
|
3277
3277
|
<dt class="tag-source">Source:</dt>
|
|
3278
3278
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3279
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3279
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1480">line 1480</a>
|
|
3280
3280
|
</li></ul></dd>
|
|
3281
3281
|
|
|
3282
3282
|
|
|
@@ -3441,7 +3441,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
3441
3441
|
|
|
3442
3442
|
<dt class="tag-source">Source:</dt>
|
|
3443
3443
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3444
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3444
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1146">line 1146</a>
|
|
3445
3445
|
</li></ul></dd>
|
|
3446
3446
|
|
|
3447
3447
|
|
|
@@ -3808,7 +3808,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
3808
3808
|
|
|
3809
3809
|
<dt class="tag-source">Source:</dt>
|
|
3810
3810
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3811
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
3811
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1171">line 1171</a>
|
|
3812
3812
|
</li></ul></dd>
|
|
3813
3813
|
|
|
3814
3814
|
|
|
@@ -4251,7 +4251,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
4251
4251
|
|
|
4252
4252
|
<dt class="tag-source">Source:</dt>
|
|
4253
4253
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4254
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
4254
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1210">line 1210</a>
|
|
4255
4255
|
</li></ul></dd>
|
|
4256
4256
|
|
|
4257
4257
|
|
|
@@ -4574,7 +4574,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
4574
4574
|
|
|
4575
4575
|
<dt class="tag-source">Source:</dt>
|
|
4576
4576
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4577
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
4577
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1323">line 1323</a>
|
|
4578
4578
|
</li></ul></dd>
|
|
4579
4579
|
|
|
4580
4580
|
|
|
@@ -5055,7 +5055,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
5055
5055
|
|
|
5056
5056
|
<dt class="tag-source">Source:</dt>
|
|
5057
5057
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
5058
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
5058
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line921">line 921</a>
|
|
5059
5059
|
</li></ul></dd>
|
|
5060
5060
|
|
|
5061
5061
|
|
|
@@ -5220,7 +5220,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
5220
5220
|
|
|
5221
5221
|
<dt class="tag-source">Source:</dt>
|
|
5222
5222
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
5223
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
5223
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1530">line 1530</a>
|
|
5224
5224
|
</li></ul></dd>
|
|
5225
5225
|
|
|
5226
5226
|
|
|
@@ -6590,7 +6590,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
6590
6590
|
|
|
6591
6591
|
<dt class="tag-source">Source:</dt>
|
|
6592
6592
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
6593
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
6593
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line887">line 887</a>
|
|
6594
6594
|
</li></ul></dd>
|
|
6595
6595
|
|
|
6596
6596
|
|
|
@@ -6748,7 +6748,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
6748
6748
|
|
|
6749
6749
|
<dt class="tag-source">Source:</dt>
|
|
6750
6750
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
6751
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
6751
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1055">line 1055</a>
|
|
6752
6752
|
</li></ul></dd>
|
|
6753
6753
|
|
|
6754
6754
|
|
|
@@ -6906,7 +6906,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
6906
6906
|
|
|
6907
6907
|
<dt class="tag-source">Source:</dt>
|
|
6908
6908
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
6909
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
6909
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1115">line 1115</a>
|
|
6910
6910
|
</li></ul></dd>
|
|
6911
6911
|
|
|
6912
6912
|
|
|
@@ -7071,7 +7071,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
7071
7071
|
|
|
7072
7072
|
<dt class="tag-source">Source:</dt>
|
|
7073
7073
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7074
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
7074
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1129">line 1129</a>
|
|
7075
7075
|
</li></ul></dd>
|
|
7076
7076
|
|
|
7077
7077
|
|
|
@@ -7385,7 +7385,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
7385
7385
|
|
|
7386
7386
|
<dt class="tag-source">Source:</dt>
|
|
7387
7387
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7388
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
7388
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line982">line 982</a>
|
|
7389
7389
|
</li></ul></dd>
|
|
7390
7390
|
|
|
7391
7391
|
|
|
@@ -7567,7 +7567,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
7567
7567
|
|
|
7568
7568
|
<dt class="tag-source">Source:</dt>
|
|
7569
7569
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7570
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
7570
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1001">line 1001</a>
|
|
7571
7571
|
</li></ul></dd>
|
|
7572
7572
|
|
|
7573
7573
|
|
|
@@ -7935,7 +7935,7 @@ It's an ongoing discussion (Aug 2024), but it's been included here if necessary<
|
|
|
7935
7935
|
|
|
7936
7936
|
<dt class="tag-source">Source:</dt>
|
|
7937
7937
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7938
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
7938
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1371">line 1371</a>
|
|
7939
7939
|
</li></ul></dd>
|
|
7940
7940
|
|
|
7941
7941
|
|
|
@@ -8401,7 +8401,7 @@ fetchSanity(query, true)
|
|
|
8401
8401
|
|
|
8402
8402
|
<dt class="tag-source">Source:</dt>
|
|
8403
8403
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
8404
|
-
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#
|
|
8404
|
+
<a href="sanity.js.html">sanity.js</a>, <a href="sanity.js.html#line1505">line 1505</a>
|
|
8405
8405
|
</li></ul></dd>
|
|
8406
8406
|
|
|
8407
8407
|
|
|
@@ -9537,7 +9537,7 @@ It also includes completion status and progress percentage for each workout by f
|
|
|
9537
9537
|
<br class="clear">
|
|
9538
9538
|
|
|
9539
9539
|
<footer>
|
|
9540
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
9540
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
9541
9541
|
</footer>
|
|
9542
9542
|
|
|
9543
9543
|
<script>prettyPrint();</script>
|
package/docs/railcontent.js.html
CHANGED
|
@@ -376,7 +376,7 @@ function fetchAbsolute(url, params) {
|
|
|
376
376
|
<br class="clear">
|
|
377
377
|
|
|
378
378
|
<footer>
|
|
379
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
379
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
380
380
|
</footer>
|
|
381
381
|
|
|
382
382
|
<script>prettyPrint();</script>
|
package/docs/sanity.js.html
CHANGED
|
@@ -149,7 +149,7 @@ export async function fetchSongArtistCount(brand) {
|
|
|
149
149
|
export async function fetchRelatedSongs(brand, songId) {
|
|
150
150
|
const query = `
|
|
151
151
|
*[_type == "song" && railcontent_id == ${songId}]{
|
|
152
|
-
"
|
|
152
|
+
"entity": array::unique([
|
|
153
153
|
...(*[_type == "song" && brand == "${brand}" && railcontent_id != ${songId} && references(^.artist->_id)]{
|
|
154
154
|
"type": _type,
|
|
155
155
|
"id": railcontent_id,
|
|
@@ -879,7 +879,7 @@ export async function fetchMethodNextLesson(railcontentId, methodId) {
|
|
|
879
879
|
*/
|
|
880
880
|
export async function fetchMethodPreviousNextLesson(railcontentId, methodId) {
|
|
881
881
|
const sortedChildren = await fetchMethodChildrenIds(methodId);
|
|
882
|
-
const index = sortedChildren.indexOf(railcontentId);
|
|
882
|
+
const index = sortedChildren.indexOf(Number(railcontentId));
|
|
883
883
|
let nextId = sortedChildren[index + 1];
|
|
884
884
|
let previousId = sortedChildren[index -1];
|
|
885
885
|
let nextPrev = await fetchByRailContentIds([nextId, previousId]);
|
|
@@ -894,13 +894,16 @@ export async function fetchMethodPreviousNextLesson(railcontentId, methodId) {
|
|
|
894
894
|
* @returns {Promise<Array<Object>|null>} - The fetched children data or null if not found.
|
|
895
895
|
*/
|
|
896
896
|
export async function fetchMethodChildrenIds(railcontentId) {
|
|
897
|
-
const query = `*[
|
|
897
|
+
const query = `*[ railcontent_id == ${railcontentId}]{
|
|
898
898
|
'children': child[]-> {
|
|
899
899
|
'id': railcontent_id,
|
|
900
|
+
'type' : _type,
|
|
900
901
|
'children': child[]-> {
|
|
901
|
-
'id': railcontent_id,
|
|
902
|
-
'children': child[]-> {
|
|
903
902
|
'id': railcontent_id,
|
|
903
|
+
'type' : _type,
|
|
904
|
+
'children': child[]-> {
|
|
905
|
+
'id': railcontent_id,
|
|
906
|
+
'type' : _type,
|
|
904
907
|
}
|
|
905
908
|
}
|
|
906
909
|
}
|
|
@@ -912,9 +915,11 @@ export async function fetchMethodChildrenIds(railcontentId) {
|
|
|
912
915
|
function getChildrenToDepth(parent, depth = 1)
|
|
913
916
|
{
|
|
914
917
|
let allChildrenIds = [];
|
|
915
|
-
if (parent['children']) {
|
|
918
|
+
if (parent && parent['children'] && depth > 0) {
|
|
916
919
|
parent['children'].forEach((child) => {
|
|
917
|
-
|
|
920
|
+
if(!child['children']) {
|
|
921
|
+
allChildrenIds.push(child['id']);
|
|
922
|
+
}
|
|
918
923
|
allChildrenIds = allChildrenIds.concat(getChildrenToDepth(child, depth-1));
|
|
919
924
|
})
|
|
920
925
|
}
|
|
@@ -927,19 +932,27 @@ function getChildrenToDepth(parent, depth = 1)
|
|
|
927
932
|
* @returns {Promise<Object|null>} - The fetched next and previous lesson data or null if found.
|
|
928
933
|
*/
|
|
929
934
|
export async function fetchNextPreviousLesson(railcontentId) {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
935
|
+
const document = await fetchLessonContent(railcontentId);
|
|
936
|
+
if (document.parent_content_data && document.parent_content_data.length > 0) {
|
|
937
|
+
const lastElement = document.parent_content_data[document.parent_content_data.length - 1];
|
|
938
|
+
const results = await fetchMethodPreviousNextLesson(railcontentId, lastElement.id);
|
|
939
|
+
return results;
|
|
940
|
+
}
|
|
941
|
+
const processedData = processMetadata(document.brand, document.type, true);
|
|
942
|
+
let sortBy = processedData?.sortBy ?? 'published_on';
|
|
943
|
+
const isDesc = sortBy.startsWith('-');
|
|
944
|
+
sortBy = isDesc ? sortBy.substring(1) : sortBy;
|
|
945
|
+
const sortValue = document[sortBy];
|
|
946
|
+
const isNumeric = !isNaN(sortValue);
|
|
947
|
+
let prevComparison = isNumeric ? `${sortBy} <= ${sortValue}` : `${sortBy} <= "${sortValue}"`;
|
|
948
|
+
let nextComparison = isNumeric ? `${sortBy} >= ${sortValue}` : `${sortBy} >= "${sortValue}"`;
|
|
949
|
+
const fields = getFieldsForContentType(document.type);
|
|
950
|
+
const query = `{
|
|
951
|
+
"prevLesson": *[brand == "${document.brand}" && status == "${document.status}" && _type == "${document.type}" && ${prevComparison} && railcontent_id != ${railcontentId}] | order(${sortBy} desc){${fields}}[0...1][0],
|
|
952
|
+
"nextLesson": *[brand == "${document.brand}" && status == "${document.status}" && _type == "${document.type}" && ${nextComparison} && railcontent_id != ${railcontentId}] | order(${sortBy} asc){${fields}}[0...1][0]
|
|
953
|
+
}`;
|
|
954
|
+
|
|
955
|
+
return await fetchSanity(query, true);
|
|
943
956
|
}
|
|
944
957
|
|
|
945
958
|
/**
|
|
@@ -961,6 +974,7 @@ export async function fetchLessonContent(railContentId) {
|
|
|
961
974
|
difficulty,
|
|
962
975
|
difficulty_string,
|
|
963
976
|
brand,
|
|
977
|
+
status,
|
|
964
978
|
soundslice,
|
|
965
979
|
instrumentless,
|
|
966
980
|
railcontent_id,
|
|
@@ -992,7 +1006,9 @@ export async function fetchLessonContent(railContentId) {
|
|
|
992
1006
|
mp3_no_drums_yes_click_url,
|
|
993
1007
|
mp3_yes_drums_no_click_url,
|
|
994
1008
|
mp3_yes_drums_yes_click_url,
|
|
995
|
-
"permission_id": permission[]->railcontent_id
|
|
1009
|
+
"permission_id": permission[]->railcontent_id,
|
|
1010
|
+
parent_content_data,
|
|
1011
|
+
sort`;
|
|
996
1012
|
const query = buildQuery(
|
|
997
1013
|
`railcontent_id == ${railContentId}`,
|
|
998
1014
|
filterParams,
|
|
@@ -1443,23 +1459,36 @@ export async function fetchSanity(query,
|
|
|
1443
1459
|
}
|
|
1444
1460
|
}
|
|
1445
1461
|
|
|
1446
|
-
async function needsAccessDecorator(results)
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1462
|
+
async function needsAccessDecorator(results) {
|
|
1463
|
+
if (globalConfig.sanityConfig.useDummyRailContentMethods) return results;
|
|
1464
|
+
|
|
1465
|
+
let userPermissions = await getUserPermissions();
|
|
1466
|
+
userPermissions = new Set(userPermissions);
|
|
1467
|
+
|
|
1468
|
+
if (Array.isArray(results)) {
|
|
1469
|
+
results.forEach((result) => {
|
|
1470
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1471
|
+
});
|
|
1472
|
+
} else if (results.entity && Array.isArray(results.entity)) {
|
|
1473
|
+
// Group By
|
|
1474
|
+
results.entity.forEach((result) => {
|
|
1475
|
+
if (result.lessons) {
|
|
1476
|
+
result.lessons.forEach((lesson) => {
|
|
1477
|
+
lesson['need_access'] = doesUserNeedAccessToContent(lesson, userPermissions); // Updated to check lesson access
|
|
1478
|
+
});
|
|
1479
|
+
} else {
|
|
1480
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
} else if (results.related_lessons && Array.isArray(results.related_lessons)) {
|
|
1484
|
+
results.related_lessons.forEach((result) => {
|
|
1485
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1486
|
+
})
|
|
1487
|
+
} else {
|
|
1488
|
+
results['need_access'] = doesUserNeedAccessToContent(results, userPermissions);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
return results;
|
|
1463
1492
|
}
|
|
1464
1493
|
|
|
1465
1494
|
function doesUserNeedAccessToContent(result, userPermissions)
|
|
@@ -1754,7 +1783,7 @@ function cleanUpGroq(query) {
|
|
|
1754
1783
|
<br class="clear">
|
|
1755
1784
|
|
|
1756
1785
|
<footer>
|
|
1757
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on
|
|
1786
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed Oct 16 2024 19:36:10 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1758
1787
|
</footer>
|
|
1759
1788
|
|
|
1760
1789
|
<script>prettyPrint();</script>
|
package/docs/scripts/collapse.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/nav.js
CHANGED
|
File without changes
|
package/docs/scripts/polyfill.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
package/docs/styles/jsdoc.css
CHANGED
|
File without changes
|
package/docs/styles/prettify.css
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/jsdoc.json
CHANGED
|
File without changes
|
package/link_mcs.sh
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/contentTypeConfig.js
CHANGED
|
File without changes
|
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
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
let globalConfig = {
|
|
6
6
|
sanityConfig: {},
|
|
7
7
|
railcontentConfig: {},
|
|
8
|
-
localStorage: null
|
|
8
|
+
localStorage: null,
|
|
9
|
+
isMA: false,
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -33,6 +34,7 @@ const excludeFromGeneratedIndex = [];
|
|
|
33
34
|
* @param {string} config.railcontentConfig.userId - The user ID for fetching user-specific data.
|
|
34
35
|
* @param {string} config.railcontentConfig.baseUrl - The url for the enviroment.
|
|
35
36
|
* @param {Object} config.localStorage - Cache to use for localStorage
|
|
37
|
+
* @param {boolean} config.isMA - Variable that tells if the library is used by MA or FEW
|
|
36
38
|
|
|
37
39
|
*
|
|
38
40
|
* @example
|
|
@@ -51,13 +53,15 @@ const excludeFromGeneratedIndex = [];
|
|
|
51
53
|
* userId: 'current-user-id',
|
|
52
54
|
* baseUrl: 'https://web-staging-one.musora.com'
|
|
53
55
|
* },
|
|
54
|
-
* localStorage: localStorage
|
|
56
|
+
* localStorage: localStorage,
|
|
57
|
+
* isMA: false
|
|
55
58
|
* });
|
|
56
59
|
*/
|
|
57
60
|
function initializeService(config) {
|
|
58
61
|
globalConfig.sanityConfig = config.sanityConfig;
|
|
59
62
|
globalConfig.railcontentConfig = config.railcontentConfig;
|
|
60
63
|
globalConfig.localStorage = config.localStorage;
|
|
64
|
+
globalConfig.isMA = config.isMA || false;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
// Export both the initialization function and the config object
|
|
File without changes
|
|
@@ -23,7 +23,7 @@ export class DataContext {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async getData() {
|
|
26
|
-
this.ensureLocalContextLoaded();
|
|
26
|
+
await this.ensureLocalContextLoaded();
|
|
27
27
|
if (!this.context || this.shouldVerifyServerVerions()) {
|
|
28
28
|
let version = this.version();
|
|
29
29
|
let data = await this.fetchData(version);
|
|
@@ -40,10 +40,10 @@ export class DataContext {
|
|
|
40
40
|
return await this.fetchDataFunction(version);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
ensureLocalContextLoaded() {
|
|
43
|
+
async ensureLocalContextLoaded() {
|
|
44
44
|
if (this.context) return;
|
|
45
45
|
this.verifyConfig();
|
|
46
|
-
let localData = cache.getItem(this.localStorageKey);
|
|
46
|
+
let localData = globalConfig.isMA ? await cache.getItem(this.localStorageKey): cache.getItem(this.localStorageKey) ;
|
|
47
47
|
if (localData) {
|
|
48
48
|
this.context = JSON.parse(localData);
|
|
49
49
|
}
|
|
@@ -56,8 +56,8 @@ export class DataContext {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
shouldVerifyServerVerions() {
|
|
60
|
-
let lastUpdated = cache.getItem(this.localStorageLastUpdatedKey);
|
|
59
|
+
async shouldVerifyServerVerions() {
|
|
60
|
+
let lastUpdated = globalConfig.isMA ? await cache.getItem(this.localStorageLastUpdatedKey) : cache.getItem(this.localStorageLastUpdatedKey);
|
|
61
61
|
if (!lastUpdated) return false;
|
|
62
62
|
const verifyServerTime = 10000; //10 s
|
|
63
63
|
return (new Date().getTime() - lastUpdated) > verifyServerTime;
|
|
@@ -74,7 +74,7 @@ export class DataContext {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
async update(localUpdateFunction, serverUpdateFunction) {
|
|
77
|
-
this.ensureLocalContextLoaded();
|
|
77
|
+
await this.ensureLocalContextLoaded();
|
|
78
78
|
if (this.context) {
|
|
79
79
|
localUpdateFunction(this.context);
|
|
80
80
|
this.context.version++;
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -102,7 +102,7 @@ export async function fetchSongArtistCount(brand) {
|
|
|
102
102
|
export async function fetchRelatedSongs(brand, songId) {
|
|
103
103
|
const query = `
|
|
104
104
|
*[_type == "song" && railcontent_id == ${songId}]{
|
|
105
|
-
"
|
|
105
|
+
"entity": array::unique([
|
|
106
106
|
...(*[_type == "song" && brand == "${brand}" && railcontent_id != ${songId} && references(^.artist->_id)]{
|
|
107
107
|
"type": _type,
|
|
108
108
|
"id": railcontent_id,
|
|
@@ -1412,23 +1412,36 @@ export async function fetchSanity(query,
|
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
-
async function needsAccessDecorator(results)
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1415
|
+
async function needsAccessDecorator(results) {
|
|
1416
|
+
if (globalConfig.sanityConfig.useDummyRailContentMethods) return results;
|
|
1417
|
+
|
|
1418
|
+
let userPermissions = await getUserPermissions();
|
|
1419
|
+
userPermissions = new Set(userPermissions);
|
|
1420
|
+
|
|
1421
|
+
if (Array.isArray(results)) {
|
|
1422
|
+
results.forEach((result) => {
|
|
1423
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1424
|
+
});
|
|
1425
|
+
} else if (results.entity && Array.isArray(results.entity)) {
|
|
1426
|
+
// Group By
|
|
1427
|
+
results.entity.forEach((result) => {
|
|
1428
|
+
if (result.lessons) {
|
|
1429
|
+
result.lessons.forEach((lesson) => {
|
|
1430
|
+
lesson['need_access'] = doesUserNeedAccessToContent(lesson, userPermissions); // Updated to check lesson access
|
|
1431
|
+
});
|
|
1432
|
+
} else {
|
|
1433
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
} else if (results.related_lessons && Array.isArray(results.related_lessons)) {
|
|
1437
|
+
results.related_lessons.forEach((result) => {
|
|
1438
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1439
|
+
})
|
|
1440
|
+
} else {
|
|
1441
|
+
results['need_access'] = doesUserNeedAccessToContent(results, userPermissions);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
return results;
|
|
1432
1445
|
}
|
|
1433
1446
|
|
|
1434
1447
|
function doesUserNeedAccessToContent(result, userPermissions)
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
package/tools/generate-index.js
CHANGED
|
File without changes
|