musora-content-services 1.3.5 → 1.3.8

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 (41) hide show
  1. package/.github/workflows/node.js.yml +0 -0
  2. package/CHANGELOG.md +6 -0
  3. package/README.md +0 -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/link_mcs.sh +0 -0
  34. package/package.json +1 -1
  35. package/src/filterBuilder.js +11 -11
  36. package/src/index.d.ts +250 -227
  37. package/src/index.js +249 -226
  38. package/src/services/dataContext.js +26 -5
  39. package/src/services/sanity.js +60 -16
  40. package/test/dataContext.test.js +38 -0
  41. package/test/sanityQueryService.test.js +16 -6
File without changes
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
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.3.8](https://github.com/railroadmedia/musora-content-services/compare/v1.3.7...v1.3.8) (2025-02-21)
6
+
7
+ ### [1.3.7](https://github.com/railroadmedia/musora-content-services/compare/v1.3.6...v1.3.7) (2025-02-20)
8
+
9
+ ### [1.3.6](https://github.com/railroadmedia/musora-content-services/compare/v1.3.5...v1.3.6) (2025-02-18)
10
+
5
11
  ### [1.3.5](https://github.com/railroadmedia/musora-content-services/compare/v1.3.4...v1.3.5) (2025-02-14)
6
12
 
7
13
  ### [1.3.4](https://github.com/railroadmedia/musora-content-services/compare/v1.3.2...v1.3.4) (2025-02-14)
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
package/link_mcs.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.3.5",
3
+ "version": "1.3.8",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -56,6 +56,15 @@ export class FilterBuilder {
56
56
  return filter
57
57
  }
58
58
 
59
+ _getRoundedTime(){
60
+ // We need to set the published on filter date to be a round time so that it doesn't bypass the query cache
61
+ // with every request by changing the filter date every second. I've set it to one minute past the current hour
62
+ // because publishing usually publishes content on the hour exactly which means it should still skip the cache
63
+ // when the new content is available.
64
+ const now = new Date();
65
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), 1);
66
+ }
67
+
59
68
  _applyContentStatuses() {
60
69
  // This must be run before _applyPublishDateRestrictions()
61
70
  if (this.bypassStatuses) return this
@@ -89,7 +98,7 @@ export class FilterBuilder {
89
98
  ) {
90
99
  // we must pull in future content here, otherwise we'll restrict on content this is published in the past and remove any scheduled content
91
100
  this.pullFutureContent = true
92
- const now = new Date().toISOString()
101
+ const now = this._getRoundedTime().toISOString();
93
102
  let statuses = [...this.availableContentStatuses]
94
103
  statuses.splice(statuses.indexOf(this.STATUS_SCHEDULED), 1)
95
104
  this._andWhere(
@@ -121,16 +130,7 @@ export class FilterBuilder {
121
130
 
122
131
  _applyPublishingDateRestrictions() {
123
132
  if (this.bypassPublishedDateRestriction) return this
124
- let now = new Date()
125
-
126
- // We need to set the published on filter date to be a round time so that it doesn't bypass the query cache
127
- // with every request by changing the filter date every second. I've set it to one minute past the current hour
128
- // because publishing usually publishes content on the hour exactly which means it should still skip the cache
129
- // when the new content is available.
130
- // Round to the start of the current hour
131
- const roundedDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours())
132
-
133
- now = roundedDate.toISOString()
133
+ const now = this._getRoundedTime().toISOString();
134
134
 
135
135
  if (this.getFutureContentOnly) {
136
136
  this._andWhere(`${this.prefix}published_on >= '${now}'`)
package/src/index.d.ts CHANGED
@@ -1,240 +1,263 @@
1
1
  /*** This file was generated automatically. To recreate, please run `npm run build-index`. ***/
2
2
 
3
- import { globalConfig, initializeService } from './services/config.js'
3
+ import {
4
+ globalConfig,
5
+ initializeService
6
+ } from './services/config.js';
4
7
 
5
- import { isContentLiked, likeContent, unlikeContent } from './services/contentLikes.js'
8
+ import {
9
+ isContentLiked,
10
+ likeContent,
11
+ unlikeContent
12
+ } from './services/contentLikes.js';
6
13
 
7
14
  import {
8
- assignmentStatusCompleted,
9
- assignmentStatusReset,
10
- contentStatusCompleted,
11
- contentStatusReset,
12
- getAllCompleted,
13
- getAllStarted,
14
- getAllStartedOrCompleted,
15
- getProgressPercentage,
16
- getProgressPercentageByIds,
17
- getProgressState,
18
- getProgressStateByIds,
19
- getResumeTimeSeconds,
20
- recordWatchSession,
21
- } from './services/contentProgress.js'
15
+ assignmentStatusCompleted,
16
+ assignmentStatusReset,
17
+ contentStatusCompleted,
18
+ contentStatusReset,
19
+ getAllCompleted,
20
+ getAllStarted,
21
+ getAllStartedOrCompleted,
22
+ getProgressPercentage,
23
+ getProgressPercentageByIds,
24
+ getProgressState,
25
+ getProgressStateByIds,
26
+ getResumeTimeSeconds,
27
+ recordWatchSession
28
+ } from './services/contentProgress.js';
22
29
 
23
30
  import {
24
- addItemToPlaylist,
25
- countAssignmentsAndLessons,
26
- createPlaylist,
27
- deletePlaylist,
28
- deletePlaylistItem,
29
- deletePlaylistLike,
30
- duplicatePlaylist,
31
- fetchAllCompletedStates,
32
- fetchCarouselCardData,
33
- fetchChallengeIndexMetadata,
34
- fetchChallengeLessonData,
35
- fetchChallengeMetadata,
36
- fetchChallengeUserActiveChallenges,
37
- fetchCompletedChallenges,
38
- fetchCompletedContent,
39
- fetchCompletedState,
40
- fetchContentInProgress,
41
- fetchContentPageUserData,
42
- fetchContentProgress,
43
- fetchHandler,
44
- fetchNextContentDataForParent,
45
- fetchOwnedChallenges,
46
- fetchPinnedPlaylists,
47
- fetchPlaylist,
48
- fetchPlaylistItem,
49
- fetchPlaylistItems,
50
- fetchSongsInProgress,
51
- fetchUserAward,
52
- fetchUserBadges,
53
- fetchUserChallengeProgress,
54
- fetchUserLikes,
55
- fetchUserPermissionsData,
56
- fetchUserPlaylists,
57
- likePlaylist,
58
- pinPlaylist,
59
- playback,
60
- postChallengesCommunityNotification,
61
- postChallengesCompleteLesson,
62
- postChallengesEnroll,
63
- postChallengesEnrollmentNotification,
64
- postChallengesHideCompletedBanner,
65
- postChallengesLeave,
66
- postChallengesSetStartDate,
67
- postChallengesSoloNotification,
68
- postChallengesUnlock,
69
- postContentCompleted,
70
- postContentLiked,
71
- postContentReset,
72
- postContentUnliked,
73
- postRecordWatchSession,
74
- reportPlaylist,
75
- setStudentViewForUser,
76
- unpinPlaylist,
77
- updatePlaylist,
78
- updatePlaylistItem,
79
- } from './services/railcontent.js'
31
+ setLastUpdatedTime,
32
+ wasLastUpdateOlderThanXSeconds
33
+ } from './services/lastUpdated.js';
80
34
 
81
35
  import {
82
- fetchAll,
83
- fetchAllFilterOptions,
84
- fetchAllPacks,
85
- fetchArtistLessons,
86
- fetchArtists,
87
- fetchByRailContentId,
88
- fetchByRailContentIds,
89
- fetchByReference,
90
- fetchChatAndLiveEnvent,
91
- fetchCoachLessons,
92
- fetchCommentModContentData,
93
- fetchFoundation,
94
- fetchGenreLessons,
95
- fetchHierarchy,
96
- fetchLessonContent,
97
- fetchLiveEvent,
98
- fetchMetadata,
99
- fetchMethod,
100
- fetchMethodChildren,
101
- fetchMethodChildrenIds,
102
- fetchMethodPreviousNextLesson,
103
- fetchNewReleases,
104
- fetchNextPreviousLesson,
105
- fetchPackAll,
106
- fetchPackData,
107
- fetchParentForDownload,
108
- fetchPlayAlongsCount,
109
- fetchRelatedLessons,
110
- fetchRelatedSongs,
111
- fetchSanity,
112
- fetchScheduledReleases,
113
- fetchShowsData,
114
- fetchSongArtistCount,
115
- fetchSongById,
116
- fetchTopLevelParentId,
117
- fetchUpcomingEvents,
118
- getSortOrder,
119
- jumpToContinueContent,
120
- } from './services/sanity.js'
36
+ addItemToPlaylist,
37
+ countAssignmentsAndLessons,
38
+ createPlaylist,
39
+ deletePlaylist,
40
+ deletePlaylistItem,
41
+ deletePlaylistLike,
42
+ duplicatePlaylist,
43
+ fetchAllCompletedStates,
44
+ fetchCarouselCardData,
45
+ fetchChallengeIndexMetadata,
46
+ fetchChallengeLessonData,
47
+ fetchChallengeMetadata,
48
+ fetchChallengeUserActiveChallenges,
49
+ fetchCompletedChallenges,
50
+ fetchCompletedContent,
51
+ fetchCompletedState,
52
+ fetchContentInProgress,
53
+ fetchContentPageUserData,
54
+ fetchContentProgress,
55
+ fetchHandler,
56
+ fetchNextContentDataForParent,
57
+ fetchOwnedChallenges,
58
+ fetchPinnedPlaylists,
59
+ fetchPlaylist,
60
+ fetchPlaylistItem,
61
+ fetchPlaylistItems,
62
+ fetchSongsInProgress,
63
+ fetchUserAward,
64
+ fetchUserBadges,
65
+ fetchUserChallengeProgress,
66
+ fetchUserLikes,
67
+ fetchUserPermissionsData,
68
+ fetchUserPlaylists,
69
+ likePlaylist,
70
+ pinPlaylist,
71
+ playback,
72
+ postChallengesCommunityNotification,
73
+ postChallengesCompleteLesson,
74
+ postChallengesEnroll,
75
+ postChallengesEnrollmentNotification,
76
+ postChallengesHideCompletedBanner,
77
+ postChallengesLeave,
78
+ postChallengesSetStartDate,
79
+ postChallengesSoloNotification,
80
+ postChallengesUnlock,
81
+ postContentCompleted,
82
+ postContentLiked,
83
+ postContentReset,
84
+ postContentUnliked,
85
+ postRecordWatchSession,
86
+ reportPlaylist,
87
+ setStudentViewForUser,
88
+ unpinPlaylist,
89
+ updatePlaylist,
90
+ updatePlaylistItem
91
+ } from './services/railcontent.js';
121
92
 
122
- import { fetchUserPermissions, reset } from './services/userPermissions.js'
93
+ import {
94
+ fetchAll,
95
+ fetchAllFilterOptions,
96
+ fetchAllPacks,
97
+ fetchArtistLessons,
98
+ fetchArtists,
99
+ fetchByRailContentId,
100
+ fetchByRailContentIds,
101
+ fetchByReference,
102
+ fetchChatAndLiveEnvent,
103
+ fetchCoachLessons,
104
+ fetchComingSoon,
105
+ fetchCommentModContentData,
106
+ fetchFoundation,
107
+ fetchGenreLessons,
108
+ fetchHierarchy,
109
+ fetchLeaving,
110
+ fetchLessonContent,
111
+ fetchLiveEvent,
112
+ fetchMetadata,
113
+ fetchMethod,
114
+ fetchMethodChildren,
115
+ fetchMethodChildrenIds,
116
+ fetchMethodPreviousNextLesson,
117
+ fetchNewReleases,
118
+ fetchNextPreviousLesson,
119
+ fetchPackAll,
120
+ fetchPackData,
121
+ fetchParentForDownload,
122
+ fetchPlayAlongsCount,
123
+ fetchRelatedLessons,
124
+ fetchRelatedSongs,
125
+ fetchReturning,
126
+ fetchSanity,
127
+ fetchScheduledReleases,
128
+ fetchShowsData,
129
+ fetchSongArtistCount,
130
+ fetchSongById,
131
+ fetchTopLevelParentId,
132
+ fetchUpcomingEvents,
133
+ getSortOrder,
134
+ jumpToContinueContent
135
+ } from './services/sanity.js';
136
+
137
+ import {
138
+ fetchUserPermissions,
139
+ reset
140
+ } from './services/userPermissions.js';
123
141
 
124
142
  declare module 'musora-content-services' {
125
- export {
126
- addItemToPlaylist,
127
- assignmentStatusCompleted,
128
- assignmentStatusReset,
129
- contentStatusCompleted,
130
- contentStatusReset,
131
- countAssignmentsAndLessons,
132
- createPlaylist,
133
- deletePlaylist,
134
- deletePlaylistItem,
135
- deletePlaylistLike,
136
- duplicatePlaylist,
137
- fetchAll,
138
- fetchAllCompletedStates,
139
- fetchAllFilterOptions,
140
- fetchAllPacks,
141
- fetchArtistLessons,
142
- fetchArtists,
143
- fetchByRailContentId,
144
- fetchByRailContentIds,
145
- fetchByReference,
146
- fetchCarouselCardData,
147
- fetchChallengeIndexMetadata,
148
- fetchChallengeLessonData,
149
- fetchChallengeMetadata,
150
- fetchChallengeUserActiveChallenges,
151
- fetchChatAndLiveEnvent,
152
- fetchCoachLessons,
153
- fetchCommentModContentData,
154
- fetchCompletedChallenges,
155
- fetchCompletedContent,
156
- fetchCompletedState,
157
- fetchContentInProgress,
158
- fetchContentPageUserData,
159
- fetchContentProgress,
160
- fetchFoundation,
161
- fetchGenreLessons,
162
- fetchHandler,
163
- fetchHierarchy,
164
- fetchLessonContent,
165
- fetchLiveEvent,
166
- fetchMetadata,
167
- fetchMethod,
168
- fetchMethodChildren,
169
- fetchMethodChildrenIds,
170
- fetchMethodPreviousNextLesson,
171
- fetchNewReleases,
172
- fetchNextContentDataForParent,
173
- fetchNextPreviousLesson,
174
- fetchOwnedChallenges,
175
- fetchPackAll,
176
- fetchPackData,
177
- fetchParentForDownload,
178
- fetchPinnedPlaylists,
179
- fetchPlayAlongsCount,
180
- fetchPlaylist,
181
- fetchPlaylistItem,
182
- fetchPlaylistItems,
183
- fetchRelatedLessons,
184
- fetchRelatedSongs,
185
- fetchSanity,
186
- fetchScheduledReleases,
187
- fetchShowsData,
188
- fetchSongArtistCount,
189
- fetchSongById,
190
- fetchSongsInProgress,
191
- fetchTopLevelParentId,
192
- fetchUpcomingEvents,
193
- fetchUserAward,
194
- fetchUserBadges,
195
- fetchUserChallengeProgress,
196
- fetchUserLikes,
197
- fetchUserPermissions,
198
- fetchUserPermissionsData,
199
- fetchUserPlaylists,
200
- getAllCompleted,
201
- getAllStarted,
202
- getAllStartedOrCompleted,
203
- getProgressPercentage,
204
- getProgressPercentageByIds,
205
- getProgressState,
206
- getProgressStateByIds,
207
- getResumeTimeSeconds,
208
- getSortOrder,
209
- globalConfig,
210
- initializeService,
211
- isContentLiked,
212
- jumpToContinueContent,
213
- likeContent,
214
- likePlaylist,
215
- pinPlaylist,
216
- playback,
217
- postChallengesCommunityNotification,
218
- postChallengesCompleteLesson,
219
- postChallengesEnroll,
220
- postChallengesEnrollmentNotification,
221
- postChallengesHideCompletedBanner,
222
- postChallengesLeave,
223
- postChallengesSetStartDate,
224
- postChallengesSoloNotification,
225
- postChallengesUnlock,
226
- postContentCompleted,
227
- postContentLiked,
228
- postContentReset,
229
- postContentUnliked,
230
- postRecordWatchSession,
231
- recordWatchSession,
232
- reportPlaylist,
233
- reset,
234
- setStudentViewForUser,
235
- unlikeContent,
236
- unpinPlaylist,
237
- updatePlaylist,
238
- updatePlaylistItem,
239
- }
143
+ export {
144
+ addItemToPlaylist,
145
+ assignmentStatusCompleted,
146
+ assignmentStatusReset,
147
+ contentStatusCompleted,
148
+ contentStatusReset,
149
+ countAssignmentsAndLessons,
150
+ createPlaylist,
151
+ deletePlaylist,
152
+ deletePlaylistItem,
153
+ deletePlaylistLike,
154
+ duplicatePlaylist,
155
+ fetchAll,
156
+ fetchAllCompletedStates,
157
+ fetchAllFilterOptions,
158
+ fetchAllPacks,
159
+ fetchArtistLessons,
160
+ fetchArtists,
161
+ fetchByRailContentId,
162
+ fetchByRailContentIds,
163
+ fetchByReference,
164
+ fetchCarouselCardData,
165
+ fetchChallengeIndexMetadata,
166
+ fetchChallengeLessonData,
167
+ fetchChallengeMetadata,
168
+ fetchChallengeUserActiveChallenges,
169
+ fetchChatAndLiveEnvent,
170
+ fetchCoachLessons,
171
+ fetchComingSoon,
172
+ fetchCommentModContentData,
173
+ fetchCompletedChallenges,
174
+ fetchCompletedContent,
175
+ fetchCompletedState,
176
+ fetchContentInProgress,
177
+ fetchContentPageUserData,
178
+ fetchContentProgress,
179
+ fetchFoundation,
180
+ fetchGenreLessons,
181
+ fetchHandler,
182
+ fetchHierarchy,
183
+ fetchLeaving,
184
+ fetchLessonContent,
185
+ fetchLiveEvent,
186
+ fetchMetadata,
187
+ fetchMethod,
188
+ fetchMethodChildren,
189
+ fetchMethodChildrenIds,
190
+ fetchMethodPreviousNextLesson,
191
+ fetchNewReleases,
192
+ fetchNextContentDataForParent,
193
+ fetchNextPreviousLesson,
194
+ fetchOwnedChallenges,
195
+ fetchPackAll,
196
+ fetchPackData,
197
+ fetchParentForDownload,
198
+ fetchPinnedPlaylists,
199
+ fetchPlayAlongsCount,
200
+ fetchPlaylist,
201
+ fetchPlaylistItem,
202
+ fetchPlaylistItems,
203
+ fetchRelatedLessons,
204
+ fetchRelatedSongs,
205
+ fetchReturning,
206
+ fetchSanity,
207
+ fetchScheduledReleases,
208
+ fetchShowsData,
209
+ fetchSongArtistCount,
210
+ fetchSongById,
211
+ fetchSongsInProgress,
212
+ fetchTopLevelParentId,
213
+ fetchUpcomingEvents,
214
+ fetchUserAward,
215
+ fetchUserBadges,
216
+ fetchUserChallengeProgress,
217
+ fetchUserLikes,
218
+ fetchUserPermissions,
219
+ fetchUserPermissionsData,
220
+ fetchUserPlaylists,
221
+ getAllCompleted,
222
+ getAllStarted,
223
+ getAllStartedOrCompleted,
224
+ getProgressPercentage,
225
+ getProgressPercentageByIds,
226
+ getProgressState,
227
+ getProgressStateByIds,
228
+ getResumeTimeSeconds,
229
+ getSortOrder,
230
+ globalConfig,
231
+ initializeService,
232
+ isContentLiked,
233
+ jumpToContinueContent,
234
+ likeContent,
235
+ likePlaylist,
236
+ pinPlaylist,
237
+ playback,
238
+ postChallengesCommunityNotification,
239
+ postChallengesCompleteLesson,
240
+ postChallengesEnroll,
241
+ postChallengesEnrollmentNotification,
242
+ postChallengesHideCompletedBanner,
243
+ postChallengesLeave,
244
+ postChallengesSetStartDate,
245
+ postChallengesSoloNotification,
246
+ postChallengesUnlock,
247
+ postContentCompleted,
248
+ postContentLiked,
249
+ postContentReset,
250
+ postContentUnliked,
251
+ postRecordWatchSession,
252
+ recordWatchSession,
253
+ reportPlaylist,
254
+ reset,
255
+ setLastUpdatedTime,
256
+ setStudentViewForUser,
257
+ unlikeContent,
258
+ unpinPlaylist,
259
+ updatePlaylist,
260
+ updatePlaylistItem,
261
+ wasLastUpdateOlderThanXSeconds,
262
+ }
240
263
  }