musora-content-services 1.0.183 → 1.0.185

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.185](https://github.com/railroadmedia/musora-content-services/compare/v1.0.176...v1.0.185) (2024-11-27)
6
+
7
+ ### [1.0.184](https://github.com/railroadmedia/musora-content-services/compare/v1.0.183...v1.0.184) (2024-11-25)
8
+
5
9
  ### [1.0.183](https://github.com/railroadmedia/musora-content-services/compare/v1.0.182...v1.0.183) (2024-11-25)
6
10
 
7
11
  ### [1.0.182](https://github.com/railroadmedia/musora-content-services/compare/v1.0.181...v1.0.182) (2024-11-25)
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.183",
3
+ "version": "1.0.185",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -290,6 +290,7 @@ const contentMetadata = {
290
290
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/gear.jpg',
291
291
  name: 'Gear Guides',
292
292
  icon: 'icon-shows',
293
+ url: '/gear-guides',
293
294
  description: "Drummers love their gear - and in here you will find videos on gear demos, reviews, maintenance, tuning tips and much more.",
294
295
  allowableFilters: ['difficulty', 'genre'],
295
296
  sortBy: '-published_on',
@@ -344,6 +345,7 @@ const contentMetadata = {
344
345
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/bootcamps.jpg',
345
346
  name: 'Boot Camps',
346
347
  icon: 'icon-shows',
348
+ url: '/boot-camps',
347
349
  description: "Grab your sticks and practice along while watching a lesson! These boot camps are designed like workout videos so you can follow along and push your drumming at the same time.",
348
350
  allowableFilters: ['difficulty', 'genre', 'essential'],
349
351
  sortBy: '-published_on',
@@ -378,6 +380,7 @@ const contentMetadata = {
378
380
  description: "Enjoy our official Drumeo Podcasts in video form! Whether it be discussions about drum topics or interviews with the greats you are looking for, these are an entertaining and educational way to pass the time.",
379
381
  allowableFilters: [],
380
382
  sortBy: '-sort',
383
+ url: '/podcasts',
381
384
  },
382
385
  'on-the-road': {
383
386
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/on-the-road.jpg',
@@ -409,6 +412,7 @@ const contentMetadata = {
409
412
  'live': {
410
413
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/show-live.jpg',
411
414
  name: 'Live',
415
+ url: '/live-streams',
412
416
  shortname: 'Live Lessons',
413
417
  icon: 'icon-shows',
414
418
  description: "Practice sessions, Q&A, celebrations, and more are available during Drumeo live lessons. Subscribe to an event or the whole calendar, so you don’t miss out!",
@@ -438,6 +442,7 @@ const contentMetadata = {
438
442
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/solos.jpg',
439
443
  name: 'Solos',
440
444
  icon: 'icon-shows',
445
+ url: '/solos',
441
446
  description: "Watch drum solos performed by the many different artists we have had out on Drumeo! A great way to be entertained, motivated, and to learn through amazing performances.",
442
447
  allowableFilters: ['difficulty', 'genre'],
443
448
  sortBy: '-published_on',
@@ -465,6 +470,7 @@ const contentMetadata = {
465
470
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/performances.jpg',
466
471
  name: 'Performances',
467
472
  icon: 'icon-shows',
473
+ url: '/performances',
468
474
  description: "Watch the world's best drummers perform songs, duets, and other inspirational pieces. Sit back, relax, and get ready to be inspired by these amazing performances!",
469
475
  allowableFilters: ['difficulty', 'genre'],
470
476
  sortBy: '-published_on',
@@ -504,6 +510,7 @@ const contentMetadata = {
504
510
  description: "Take a closer look at Sonor Drums with Jared as he explores the Sonor Factory in Bad Berleburg Germany and interviews the people behind the amazing brand.",
505
511
  allowableFilters: [],
506
512
  sortBy: 'published_on',
513
+ url: '/sonor-drums',
507
514
  },
508
515
  'paiste-cymbals': {
509
516
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/paiste-cymbals.jpg',
@@ -531,6 +538,7 @@ const contentMetadata = {
531
538
  description: "Take a closer look at Tama Drums with Jared as he explores the Tama factory in Japan, learns about Japanese Culture, experiments with traditional Taiko drummers, and interviews the people behind the amazing brand.",
532
539
  allowableFilters: [],
533
540
  sortBy: 'published_on',
541
+ url: '/tama-drums',
534
542
  },
535
543
  'question-and-answer': {
536
544
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/question-answer.jpg',
@@ -546,6 +554,7 @@ const contentMetadata = {
546
554
  description: "Collaborate with the community with Drumeo Monthly Collaborations! Each month a new Play-Along is chosen and members are tasked to submit their videos playing along to the song. At the end of each month, every video is joined together to create a single performance!",
547
555
  allowableFilters: [],
548
556
  sortBy: '-published_on',
557
+ url: '/student-collaborations',
549
558
  trailer1: {
550
559
  vimeo_video_id: 448684113,
551
560
  video_playback_endpoints: [
@@ -639,6 +648,7 @@ const contentMetadata = {
639
648
  description: "Step into David Raouf’s workshop where he will show you how to repurpose old and broken drum gear into usable and functional items! Whether you are a handyman or not, this show will give you unique and creative ideas and drum hacks that you have never seen before!",
640
649
  allowableFilters: [],
641
650
  sortBy: 'sort',
651
+ url: '/diy-drum-experiments',
642
652
  },
643
653
  'rhythmic-adventures-of-captain-carson': {
644
654
  thumbnailUrl: 'https://dpwjbsxqtam5n.cloudfront.net/shows/raocc-showcard.jpg',
@@ -666,6 +676,7 @@ const contentMetadata = {
666
676
  description: "Join the roadies of Rush and get a firsthand look at what it's like to be part of one of our favorite bands. You’re going on an exciting, behind-the-scenes journey to their 2008 Snakes & Arrows Concert Tour - an exclusive invitation to witness the reveal of all of the band’s backstage secrets. Roadies are the unsung heroes of any band - and being a roadie with a top-rated, world-famous rock and roll band is a highly coveted job. It may appear to be all glamour and adventure, but it can be a grueling marathon of 18-hour workdays!",
667
677
  allowableFilters: [],
668
678
  sortBy: 'sort',
679
+ url: '/backstage-secrets',
669
680
  },
670
681
  'the-history-of-electronic-drums': {
671
682
  thumbnailUrl: 'https://imagedelivery.net/0Hon__GSkIjm-B_W77SWCA/31847ba4-02d4-4c6a-4507-32b40284a000/width=500,height=500,quality=95,fit=cover',
@@ -795,6 +806,7 @@ const contentMetadata = {
795
806
  allowableFilters: ['difficulty', 'genre', 'essential'],
796
807
  sortBy: '-published_on',
797
808
  shortname: 'Bootcamps',
809
+ url: '/boot-camps',
798
810
  icon: 'icon-chords-scales-icon',
799
811
  description: "These bootcamps deliver results, but they also require commitment. Select a topic that you want to become an expert in, and get ready to learn!",
800
812
  amountOfFutureLessonsToShow: 3,
@@ -826,6 +838,7 @@ const contentMetadata = {
826
838
  sortBy: '-published_on',
827
839
  shortname: 'Podcast',
828
840
  icon: 'icon-podcast',
841
+ url: '/podcasts',
829
842
  description: "Join Lisa in her quest to unify piano players around the world, build community, and make playing the piano cool!",
830
843
  amountOfFutureLessonsToShow: 3,
831
844
  showFutureLessonAtTopOrBottom: 'bottom',
@@ -1131,7 +1144,8 @@ function processMetadata(brand, type, withFilters = false)
1131
1144
  type,
1132
1145
  thumbnailUrl: brandMetaData.thumbnailUrl || null,
1133
1146
  name: brandMetaData.name || null,
1134
- description: brandMetaData.description || null
1147
+ description: brandMetaData.description || null,
1148
+ url: brandMetaData.url ? (brand + brandMetaData.url): (brand +'/'+ type)
1135
1149
  };
1136
1150
 
1137
1151
  if (withFilters) {
File without changes
package/src/index.d.ts CHANGED
File without changes
package/src/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1643,6 +1643,7 @@ export async function fetchSanity(query,
1643
1643
  ]);
1644
1644
  const response = promisesResult[0];
1645
1645
  const userPermissions = promisesResult[1]?.permissions;
1646
+ const isAdmin = promisesResult[1]?.isAdmin;
1646
1647
 
1647
1648
  if (!response.ok) {
1648
1649
  throw new Error(`Sanity API error: ${response.status} - ${response.statusText}`);
@@ -1653,7 +1654,7 @@ export async function fetchSanity(query,
1653
1654
  console.log("fetchSanity Results:", result);
1654
1655
  }
1655
1656
  let results = isList ? result.result : result.result[0];
1656
- results = processNeedAccess ? await needsAccessDecorator(results, userPermissions) : results;
1657
+ results = processNeedAccess ? await needsAccessDecorator(results, userPermissions, isAdmin) : results;
1657
1658
  return customPostProcess ? customPostProcess(results) : results;
1658
1659
  } else {
1659
1660
  throw new Error('No results found');
@@ -1664,38 +1665,41 @@ export async function fetchSanity(query,
1664
1665
  }
1665
1666
  }
1666
1667
 
1667
- function needsAccessDecorator(results, userPermissions) {
1668
+ function needsAccessDecorator(results, userPermissions, isAdmin) {
1668
1669
  if (globalConfig.sanityConfig.useDummyRailContentMethods) return results;
1669
1670
 
1670
1671
  userPermissions = new Set(userPermissions);
1671
1672
 
1672
1673
  if (Array.isArray(results)) {
1673
1674
  results.forEach((result) => {
1674
- result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
1675
+ result['need_access'] = doesUserNeedAccessToContent(result, userPermissions, isAdmin);
1675
1676
  });
1676
1677
  } else if (results.entity && Array.isArray(results.entity)) {
1677
1678
  // Group By
1678
1679
  results.entity.forEach((result) => {
1679
1680
  if (result.lessons) {
1680
1681
  result.lessons.forEach((lesson) => {
1681
- lesson['need_access'] = doesUserNeedAccessToContent(lesson, userPermissions); // Updated to check lesson access
1682
+ lesson['need_access'] = doesUserNeedAccessToContent(lesson, userPermissions, isAdmin); // Updated to check lesson access
1682
1683
  });
1683
1684
  } else {
1684
- result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
1685
+ result['need_access'] = doesUserNeedAccessToContent(result, userPermissions, isAdmin);
1685
1686
  }
1686
1687
  });
1687
1688
  } else if (results.related_lessons && Array.isArray(results.related_lessons)) {
1688
1689
  results.related_lessons.forEach((result) => {
1689
- result['need_access'] = doesUserNeedAccessToContent(result, userPermissions);
1690
+ result['need_access'] = doesUserNeedAccessToContent(result, userPermissions, isAdmin);
1690
1691
  })
1691
1692
  } else {
1692
- results['need_access'] = doesUserNeedAccessToContent(results, userPermissions);
1693
+ results['need_access'] = doesUserNeedAccessToContent(results, userPermissions, isAdmin);
1693
1694
  }
1694
1695
 
1695
1696
  return results;
1696
1697
  }
1697
1698
 
1698
- function doesUserNeedAccessToContent(result, userPermissions) {
1699
+ function doesUserNeedAccessToContent(result, userPermissions, isAdmin) {
1700
+ if (isAdmin ?? false) {
1701
+ return false;
1702
+ }
1699
1703
  const permissions = new Set(result?.permission_id ?? []);
1700
1704
  if (permissions.size === 0) {
1701
1705
  return false;
File without changes
File without changes
@@ -830,6 +830,8 @@ describe('MetaData', function () {
830
830
  test('onlyCommon', async () => {
831
831
  const guitareoMetaData = processMetadata('guitareo', 'challenge');
832
832
  const drumeoMetaData = processMetadata('drumeo', 'challenge');
833
+ guitareoMetaData.url = ''
834
+ drumeoMetaData.url = ''
833
835
  expect(guitareoMetaData).toStrictEqual(drumeoMetaData);
834
836
  expect(guitareoMetaData.type).toBe('challenge');
835
837
  expect(guitareoMetaData.name).toBe('Challenges');
@@ -841,6 +843,8 @@ describe('MetaData', function () {
841
843
  expect(guitareoMetaData.description).not.toBe(drumeoMetaData.description);
842
844
  guitareoMetaData.description = ''
843
845
  drumeoMetaData.description = ''
846
+ guitareoMetaData.url = ''
847
+ drumeoMetaData.url = ''
844
848
  expect(guitareoMetaData).toStrictEqual(drumeoMetaData);
845
849
  });
846
850