musora-content-services 1.0.11 → 1.0.12
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/package.json +1 -1
- package/src/index.d.ts +52 -0
- package/src/index.js +30 -31
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.12](https://github.com/railroadmedia/musora-content-services/compare/v1.0.11...v1.0.12) (2024-08-12)
|
|
6
|
+
|
|
5
7
|
### [1.0.11](https://github.com/railroadmedia/musora-content-services/compare/v1.0.10...v1.0.11) (2024-08-12)
|
|
6
8
|
|
|
7
9
|
### [1.0.10](https://github.com/railroadmedia/musora-content-services/compare/v1.0.9...v1.0.10) (2024-08-12)
|
package/package.json
CHANGED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
initializeSanityService,
|
|
3
|
+
fetchSongById,
|
|
4
|
+
fetchArtists,
|
|
5
|
+
fetchSongArtistCount,
|
|
6
|
+
fetchRelatedSongs,
|
|
7
|
+
fetchAllSongs,
|
|
8
|
+
fetchSongFilterOptions,
|
|
9
|
+
fetchSongCount,
|
|
10
|
+
fetchWorkouts,
|
|
11
|
+
fetchNewReleases,
|
|
12
|
+
fetchUpcomingEvents,
|
|
13
|
+
fetchByRailContentId,
|
|
14
|
+
fetchByRailContentIds,
|
|
15
|
+
fetchAll,
|
|
16
|
+
fetchAllFilterOptions,
|
|
17
|
+
fetchMethodNextLesson,
|
|
18
|
+
fetchMethodChildren,
|
|
19
|
+
fetchNextPreviousLesson,
|
|
20
|
+
fetchRelatedLessons,
|
|
21
|
+
fetchPackAll,
|
|
22
|
+
fetchPackChildren,
|
|
23
|
+
fetchLessonContent
|
|
24
|
+
} from './index.js';
|
|
25
|
+
|
|
26
|
+
declare module 'musora-content-services' {
|
|
27
|
+
export {
|
|
28
|
+
initializeSanityService,
|
|
29
|
+
fetchSongById,
|
|
30
|
+
fetchArtists,
|
|
31
|
+
fetchSongArtistCount,
|
|
32
|
+
fetchRelatedSongs,
|
|
33
|
+
fetchAllSongs,
|
|
34
|
+
fetchSongFilterOptions,
|
|
35
|
+
fetchSongCount,
|
|
36
|
+
fetchWorkouts,
|
|
37
|
+
fetchNewReleases,
|
|
38
|
+
fetchUpcomingEvents,
|
|
39
|
+
fetchByRailContentId,
|
|
40
|
+
fetchByRailContentIds,
|
|
41
|
+
fetchAll,
|
|
42
|
+
fetchAllFilterOptions,
|
|
43
|
+
fetchMethodNextLesson,
|
|
44
|
+
fetchMethodChildren,
|
|
45
|
+
fetchNextPreviousLesson,
|
|
46
|
+
fetchRelatedLessons,
|
|
47
|
+
fetchPackAll,
|
|
48
|
+
fetchPackChildren,
|
|
49
|
+
fetchLessonContent
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
package/src/index.js
CHANGED
|
@@ -85,7 +85,7 @@ async function fetchArtists(brand) {
|
|
|
85
85
|
*/
|
|
86
86
|
async function fetchSongArtistCount(brand) {
|
|
87
87
|
const query = `count(*[_type == 'artist']{'lessonsCount': count(*[_type == 'song' && brand == '${brand}' && references(^._id)]._id)}[lessonsCount > 0])`;
|
|
88
|
-
return fetchSanity(query,
|
|
88
|
+
return fetchSanity(query, true);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -257,21 +257,21 @@ async function fetchAllSongs(brand, {
|
|
|
257
257
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
258
258
|
'all_lessons_count': count(*[_type == 'song' && brand == '${brand}' && ^._id == artist._ref ]._id),
|
|
259
259
|
'lessons': *[_type == 'song' && brand == '${brand}' && ^._id == artist._ref ]{
|
|
260
|
-
|
|
260
|
+
"id": railcontent_id,
|
|
261
|
+
"type": _type,
|
|
261
262
|
title,
|
|
262
|
-
"
|
|
263
|
+
"thumbnail_url": thumbnail.asset->url,
|
|
263
264
|
"artist_name": artist->name,
|
|
264
|
-
artist,
|
|
265
|
-
difficulty,
|
|
266
265
|
difficulty_string,
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
published_on,
|
|
267
|
+
soundslice,
|
|
268
|
+
instrumentless,
|
|
269
269
|
}[0...10]
|
|
270
270
|
}
|
|
271
271
|
|order(${sortOrder})
|
|
272
272
|
[${start}...${end}]
|
|
273
273
|
}`;
|
|
274
|
-
} else if (groupBy === "
|
|
274
|
+
} else if (groupBy === "style") {
|
|
275
275
|
query = `
|
|
276
276
|
{
|
|
277
277
|
"total": count(*[_type == 'genre' && count(*[_type == 'song' && brand == '${brand}' && ^._id in genre[]._ref ]._id) > 0]),
|
|
@@ -284,15 +284,15 @@ async function fetchAllSongs(brand, {
|
|
|
284
284
|
'head_shot_picture_url': thumbnail_url.asset->url,
|
|
285
285
|
'all_lessons_count': count(*[_type == 'song' && brand == '${brand}' && ^._id in genre[]._ref ]._id),
|
|
286
286
|
'lessons': *[_type == 'song' && brand == '${brand}' && ^._id in genre[]._ref ]{
|
|
287
|
-
railcontent_id,
|
|
287
|
+
"id": railcontent_id,
|
|
288
|
+
"type": _type,
|
|
288
289
|
title,
|
|
289
|
-
"
|
|
290
|
+
"thumbnail_url": thumbnail.asset->url,
|
|
290
291
|
"artist_name": artist->name,
|
|
291
|
-
artist,
|
|
292
|
-
difficulty,
|
|
293
292
|
difficulty_string,
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
published_on,
|
|
294
|
+
soundslice,
|
|
295
|
+
instrumentless,
|
|
296
296
|
}[0...10]
|
|
297
297
|
}
|
|
298
298
|
|order(${sortOrder})
|
|
@@ -302,22 +302,22 @@ async function fetchAllSongs(brand, {
|
|
|
302
302
|
query = `
|
|
303
303
|
{
|
|
304
304
|
"entity": *[_type == 'song' && brand == "${brand}" ${searchFilter} ${includedFieldsFilter}] | order(${sortOrder}) [${start}...${end}] {
|
|
305
|
-
railcontent_id,
|
|
305
|
+
"id": railcontent_id,
|
|
306
|
+
"type": _type,
|
|
306
307
|
title,
|
|
307
|
-
"
|
|
308
|
+
"thumbnail_url": thumbnail.asset->url,
|
|
308
309
|
"artist_name": artist->name,
|
|
309
|
-
artist,
|
|
310
|
-
difficulty,
|
|
311
310
|
difficulty_string,
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
published_on,
|
|
312
|
+
soundslice,
|
|
313
|
+
instrumentless,
|
|
314
314
|
},
|
|
315
315
|
"total": count(*[_type == 'song' && brand == "${brand}" ${searchFilter} ${includedFieldsFilter}])
|
|
316
316
|
}
|
|
317
317
|
`;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
return fetchSanity(query,
|
|
320
|
+
return fetchSanity(query, true);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
/**
|
|
@@ -335,24 +335,24 @@ async function fetchSongFilterOptions(brand) {
|
|
|
335
335
|
const query = `
|
|
336
336
|
{
|
|
337
337
|
"difficulty": [
|
|
338
|
-
{"type": "Introductory", "count": count(*[_type == 'song' && brand == ${brand} && difficulty_string == "Introductory"]._id)},
|
|
339
|
-
{"type": "Beginner", "count": count(*[_type == 'song' && brand == ${brand} && difficulty_string == "Beginner"]._id)},
|
|
340
|
-
{"type": "Intermediate", "count": count(*[_type == 'song' && brand == ${brand} && difficulty_string == "Intermediate"]._id)},
|
|
341
|
-
{"type": "Advanced", "count": count(*[_type == 'song' && brand == ${brand} && difficulty_string == "Advanced"]._id)},
|
|
342
|
-
{"type": "Expert", "count": count(*[_type == 'song' && brand == ${brand} && difficulty_string == "Expert"]._id)}
|
|
338
|
+
{"type": "Introductory", "count": count(*[_type == 'song' && brand == '${brand}' && difficulty_string == "Introductory"]._id)},
|
|
339
|
+
{"type": "Beginner", "count": count(*[_type == 'song' && brand == '${brand}' && difficulty_string == "Beginner"]._id)},
|
|
340
|
+
{"type": "Intermediate", "count": count(*[_type == 'song' && brand == '${brand}' && difficulty_string == "Intermediate"]._id)},
|
|
341
|
+
{"type": "Advanced", "count": count(*[_type == 'song' && brand == '${brand}' && difficulty_string == "Advanced"]._id)},
|
|
342
|
+
{"type": "Expert", "count": count(*[_type == 'song' && brand == '${brand}' && difficulty_string == "Expert"]._id)}
|
|
343
343
|
],
|
|
344
344
|
"genre": *[_type == 'genre' && 'song' in filter_types] {
|
|
345
345
|
"type": name,
|
|
346
|
-
"count": count(*[_type == 'song' && brand == ${brand} && references(^._id)]._id)
|
|
346
|
+
"count": count(*[_type == 'song' && brand == '${brand}' && references(^._id)]._id)
|
|
347
347
|
},
|
|
348
348
|
"instrumentless": [
|
|
349
|
-
{"type": "Full Song Only", "count": count(*[_type == 'song' && brand == ${brand} && instrumentless == false]._id)},
|
|
350
|
-
{"type": "Instrument Removed", "count": count(*[_type == 'song' && brand == ${brand} && instrumentless == true]._id)}
|
|
349
|
+
{"type": "Full Song Only", "count": count(*[_type == 'song' && brand == '${brand}' && instrumentless == false]._id)},
|
|
350
|
+
{"type": "Instrument Removed", "count": count(*[_type == 'song' && brand == '${brand}' && instrumentless == true]._id)}
|
|
351
351
|
]
|
|
352
352
|
}
|
|
353
353
|
`;
|
|
354
354
|
|
|
355
|
-
return fetchSanity(query,
|
|
355
|
+
return fetchSanity(query, true);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
/**
|
|
@@ -980,4 +980,3 @@ module.exports = {
|
|
|
980
980
|
fetchPackChildren,
|
|
981
981
|
fetchLessonContent
|
|
982
982
|
};
|
|
983
|
-
|