musora-content-services 1.0.125 → 1.0.127
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 +0 -0
- 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 +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/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/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 +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +24 -12
- 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.127](https://github.com/railroadmedia/musora-content-services/compare/v1.0.123...v1.0.127) (2024-10-03)
|
|
6
|
+
|
|
7
|
+
### [1.0.126](https://github.com/railroadmedia/musora-content-services/compare/v1.0.124...v1.0.126) (2024-10-02)
|
|
8
|
+
|
|
5
9
|
### [1.0.125](https://github.com/railroadmedia/musora-content-services/compare/v1.0.124...v1.0.125) (2024-10-02)
|
|
6
10
|
|
|
7
11
|
### [1.0.124](https://github.com/railroadmedia/musora-content-services/compare/v1.0.99...v1.0.124) (2024-10-02)
|
package/README.md
CHANGED
|
File without changes
|
package/babel.config.js
CHANGED
|
File without changes
|
package/docs/config.js.html
CHANGED
|
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
|
|
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/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/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
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function fetchArtists(brand) {
|
|
|
67
67
|
name,
|
|
68
68
|
"lessonsCount": count(*[${filter}])
|
|
69
69
|
}[lessonsCount > 0]`;
|
|
70
|
-
return fetchSanity(query, true);
|
|
70
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -77,7 +77,7 @@ export async function fetchArtists(brand) {
|
|
|
77
77
|
*/
|
|
78
78
|
export async function fetchSongArtistCount(brand) {
|
|
79
79
|
const query = `count(*[_type == 'artist']{'lessonsCount': count(*[_type == 'song' && brand == '${brand}' && references(^._id)]._id)}[lessonsCount > 0])`;
|
|
80
|
-
return fetchSanity(query, true);
|
|
80
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -234,7 +234,7 @@ export async function fetchSongFilterOptions(brand) {
|
|
|
234
234
|
*/
|
|
235
235
|
export async function fetchSongCount(brand) {
|
|
236
236
|
const query = `count(*[_type == 'song' && brand == "${brand}"])`;
|
|
237
|
-
return fetchSanity(query, true);
|
|
237
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
/**
|
|
@@ -243,7 +243,8 @@ export async function fetchSongCount(brand) {
|
|
|
243
243
|
* It also includes completion status and progress percentage for each workout by fetching additional data about user progress.
|
|
244
244
|
*
|
|
245
245
|
* @param {string} brand - The brand for which to fetch workouts (e.g., 'drumeo', 'pianote').
|
|
246
|
-
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of workout data objects with additional properties for completion status and progress percentage,
|
|
246
|
+
* @returns {Promise<Array<Object>|null>} - A promise that resolves to an array of workout data objects with additional properties for completion status and progress percentage,
|
|
247
|
+
* or null if no workouts are found.
|
|
247
248
|
*
|
|
248
249
|
* @example
|
|
249
250
|
* fetchWorkouts('drumeo')
|
|
@@ -281,7 +282,9 @@ export async function fetchNewReleases(brand, { page = 1, limit = 20, sort="-pub
|
|
|
281
282
|
length_in_seconds,
|
|
282
283
|
published_on,
|
|
283
284
|
"type": _type,
|
|
284
|
-
web_url_path
|
|
285
|
+
web_url_path,
|
|
286
|
+
"permission_id": permission[]->railcontent_id,
|
|
287
|
+
`;
|
|
285
288
|
const filterParams = {};
|
|
286
289
|
const query = buildQuery(
|
|
287
290
|
filter,
|
|
@@ -326,7 +329,8 @@ export async function fetchUpcomingEvents(brand, { page = 1, limit = 10 } = {})
|
|
|
326
329
|
length_in_seconds,
|
|
327
330
|
published_on,
|
|
328
331
|
"type": _type,
|
|
329
|
-
web_url_path
|
|
332
|
+
web_url_path,
|
|
333
|
+
"permission_id": permission[]->railcontent_id,`;
|
|
330
334
|
const query = buildRawQuery(
|
|
331
335
|
`_type in ${typesString} && brand == '${brand}' && published_on > '${now}' && status == 'scheduled'`,
|
|
332
336
|
fields,
|
|
@@ -374,6 +378,7 @@ export async function fetchScheduledReleases(brand, { page = 1, limit = 10 }) {
|
|
|
374
378
|
published_on,
|
|
375
379
|
"type": _type,
|
|
376
380
|
web_url_path,
|
|
381
|
+
"permission_id": permission[]->railcontent_id,
|
|
377
382
|
} | order(published_on asc)[${start}...${end}]`;
|
|
378
383
|
return fetchSanity(query, true);
|
|
379
384
|
}
|
|
@@ -664,7 +669,7 @@ export async function fetchAllFilterOptions(
|
|
|
664
669
|
}
|
|
665
670
|
}
|
|
666
671
|
}`;
|
|
667
|
-
return fetchSanity(query, true);
|
|
672
|
+
return fetchSanity(query, true, {processNeedAccess:false});
|
|
668
673
|
}
|
|
669
674
|
|
|
670
675
|
/**
|
|
@@ -752,6 +757,7 @@ export async function fetchMethod(brand, slug) {
|
|
|
752
757
|
video,
|
|
753
758
|
length_in_seconds,
|
|
754
759
|
"type": _type,
|
|
760
|
+
"permission_id": permission[]->railcontent_id,
|
|
755
761
|
"levels": child[]->
|
|
756
762
|
{
|
|
757
763
|
"id": railcontent_id,
|
|
@@ -933,7 +939,8 @@ export async function fetchLessonContent(railContentId) {
|
|
|
933
939
|
mp3_no_drums_no_click_url,
|
|
934
940
|
mp3_no_drums_yes_click_url,
|
|
935
941
|
mp3_yes_drums_no_click_url,
|
|
936
|
-
mp3_yes_drums_yes_click_url
|
|
942
|
+
mp3_yes_drums_yes_click_url,
|
|
943
|
+
"permission_id": permission[]->railcontent_id,`;
|
|
937
944
|
const query = buildQuery(
|
|
938
945
|
`railcontent_id == ${railContentId}`,
|
|
939
946
|
filterParams,
|
|
@@ -961,8 +968,8 @@ export async function fetchRelatedLessons(railContentId, brand) {
|
|
|
961
968
|
//TODO: Implement $this->contentService->getFiltered
|
|
962
969
|
const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && references(*[_type=='permission']._id)]{
|
|
963
970
|
"related_lessons" : array::unique([
|
|
964
|
-
...(*[_type=="song" && brand == "${brand}" && references(^.artist->_id)]{_id, "id":railcontent_id, published_on, title, "thumbnail_url":thumbnail.asset->url, difficulty_string, railcontent_id, artist->}[0...11]),
|
|
965
|
-
...(*[_type=="song" && brand == "${brand}" && references(^.genre[]->_id)]{_id, "id":railcontent_id, published_on, title, "thumbnail_url":thumbnail.asset->url, difficulty_string, railcontent_id, artist->}[0...11])
|
|
971
|
+
...(*[_type=="song" && brand == "${brand}" && references(^.artist->_id)]{_id, "id":railcontent_id, published_on, title, "thumbnail_url":thumbnail.asset->url, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,}[0...11]),
|
|
972
|
+
...(*[_type=="song" && brand == "${brand}" && references(^.genre[]->_id)]{_id, "id":railcontent_id, published_on, title, "thumbnail_url":thumbnail.asset->url, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,}[0...11])
|
|
966
973
|
])|order(published_on, railcontent_id)[0...11]}`;
|
|
967
974
|
return fetchSanity(query, false);
|
|
968
975
|
}
|
|
@@ -1363,6 +1370,10 @@ async function needsAccessDecorator(results)
|
|
|
1363
1370
|
results.forEach((result) => {
|
|
1364
1371
|
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1365
1372
|
});
|
|
1373
|
+
}else if (results.entity && Array.isArray(results.entity)) {
|
|
1374
|
+
results.entity.forEach((result) => {
|
|
1375
|
+
result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
|
|
1376
|
+
});
|
|
1366
1377
|
} else {
|
|
1367
1378
|
results['need_access'] = doesUserNeedAccessToContent(results, userPermissions);
|
|
1368
1379
|
}
|
|
@@ -1372,7 +1383,8 @@ async function needsAccessDecorator(results)
|
|
|
1372
1383
|
function doesUserNeedAccessToContent(result, userPermissions)
|
|
1373
1384
|
{
|
|
1374
1385
|
const permissions = new Set(result.permission_id ?? []);
|
|
1375
|
-
|
|
1386
|
+
|
|
1387
|
+
if (permissions.size === 0) {
|
|
1376
1388
|
return false;
|
|
1377
1389
|
}
|
|
1378
1390
|
for (let permission of permissions) {
|
|
@@ -1412,7 +1424,7 @@ export async function fetchCatalogMetadata(contentType)
|
|
|
1412
1424
|
modal_text,
|
|
1413
1425
|
sort_by,
|
|
1414
1426
|
}`
|
|
1415
|
-
return fetchSanity(query, false);
|
|
1427
|
+
return fetchSanity(query, false, {processNeedAccess:false});
|
|
1416
1428
|
}
|
|
1417
1429
|
|
|
1418
1430
|
/**
|
|
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
|