musora-content-services 1.0.258 → 1.1.3

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,26 @@
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.1.3](https://github.com/railroadmedia/musora-content-services/compare/v1.1.2...v1.1.3) (2025-01-08)
6
+
7
+ ### [1.1.2](https://github.com/railroadmedia/musora-content-services/compare/v1.1.1...v1.1.2) (2025-01-08)
8
+
9
+ ### [1.1.1](https://github.com/railroadmedia/musora-content-services/compare/v1.1.0...v1.1.1) (2025-01-08)
10
+
11
+ ## [1.1.0](https://github.com/railroadmedia/musora-content-services/compare/v1.0.258...v1.1.0) (2025-01-08)
12
+
13
+
14
+ ### Features
15
+
16
+ * add es6 exports ([f16d26f](https://github.com/railroadmedia/musora-content-services/commit/f16d26ffd26cc0febdb4050b5fd33bcd06c78c54))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * babel blocking tests ([b219af7](https://github.com/railroadmedia/musora-content-services/commit/b219af7097927bd6452af533f9ec0722cbba9c29))
22
+ * jest esm support and security vulnerability ([1aa7f91](https://github.com/railroadmedia/musora-content-services/commit/1aa7f9181247e26f91f038edefd5b3e50b276661))
23
+ * merge conflict ([c7714b9](https://github.com/railroadmedia/musora-content-services/commit/c7714b932585ae0a862370027be57f285878033c))
24
+
5
25
  ### [1.0.258](https://github.com/railroadmedia/musora-content-services/compare/v1.0.257...v1.0.258) (2025-01-08)
6
26
 
7
27
  ### [1.0.257](https://github.com/railroadmedia/musora-content-services/compare/v1.0.256...v1.0.257) (2025-01-03)
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['@babel/preset-env']
3
+ }
package/jest.config.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  /** @type {import('jest').Config} */
7
- const config = {
7
+ export default {
8
8
  // All imported modules in your tests should be mocked automatically
9
9
  // automock: false,
10
10
 
@@ -198,6 +198,3 @@ const config = {
198
198
  // watchman: true,
199
199
 
200
200
  };
201
-
202
- module.exports = config;
203
-
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.258",
3
+ "version": "1.1.3",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "build-index": "node tools/generate-index.js",
8
9
  "release": "standard-version",
@@ -1168,8 +1168,8 @@ const contentMetadata = {
1168
1168
  }
1169
1169
  };
1170
1170
 
1171
- const typeWithSortOrder = ['in-rhythm', 'diy-drum-experiments', 'rhythmic-adventures-of-captain-carson'];
1172
- function processMetadata(brand, type, withFilters = false) {
1171
+ export const typeWithSortOrder = ['in-rhythm', 'diy-drum-experiments', 'rhythmic-adventures-of-captain-carson'];
1172
+ export function processMetadata(brand, type, withFilters = false) {
1173
1173
  let brandMetaData = contentMetadata[brand]?.[type];
1174
1174
  // If the type is explicitly defined as null or the brand doesn't exist return null
1175
1175
  // Specifically this is for drumeo.student-review
@@ -1199,8 +1199,3 @@ function processMetadata(brand, type, withFilters = false) {
1199
1199
 
1200
1200
  return processedData;
1201
1201
  }
1202
-
1203
- module.exports = {
1204
- processMetadata,
1205
- typeWithSortOrder
1206
- }
@@ -1,7 +1,7 @@
1
1
  //import {AWSUrl, CloudFrontURl} from "./services/config";
2
- const AWSUrl = 'https://s3.us-east-1.amazonaws.com/musora-web-platform';
3
- const CloudFrontURl = 'https://d3fzm1tzeyr5n3.cloudfront.net';
4
- const DEFAULT_FIELDS = [
2
+ export const AWSUrl = 'https://s3.us-east-1.amazonaws.com/musora-web-platform';
3
+ export const CloudFrontURl = 'https://d3fzm1tzeyr5n3.cloudfront.net';
4
+ export const DEFAULT_FIELDS = [
5
5
  "'sanity_id' : _id",
6
6
  "'id': railcontent_id",
7
7
  'railcontent_id',
@@ -27,15 +27,15 @@ const DEFAULT_FIELDS = [
27
27
  "child_count"
28
28
  ];
29
29
 
30
- const descriptionField = 'description[0].children[0].text';
30
+ export const descriptionField = 'description[0].children[0].text';
31
31
  // this pulls both any defined resources for the document as well as any resources in the parent document
32
- const resourcesField = `[
32
+ export const resourcesField = `[
33
33
  ... resource[]{resource_name, _key, "resource_url": coalesce('${CloudFrontURl}'+string::split(resource_aws.asset->fileURL, '${AWSUrl}')[1], resource_url )},
34
34
  ... *[railcontent_id == ^.parent_content_data[0].id] [0].resource[]{resource_name, _key, "resource_url": coalesce('${CloudFrontURl}'+string::split(resource_aws.asset->fileURL, '${AWSUrl}')[1], resource_url )},
35
35
  ]`;
36
36
 
37
37
 
38
- const assignmentsField = `"assignments":assignment[]{
38
+ export const assignmentsField = `"assignments":assignment[]{
39
39
  "id": railcontent_id,
40
40
  "soundslice_slug": assignment_soundslice,
41
41
  "title": assignment_title,
@@ -55,7 +55,7 @@ const contentWithSortField = {
55
55
  'sort',
56
56
  ]
57
57
  }
58
- const showsTypes = {
58
+ export const showsTypes = {
59
59
  'drumeo': ['odd-times', 'drum-fest-international-2022', 'spotlight', 'the-history-of-electronic-drums', 'backstage-secret', 'quick-tips', 'question-and-answer', 'student-collaboration',
60
60
  'live', 'podcast', 'solo', 'boot-camp', 'gear-guide', 'performance', 'in-rhythm', 'challenges', 'on-the-road', 'diy-drum-experiment', 'rhythmic-adventures-of-captain-carson',
61
61
  'study-the-greats', 'rhythms-from-another-planet', 'tama', 'paiste-cymbals', 'behind-the-scenes', 'exploring-beats', 'sonor'
@@ -65,9 +65,9 @@ const showsTypes = {
65
65
  'singeo': ['student-review', 'question-and-answer']
66
66
  }
67
67
 
68
- const coachLessonsTypes = ['course', 'course-part', 'coach-stream', 'student-focus', 'quick-tips', 'pack', 'semester-pack', 'question-and-answer', 'song-tutorial', 'song-tutorial-children', 'workout'];
68
+ export const coachLessonsTypes = ['course', 'course-part', 'coach-stream', 'student-focus', 'quick-tips', 'pack', 'semester-pack', 'question-and-answer', 'song-tutorial', 'song-tutorial-children', 'workout'];
69
69
 
70
- let contentTypeConfig = {
70
+ export let contentTypeConfig = {
71
71
  'song': {
72
72
  'fields': [
73
73
  'album',
@@ -411,9 +411,9 @@ let contentTypeConfig = {
411
411
  'sonor': contentWithSortField,
412
412
  }
413
413
 
414
- const songAccessMembership = 94;
414
+ export const songAccessMembership = 94;
415
415
 
416
- function getNewReleasesTypes(brand) {
416
+ export function getNewReleasesTypes(brand) {
417
417
  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"];
418
418
  switch (brand) {
419
419
  case 'drumeo':
@@ -427,7 +427,7 @@ function getNewReleasesTypes(brand) {
427
427
  }
428
428
  }
429
429
 
430
- function getUpcomingEventsTypes(brand) {
430
+ export function getUpcomingEventsTypes(brand) {
431
431
  const baseLiveTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "recording", "pack-bundle-lesson"];
432
432
  switch (brand) {
433
433
  case 'drumeo':
@@ -441,15 +441,15 @@ function getUpcomingEventsTypes(brand) {
441
441
  }
442
442
  }
443
443
 
444
- function artistOrInstructorName(key = 'artist_name') {
444
+ export function artistOrInstructorName(key = 'artist_name') {
445
445
  return `'${key}': coalesce(artist->name, instructor[0]->name)`;
446
446
  }
447
447
 
448
- function artistOrInstructorNameAsArray(key = 'artists') {
448
+ export function artistOrInstructorNameAsArray(key = 'artists') {
449
449
  return `'${key}': select(artist->name != null => [artist->name], instructor[]->name)`;
450
450
  }
451
451
 
452
- function getFieldsForContentType(contentType, asQueryString = true) {
452
+ export function getFieldsForContentType(contentType, asQueryString = true) {
453
453
  const fields = contentType ? DEFAULT_FIELDS.concat(contentTypeConfig?.[contentType]?.fields ?? []) : DEFAULT_FIELDS;
454
454
  return asQueryString ? fields.toString() + ',' : fields;
455
455
  }
@@ -460,7 +460,7 @@ function getFieldsForContentType(contentType, asQueryString = true) {
460
460
  * 'genre,rock']
461
461
  * @returns {string} - A string that can be used in a groq query
462
462
  */
463
- function filtersToGroq(filters, selectedFilters = []) {
463
+ export function filtersToGroq(filters, selectedFilters = []) {
464
464
  if (!filters) {
465
465
  filters = [];
466
466
  }
@@ -544,20 +544,3 @@ function groupFilters(filters) {
544
544
  return acc;
545
545
  }, {});
546
546
  }
547
-
548
- module.exports = {
549
- contentTypeConfig,
550
- descriptionField,
551
- resourcesField,
552
- artistOrInstructorName,
553
- artistOrInstructorNameAsArray,
554
- getFieldsForContentType,
555
- DEFAULT_FIELDS,
556
- assignmentsField,
557
- filtersToGroq,
558
- getNewReleasesTypes,
559
- getUpcomingEventsTypes,
560
- showsTypes,
561
- coachLessonsTypes,
562
- songAccessMembership
563
- }
@@ -1,7 +1,7 @@
1
- import {fetchUserPermissions} from "./services/userPermissions";
1
+ import {fetchUserPermissions} from "./services/userPermissions.js";
2
2
  import {
3
3
  songAccessMembership
4
- } from "./contentTypeConfig";
4
+ } from "./contentTypeConfig.js";
5
5
 
6
6
  export class FilterBuilder {
7
7
 
@@ -2,13 +2,13 @@
2
2
  * @module Config
3
3
  */
4
4
 
5
- let globalConfig = {
5
+ export let globalConfig = {
6
6
  sanityConfig: {},
7
7
  railcontentConfig: {},
8
8
  localStorage: null,
9
9
  isMA: false,
10
10
  localTimezoneString: null, // In format: America/Vancouver
11
- };
11
+ };
12
12
 
13
13
  /**
14
14
  * Exported functions that are excluded from index generation.
@@ -17,7 +17,6 @@ let globalConfig = {
17
17
  */
18
18
  const excludeFromGeneratedIndex = [];
19
19
 
20
-
21
20
  /**
22
21
  * Initializes the service with the given configuration.
23
22
  * This function must be called before using any other functions in this library.
@@ -61,16 +60,10 @@ const excludeFromGeneratedIndex = [];
61
60
  * isMA: false
62
61
  * });
63
62
  */
64
- function initializeService(config) {
63
+ export function initializeService(config) {
65
64
  globalConfig.sanityConfig = config.sanityConfig;
66
65
  globalConfig.railcontentConfig = config.railcontentConfig;
67
66
  globalConfig.localStorage = config.localStorage;
68
67
  globalConfig.isMA = config.isMA || false;
69
68
  globalConfig.localTimezoneString = config.localTimezoneString || null;
70
69
  }
71
-
72
- // Export both the initialization function and the config object
73
- module.exports = {
74
- initializeService,
75
- globalConfig,
76
- };
@@ -1,5 +1,5 @@
1
- import {fetchUserLikes, postContentLiked, postContentUnliked} from "./railcontent";
2
- import {DataContext, ContentLikesVersionKey} from "./dataContext";
1
+ import {fetchUserLikes, postContentLiked, postContentUnliked} from "./railcontent.js";
2
+ import {DataContext, ContentLikesVersionKey} from "./dataContext.js";
3
3
 
4
4
  /**
5
5
  * Exported functions that are excluded from index generation.
@@ -3,9 +3,9 @@ import {
3
3
  postContentCompleted,
4
4
  postContentReset,
5
5
  postRecordWatchSession
6
- } from "./railcontent";
7
- import {DataContext, ContentProgressVersionKey} from "./dataContext";
8
- import {fetchAssignments, fetchHierarchy} from "./sanity";
6
+ } from "./railcontent.js";
7
+ import {DataContext, ContentProgressVersionKey} from "./dataContext.js";
8
+ import {fetchAssignments, fetchHierarchy} from "./sanity.js";
9
9
 
10
10
  const STATE_STARTED = 'started';
11
11
  const STATE_COMPLETED = 'completed';
@@ -1,4 +1,4 @@
1
- import {globalConfig} from "./config";
1
+ import {globalConfig} from "./config.js";
2
2
 
3
3
  /**
4
4
  * Exported functions that are excluded from index generation.
@@ -1,4 +1,4 @@
1
- import {globalConfig} from "./config";
1
+ import {globalConfig} from "./config.js";
2
2
 
3
3
  /**
4
4
  * Exported functions that are excluded from index generation.
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @module Railcontent-Services
3
3
  */
4
- import {contentStatusCompleted} from "./contentProgress";
4
+ import {contentStatusCompleted} from "./contentProgress.js";
5
5
 
6
- const {globalConfig} = require('./config');
6
+ import { globalConfig } from "./config.js";
7
7
 
8
8
  /**
9
9
  * Exported functions that are excluded from index generation.
@@ -14,27 +14,26 @@ import {
14
14
  getUpcomingEventsTypes,
15
15
  showsTypes,
16
16
  getNewReleasesTypes,
17
- coachLessonsTypes,
18
- } from "../contentTypeConfig";
17
+ coachLessonsTypes
18
+ } from "../contentTypeConfig.js";
19
19
 
20
20
  import {
21
21
  processMetadata,
22
22
  typeWithSortOrder
23
- } from "../contentMetaData";
23
+ } from "../contentMetaData.js";
24
24
 
25
- import {globalConfig} from "./config";
25
+ import {globalConfig} from "./config.js";
26
26
 
27
27
  import {
28
28
  fetchAllCompletedStates,
29
29
  fetchCompletedChallenges,
30
- fetchCurrentSongComplete,
31
30
  fetchOwnedChallenges,
32
31
  fetchNextContentDataForParent,
33
32
  fetchHandler,
34
33
  } from './railcontent.js';
35
- import {arrayToStringRepresentation, FilterBuilder} from "../filterBuilder";
36
- import {fetchUserPermissions} from "./userPermissions";
37
- import {getAllCompleted, getAllStarted, getAllStartedOrCompleted} from "./contentProgress";
34
+ import {arrayToStringRepresentation, FilterBuilder} from "../filterBuilder.js";
35
+ import {fetchUserPermissions} from "./userPermissions.js";
36
+ import {getAllCompleted, getAllStarted, getAllStartedOrCompleted} from "./contentProgress.js";
38
37
 
39
38
  /**
40
39
  * Exported functions that are excluded from index generation.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchUserPermissionsData
3
- } from "./railcontent";
4
- import {setLastUpdatedTime, wasLastUpdateOlderThanXSeconds} from "./lastUpdated";
3
+ } from "./railcontent.js";
4
+ import {setLastUpdatedTime, wasLastUpdateOlderThanXSeconds} from "./lastUpdated.js";
5
5
 
6
6
  /**
7
7
  * Exported functions that are excluded from index generation.
package/babel.config.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {presets: ['@babel/preset-env']}