musora-content-services 1.0.180 → 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 +2 -0
- package/README.md +0 -0
- package/jest.config.js +0 -0
- package/package.json +1 -1
- 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,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.181](https://github.com/railroadmedia/musora-content-services/compare/v1.0.180...v1.0.181) (2024-11-25)
|
|
6
|
+
|
|
5
7
|
### [1.0.180](https://github.com/railroadmedia/musora-content-services/compare/v1.0.179...v1.0.180) (2024-11-23)
|
|
6
8
|
|
|
7
9
|
### [1.0.179](https://github.com/railroadmedia/musora-content-services/compare/v1.0.178...v1.0.179) (2024-11-19)
|
package/README.md
CHANGED
|
File without changes
|
package/jest.config.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
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
|