musora-content-services 1.0.111 → 1.0.113

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 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.113](https://github.com/railroadmedia/musora-content-services/compare/v1.0.112...v1.0.113) (2024-09-25)
6
+
7
+ ### [1.0.112](https://github.com/railroadmedia/musora-content-services/compare/v1.0.111...v1.0.112) (2024-09-24)
8
+
5
9
  ### [1.0.111](https://github.com/railroadmedia/musora-content-services/compare/v1.0.110...v1.0.111) (2024-09-24)
6
10
 
7
11
  ### [1.0.110](https://github.com/railroadmedia/musora-content-services/compare/v1.0.109...v1.0.110) (2024-09-23)
@@ -114,7 +114,7 @@ module.exports = {
114
114
  <br class="clear">
115
115
 
116
116
  <footer>
117
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
117
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
118
118
  </footer>
119
119
 
120
120
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -149,7 +149,7 @@ with <code>npm test -- -t=&quot;userContext&quot;</code> or just the contentLike
149
149
  <br class="clear">
150
150
 
151
151
  <footer>
152
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
152
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
153
153
  </footer>
154
154
 
155
155
  <script>prettyPrint();</script>
@@ -681,7 +681,7 @@ initializeService({
681
681
  <br class="clear">
682
682
 
683
683
  <footer>
684
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
684
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
685
685
  </footer>
686
686
 
687
687
  <script>prettyPrint();</script>
@@ -1518,7 +1518,7 @@
1518
1518
  <br class="clear">
1519
1519
 
1520
1520
  <footer>
1521
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1521
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1522
1522
  </footer>
1523
1523
 
1524
1524
  <script>prettyPrint();</script>
@@ -8166,7 +8166,7 @@ It also includes completion status and progress percentage for each workout by f
8166
8166
  <br class="clear">
8167
8167
 
8168
8168
  <footer>
8169
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
8169
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
8170
8170
  </footer>
8171
8171
 
8172
8172
  <script>prettyPrint();</script>
@@ -372,7 +372,7 @@ export async function fetchUnlikeContent(contentId) {
372
372
  <br class="clear">
373
373
 
374
374
  <footer>
375
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
375
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
376
376
  </footer>
377
377
 
378
378
  <script>prettyPrint();</script>
@@ -306,7 +306,7 @@ export async function fetchWorkouts(brand) {
306
306
  * @param {string} brand - The brand for which to fetch new releases.
307
307
  * @returns {Promise&lt;Object|null>} - The fetched new releases data or null if not found.
308
308
  */
309
- export async function fetchNewReleases(brand, { page = 1, limit = 10, sort="-published_on" } = {}) {
309
+ export async function fetchNewReleases(brand, { page = 1, limit = 20, sort="-published_on" } = {}) {
310
310
  const newTypes = getNewReleasesTypes(brand);
311
311
  const typesString = arrayToStringRepresentation(newTypes);
312
312
  const start = (page - 1) * limit;
@@ -559,7 +559,7 @@ export async function fetchAll(brand, type, {
559
559
  'lessons': *[_type == '${type}' &amp;&amp; brand == '${brand}' &amp;&amp; ^._id == ${groupBy}._ref ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
560
560
  ${fieldsString},
561
561
  ${groupBy}
562
- }[0...10]
562
+ }[0...20]
563
563
  }
564
564
  |order(${sortOrder})
565
565
  [${start}...${end}]
@@ -580,7 +580,7 @@ export async function fetchAll(brand, type, {
580
580
  'lessons': *[brand == '${brand}' &amp;&amp; ^._id in ${groupBy}[]._ref ${typeFilter} ${searchFilter} ${includedFieldsFilter} ${progressFilter}]{
581
581
  ${fieldsString},
582
582
  ${groupBy}
583
- }[0...10]
583
+ }[0...20]
584
584
  }
585
585
  |order(${sortOrder})
586
586
  [${start}...${end}]
@@ -1239,7 +1239,7 @@ export async function fetchArtistLessons(brand, name, contentType, {
1239
1239
  const end = start + limit;
1240
1240
  const searchFilter = searchTerm ? `&amp;&amp; title match "${searchTerm}*"`: ''
1241
1241
  const sortOrder = getSortOrder(sort);
1242
- const addType = contentType ? `_type == '${contentType}' &amp;&amp; `:''
1242
+ const addType = contentType &amp;&amp; Array.isArray(contentType) ? `_type in ['${contentType.join("', '")}'] &amp;&amp;` : contentType ? `_type == '${contentType}' &amp;&amp; `:''
1243
1243
  const includedFieldsFilter = includedFields.length > 0
1244
1244
  ? filtersToGroq(includedFields)
1245
1245
  : "";
@@ -1517,7 +1517,6 @@ function processMetadata(brand, type, withFilters = false) {
1517
1517
  if (!metadataElement) {
1518
1518
  return null;
1519
1519
  }
1520
-
1521
1520
  const processedData = {
1522
1521
  type,
1523
1522
  thumbnailUrl: metadataElement.thumbnailUrl || null,
@@ -1527,54 +1526,14 @@ function processMetadata(brand, type, withFilters = false) {
1527
1526
 
1528
1527
  if (withFilters) {
1529
1528
  Object.keys(metadataElement).forEach(key => {
1530
- if (key !== 'thumbnailUrl' &amp;&amp; key !== 'name' &amp;&amp; key !== 'description') {
1529
+ if ( !['thumbnailUrl', 'name', 'description'].includes(key) ) {
1531
1530
  processedData[key] = metadataElement[key];
1532
1531
  }
1533
1532
  });
1534
- // processedData.icon = metadataElement.icon || null;
1535
- // processedData.sortBy = metadataElement.sortBy || null;
1536
- // processedData.allowableFilters = metadataElement.allowableFilters || [];
1537
- // processedData.tabs = metadataElement.tabs ? metadataElement.tabs.map(tab => ({
1538
- // name: tab.name,
1539
- // short_name: tab.short_name,
1540
- // value: tab.value || null,
1541
- // is_required_field: tab.is_required_field || false
1542
- // })) : [];
1543
1533
  }
1544
1534
 
1545
1535
  return processedData;
1546
1536
  }
1547
- function processMetadatas(brand, type, withFilters=false) {
1548
- const metadataElement = contentMetadata[brand]?.[type];
1549
- if (!metadataElement) {
1550
- return null;
1551
- }
1552
-
1553
- const processedData = {
1554
- type,
1555
- thumbnailUrl: metadataElement.thumbnailUrl || null,
1556
- name: metadataElement.name || null,
1557
- description: metadataElement.description || null
1558
- };
1559
-
1560
- if(withFilters){
1561
- processedData.push({
1562
- icon: metadataElement.icon || null,
1563
- sortBy: metadataElement.sortBy || null,
1564
- allowableFilters: metadataElement.allowableFilters || [],
1565
- tabs: metadataElement.tabs ? metadataElement.tabs.map(tab => ({
1566
- name: tab.name,
1567
- short_name: tab.short_name,
1568
- value: tab.value || null,
1569
- is_required_field: tab.is_required_field || false
1570
- })) : [],
1571
-
1572
- });
1573
- }
1574
-
1575
- return processedData;
1576
- }
1577
-
1578
1537
 
1579
1538
 
1580
1539
 
@@ -1594,7 +1553,7 @@ function processMetadatas(brand, type, withFilters=false) {
1594
1553
  <br class="clear">
1595
1554
 
1596
1555
  <footer>
1597
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Fri Sep 20 2024 13:45:33 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1556
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue Sep 24 2024 20:13:55 GMT+0000 (Coordinated Universal Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1598
1557
  </footer>
1599
1558
 
1600
1559
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.111",
3
+ "version": "1.0.113",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -321,7 +321,7 @@ const contentMetadata = {
321
321
  allowableFilters: [],
322
322
  sortBy: 'sort',
323
323
  },
324
- 'live-stream': {
324
+ 'live': {
325
325
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/show-live.jpg',
326
326
  name: 'Live',
327
327
  shortname: 'Live Lessons',
@@ -1680,7 +1680,7 @@ function getNewReleasesTypes(brand) {
1680
1680
  const baseNewTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "workout", "challenge", "challenge-part", "podcasts", "pack", "song", "learning-path-level", "play-along", "course", "unit"];
1681
1681
  switch(brand) {
1682
1682
  case 'drumeo':
1683
- return [...baseNewTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live-streams", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
1683
+ return [...baseNewTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
1684
1684
  case 'guitareo':
1685
1685
  return [...baseNewTypes, "archives", "recording", "chords-and-scales"];
1686
1686
  case 'pianote':
@@ -1694,7 +1694,7 @@ function getUpcomingEventsTypes(brand) {
1694
1694
  const baseLiveTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "recording", "pack-bundle-lesson"];
1695
1695
  switch(brand) {
1696
1696
  case 'drumeo':
1697
- return [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live-streams", "podcasts", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
1697
+ return [...baseLiveTypes, "drum-fest-international-2022", "spotlight", "the-history-of-electronic-drums", "backstage-secrets", "student-collaborations", "live", "podcasts", "solos", "gear-guides", "performances", "in-rhythm", "challenges", "on-the-road", "diy-drum-experiments", "rhythmic-adventures-of-captain-carson", "study-the-greats", "rhythms-from-another-planet", "tama-drums", "paiste-cymbals", "behind-the-scenes", "exploring-beats", "sonor"];
1698
1698
  case 'guitareo':
1699
1699
  return [...baseLiveTypes, "archives"];
1700
1700
  case 'pianote':
@@ -1192,7 +1192,7 @@ export async function fetchArtistLessons(brand, name, contentType, {
1192
1192
  const end = start + limit;
1193
1193
  const searchFilter = searchTerm ? `&& title match "${searchTerm}*"`: ''
1194
1194
  const sortOrder = getSortOrder(sort);
1195
- const addType = contentType ? `_type == '${contentType}' && `:''
1195
+ const addType = contentType && Array.isArray(contentType) ? `_type in ['${contentType.join("', '")}'] &&` : contentType ? `_type == '${contentType}' && `:''
1196
1196
  const includedFieldsFilter = includedFields.length > 0
1197
1197
  ? filtersToGroq(includedFields)
1198
1198
  : "";
@@ -359,9 +359,11 @@ describe('Sanity Queries', function () {
359
359
  });
360
360
 
361
361
  test('fetchShowsData', async () => {
362
- const response = await fetchShowsData('singeo');
362
+ const response = await fetchShowsData('drumeo');
363
363
  log(response);
364
364
  expect(response.length).toBeGreaterThan(0);
365
+ const showTypes = response.map((x) => x.type);
366
+ expect(showTypes).toContain('live');
365
367
  });
366
368
 
367
369
  test('fetchMetadata', async () => {