musora-content-services 2.86.1 → 2.88.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.
Files changed (117) hide show
  1. package/.claude/settings.local.json +14 -0
  2. package/.coderabbit.yaml +0 -0
  3. package/.editorconfig +0 -0
  4. package/.github/pull_request_template.md +0 -0
  5. package/.github/workflows/conventional-commits.yaml +0 -0
  6. package/.github/workflows/docs.js.yml +0 -0
  7. package/.github/workflows/node.js.yml +0 -0
  8. package/.prettierignore +0 -0
  9. package/.prettierrc +0 -0
  10. package/.yarnrc.yml +1 -0
  11. package/CHANGELOG.md +16 -0
  12. package/README.md +0 -0
  13. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  14. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  15. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  16. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  17. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  18. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  19. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  20. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  21. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  22. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
  23. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  24. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  25. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  26. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  27. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
  28. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  29. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  30. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  31. package/docs/forums_discussions.js.html +0 -0
  32. package/docs/forums_forum.js.html +0 -0
  33. package/docs/gamification_awards.js.html +0 -0
  34. package/docs/gamification_types.js.html +0 -0
  35. package/docs/module-Categories.html +0 -0
  36. package/docs/module-ForumCategories.html +0 -0
  37. package/docs/module-ForumDiscussions.html +0 -0
  38. package/docs/module-Threads.html +0 -0
  39. package/docs/scripts/collapse.js +0 -0
  40. package/docs/scripts/commonNav.js +0 -0
  41. package/docs/scripts/linenumber.js +0 -0
  42. package/docs/scripts/nav.js +0 -0
  43. package/docs/scripts/polyfill.js +0 -0
  44. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
  45. package/docs/scripts/prettify/lang-css.js +0 -0
  46. package/docs/scripts/prettify/prettify.js +0 -0
  47. package/docs/scripts/search.js +0 -0
  48. package/docs/styles/jsdoc.css +0 -0
  49. package/docs/styles/prettify.css +0 -0
  50. package/docs/user_memberships.js.html +0 -0
  51. package/jest.config.js +0 -0
  52. package/package.json +1 -1
  53. package/src/contentMetaData.js +0 -0
  54. package/src/index.d.ts +8 -3
  55. package/src/index.js +8 -3
  56. package/src/infrastructure/http/HttpClient.ts +0 -0
  57. package/src/infrastructure/http/executors/FetchRequestExecutor.ts +0 -0
  58. package/src/infrastructure/http/index.ts +0 -0
  59. package/src/infrastructure/http/interfaces/HeaderProvider.ts +0 -0
  60. package/src/infrastructure/http/interfaces/HttpError.ts +0 -0
  61. package/src/infrastructure/http/interfaces/NetworkError.ts +0 -0
  62. package/src/infrastructure/http/interfaces/RequestExecutor.ts +0 -0
  63. package/src/infrastructure/http/interfaces/RequestOptions.ts +0 -0
  64. package/src/infrastructure/http/providers/DefaultHeaderProvider.ts +0 -0
  65. package/src/lib/httpHelper.js +0 -0
  66. package/src/services/api/types.js +0 -0
  67. package/src/services/api/types.ts +0 -0
  68. package/src/services/content-org/content-org.js +0 -0
  69. package/src/services/content-org/guided-courses.ts +0 -0
  70. package/src/services/content-org/learning-paths.ts +12 -23
  71. package/src/services/content-org/playlists-types.js +0 -0
  72. package/src/services/content-org/playlists.js +0 -0
  73. package/src/services/dateUtils.js +0 -0
  74. package/src/services/eventsAPI.js +0 -0
  75. package/src/services/forums/forums.ts +0 -0
  76. package/src/services/forums/posts.ts +0 -0
  77. package/src/services/gamification/awards.ts +0 -0
  78. package/src/services/gamification/gamification.js +0 -0
  79. package/src/services/imageSRCBuilder.js +0 -0
  80. package/src/services/imageSRCVerify.js +0 -0
  81. package/src/services/liveTesting.ts +0 -0
  82. package/src/services/progress-row/method-card.js +0 -0
  83. package/src/services/recommendations.js +0 -0
  84. package/src/services/reporting/README.md +316 -0
  85. package/src/services/reporting/reporting.ts +189 -0
  86. package/src/services/reporting/types.ts +56 -0
  87. package/src/services/user/chat.js +0 -0
  88. package/src/services/user/interests.js +0 -0
  89. package/src/services/user/management.js +0 -0
  90. package/src/services/user/memberships.ts +0 -0
  91. package/src/services/user/notifications.js +0 -0
  92. package/src/services/user/payments.ts +0 -0
  93. package/src/services/user/profile.js +0 -0
  94. package/src/services/user/sessions.js +0 -0
  95. package/src/services/user/types.js +0 -0
  96. package/src/services/user/user-management-system.js +0 -0
  97. package/test/HttpClient.test.js +0 -0
  98. package/test/contentLikes.test.js +0 -0
  99. package/test/dataContext.test.js +0 -0
  100. package/test/imageSRCBuilder.test.js +0 -0
  101. package/test/imageSRCVerify.test.js +0 -0
  102. package/test/learningPaths.test.js +0 -0
  103. package/test/lib/lastUpdated.test.js +0 -0
  104. package/test/live/railcontentLive.test.js +0 -0
  105. package/test/localStorageMock.js +0 -0
  106. package/test/log.js +0 -0
  107. package/test/mockData/mockData_fetchByRailContentIds_one_content.json +0 -0
  108. package/test/mockData/mockData_progress_content.json +0 -0
  109. package/test/mockData/mockData_sanity_progress_content.json +0 -0
  110. package/test/mockData/mockData_user_practices.json +0 -0
  111. package/test/notifications.test.js +0 -0
  112. package/test/progressRows.test.js +0 -0
  113. package/test/reporting.test.js +132 -0
  114. package/test/sanityQueryService.test.js +0 -0
  115. package/test/streakMessage.test.js +0 -0
  116. package/test/user/permissions.test.js +0 -0
  117. package/test/userActivity.test.js +0 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(//app/musora-platform-backend/**)",
5
+ "Read(//app/musora-platform-frontend/**)",
6
+ "Bash(find:*)",
7
+ "Bash(sed:*)",
8
+ "Read(//app/**)",
9
+ "Bash(cat:*)"
10
+ ],
11
+ "deny": [],
12
+ "ask": []
13
+ }
14
+ }
package/.coderabbit.yaml CHANGED
File without changes
package/.editorconfig CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/.prettierignore CHANGED
File without changes
package/.prettierrc CHANGED
File without changes
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
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.88.0](https://github.com/railroadmedia/musora-content-services/compare/v2.86.1...v2.88.0) (2025-11-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * **BEH-1418:** refactor learning path endpoints ([#589](https://github.com/railroadmedia/musora-content-services/issues/589)) ([e3637f6](https://github.com/railroadmedia/musora-content-services/commit/e3637f6359ddf8f4295eead890de6457b942b4ea))
11
+ * Implement unified user reporting system ([7aa42ab](https://github.com/railroadmedia/musora-content-services/commit/7aa42ab8dcee09ce3f293d9fbb1a203dcbe94414))
12
+ * **MU2-1250:** Implement unified user reporting system ([3303282](https://github.com/railroadmedia/musora-content-services/commit/33032829b729efa9f9b1e40f31179127c8c74f9d))
13
+
14
+ ## [2.87.0](https://github.com/railroadmedia/musora-content-services/compare/v2.86.1...v2.87.0) (2025-11-26)
15
+
16
+
17
+ ### Features
18
+
19
+ * **BEH-1418:** refactor learning path endpoints ([#589](https://github.com/railroadmedia/musora-content-services/issues/589)) ([e3637f6](https://github.com/railroadmedia/musora-content-services/commit/e3637f6359ddf8f4295eead890de6457b942b4ea))
20
+
5
21
  ### [2.86.1](https://github.com/railroadmedia/musora-content-services/compare/v2.86.0...v2.86.1) (2025-11-25)
6
22
 
7
23
 
package/README.md CHANGED
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
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
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "2.86.1",
3
+ "version": "2.88.0",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
File without changes
package/src/index.d.ts CHANGED
@@ -41,7 +41,6 @@ import {
41
41
  mapContentToParent,
42
42
  resetAllLearningPaths,
43
43
  startLearningPath,
44
- updateActivePath,
45
44
  updateDailySession
46
45
  } from './services/content-org/learning-paths.ts';
47
46
 
@@ -243,6 +242,11 @@ import {
243
242
  recommendations
244
243
  } from './services/recommendations.js';
245
244
 
245
+ import {
246
+ getReportIssueOptions,
247
+ report
248
+ } from './services/reporting/reporting.ts';
249
+
246
250
  import {
247
251
  buildEntityAndTotalQuery,
248
252
  fetchAll,
@@ -413,7 +417,7 @@ import {
413
417
  } from './services/userActivity.js';
414
418
 
415
419
  import {
416
- default as EventsAPI
420
+ default as EventsAPI
417
421
  } from './services/eventsAPI';
418
422
 
419
423
  declare module 'musora-content-services' {
@@ -598,6 +602,7 @@ declare module 'musora-content-services' {
598
602
  getRecent,
599
603
  getRecentActivity,
600
604
  getRecommendedForYou,
605
+ getReportIssueOptions,
601
606
  getResumeTimeSeconds,
602
607
  getResumeTimeSecondsByIds,
603
608
  getSanityDate,
@@ -663,6 +668,7 @@ declare module 'musora-content-services' {
663
668
  removeContentAsNotInterested,
664
669
  removeUserPractice,
665
670
  replyToComment,
671
+ report,
666
672
  reportComment,
667
673
  reportPlaylist,
668
674
  requestEmailChange,
@@ -702,7 +708,6 @@ declare module 'musora-content-services' {
702
708
  unlockThread,
703
709
  unpinProgressRow,
704
710
  unpinThread,
705
- updateActivePath,
706
711
  updateDailySession,
707
712
  updateDisplayName,
708
713
  updateForumCategory,
package/src/index.js CHANGED
@@ -41,7 +41,6 @@ import {
41
41
  mapContentToParent,
42
42
  resetAllLearningPaths,
43
43
  startLearningPath,
44
- updateActivePath,
45
44
  updateDailySession
46
45
  } from './services/content-org/learning-paths.ts';
47
46
 
@@ -243,6 +242,11 @@ import {
243
242
  recommendations
244
243
  } from './services/recommendations.js';
245
244
 
245
+ import {
246
+ getReportIssueOptions,
247
+ report
248
+ } from './services/reporting/reporting.ts';
249
+
246
250
  import {
247
251
  buildEntityAndTotalQuery,
248
252
  fetchAll,
@@ -413,7 +417,7 @@ import {
413
417
  } from './services/userActivity.js';
414
418
 
415
419
  import {
416
- default as EventsAPI
420
+ default as EventsAPI
417
421
  } from './services/eventsAPI';
418
422
 
419
423
  export {
@@ -597,6 +601,7 @@ export {
597
601
  getRecent,
598
602
  getRecentActivity,
599
603
  getRecommendedForYou,
604
+ getReportIssueOptions,
600
605
  getResumeTimeSeconds,
601
606
  getResumeTimeSecondsByIds,
602
607
  getSanityDate,
@@ -662,6 +667,7 @@ export {
662
667
  removeContentAsNotInterested,
663
668
  removeUserPractice,
664
669
  replyToComment,
670
+ report,
665
671
  reportComment,
666
672
  reportPlaylist,
667
673
  requestEmailChange,
@@ -701,7 +707,6 @@ export {
701
707
  unlockThread,
702
708
  unpinProgressRow,
703
709
  unpinThread,
704
- updateActivePath,
705
710
  updateDailySession,
706
711
  updateDisplayName,
707
712
  updateForumCategory,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -32,9 +32,9 @@ interface ActiveLearningPathResponse {
32
32
  */
33
33
  export async function getDailySession(brand: string, userDate: Date) {
34
34
  const stringDate = userDate.toISOString().split('T')[0]
35
- const url: string = `${LEARNING_PATHS_PATH}/daily-session/get-or-create`
35
+ const url: string = `${LEARNING_PATHS_PATH}/daily-session/get`
36
36
  const body = { brand: brand, userDate: stringDate }
37
- return await fetchHandler(url, 'POST', null, body)
37
+ return await fetchHandler(url, 'GET', null, body)
38
38
  }
39
39
 
40
40
  /**
@@ -49,7 +49,7 @@ export async function updateDailySession(
49
49
  keepFirstLearningPath: boolean
50
50
  ) {
51
51
  const stringDate = userDate.toISOString().split('T')[0]
52
- const url: string = `${LEARNING_PATHS_PATH}/daily-session/update`
52
+ const url: string = `${LEARNING_PATHS_PATH}/daily-session/create`
53
53
  const body = { brand: brand, userDate: stringDate, keepFirstLearningPath: keepFirstLearningPath }
54
54
  return await fetchHandler(url, 'POST', null, body)
55
55
  }
@@ -59,30 +59,18 @@ export async function updateDailySession(
59
59
  * @param brand
60
60
  */
61
61
  export async function getActivePath(brand: string) {
62
- const url: string = `${LEARNING_PATHS_PATH}/active-path/get-or-create`
63
- const body = { brand: brand }
64
- return await fetchHandler(url, 'POST', null, body)
65
- }
66
-
67
- // todo this should be removed once we handle active path gen only through
68
- // finish method intro or complete current active path
69
- /**
70
- * Updates user's active learning path.
71
- * @param brand
72
- */
73
- export async function updateActivePath(brand: string) {
74
- const url: string = `${LEARNING_PATHS_PATH}/active-path/update`
62
+ const url: string = `${LEARNING_PATHS_PATH}/active-path/get`
75
63
  const body = { brand: brand }
76
- return await fetchHandler(url, 'POST', null, body)
64
+ return await fetchHandler(url, 'GET', null, body)
77
65
  }
78
66
 
79
67
  /**
80
- * Starts a new learning path for the user.
68
+ * Sets a new learning path as the user's active learning path.
81
69
  * @param brand
82
70
  * @param learningPathId
83
71
  */
84
72
  export async function startLearningPath(brand: string, learningPathId: number) {
85
- const url: string = `${LEARNING_PATHS_PATH}/start`
73
+ const url: string = `${LEARNING_PATHS_PATH}/active-path/set`
86
74
  const body = { brand: brand, learning_path_id: learningPathId }
87
75
  return await fetchHandler(url, 'POST', null, body)
88
76
  }
@@ -172,10 +160,11 @@ export async function fetchLearningPathLessons(
172
160
  brand: string,
173
161
  userDate: Date
174
162
  ) {
175
- const [learningPath, dailySession] = await Promise.all([
176
- getEnrichedLearningPath(learningPathId),
177
- getDailySession(brand, userDate),
178
- ])
163
+ const learningPath = await getEnrichedLearningPath(learningPathId)
164
+ let dailySession = await getDailySession(brand, userDate)
165
+ if (!dailySession) {
166
+ dailySession = await updateDailySession(brand, userDate, false)
167
+ }
179
168
 
180
169
  const isActiveLearningPath = (dailySession?.active_learning_path_id || 0) == learningPathId
181
170
  if (!isActiveLearningPath) {
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