musora-content-services 1.0.208 → 1.0.210
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/.github/workflows/node.js.yml +0 -0
- package/CHANGELOG.md +4 -0
- package/README.md +0 -0
- package/babel.config.js +0 -0
- package/docs/config.js.html +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/index.html +0 -0
- package/docs/module-Config.html +0 -0
- package/docs/module-Railcontent-Services.html +0 -0
- package/docs/module-Sanity-Services.html +0 -0
- package/docs/railcontent.js.html +0 -0
- package/docs/sanity.js.html +0 -0
- package/docs/scripts/collapse.js +0 -0
- package/docs/scripts/commonNav.js +0 -0
- package/docs/scripts/linenumber.js +0 -0
- package/docs/scripts/nav.js +0 -0
- package/docs/scripts/polyfill.js +0 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
- package/docs/scripts/prettify/lang-css.js +0 -0
- package/docs/scripts/prettify/prettify.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/styles/jsdoc.css +0 -0
- package/docs/styles/prettify.css +0 -0
- package/jest.config.js +0 -0
- package/jsdoc.json +0 -0
- package/package.json +1 -1
- package/src/contentMetaData.js +0 -0
- package/src/filterBuilder.js +5 -3
- package/src/index.d.ts +0 -0
- package/src/index.js +0 -0
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/contentProgress.js +0 -0
- package/src/services/dataContext.js +0 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/railcontent.js +0 -0
- package/src/services/sanity.js +7 -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 +13 -16
- package/test/userPermissions.test.js +0 -0
- package/tools/generate-index.js +0 -0
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.210](https://github.com/railroadmedia/musora-content-services/compare/v1.0.209...v1.0.210) (2024-12-02)
|
|
6
|
+
|
|
7
|
+
### [1.0.209](https://github.com/railroadmedia/musora-content-services/compare/v1.0.208...v1.0.209) (2024-12-02)
|
|
8
|
+
|
|
5
9
|
### [1.0.208](https://github.com/railroadmedia/musora-content-services/compare/v1.0.207...v1.0.208) (2024-12-02)
|
|
6
10
|
|
|
7
11
|
### [1.0.207](https://github.com/railroadmedia/musora-content-services/compare/v1.0.198...v1.0.207) (2024-12-02)
|
package/README.md
CHANGED
|
File without changes
|
package/babel.config.js
CHANGED
|
File without changes
|
package/docs/config.js.html
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
|
package/docs/index.html
CHANGED
|
File without changes
|
package/docs/module-Config.html
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/railcontent.js.html
CHANGED
|
File without changes
|
package/docs/sanity.js.html
CHANGED
|
File without changes
|
package/docs/scripts/collapse.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/nav.js
CHANGED
|
File without changes
|
package/docs/scripts/polyfill.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
package/docs/styles/jsdoc.css
CHANGED
|
File without changes
|
package/docs/styles/prettify.css
CHANGED
|
File without changes
|
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/filterBuilder.js
CHANGED
|
@@ -61,10 +61,12 @@ export class FilterBuilder {
|
|
|
61
61
|
if (this.availableContentStatuses.length === 0) {
|
|
62
62
|
if (this.userData.isAdmin) {
|
|
63
63
|
this.availableContentStatuses = [this.STATUS_DRAFT, this.STATUS_SCHEDULED, this.STATUS_PUBLISHED, this.STATUS_ARCHIVED, this.STATUS_UNLISTED];
|
|
64
|
+
this.getFutureScheduledContentsOnly = true;
|
|
64
65
|
} else if(this.isSingle){
|
|
65
66
|
this.availableContentStatuses = [this.STATUS_SCHEDULED, this.STATUS_PUBLISHED, this.STATUS_UNLISTED, this.STATUS_ARCHIVED];
|
|
66
67
|
} else{
|
|
67
68
|
this.availableContentStatuses = [this.STATUS_SCHEDULED, this.STATUS_PUBLISHED];
|
|
69
|
+
this.getFutureScheduledContentsOnly = true;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -74,8 +76,8 @@ export class FilterBuilder {
|
|
|
74
76
|
this.pullFutureContent = true;
|
|
75
77
|
const now = new Date().toISOString();
|
|
76
78
|
let statuses = [...this.availableContentStatuses];
|
|
77
|
-
statuses.splice(statuses.indexOf(this.STATUS_SCHEDULED));
|
|
78
|
-
this._andWhere(`(status in ${arrayToStringRepresentation(statuses)} || (status == '${this.STATUS_SCHEDULED}' && published_on >= '${now}'))`)
|
|
79
|
+
statuses.splice(statuses.indexOf(this.STATUS_SCHEDULED), 1);
|
|
80
|
+
this._andWhere(`(status in ${arrayToStringRepresentation(statuses)} || (status == '${this.STATUS_SCHEDULED}' && defined(published_on) && published_on >= '${now}'))`)
|
|
79
81
|
|
|
80
82
|
} else {
|
|
81
83
|
this._andWhere(`status in ${arrayToStringRepresentation(this.availableContentStatuses)}`);
|
|
@@ -145,4 +147,4 @@ export function arrayToStringRepresentation(arr) {
|
|
|
145
147
|
|
|
146
148
|
export function arrayToRawRepresentation(arr) {
|
|
147
149
|
return '[' + arr.map(item => `${item}`).join(',') + ']';
|
|
148
|
-
}
|
|
150
|
+
}
|
package/src/index.d.ts
CHANGED
|
File without changes
|
package/src/index.js
CHANGED
|
File without changes
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/services/sanity.js
CHANGED
|
@@ -514,7 +514,13 @@ export async function fetchAll(brand, type, {
|
|
|
514
514
|
let bypassStatusAndPublishedValidation = (type == 'instructor' || groupBy == 'artist' || groupBy == 'genre' || groupBy == 'instructor');
|
|
515
515
|
|
|
516
516
|
// Construct the type filter
|
|
517
|
-
|
|
517
|
+
let typeFilter;
|
|
518
|
+
|
|
519
|
+
if( type === 'archives' ) {
|
|
520
|
+
typeFilter = `&& status == "archived"`
|
|
521
|
+
} else {
|
|
522
|
+
typeFilter = type ? `&& _type == '${type}'` : "";
|
|
523
|
+
}
|
|
518
524
|
|
|
519
525
|
// Construct the search filter
|
|
520
526
|
const searchFilter = searchTerm
|
|
@@ -597,7 +603,6 @@ export async function fetchAll(brand, type, {
|
|
|
597
603
|
start: start,
|
|
598
604
|
end: end,
|
|
599
605
|
});
|
|
600
|
-
|
|
601
606
|
return fetchSanity(query, true);
|
|
602
607
|
}
|
|
603
608
|
|
|
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
|
|
@@ -683,16 +683,16 @@ describe('Filter Builder', function () {
|
|
|
683
683
|
let finalFilter = await builder.buildFilter(filter);
|
|
684
684
|
let clauses = spliceFilterForAnds(finalFilter);
|
|
685
685
|
expect(clauses[0].phrase).toBe(filter);
|
|
686
|
-
expect(clauses[1].field).toBe('status');
|
|
687
|
-
expect(clauses[
|
|
686
|
+
expect(clauses[1].field).toBe('(status');
|
|
687
|
+
expect(clauses[3].field).toBe('published_on');
|
|
688
688
|
|
|
689
689
|
builder = new FilterBuilder('', {bypassPermissions: true});
|
|
690
690
|
finalFilter = await builder.buildFilter(filter);
|
|
691
691
|
clauses = spliceFilterForAnds(finalFilter);
|
|
692
|
-
expect(clauses[0].field).toBe('status');
|
|
692
|
+
expect(clauses[0].field).toBe('(status');
|
|
693
693
|
expect(clauses[0].operator).toBe('in');
|
|
694
|
-
expect(clauses[
|
|
695
|
-
expect(clauses[
|
|
694
|
+
expect(clauses[2].field).toBe('published_on');
|
|
695
|
+
expect(clauses[2].operator).toBe('>=');
|
|
696
696
|
});
|
|
697
697
|
|
|
698
698
|
test('withOnlyFilterAvailableStatuses', async () => {
|
|
@@ -720,7 +720,7 @@ describe('Filter Builder', function () {
|
|
|
720
720
|
expect(clauses[1].field).toBe('(status'); // extra ( because it's a multi part filter
|
|
721
721
|
expect(clauses[1].operator).toBe('in');
|
|
722
722
|
// getFutureScheduledContentsOnly doesn't make a filter that's splicable, so we match on the more static string
|
|
723
|
-
const expected = "['published','unlisted'] || (status == 'scheduled' && published_on >=";
|
|
723
|
+
const expected = "['published','unlisted'] || (status == 'scheduled' && defined(published_on) && published_on >=";
|
|
724
724
|
const isMatch = finalFilter.includes(expected);
|
|
725
725
|
expect(isMatch).toBeTruthy();
|
|
726
726
|
});
|
|
@@ -756,8 +756,8 @@ describe('Filter Builder', function () {
|
|
|
756
756
|
expect(isMatch).toBeFalsy();
|
|
757
757
|
const clauses = spliceFilterForAnds(finalFilter);
|
|
758
758
|
expect(clauses[0].field).toBe('railcontent_id');
|
|
759
|
-
expect(clauses[1].field).toBe('status');
|
|
760
|
-
expect(clauses[
|
|
759
|
+
expect(clauses[1].field).toBe('(status');
|
|
760
|
+
expect(clauses[3].field).toBe('published_on');
|
|
761
761
|
|
|
762
762
|
});
|
|
763
763
|
|
|
@@ -774,13 +774,10 @@ describe('Filter Builder', function () {
|
|
|
774
774
|
let finalFilter = await builder.buildFilter();
|
|
775
775
|
let clauses = spliceFilterForAnds(finalFilter);
|
|
776
776
|
expect(clauses[0].phrase).toBe(filter);
|
|
777
|
-
expect(clauses[1].field).toBe('status');
|
|
777
|
+
expect(clauses[1].field).toBe('(status');
|
|
778
778
|
expect(clauses[1].operator).toBe('in');
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
// const restrictionDate = new Date(clauses[2].condition)
|
|
782
|
-
// const now = new Date();
|
|
783
|
-
// expect(now.getTime()).toBeLessThan(restrictionDate.getTime());
|
|
779
|
+
expect(clauses[2].phrase).toBe('defined(published_on)');
|
|
780
|
+
expect(clauses[3].field).toBe('published_on');
|
|
784
781
|
|
|
785
782
|
builder = new FilterBuilder(filter,
|
|
786
783
|
{
|
|
@@ -790,8 +787,8 @@ describe('Filter Builder', function () {
|
|
|
790
787
|
finalFilter = await builder.buildFilter();
|
|
791
788
|
clauses = spliceFilterForAnds(finalFilter);
|
|
792
789
|
expect(clauses[0].phrase).toBe(filter);
|
|
793
|
-
expect(clauses[
|
|
794
|
-
expect(clauses[
|
|
790
|
+
expect(clauses[3].field).toBe('published_on');
|
|
791
|
+
expect(clauses[3].operator).toBe('>=');
|
|
795
792
|
});
|
|
796
793
|
|
|
797
794
|
function spliceFilterForAnds(filter) {
|
|
File without changes
|
package/tools/generate-index.js
CHANGED
|
File without changes
|