musora-content-services 1.0.217 → 1.0.219
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 +23 -2
- package/src/filterBuilder.js +0 -0
- package/src/index.d.ts +0 -0
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +17 -6
- package/src/services/userPermissions.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +13 -0
- package/test/userPermissions.test.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.219](https://github.com/railroadmedia/musora-content-services/compare/v1.0.218...v1.0.219) (2024-12-05)
|
|
6
|
+
|
|
7
|
+
### [1.0.218](https://github.com/railroadmedia/musora-content-services/compare/v1.0.209...v1.0.218) (2024-12-05)
|
|
8
|
+
|
|
5
9
|
### [1.0.217](https://github.com/railroadmedia/musora-content-services/compare/v1.0.216...v1.0.217) (2024-12-05)
|
|
6
10
|
|
|
7
11
|
### [1.0.216](https://github.com/railroadmedia/musora-content-services/compare/v1.0.215...v1.0.216) (2024-12-04)
|
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
|
@@ -207,6 +207,27 @@ const commonMetadata ={
|
|
|
207
207
|
},
|
|
208
208
|
'coach-lessons':{
|
|
209
209
|
allowableFilters: ['difficulty', 'genre', 'essential','theory','lifestyle','type'],
|
|
210
|
+
},
|
|
211
|
+
'lesson-history': {
|
|
212
|
+
name: 'Lesson History',
|
|
213
|
+
shortname: 'Lesson History',
|
|
214
|
+
icon: 'bookmark',
|
|
215
|
+
allowableFilters: ['difficulty', 'type'],
|
|
216
|
+
sortBy: '-published_on',
|
|
217
|
+
tabs: [
|
|
218
|
+
{
|
|
219
|
+
name: 'In Progress',
|
|
220
|
+
short_name: 'IN PROGRESS',
|
|
221
|
+
is_group_by: false,
|
|
222
|
+
value: 'inProgress',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'Completed',
|
|
226
|
+
short_name: 'COMPLETED',
|
|
227
|
+
is_group_by: false,
|
|
228
|
+
value: 'completed',
|
|
229
|
+
},
|
|
230
|
+
]
|
|
210
231
|
}
|
|
211
232
|
}
|
|
212
233
|
const contentMetadata = {
|
|
@@ -219,7 +240,7 @@ const contentMetadata = {
|
|
|
219
240
|
sortBy: '-published_on',
|
|
220
241
|
},
|
|
221
242
|
'song': {
|
|
222
|
-
sortBy: '
|
|
243
|
+
sortBy: '-published_on',
|
|
223
244
|
},
|
|
224
245
|
'student-review' : null,
|
|
225
246
|
'student-focus': {
|
|
@@ -748,7 +769,7 @@ const contentMetadata = {
|
|
|
748
769
|
shortname: 'songs',
|
|
749
770
|
amountOfFutureLessonsToShow: 3,
|
|
750
771
|
showFutureLessonAtTopOrBottom: 'bottom',
|
|
751
|
-
sortBy: '
|
|
772
|
+
sortBy: '-published_on',
|
|
752
773
|
},
|
|
753
774
|
'course': {
|
|
754
775
|
thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/pianote/courses.jpg',
|
package/src/filterBuilder.js
CHANGED
|
File without changes
|
package/src/index.d.ts
CHANGED
|
File without changes
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -1082,7 +1082,11 @@ export async function fetchNextPreviousLesson(railcontentId) {
|
|
|
1082
1082
|
let sortBy = processedData?.sortBy ?? 'published_on';
|
|
1083
1083
|
const isDesc = sortBy.startsWith('-');
|
|
1084
1084
|
sortBy = isDesc ? sortBy.substring(1) : sortBy;
|
|
1085
|
-
|
|
1085
|
+
let sortValue = document[sortBy];
|
|
1086
|
+
if (sortValue == null) {
|
|
1087
|
+
sortBy = 'railcontent_id';
|
|
1088
|
+
sortValue = document['railcontent_id'];
|
|
1089
|
+
}
|
|
1086
1090
|
const isNumeric = !isNaN(sortValue);
|
|
1087
1091
|
let prevComparison = isNumeric ? `${sortBy} <= ${sortValue}` : `${sortBy} <= "${sortValue}"`;
|
|
1088
1092
|
let nextComparison = isNumeric ? `${sortBy} >= ${sortValue}` : `${sortBy} >= "${sortValue}"`;
|
|
@@ -1171,14 +1175,21 @@ export async function fetchLessonContent(railContentId) {
|
|
|
1171
1175
|
* @returns {Promise<Array<Object>|null>} - The fetched related lessons data or null if not found.
|
|
1172
1176
|
*/
|
|
1173
1177
|
export async function fetchRelatedLessons(railContentId, brand) {
|
|
1178
|
+
const filterSameTypeAndSortOrder = await new FilterBuilder(`_type==^._type && _type in ${JSON.stringify(typeWithSortOrder)} && brand == "${brand}" && railcontent_id !=${railContentId}`).buildFilter();
|
|
1179
|
+
const filterSameType = await new FilterBuilder(`_type==^._type && !(_type in ${JSON.stringify(typeWithSortOrder)}) && !(defined(parent_type)) && brand == "${brand}" && railcontent_id !=${railContentId}`).buildFilter();
|
|
1180
|
+
const filterSongSameArtist = await new FilterBuilder(`_type=="song" && _type==^._type && brand == "${brand}" && references(^.artist->_id) && railcontent_id !=${railContentId}`).buildFilter();
|
|
1181
|
+
const filterSongSameGenre = await new FilterBuilder(`_type=="song" && _type==^._type && brand == "${brand}" && references(^.genre[]->_id) && railcontent_id !=${railContentId}`).buildFilter();
|
|
1182
|
+
const filterNeighbouringSiblings = await new FilterBuilder(`references(^._id)`).buildFilter();
|
|
1183
|
+
|
|
1174
1184
|
const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && (!defined(permission) || references(*[_type=='permission']._id))]{
|
|
1175
1185
|
_type, parent_type, railcontent_id,
|
|
1176
1186
|
"related_lessons" : array::unique([
|
|
1177
|
-
...(*[
|
|
1178
|
-
...(*[
|
|
1179
|
-
...(*[
|
|
1180
|
-
...(*[
|
|
1181
|
-
...(*[
|
|
1187
|
+
...(*[${filterNeighbouringSiblings}][0].child[]->{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}),
|
|
1188
|
+
...(*[${filterSongSameArtist}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10]),
|
|
1189
|
+
...(*[${filterSongSameGenre}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10]),
|
|
1190
|
+
...(*[${filterSameTypeAndSortOrder}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type, sort}|order(sort asc, title asc)[0...10]),
|
|
1191
|
+
...(*[${filterSameType}]{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}|order(published_on desc, title asc)[0...10])
|
|
1192
|
+
,
|
|
1182
1193
|
])[0...10]}`;
|
|
1183
1194
|
return fetchSanity(query, false);
|
|
1184
1195
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/initializeTests.js
CHANGED
|
File without changes
|
package/test/lastUpdated.test.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
@@ -633,6 +633,19 @@ describe('Sanity Queries', function () {
|
|
|
633
633
|
expect(documentPublishedOn.getTime()).toBeLessThan(nextDocumentPublishedOn.getTime());
|
|
634
634
|
});
|
|
635
635
|
|
|
636
|
+
test('fetchNextPreviousLesson-Song', async () => {
|
|
637
|
+
const id = 414041;
|
|
638
|
+
const response = await fetchNextPreviousLesson(id);
|
|
639
|
+
const document = await fetchByRailContentId(id, 'song');
|
|
640
|
+
const documentPublishedOn = new Date(document.published_on);
|
|
641
|
+
const prevDocumentPublishedOn = new Date(response.prevLesson.published_on);
|
|
642
|
+
const nextDocumentPublishedOn = new Date(response.nextLesson.published_on);
|
|
643
|
+
expect(response.prevLesson).toBeDefined();
|
|
644
|
+
expect(prevDocumentPublishedOn.getTime()).toBeLessThanOrEqual(documentPublishedOn.getTime());
|
|
645
|
+
expect(response.nextLesson).toBeDefined();
|
|
646
|
+
expect(documentPublishedOn.getTime()).toBeLessThanOrEqual(nextDocumentPublishedOn.getTime());
|
|
647
|
+
});
|
|
648
|
+
|
|
636
649
|
test('fetchTopLevelParentId', async () => {
|
|
637
650
|
let contentId = await fetchTopLevelParentId(241250);
|
|
638
651
|
expect(contentId).toBe(241247);
|
|
File without changes
|
package/tools/generate-index.js
CHANGED
|
File without changes
|