musora-content-services 1.3.9 → 1.3.11
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/.prettierignore +0 -0
- package/.prettierrc +0 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.cjs +0 -0
- package/docs/config.js.html +14 -14
- package/docs/index.html +2 -2
- package/docs/module-Config.html +2 -2
- package/docs/module-Railcontent-Services.html +46 -46
- package/docs/module-Sanity-Services.html +540 -36
- package/docs/railcontent.js.html +370 -366
- package/docs/sanity.js.html +1111 -967
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/contentTypeConfig.js +1 -1
- package/src/filterBuilder.js +2 -2
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/sanity.js +18 -2
- package/src/services/userPermissions.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/contentProgress.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lastUpdated.test.js +0 -0
- package/test/live/contentProgressLive.test.js +0 -0
- package/test/live/railcontentLive.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +0 -0
- package/test/userPermissions.test.js +0 -0
- package/tools/generate-index.cjs +0 -0
package/jest.config.js
CHANGED
|
File without changes
|
package/jsdoc.json
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentMetaData.js
CHANGED
|
File without changes
|
package/src/contentTypeConfig.js
CHANGED
package/src/filterBuilder.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchUserPermissions } from './services/userPermissions.js'
|
|
2
|
-
import {
|
|
2
|
+
import { plusMembershipPermissions } from './contentTypeConfig.js'
|
|
3
3
|
|
|
4
4
|
export class FilterBuilder {
|
|
5
5
|
STATUS_SCHEDULED = 'scheduled'
|
|
@@ -116,7 +116,7 @@ export class FilterBuilder {
|
|
|
116
116
|
if (this.bypassPermissions || this.userData.isAdmin) return this
|
|
117
117
|
let requiredPermissions = this._getUserPermissions()
|
|
118
118
|
if (this.userData.isABasicMember && this.allowsPullSongsContent) {
|
|
119
|
-
requiredPermissions = [...requiredPermissions,
|
|
119
|
+
requiredPermissions = [...requiredPermissions, plusMembershipPermissions]
|
|
120
120
|
}
|
|
121
121
|
this._andWhere(
|
|
122
122
|
`(!defined(permission) || references(*[_type == 'permission' && railcontent_id in ${arrayToRawRepresentation(requiredPermissions)}]._id))`
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -255,6 +255,7 @@ export async function fetchRelatedSongs(brand, songId) {
|
|
|
255
255
|
"published_on": published_on,
|
|
256
256
|
status,
|
|
257
257
|
"image": thumbnail.asset->url,
|
|
258
|
+
"permission_id": permission[]->railcontent_id,
|
|
258
259
|
"fields": [
|
|
259
260
|
{
|
|
260
261
|
"key": "title",
|
|
@@ -280,6 +281,7 @@ export async function fetchRelatedSongs(brand, songId) {
|
|
|
280
281
|
"id": railcontent_id,
|
|
281
282
|
"url": web_url_path,
|
|
282
283
|
"published_on": published_on,
|
|
284
|
+
"permission_id": permission[]->railcontent_id,
|
|
283
285
|
status,
|
|
284
286
|
"fields": [
|
|
285
287
|
{
|
|
@@ -486,6 +488,9 @@ export async function fetchByRailContentId(id, contentType) {
|
|
|
486
488
|
* .catch(error => console.error(error));
|
|
487
489
|
*/
|
|
488
490
|
export async function fetchByRailContentIds(ids, contentType = undefined) {
|
|
491
|
+
if (!ids) {
|
|
492
|
+
return [];
|
|
493
|
+
}
|
|
489
494
|
const idsString = ids.join(',')
|
|
490
495
|
|
|
491
496
|
const query = `*[railcontent_id in [${idsString}]]{
|
|
@@ -1253,11 +1258,22 @@ export async function fetchLessonContent(railContentId) {
|
|
|
1253
1258
|
"type": *[railcontent_id == ^.id][0]._type,
|
|
1254
1259
|
},
|
|
1255
1260
|
sort,
|
|
1256
|
-
xp
|
|
1261
|
+
xp,
|
|
1262
|
+
stbs,ds2stbs, bdsStbs`
|
|
1257
1263
|
const query = await buildQuery(`railcontent_id == ${railContentId}`, filterParams, fields, {
|
|
1258
1264
|
isSingle: true,
|
|
1259
1265
|
})
|
|
1260
|
-
|
|
1266
|
+
const chapterProcess = (result) => {
|
|
1267
|
+
const chapters = result.chapters ?? [];
|
|
1268
|
+
if(chapters.length == 0) return result
|
|
1269
|
+
result.chapters = chapters.map((chapter, index) => ({
|
|
1270
|
+
...chapter,
|
|
1271
|
+
chapter_thumbnail_url: `https://musora-web-platform.s3.amazonaws.com/chapters/${result.brand}/Chapter${index + 1}.jpg`
|
|
1272
|
+
}));
|
|
1273
|
+
return result
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
return fetchSanity(query, false, {customPostProcess:chapterProcess})
|
|
1261
1277
|
}
|
|
1262
1278
|
|
|
1263
1279
|
/**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/initializeTests.js
CHANGED
|
File without changes
|
package/test/lastUpdated.test.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/tools/generate-index.cjs
CHANGED
|
File without changes
|