musora-content-services 2.27.4 → 2.28.0

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,29 @@
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
+ ## [2.28.0](https://github.com/railroadmedia/musora-content-services/compare/v2.27.5...v2.28.0) (2025-07-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * added parent id for multi-level content ([#366](https://github.com/railroadmedia/musora-content-services/issues/366)) ([67f7847](https://github.com/railroadmedia/musora-content-services/commit/67f7847af2147095b5b7c91066a2f2756539c137))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **T3PS-306:** fix function return ([#378](https://github.com/railroadmedia/musora-content-services/issues/378)) ([c5abf09](https://github.com/railroadmedia/musora-content-services/commit/c5abf09cd7bd9ab7d1a298d7a1158d8162fa9cc7))
16
+
17
+ ### [2.27.5](https://github.com/railroadmedia/musora-content-services/compare/v2.27.3...v2.27.5) (2025-07-23)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * MU2-848 New releases should only show published releases, not scheduled conte… ([34f081e](https://github.com/railroadmedia/musora-content-services/commit/34f081e56be1a7a562004d76fd9ca3ae1955e726))
23
+ * MU2-848 New releases should only show published releases, not scheduled conte… ([637bad5](https://github.com/railroadmedia/musora-content-services/commit/637bad53c5e5c57f24b785ea0e7d35aa56fe0eb5))
24
+ * T3PS-272 Update course part meta ([4249b35](https://github.com/railroadmedia/musora-content-services/commit/4249b352c4abb9798a3232aa5fd3d25dc89461fd))
25
+ * **T3PS-306:** add custom method to delete profile picture ([#369](https://github.com/railroadmedia/musora-content-services/issues/369)) ([61634db](https://github.com/railroadmedia/musora-content-services/commit/61634db6923f9ca4fdde9a5c20f18e8b61dd78ec))
26
+ * T3PS-501: Homepage progress rows - content types ([954df2f](https://github.com/railroadmedia/musora-content-services/commit/954df2f92099c58e2b9c545d7c8515aa53eda0a8))
27
+
5
28
  ### [2.27.4](https://github.com/railroadmedia/musora-content-services/compare/v2.27.3...v2.27.4) (2025-07-23)
6
29
 
7
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.27.4",
3
+ "version": "2.28.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -33,6 +33,7 @@ export const DEFAULT_FIELDS = [
33
33
  'xp',
34
34
  'child_count',
35
35
  '"lesson_count": coalesce(count(child[]->.child[]->), child_count)',
36
+ '"parent_id": parent_content_data[0].id',
36
37
  ]
37
38
  export const DEFAULT_CHILD_FIELDS = [
38
39
  `"id": railcontent_id`,
@@ -182,7 +183,7 @@ export const lessonTypesMapping = {
182
183
  export const getNextLessonLessonParentTypes = ['course', 'guided-course', 'pack', 'pack-bundle', 'song-tutorial'];
183
184
 
184
185
  export const progressTypesMapping = {
185
- 'lesson': [...singleLessonTypes,...practiceAlongsLessonTypes, ...liveArchivesLessonTypes, ...performancesLessonTypes, ...studentArchivesLessonTypes, ...documentariesLessonTypes, 'live', 'pack-bundle-lesson', 'course-part'],
186
+ 'lesson': [...singleLessonTypes,...practiceAlongsLessonTypes, ...liveArchivesLessonTypes, ...performancesLessonTypes, ...studentArchivesLessonTypes, ...documentariesLessonTypes, 'live', 'pack-bundle-lesson'],
186
187
  'course': ['course'],
187
188
  'show': showsLessonTypes,
188
189
  'song tutorial': [...tutorialsLessonTypes, 'song-tutorial-children'],
@@ -192,6 +193,7 @@ export const progressTypesMapping = {
192
193
  'pack': ['pack', 'semester-pack'],
193
194
  'method': ['learning-path'],
194
195
  'jam track': ['jam-track'],
196
+ 'course video': ['course-part'],
195
197
  };
196
198
 
197
199
  export const songs = {
@@ -351,7 +351,7 @@ export async function fetchNewReleases(
351
351
  const end = start + limit
352
352
  const sortOrder = getSortOrder(sort, brand)
353
353
  const nextQuarter = getNextAndPreviousQuarterDates()['next']
354
- const filter = `_type in ${typesString} && brand == '${brand}' && show_in_new_feed == true && (!defined(quarter_published) || quarter_published != '${nextQuarter}')`
354
+ const filter = `_type in ${typesString} && brand == '${brand}' && status == 'published' && show_in_new_feed == true && (!defined(quarter_published) || quarter_published != '${nextQuarter}')`
355
355
  const fields = `
356
356
  "id": railcontent_id,
357
357
  title,
@@ -1470,7 +1470,7 @@ export async function fetchSiblingContent(railContentId, brand)
1470
1470
  }).buildFilter()
1471
1471
  const childrenFilter = await new FilterBuilder(``, { isChildrenFilter: true }).buildFilter()
1472
1472
 
1473
- const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, artist->, "permission_id": permission[]->railcontent_id, "genre": genre[]->name`
1473
+ const queryFields = `_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail":thumbnail.asset->url, length_in_seconds, status, "type": _type, difficulty, difficulty_string, artist->, "permission_id": permission[]->railcontent_id, "genre": genre[]->name, "parent_id": parent_content_data[0].id`
1474
1474
 
1475
1475
  const query = `*[railcontent_id == ${railContentId} && brand == "${brand}"]{
1476
1476
  _type, parent_type, 'parent_id': parent_content_data[0].id, railcontent_id,
@@ -32,6 +32,11 @@ export async function otherStats(userId = globalConfig.sessionConfig.userId) {
32
32
  }
33
33
  }
34
34
 
35
+ /**
36
+ * Delete profile picture for the authenticated user
37
+ *
38
+ * @returns {Promise<void>}
39
+ */
35
40
  export async function deleteProfilePicture() {
36
41
  const url = `${baseUrl}/v1/users/profile_picture`
37
42
  const response = await fetchHandler(url, 'DELETE')
@@ -41,6 +46,4 @@ export async function deleteProfilePicture() {
41
46
  console.log('Error deleting profile picture:', problemDetails.detail)
42
47
  throw new Error(`Delete failed: ${problemDetails.detail}`)
43
48
  }
44
-
45
- return response.json()
46
49
  }
@@ -18,7 +18,7 @@ import {fetchPlaylist, fetchUserPlaylists} from "./content-org/playlists"
18
18
  import {pinnedGuidedCourses} from "./content-org/guided-courses"
19
19
  import {convertToTimeZone, getMonday, getWeekNumber, isSameDate, isNextDay, getTimeRemainingUntilLocal, toDayjs} from './dateUtils.js'
20
20
  import { globalConfig } from './config'
21
- import {collectionLessonTypes, lessonTypesMapping, progressTypesMapping, showsLessonTypes, songs} from "../contentTypeConfig";
21
+ import {collectionLessonTypes, lessonTypesMapping, progressTypesMapping, recentTypes, showsLessonTypes, songs} from "../contentTypeConfig";
22
22
  import {
23
23
  getAllStartedOrCompleted,
24
24
  getProgressPercentageByIds,
@@ -355,9 +355,14 @@ export async function removeUserPractice(id) {
355
355
  async function (localContext) {
356
356
  if (localContext.data?.[DATA_KEY_PRACTICES]) {
357
357
  Object.keys(localContext.data[DATA_KEY_PRACTICES]).forEach((date) => {
358
- localContext.data[DATA_KEY_PRACTICES][date] = localContext.data[DATA_KEY_PRACTICES][
359
- date
360
- ].filter((practice) => practice.id !== id)
358
+ const filtered = localContext.data[DATA_KEY_PRACTICES][date].filter(
359
+ (practice) => practice.id !== id
360
+ )
361
+ if (filtered.length > 0) {
362
+ localContext.data[DATA_KEY_PRACTICES][date] = filtered
363
+ } else {
364
+ delete localContext.data[DATA_KEY_PRACTICES][date]
365
+ }
361
366
  })
362
367
  }
363
368
  },
@@ -963,11 +968,14 @@ export async function getProgressRows({ brand = null, limit = 8 } = {}) {
963
968
  }
964
969
  });
965
970
 
971
+ const allRecentTypeSet = new Set(
972
+ Object.values(recentTypes).flat()
973
+ )
966
974
  const progressMap = new Map();
967
975
  for (const [idStr, progress] of Object.entries(progressContents)) {
968
976
  const id = parseInt(idStr);
969
977
  const content = contentsMap[id];
970
- if (!content || excludedTypes.has(content.type)) continue;
978
+ if (!content || excludedTypes.has(content.type) || !allRecentTypeSet.has(content.type) ) continue;
971
979
  const parentId = childToParentMap[id];
972
980
  // Handle children with parents
973
981
  if (parentId) {