musora-content-services 2.99.1 → 2.99.4
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 +17 -0
- package/package.json +1 -1
- package/src/index.d.ts +3 -1
- package/src/index.js +3 -1
- package/src/lib/sanity/query.ts +2 -2
- package/src/services/content/artist.ts +2 -2
- package/src/services/content/genre.ts +2 -2
- package/src/services/content/instructor.ts +2 -2
- package/src/services/content-org/learning-paths.ts +38 -6
- package/.claude/settings.local.json +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.99.4](https://github.com/railroadmedia/musora-content-services/compare/v2.99.3...v2.99.4) (2025-12-09)
|
|
6
|
+
|
|
7
|
+
### [2.99.3](https://github.com/railroadmedia/musora-content-services/compare/v2.99.2...v2.99.3) (2025-12-09)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **agi:** optional query options property access ([e8d9a33](https://github.com/railroadmedia/musora-content-services/commit/e8d9a333462dc8bcfed7af9171bff4380c9d67fd))
|
|
13
|
+
* **groq:** query order and slicing out of place ([97a3c1c](https://github.com/railroadmedia/musora-content-services/commit/97a3c1c9d27745ee78894f3d2c9c5d3e8195efb0))
|
|
14
|
+
|
|
15
|
+
### [2.99.2](https://github.com/railroadmedia/musora-content-services/compare/v2.99.1...v2.99.2) (2025-12-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update get enriched LPs ([#635](https://github.com/railroadmedia/musora-content-services/issues/635)) ([01995dc](https://github.com/railroadmedia/musora-content-services/commit/01995dcd2c013c8cca31e29a44c41118623d9d9b))
|
|
21
|
+
|
|
5
22
|
### [2.99.1](https://github.com/railroadmedia/musora-content-services/compare/v2.99.0...v2.99.1) (2025-12-09)
|
|
6
23
|
|
|
7
24
|
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
getActivePath,
|
|
51
51
|
getDailySession,
|
|
52
52
|
getEnrichedLearningPath,
|
|
53
|
+
getEnrichedLearningPaths,
|
|
53
54
|
getLearningPathLessonsByIds,
|
|
54
55
|
mapContentToParent,
|
|
55
56
|
onContentCompletedLearningPathListener,
|
|
@@ -425,7 +426,7 @@ import {
|
|
|
425
426
|
} from './services/userActivity.js';
|
|
426
427
|
|
|
427
428
|
import {
|
|
428
|
-
default as EventsAPI
|
|
429
|
+
default as EventsAPI
|
|
429
430
|
} from './services/eventsAPI';
|
|
430
431
|
|
|
431
432
|
declare module 'musora-content-services' {
|
|
@@ -588,6 +589,7 @@ declare module 'musora-content-services' {
|
|
|
588
589
|
getContentRows,
|
|
589
590
|
getDailySession,
|
|
590
591
|
getEnrichedLearningPath,
|
|
592
|
+
getEnrichedLearningPaths,
|
|
591
593
|
getInProgressAwards,
|
|
592
594
|
getLastInteractedOf,
|
|
593
595
|
getLearningPathLessonsByIds,
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*** This file was generated automatically. To recreate, please run `npm run build-index`. ***/
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
default as EventsAPI
|
|
4
|
+
default as EventsAPI
|
|
5
5
|
} from './services/eventsAPI';
|
|
6
6
|
|
|
7
7
|
import {
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
getActivePath,
|
|
55
55
|
getDailySession,
|
|
56
56
|
getEnrichedLearningPath,
|
|
57
|
+
getEnrichedLearningPaths,
|
|
57
58
|
getLearningPathLessonsByIds,
|
|
58
59
|
mapContentToParent,
|
|
59
60
|
onContentCompletedLearningPathListener,
|
|
@@ -587,6 +588,7 @@ export {
|
|
|
587
588
|
getContentRows,
|
|
588
589
|
getDailySession,
|
|
589
590
|
getEnrichedLearningPath,
|
|
591
|
+
getEnrichedLearningPaths,
|
|
590
592
|
getInProgressAwards,
|
|
591
593
|
getLastInteractedOf,
|
|
592
594
|
getLearningPathLessonsByIds,
|
package/src/lib/sanity/query.ts
CHANGED
|
@@ -111,10 +111,10 @@ export const query = (): QueryBuilder => {
|
|
|
111
111
|
|
|
112
112
|
return `
|
|
113
113
|
*[${filter}]
|
|
114
|
-
${ordering}
|
|
115
|
-
${slice}
|
|
116
114
|
${projection.length > 0 ? `{ ${projection} }` : ''}
|
|
117
115
|
${state.postFilter ? `[${state.postFilter}]` : ''}
|
|
116
|
+
${ordering}
|
|
117
|
+
${slice}
|
|
118
118
|
`.trim()
|
|
119
119
|
},
|
|
120
120
|
|
|
@@ -41,8 +41,8 @@ export async function fetchArtists(
|
|
|
41
41
|
|
|
42
42
|
const data = query()
|
|
43
43
|
.and(`_type == "artist"`)
|
|
44
|
-
.order(options
|
|
45
|
-
.slice(options
|
|
44
|
+
.order(options?.sort || 'lower(name) asc')
|
|
45
|
+
.slice(options?.offset || 0, (options?.offset || 0) + (options?.limit || 20))
|
|
46
46
|
.select(
|
|
47
47
|
'name',
|
|
48
48
|
`"slug": slug.current`,
|
|
@@ -41,8 +41,8 @@ export async function fetchGenres(
|
|
|
41
41
|
|
|
42
42
|
const data = query()
|
|
43
43
|
.and(`_type == "genre"`)
|
|
44
|
-
.order(options
|
|
45
|
-
.slice(options
|
|
44
|
+
.order(options?.sort || 'lower(name) asc')
|
|
45
|
+
.slice(options?.offset || 0, (options?.offset || 0) + (options?.limit || 20))
|
|
46
46
|
.select(
|
|
47
47
|
'name',
|
|
48
48
|
`"slug": slug.current`,
|
|
@@ -42,8 +42,8 @@ export async function fetchInstructors(
|
|
|
42
42
|
|
|
43
43
|
const data = query()
|
|
44
44
|
.and(`_type == "instructor"`)
|
|
45
|
-
.order(options
|
|
46
|
-
.slice(options
|
|
45
|
+
.order(options?.sort || 'lower(name) asc')
|
|
46
|
+
.slice(options?.offset || 0, (options?.offset || 0) + (options?.limit || 20))
|
|
47
47
|
.select(
|
|
48
48
|
'name',
|
|
49
49
|
`"slug": slug.current`,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { fetchHandler } from '../railcontent.js'
|
|
6
|
-
import { fetchByRailContentId, fetchMethodV2Structure } from '../sanity.js'
|
|
7
|
-
import {
|
|
6
|
+
import { fetchByRailContentId, fetchByRailContentIds, fetchMethodV2Structure } from '../sanity.js'
|
|
7
|
+
import { addContextToLearningPaths } from '../contentAggregator.js'
|
|
8
8
|
import {
|
|
9
9
|
contentStatusCompleted,
|
|
10
10
|
contentsStatusCompleted,
|
|
@@ -107,14 +107,14 @@ export async function resetAllLearningPaths() {
|
|
|
107
107
|
* @returns {Promise<Object>} Learning path with enriched lesson data
|
|
108
108
|
*/
|
|
109
109
|
export async function getEnrichedLearningPath(learningPathId) {
|
|
110
|
-
const response = (await
|
|
110
|
+
const response = (await addContextToLearningPaths(
|
|
111
111
|
fetchByRailContentId,
|
|
112
112
|
learningPathId,
|
|
113
113
|
COLLECTION_TYPE.LEARNING_PATH,
|
|
114
114
|
{
|
|
115
|
-
collection: { id: learningPathId, type: COLLECTION_TYPE.LEARNING_PATH },
|
|
116
115
|
dataField: 'children',
|
|
117
116
|
dataField_includeParent: true,
|
|
117
|
+
dataField_includeIntroVideo: true,
|
|
118
118
|
addProgressStatus: true,
|
|
119
119
|
addProgressPercentage: true,
|
|
120
120
|
addProgressTimestamp: true,
|
|
@@ -125,12 +125,44 @@ export async function getEnrichedLearningPath(learningPathId) {
|
|
|
125
125
|
|
|
126
126
|
response.children = mapContentToParent(
|
|
127
127
|
response.children,
|
|
128
|
-
|
|
128
|
+
COLLECTION_TYPE.LEARNING_PATH,
|
|
129
129
|
learningPathId
|
|
130
130
|
)
|
|
131
131
|
return response
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Returns learning paths with lessons and progress data
|
|
136
|
+
* @param {number[]} learningPathIds - The learning path IDs
|
|
137
|
+
* @returns {Promise<Object>} Learning paths with enriched lesson data
|
|
138
|
+
*/
|
|
139
|
+
export async function getEnrichedLearningPaths(learningPathIds: number[]) {
|
|
140
|
+
const response = (await addContextToLearningPaths(
|
|
141
|
+
fetchByRailContentIds,
|
|
142
|
+
learningPathIds,
|
|
143
|
+
COLLECTION_TYPE.LEARNING_PATH,
|
|
144
|
+
{
|
|
145
|
+
dataField: 'children',
|
|
146
|
+
dataField_includeParent: true,
|
|
147
|
+
dataField_includeIntroVideo: true,
|
|
148
|
+
addProgressStatus: true,
|
|
149
|
+
addProgressPercentage: true,
|
|
150
|
+
addProgressTimestamp: true,
|
|
151
|
+
addNavigateTo: true,
|
|
152
|
+
}
|
|
153
|
+
)) as any
|
|
154
|
+
if (!response) return response
|
|
155
|
+
|
|
156
|
+
response.forEach((learningPath) => {
|
|
157
|
+
learningPath.children = mapContentToParent(
|
|
158
|
+
learningPath.children,
|
|
159
|
+
COLLECTION_TYPE.LEARNING_PATH,
|
|
160
|
+
learningPath.id
|
|
161
|
+
)
|
|
162
|
+
})
|
|
163
|
+
return response
|
|
164
|
+
}
|
|
165
|
+
|
|
134
166
|
/**
|
|
135
167
|
* Get specific learning path lessons by content IDs
|
|
136
168
|
* @param {number[]} contentIds - Array of content IDs to filter
|
|
@@ -179,7 +211,7 @@ export async function fetchLearningPathLessons(
|
|
|
179
211
|
userDate: Date
|
|
180
212
|
) {
|
|
181
213
|
const learningPath = await getEnrichedLearningPath(learningPathId)
|
|
182
|
-
let dailySession = await getDailySession(brand, userDate) // what if the call just fails, and a DS does exist?
|
|
214
|
+
let dailySession = await getDailySession(brand, userDate); // what if the call just fails, and a DS does exist?
|
|
183
215
|
if (!dailySession) {
|
|
184
216
|
dailySession = await updateDailySession(brand, userDate, false)
|
|
185
217
|
}
|