musora-content-services 1.0.257 → 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.
Files changed (48) hide show
  1. package/.github/workflows/node.js.yml +0 -0
  2. package/CHANGELOG.md +22 -0
  3. package/babel.config.cjs +3 -0
  4. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  5. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  6. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  7. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  8. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  9. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  10. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  11. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  12. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  13. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
  14. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  15. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  16. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  17. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  18. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
  19. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  20. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  21. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  22. package/docs/scripts/collapse.js +0 -0
  23. package/docs/scripts/commonNav.js +0 -0
  24. package/docs/scripts/linenumber.js +0 -0
  25. package/docs/scripts/nav.js +0 -0
  26. package/docs/scripts/polyfill.js +0 -0
  27. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
  28. package/docs/scripts/prettify/lang-css.js +0 -0
  29. package/docs/scripts/prettify/prettify.js +0 -0
  30. package/docs/scripts/search.js +0 -0
  31. package/docs/styles/jsdoc.css +0 -0
  32. package/docs/styles/prettify.css +0 -0
  33. package/jest.config.js +1 -4
  34. package/jsdoc.json +0 -0
  35. package/link_mcs.sh +0 -0
  36. package/package.json +2 -1
  37. package/src/contentMetaData.js +2 -7
  38. package/src/contentTypeConfig.js +34 -31
  39. package/src/filterBuilder.js +2 -2
  40. package/src/services/config.js +3 -9
  41. package/src/services/contentLikes.js +2 -2
  42. package/src/services/contentProgress.js +3 -3
  43. package/src/services/dataContext.js +1 -1
  44. package/src/services/lastUpdated.js +1 -1
  45. package/src/services/railcontent.js +2 -2
  46. package/src/services/sanity.js +8 -12
  47. package/src/services/userPermissions.js +2 -2
  48. package/babel.config.js +0 -1
File without changes
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
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
+
25
+ ### [1.0.258](https://github.com/railroadmedia/musora-content-services/compare/v1.0.257...v1.0.258) (2025-01-08)
26
+
5
27
  ### [1.0.257](https://github.com/railroadmedia/musora-content-services/compare/v1.0.256...v1.0.257) (2025-01-03)
6
28
 
