@websolutespa/bom-mixer-store 1.8.1 → 1.8.2
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 +6 -0
- package/dist/index.js +7 -10
- package/dist/index.mjs +7 -10
- package/package.json +1 -1
- package/src/remote/remote.store.ts +5 -9
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1648,17 +1648,14 @@ async function getRemoteStore_() {
|
|
|
1648
1648
|
async function getRemoteStoreStaticBuild_() {
|
|
1649
1649
|
return fromCache(async () => {
|
|
1650
1650
|
console.log("getRemoteStoreStaticBuild_");
|
|
1651
|
-
|
|
1651
|
+
let store = {};
|
|
1652
1652
|
const url = "/store";
|
|
1653
1653
|
const json = await remoteApiGet(url);
|
|
1654
1654
|
if (json != null) {
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
store[key] = new MockService(json[key], store);
|
|
1660
|
-
}
|
|
1661
|
-
});
|
|
1655
|
+
const data = Object.fromEntries(
|
|
1656
|
+
COLLECTIONS.map((key) => [key, json[key] || []])
|
|
1657
|
+
);
|
|
1658
|
+
store = getMockStoreFromData_(data);
|
|
1662
1659
|
}
|
|
1663
1660
|
return store;
|
|
1664
1661
|
}, "STORE_BUILD_");
|
|
@@ -2186,7 +2183,7 @@ function newRouteLink(category, route, locale) {
|
|
|
2186
2183
|
const href = route && route.id ? route.id.toString() : "/";
|
|
2187
2184
|
const id = route?.page || category.id;
|
|
2188
2185
|
const media = category.media || route?.media;
|
|
2189
|
-
const schema = route?.schema || category?.schema || "unknown";
|
|
2186
|
+
const schema = route?.template || route?.schema || category?.schema || "unknown";
|
|
2190
2187
|
const title = (0, import_bom_core15.localize)(category.title || route?.title || "untitled", locale);
|
|
2191
2188
|
const routeLink = {
|
|
2192
2189
|
category: category.id,
|
|
@@ -2215,7 +2212,7 @@ async function getLayout(market, locale) {
|
|
|
2215
2212
|
return object;
|
|
2216
2213
|
}, {});
|
|
2217
2214
|
const topLevelHrefs = flatTopLevelRoutes.reduce((object, routeLink) => {
|
|
2218
|
-
if (routeLink.href && !object[routeLink.schema] || routeLink.schema === routeLink.category) {
|
|
2215
|
+
if (routeLink.href && (!object[routeLink.schema] || routeLink.schema === routeLink.category)) {
|
|
2219
2216
|
object[routeLink.schema] = routeLink.href;
|
|
2220
2217
|
}
|
|
2221
2218
|
return object;
|
package/dist/index.mjs
CHANGED
|
@@ -1543,17 +1543,14 @@ async function getRemoteStore_() {
|
|
|
1543
1543
|
async function getRemoteStoreStaticBuild_() {
|
|
1544
1544
|
return fromCache(async () => {
|
|
1545
1545
|
console.log("getRemoteStoreStaticBuild_");
|
|
1546
|
-
|
|
1546
|
+
let store = {};
|
|
1547
1547
|
const url = "/store";
|
|
1548
1548
|
const json = await remoteApiGet(url);
|
|
1549
1549
|
if (json != null) {
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
store[key] = new MockService(json[key], store);
|
|
1555
|
-
}
|
|
1556
|
-
});
|
|
1550
|
+
const data = Object.fromEntries(
|
|
1551
|
+
COLLECTIONS.map((key) => [key, json[key] || []])
|
|
1552
|
+
);
|
|
1553
|
+
store = getMockStoreFromData_(data);
|
|
1557
1554
|
}
|
|
1558
1555
|
return store;
|
|
1559
1556
|
}, "STORE_BUILD_");
|
|
@@ -2081,7 +2078,7 @@ function newRouteLink(category, route, locale) {
|
|
|
2081
2078
|
const href = route && route.id ? route.id.toString() : "/";
|
|
2082
2079
|
const id = route?.page || category.id;
|
|
2083
2080
|
const media = category.media || route?.media;
|
|
2084
|
-
const schema = route?.schema || category?.schema || "unknown";
|
|
2081
|
+
const schema = route?.template || route?.schema || category?.schema || "unknown";
|
|
2085
2082
|
const title = localize(category.title || route?.title || "untitled", locale);
|
|
2086
2083
|
const routeLink = {
|
|
2087
2084
|
category: category.id,
|
|
@@ -2110,7 +2107,7 @@ async function getLayout(market, locale) {
|
|
|
2110
2107
|
return object;
|
|
2111
2108
|
}, {});
|
|
2112
2109
|
const topLevelHrefs = flatTopLevelRoutes.reduce((object, routeLink) => {
|
|
2113
|
-
if (routeLink.href && !object[routeLink.schema] || routeLink.schema === routeLink.category) {
|
|
2110
|
+
if (routeLink.href && (!object[routeLink.schema] || routeLink.schema === routeLink.category)) {
|
|
2114
2111
|
object[routeLink.schema] = routeLink.href;
|
|
2115
2112
|
}
|
|
2116
2113
|
return object;
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IMemoryStore, IQuerable, IStore } from '@websolutespa/bom-core';
|
|
2
2
|
import { fromCache } from '../cache/cache.service';
|
|
3
3
|
import { CachedService } from '../cached/cached.service';
|
|
4
|
-
import { MockService } from '../mock/mock.service';
|
|
5
4
|
import { getMockStore, getMockStoreFromData_ } from '../mock/mock.store';
|
|
6
5
|
import { BuildStrategy, COLLECTIONS, KNOWN_COLLECTIONS, MOCK_COLLECTIONS, NextPhase, StoreStrategy, buildStrategy, nextPhase, storeStrategy } from '../store/store';
|
|
7
6
|
import { RemoteMenuService } from './remote-menu.service';
|
|
@@ -49,17 +48,14 @@ async function getRemoteStore_<T extends IStore>(): Promise<T> {
|
|
|
49
48
|
async function getRemoteStoreStaticBuild_<T extends IStore>(): Promise<T> {
|
|
50
49
|
return fromCache<T>(async () => {
|
|
51
50
|
console.log('getRemoteStoreStaticBuild_');
|
|
52
|
-
|
|
51
|
+
let store: IStore = {};
|
|
53
52
|
const url = '/store';
|
|
54
53
|
const json = await remoteApiGet<IMemoryStore>(url);
|
|
55
54
|
if (json != null) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
store[key] = new MockService(json[key], store);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
55
|
+
const data = Object.fromEntries(
|
|
56
|
+
COLLECTIONS.map(key => ([key, json[key] || []]))
|
|
57
|
+
);
|
|
58
|
+
store = getMockStoreFromData_(data);
|
|
63
59
|
}
|
|
64
60
|
return store as T;
|
|
65
61
|
}, 'STORE_BUILD_');
|