musora-content-services 1.0.133 → 1.0.135
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/link_mcs.sh +0 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +17 -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 +27 -6
- package/test/contentLikes.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.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.135](https://github.com/railroadmedia/musora-content-services/compare/v1.0.134...v1.0.135) (2024-10-11)
|
|
6
|
+
|
|
7
|
+
### [1.0.134](https://github.com/railroadmedia/musora-content-services/compare/v1.0.133...v1.0.134) (2024-10-11)
|
|
8
|
+
|
|
5
9
|
### [1.0.133](https://github.com/railroadmedia/musora-content-services/compare/v1.0.132...v1.0.133) (2024-10-10)
|
|
6
10
|
|
|
7
11
|
### [1.0.132](https://github.com/railroadmedia/musora-content-services/compare/v1.0.131...v1.0.132) (2024-10-10)
|
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/link_mcs.sh
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -171,6 +171,23 @@ let contentTypeConfig = {
|
|
|
171
171
|
}`,
|
|
172
172
|
]
|
|
173
173
|
},
|
|
174
|
+
'learning-path-level': {
|
|
175
|
+
'fields': [
|
|
176
|
+
'"lesson_count": child_count',
|
|
177
|
+
'"instructors": instructor[]->name',
|
|
178
|
+
`"description": ${descriptionField}`,
|
|
179
|
+
'resource',
|
|
180
|
+
'xp',
|
|
181
|
+
'total_xp',
|
|
182
|
+
`"lessons": child[]->{
|
|
183
|
+
"id": railcontent_id,
|
|
184
|
+
title,
|
|
185
|
+
"image": thumbnail.asset->url,
|
|
186
|
+
"instructors": instructor[]->name,
|
|
187
|
+
length_in_seconds,
|
|
188
|
+
}`,
|
|
189
|
+
]
|
|
190
|
+
},
|
|
174
191
|
'workout': {
|
|
175
192
|
'fields': [
|
|
176
193
|
artistOrInstructorNameAsArray(),
|
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
|
@@ -1214,10 +1214,17 @@ export async function fetchByReference(brand, {
|
|
|
1214
1214
|
* @param {string} brand - The brand for which to fetch lessons.
|
|
1215
1215
|
* @param {string} name - The name of the artist
|
|
1216
1216
|
* @param {string} contentType - The type of the lessons we need to get from the artist. If not defined, groq will get lessons from all content types
|
|
1217
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1218
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1219
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1220
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1221
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1222
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1223
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1217
1224
|
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1218
1225
|
*
|
|
1219
1226
|
* @example
|
|
1220
|
-
* fetchArtistLessons('10 Years', 'song')
|
|
1227
|
+
* fetchArtistLessons('drumeo', '10 Years', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1221
1228
|
* .then(lessons => console.log(lessons))
|
|
1222
1229
|
* .catch(error => console.error(error));
|
|
1223
1230
|
*/
|
|
@@ -1227,7 +1234,9 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1227
1234
|
page = 1,
|
|
1228
1235
|
limit = 10,
|
|
1229
1236
|
includedFields = [],
|
|
1237
|
+
progressIds = undefined,
|
|
1230
1238
|
} = {}) {
|
|
1239
|
+
|
|
1231
1240
|
const fieldsString = DEFAULT_FIELDS.join(',');
|
|
1232
1241
|
const start = (page - 1) * limit;
|
|
1233
1242
|
const end = start + limit;
|
|
@@ -1238,12 +1247,15 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1238
1247
|
? filtersToGroq(includedFields)
|
|
1239
1248
|
: "";
|
|
1240
1249
|
|
|
1250
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1251
|
+
const progressFilter = progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : "";
|
|
1252
|
+
|
|
1241
1253
|
const query = `{
|
|
1242
1254
|
"entity":
|
|
1243
1255
|
*[_type == 'artist' && name == '${name}']
|
|
1244
1256
|
{'type': _type, name, 'thumbnail_url':thumbnail_url.asset->url,
|
|
1245
1257
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1246
|
-
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter}]{${fieldsString}}
|
|
1258
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1247
1259
|
[${start}...${end}]}
|
|
1248
1260
|
|order(${sortOrder})
|
|
1249
1261
|
}`;
|
|
@@ -1254,11 +1266,17 @@ export async function fetchArtistLessons(brand, name, contentType, {
|
|
|
1254
1266
|
* Fetch the genre's lessons.
|
|
1255
1267
|
* @param {string} brand - The brand for which to fetch lessons.
|
|
1256
1268
|
* @param {string} name - The name of the genre
|
|
1257
|
-
* @param {
|
|
1258
|
-
* @
|
|
1269
|
+
* @param {Object} params - Parameters for sorting, searching, pagination and filtering.
|
|
1270
|
+
* @param {string} [params.sort="-published_on"] - The field to sort the lessons by.
|
|
1271
|
+
* @param {string} [params.searchTerm=""] - The search term to filter the lessons.
|
|
1272
|
+
* @param {number} [params.page=1] - The page number for pagination.
|
|
1273
|
+
* @param {number} [params.limit=10] - The number of items per page.
|
|
1274
|
+
* @param {Array<string>} [params.includedFields=[]] - Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
|
|
1275
|
+
* @param {Array<number>} [params.progressIds] - The ids of the lessons that are in progress or completed
|
|
1276
|
+
* @returns {Promise<Object|null>} - The lessons for the artist and some details about the artist (name and thumbnail).
|
|
1259
1277
|
*
|
|
1260
1278
|
* @example
|
|
1261
|
-
* fetchGenreLessons('Blues', 'song')
|
|
1279
|
+
* fetchGenreLessons('drumeo', 'Blues', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
|
|
1262
1280
|
* .then(lessons => console.log(lessons))
|
|
1263
1281
|
* .catch(error => console.error(error));
|
|
1264
1282
|
*/
|
|
@@ -1268,6 +1286,7 @@ export async function fetchGenreLessons(brand, name, contentType, {
|
|
|
1268
1286
|
page = 1,
|
|
1269
1287
|
limit = 10,
|
|
1270
1288
|
includedFields = [],
|
|
1289
|
+
progressIds = undefined,
|
|
1271
1290
|
} = {}) {
|
|
1272
1291
|
const fieldsString = DEFAULT_FIELDS.join(',');
|
|
1273
1292
|
const start = (page - 1) * limit;
|
|
@@ -1278,13 +1297,15 @@ export async function fetchGenreLessons(brand, name, contentType, {
|
|
|
1278
1297
|
const includedFieldsFilter = includedFields.length > 0
|
|
1279
1298
|
? filtersToGroq(includedFields)
|
|
1280
1299
|
: "";
|
|
1300
|
+
// limits the results to supplied progressIds for started & completed filters
|
|
1301
|
+
const progressFilter = progressIds !== undefined ? `&& railcontent_id in [${progressIds.join(',')}]` : "";
|
|
1281
1302
|
|
|
1282
1303
|
const query = `{
|
|
1283
1304
|
"entity":
|
|
1284
1305
|
*[_type == 'genre' && name == '${name}']
|
|
1285
1306
|
{'type': _type, name, 'thumbnail_url':thumbnail_url.asset->url,
|
|
1286
1307
|
'lessons_count': count(*[${addType} brand == '${brand}' && references(^._id)]),
|
|
1287
|
-
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter}]{${fieldsString}}
|
|
1308
|
+
'lessons': *[${addType} brand == '${brand}' && references(^._id) ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{${fieldsString}}
|
|
1288
1309
|
[${start}...${end}]}
|
|
1289
1310
|
|order(${sortOrder})
|
|
1290
1311
|
}`;
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
File without changes
|
package/tools/generate-index.js
CHANGED
|
File without changes
|