7
29
  ### [1.0.256](https://github.com/railroadmedia/musora-content-services/compare/v1.0.255...v1.0.256) (2025-01-02)
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['@babel/preset-env']
3
+ }
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/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/jsdoc.json CHANGED
File without changes
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.257",
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,4 +1,7 @@
1
- const DEFAULT_FIELDS = [
1
+ //import {AWSUrl, CloudFrontURl} from "./services/config";
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 = [
2
5
  "'sanity_id' : _id",
3
6
  "'id': railcontent_id",
4
7
  'railcontent_id',
@@ -20,13 +23,19 @@ const DEFAULT_FIELDS = [
20
23
  'status',
21
24
  "'slug' : slug.current",
22
25
  "'permission_id': permission[]->railcontent_id",
23
- "xp"
26
+ "xp",
27
+ "child_count"
24
28
  ];
25
29
 
26
- const descriptionField = 'description[0].children[0].text';
27
- const resourcesField = 'resource[]{resource_name, _key, "resource_url": coalesce(\'https://d3fzm1tzeyr5n3.cloudfront.net\'+string::split(resource_aws.asset->fileURL,\'https://s3.us-east-1.amazonaws.com/musora-web-platform\')[1], resource_url )}';
30
+ export const descriptionField = 'description[0].children[0].text';
31
+ // this pulls both any defined resources for the document as well as any resources in the parent document
32
+ export const resourcesField = `[
33
+ ... resource[]{resource_name, _key, "resource_url": coalesce('${CloudFrontURl}'+string::split(resource_aws.asset->fileURL, '${AWSUrl}')[1], resource_url )},
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
+ ]`;
28
36
 
29
- const assignmentsField = `"assignments":assignment[]{
37
+
38
+ export const assignmentsField = `"assignments":assignment[]{
30
39
  "id": railcontent_id,
31
40
  "soundslice_slug": assignment_soundslice,
32
41
  "title": assignment_title,
@@ -46,7 +55,7 @@ const contentWithSortField = {
46
55
  'sort',
47
56
  ]
48
57
  }
49
- const showsTypes = {
58
+ export const showsTypes = {
50
59
  'drumeo': ['odd-times', 'drum-fest-international-2022', 'spotlight', 'the-history-of-electronic-drums', 'backstage-secret', 'quick-tips', 'question-and-answer', 'student-collaboration',
51
60
  'live', 'podcast', 'solo', 'boot-camp', 'gear-guide', 'performance', 'in-rhythm', 'challenges', 'on-the-road', 'diy-drum-experiment', 'rhythmic-adventures-of-captain-carson',
52
61
  'study-the-greats', 'rhythms-from-another-planet', 'tama', 'paiste-cymbals', 'behind-the-scenes', 'exploring-beats', 'sonor'
@@ -56,9 +65,9 @@ const showsTypes = {
56
65
  'singeo': ['student-review', 'question-and-answer']
57
66
  }
58
67
 
59
- 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'];
60
69
 
61
- let contentTypeConfig = {
70
+ export let contentTypeConfig = {
62
71
  'song': {
63
72
  'fields': [
64
73
  'album',
@@ -90,6 +99,11 @@ let contentTypeConfig = {
90
99
  }
91
100
  },
92
101
  },
102
+ 'song-tutorial-children': {
103
+ 'fields': [
104
+ `"resources": ${resourcesField}`,
105
+ ],
106
+ },
93
107
  'challenge': {
94
108
  'fields': [
95
109
  'enrollment_start_time',
@@ -308,6 +322,11 @@ let contentTypeConfig = {
308
322
  'total_xp',
309
323
  ]
310
324
  },
325
+ 'pack-bundle-lesson': {
326
+ 'fields': [
327
+ `"resources": ${resourcesField}`,
328
+ ],
329
+ },
311
330
  'foundation': {
312
331
  'fields': [
313
332
  `"description": ${descriptionField}`,
@@ -392,9 +411,9 @@ let contentTypeConfig = {
392
411
  'sonor': contentWithSortField,
393
412
  }
394
413
 
395
- const songAccessMembership = 94;
414
+ export const songAccessMembership = 94;
396
415
 
397
- function getNewReleasesTypes(brand) {
416
+ export function getNewReleasesTypes(brand) {
398
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"];
399
418
  switch (brand) {
400
419
  case 'drumeo':
@@ -408,7 +427,7 @@ function getNewReleasesTypes(brand) {
408
427
  }
409
428
  }
410
429
 
411
- function getUpcomingEventsTypes(brand) {
430
+ export function getUpcomingEventsTypes(brand) {
412
431
  const baseLiveTypes = ["student-review", "student-review", "student-focus", "coach-stream", "live", "question-and-answer", "boot-camps", "quick-tips", "recording", "pack-bundle-lesson"];
413
432
  switch (brand) {
414
433
  case 'drumeo':
@@ -422,15 +441,15 @@ function getUpcomingEventsTypes(brand) {
422
441
  }
423
442
  }
424
443
 
425
- function artistOrInstructorName(key = 'artist_name') {
444
+ export function artistOrInstructorName(key = 'artist_name') {
426
445
  return `'${key}': coalesce(artist->name, instructor[0]->name)`;
427
446
  }
428
447
 
429
- function artistOrInstructorNameAsArray(key = 'artists') {
448
+ export function artistOrInstructorNameAsArray(key = 'artists') {
430
449
  return `'${key}': select(artist->name != null => [artist->name], instructor[]->name)`;
431
450
  }
432
451
 
433
- function getFieldsForContentType(contentType, asQueryString = true) {
452
+ export function getFieldsForContentType(contentType, asQueryString = true) {
434
453
  const fields = contentType ? DEFAULT_FIELDS.concat(contentTypeConfig?.[contentType]?.fields ?? []) : DEFAULT_FIELDS;
435
454
  return asQueryString ? fields.toString() + ',' : fields;
436
455
  }
@@ -441,7 +460,7 @@ function getFieldsForContentType(contentType, asQueryString = true) {
441
460
  * 'genre,rock']
442
461
  * @returns {string} - A string that can be used in a groq query
443
462
  */
444
- function filtersToGroq(filters, selectedFilters = []) {
463
+ export function filtersToGroq(filters, selectedFilters = []) {
445
464
  if (!filters) {
446
465
  filters = [];
447
466
  }
@@ -525,19 +544,3 @@ function groupFilters(filters) {
525
544
  return acc;
526
545
  }, {});
527
546
  }
528
-
529
- module.exports = {
530
- contentTypeConfig,
531
- descriptionField,
532
- artistOrInstructorName,
533
- artistOrInstructorNameAsArray,
534
- getFieldsForContentType,
535
- DEFAULT_FIELDS,
536
- assignmentsField,
537
- filtersToGroq,
538
- getNewReleasesTypes,
539
- getUpcomingEventsTypes,
540
- showsTypes,
541
- coachLessonsTypes,
542
- songAccessMembership
543
- }
@@ -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.
@@ -60,16 +60,10 @@ const excludeFromGeneratedIndex = [];
60
60
  * isMA: false
61
61
  * });
62
62
  */
63
- function initializeService(config) {
63
+ export function initializeService(config) {
64
64
  globalConfig.sanityConfig = config.sanityConfig;
65
65
  globalConfig.railcontentConfig = config.railcontentConfig;
66
66
  globalConfig.localStorage = config.localStorage;
67
67
  globalConfig.isMA = config.isMA || false;
68
68
  globalConfig.localTimezoneString = config.localTimezoneString || null;
69
69
  }
70
-
71
- // Export both the initialization function and the config object
72
- module.exports = {
73
- initializeService,
74
- globalConfig
75
- };
@@ -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.
@@ -6,6 +6,7 @@ import {
6
6
  artistOrInstructorNameAsArray,
7
7
  assignmentsField,
8
8
  descriptionField,
9
+ resourcesField,
9
10
  contentTypeConfig,
10
11
  DEFAULT_FIELDS,
11
12
  getFieldsForContentType,
@@ -14,26 +15,25 @@ import {
14
15
  showsTypes,
15
16
  getNewReleasesTypes,
16
17
  coachLessonsTypes
17
- } from "../contentTypeConfig";
18
+ } from "../contentTypeConfig.js";
18
19
 
19
20
  import {
20
21
  processMetadata,
21
22
  typeWithSortOrder
22
- } from "../contentMetaData";
23
+ } from "../contentMetaData.js";
23
24
 
24
- import {globalConfig} from "./config";
25
+ import {globalConfig} from "./config.js";
25
26
 
26
27
  import {
27
28
  fetchAllCompletedStates,
28
29
  fetchCompletedChallenges,
29
- fetchCurrentSongComplete,
30
30
  fetchOwnedChallenges,
31
31
  fetchNextContentDataForParent,
32
32
  fetchHandler,
33
33
  } from './railcontent.js';
34
- import {arrayToStringRepresentation, FilterBuilder} from "../filterBuilder";
35
- import {fetchUserPermissions} from "./userPermissions";
36
- 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";
37
37
 
38
38
  /**
39
39
  * Exported functions that are excluded from index generation.
@@ -1179,11 +1179,7 @@ export async function fetchLessonContent(railContentId) {
1179
1179
  const fields = `title,
1180
1180
  published_on,
1181
1181
  "type":_type,
1182
- "resources": resource[]{resource_name, _key,
1183
- "resource_url": coalesce(
1184
- 'https://d3fzm1tzeyr5n3.cloudfront.net'+string::split(resource_aws.asset->fileURL,'https://s3.us-east-1.amazonaws.com/musora-web-platform')[1],
1185
- resource_url
1186
- )},
1182
+ "resources": ${resourcesField},
1187
1183
  difficulty,
1188
1184
  difficulty_string,
1189
1185
  brand,
@@ -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']}