musora-content-services 1.0.179 → 1.0.181
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 +4 -0
- package/README.md +0 -0
- package/jest.config.js +0 -0
- package/package.json +1 -1
- package/src/contentTypeConfig.js +5 -6
- package/src/services/config.js +0 -0
- package/src/services/contentLikes.js +0 -0
- package/src/services/dataContext.js +9 -0
- package/src/services/lastUpdated.js +0 -0
- package/src/services/userPermissions.js +0 -0
- package/test/contentLikes.test.js +0 -0
- package/test/initializeTests.js +0 -0
- package/test/lastUpdated.test.js +0 -0
- package/test/localStorageMock.js +0 -0
- package/test/log.js +0 -0
- package/test/sanityQueryService.test.js +3 -3
- package/test/userPermissions.test.js +0 -0
- package/tools/generate-index.js +0 -0
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.181](https://github.com/railroadmedia/musora-content-services/compare/v1.0.180...v1.0.181) (2024-11-25)
|
|
6
|
+
|
|
7
|
+
### [1.0.180](https://github.com/railroadmedia/musora-content-services/compare/v1.0.179...v1.0.180) (2024-11-23)
|
|
8
|
+
|
|
5
9
|
### [1.0.179](https://github.com/railroadmedia/musora-content-services/compare/v1.0.178...v1.0.179) (2024-11-19)
|
|
6
10
|
|
|
7
11
|
### [1.0.178](https://github.com/railroadmedia/musora-content-services/compare/v1.0.177...v1.0.178) (2024-11-19)
|
package/README.md
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/contentTypeConfig.js
CHANGED
|
@@ -10,6 +10,7 @@ const DEFAULT_FIELDS = [
|
|
|
10
10
|
"difficulty",
|
|
11
11
|
"difficulty_string",
|
|
12
12
|
"web_url_path",
|
|
13
|
+
"'url': web_url_path",
|
|
13
14
|
"published_on",
|
|
14
15
|
"'type': _type",
|
|
15
16
|
"progress_percent",
|
|
@@ -103,7 +104,7 @@ let contentTypeConfig = {
|
|
|
103
104
|
'"gold_award": gold_award.asset->url',
|
|
104
105
|
'"silver_award": silver_award.asset->url',
|
|
105
106
|
'"bronze_award": bronze_award.asset->url',
|
|
106
|
-
'
|
|
107
|
+
'is_solo',
|
|
107
108
|
`"lessons": child[]->{
|
|
108
109
|
"id": railcontent_id,
|
|
109
110
|
title,
|
|
@@ -196,7 +197,6 @@ let contentTypeConfig = {
|
|
|
196
197
|
'title',
|
|
197
198
|
'total_xp',
|
|
198
199
|
'"type": _type',
|
|
199
|
-
'"url": web_url_path',
|
|
200
200
|
'xp',
|
|
201
201
|
]
|
|
202
202
|
},
|
|
@@ -316,7 +316,6 @@ let contentTypeConfig = {
|
|
|
316
316
|
title,
|
|
317
317
|
"type": _type,
|
|
318
318
|
"description": ${descriptionField},
|
|
319
|
-
"url": web_url_path,
|
|
320
319
|
xp,
|
|
321
320
|
}`
|
|
322
321
|
]
|
|
@@ -345,12 +344,12 @@ let contentTypeConfig = {
|
|
|
345
344
|
'"coach_card_image": coach_card_image.asset->url',
|
|
346
345
|
'"coach_featured_image": coach_featured_image.asset->url',
|
|
347
346
|
'"coach_top_banner_image": coach_top_banner_image.asset->url',
|
|
348
|
-
'focus',
|
|
347
|
+
'"focus": focus[]->name',
|
|
349
348
|
'focus_text',
|
|
350
349
|
'forum_thread_id',
|
|
351
|
-
'long_bio',
|
|
350
|
+
'"long_bio": long_bio[0].children[0].text,',
|
|
352
351
|
'name',
|
|
353
|
-
'short_bio',
|
|
352
|
+
'"short_bio" : short_bio[0].children[0].text',
|
|
354
353
|
'bands',
|
|
355
354
|
'endorsements',
|
|
356
355
|
]
|
package/src/services/config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -15,6 +15,7 @@ let cache = null;
|
|
|
15
15
|
|
|
16
16
|
export class DataContext {
|
|
17
17
|
context = null;
|
|
18
|
+
dataPromise = null;
|
|
18
19
|
|
|
19
20
|
constructor(dataVersionKey, fetchDataFunction) {
|
|
20
21
|
this.dataVersionKey = dataVersionKey;
|
|
@@ -24,6 +25,13 @@ export class DataContext {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
async getData() {
|
|
28
|
+
if (!this.dataPromise) {
|
|
29
|
+
this.dataPromise = this.getDataPromise();
|
|
30
|
+
}
|
|
31
|
+
return this.dataPromise;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async getDataPromise() {
|
|
27
35
|
await this.ensureLocalContextLoaded();
|
|
28
36
|
const shouldVerify = await this.shouldVerifyServerVerions();
|
|
29
37
|
|
|
@@ -36,6 +44,7 @@ export class DataContext {
|
|
|
36
44
|
}
|
|
37
45
|
cache.setItem(this.localStorageLastUpdatedKey, new Date().getTime()?.toString());
|
|
38
46
|
}
|
|
47
|
+
this.dataPromise = null;
|
|
39
48
|
return this.context.data;
|
|
40
49
|
}
|
|
41
50
|
|
|
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
|
package/test/localStorageMock.js
CHANGED
|
File without changes
|
package/test/log.js
CHANGED
|
File without changes
|
|
@@ -66,7 +66,7 @@ describe('Sanity Queries', function () {
|
|
|
66
66
|
test('fetchArtists', async () => {
|
|
67
67
|
const response = await fetchArtists('drumeo');
|
|
68
68
|
const artistNames = response.map((x) => x.name);
|
|
69
|
-
expect(artistNames).toContain("
|
|
69
|
+
expect(artistNames).toContain("Audioslave");
|
|
70
70
|
|
|
71
71
|
}, 10000);
|
|
72
72
|
|
|
@@ -161,11 +161,11 @@ describe('Sanity Queries', function () {
|
|
|
161
161
|
|
|
162
162
|
test('fetchAllSongsInProgress', async () => {
|
|
163
163
|
var mock = jest.spyOn(dataContext, 'fetchData');
|
|
164
|
-
var json = JSON.parse(`{"version":1,"config":{"key":1,"enabled":1,"checkInterval":1,"refreshInterval":2},"data":{"
|
|
164
|
+
var json = JSON.parse(`{"version":1,"config":{"key":1,"enabled":1,"checkInterval":1,"refreshInterval":2},"data":{"412941":{"s":"started","p":6,"t":20,"u":1731108082}}}`);
|
|
165
165
|
mock.mockImplementation(() =>
|
|
166
166
|
json);
|
|
167
167
|
const response = await fetchAll('drumeo', 'song',{progress:"in progress"});
|
|
168
|
-
expect(response.entity[0].id).toBe(
|
|
168
|
+
expect(response.entity[0].id).toBe(412941);
|
|
169
169
|
expect(response.entity.length).toBe(1);
|
|
170
170
|
});
|
|
171
171
|
|
|
File without changes
|
package/tools/generate-index.js
CHANGED
|
File without changes
|