musora-content-services 1.0.207 → 1.0.208

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,8 @@
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.0.208](https://github.com/railroadmedia/musora-content-services/compare/v1.0.207...v1.0.208) (2024-12-02)
6
+
5
7
  ### [1.0.207](https://github.com/railroadmedia/musora-content-services/compare/v1.0.198...v1.0.207) (2024-12-02)
6
8
 
7
9
  ### [1.0.206](https://github.com/railroadmedia/musora-content-services/compare/v1.0.205...v1.0.206) (2024-12-01)
File without changes
package/docs/index.html CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.207",
3
+ "version": "1.0.208",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -86,8 +86,7 @@ export class FilterBuilder {
86
86
  _applyPermissions() {
87
87
  if (this.bypassPermissions || this.userData.isAdmin) return this;
88
88
  const requiredPermissions = this._getUserPermissions();
89
- if (requiredPermissions.length === 0) return this;
90
- this._andWhere(`references(*[_type == 'permission' && railcontent_id in ${arrayToRawRepresentation(requiredPermissions)}]._id)`);
89
+ this._andWhere(`(!defined(permission) || references(*[_type == 'permission' && railcontent_id in ${arrayToRawRepresentation(requiredPermissions)}]._id))`);
91
90
  return this;
92
91
  }
93
92
 
package/src/index.d.ts CHANGED
File without changes
package/src/index.js CHANGED
File without changes
File without changes
@@ -1160,7 +1160,7 @@ export async function fetchLessonContent(railContentId) {
1160
1160
  * @returns {Promise<Array<Object>|null>} - The fetched related lessons data or null if not found.
1161
1161
  */
1162
1162
  export async function fetchRelatedLessons(railContentId, brand) {
1163
- const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && references(*[_type=='permission']._id)]{
1163
+ const query = `*[railcontent_id == ${railContentId} && brand == "${brand}" && (!defined(permission) || references(*[_type=='permission']._id))]{
1164
1164
  _type, parent_type, railcontent_id,
1165
1165
  "related_lessons" : array::unique([
1166
1166
  ...(*[references(^._id)][0].child[]->{_id, "id":railcontent_id, published_on, "instructor": instructor[0]->name, title, "thumbnail_url":thumbnail.asset->url, length_in_seconds, web_url_path, "type": _type, difficulty, difficulty_string, railcontent_id, artist->,"permission_id": permission[]->railcontent_id,_type}),
@@ -747,7 +747,8 @@ describe('Filter Builder', function () {
747
747
  const filter = 'railcontent_id = 111'
748
748
  const builder = new FilterBuilder(filter,
749
749
  {
750
- bypassPermissions: true
750
+ bypassPermissions: true,
751
+ pullFutureContent: false
751
752
  });
752
753
  const finalFilter = await builder.buildFilter();
753
754
  const expected = "references(*[_type == 'permission' && railcontent_id in [78,91,92]]._id)"
@@ -775,11 +776,11 @@ describe('Filter Builder', function () {
775
776
  expect(clauses[0].phrase).toBe(filter);
776
777
  expect(clauses[1].field).toBe('status');
777
778
  expect(clauses[1].operator).toBe('in');
778
- expect(clauses[2].field).toBe('published_on');
779
- expect(clauses[2].operator).toBe('<=');
780
- const restrictionDate = new Date(clauses[2].condition)
781
- const now = new Date();
782
- expect(now.getTime()).toBeLessThan(restrictionDate.getTime());
779
+ // expect(clauses[2].field).toBe('published_on');
780
+ // expect(clauses[2].operator).toBe('<=');
781
+ // const restrictionDate = new Date(clauses[2].condition)
782
+ // const now = new Date();
783
+ // expect(now.getTime()).toBeLessThan(restrictionDate.getTime());
783
784
 
784
785
  builder = new FilterBuilder(filter,
785
786
  {