@websolutespa/bom-mixer-store 1.8.8 → 1.8.10

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
@@ -1,5 +1,19 @@
1
1
  # @websolutespa/bom-mixer-store
2
2
 
3
+ ## 1.8.10
4
+
5
+ ### Patch Changes
6
+
7
+ - f0d17f3: Modified: page market filtering
8
+ - Updated dependencies [f0d17f3]
9
+ - @websolutespa/bom-core@1.8.19
10
+
11
+ ## 1.8.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Modified: BuildStrategy.Runtime
16
+
3
17
  ## 1.8.8
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -362,7 +362,7 @@ function itemsFilteredByMarket_(items, market) {
362
362
  });
363
363
  }
364
364
  function itemHasMarket_(item, market) {
365
- return Array.isArray(item.markets) ? item.markets.includes(market) : true;
365
+ return Array.isArray(item.markets) && item.markets.length > 0 ? item.markets.includes(market) : true;
366
366
  }
367
367
  function collectUndecoratedCategories(items, undecoratedCategories = []) {
368
368
  items.forEach((item) => {
@@ -818,6 +818,12 @@ var MockPageService = class extends MockService {
818
818
  locale: params.locale,
819
819
  depth: params.depth
820
820
  });
821
+ const invalidKeys = ["components"];
822
+ decoratedItems = decoratedItems.map((x) => Object.fromEntries(
823
+ Object.entries(x).filter(
824
+ ([k, v]) => !invalidKeys.includes(k)
825
+ )
826
+ ));
821
827
  return decoratedItems;
822
828
  }
823
829
  };
@@ -1746,7 +1752,7 @@ async function getRemoteStoreStaticBuild_() {
1746
1752
  return fromCache(async () => {
1747
1753
  console.log("getRemoteStoreStaticBuild_");
1748
1754
  let store = {};
1749
- const url = "/store";
1755
+ const url = `/store?strategy=${buildStrategy}`;
1750
1756
  const json = await remoteApiGet(url);
1751
1757
  if (json != null) {
1752
1758
  const data = Object.fromEntries(
@@ -1757,24 +1763,9 @@ async function getRemoteStoreStaticBuild_() {
1757
1763
  return store;
1758
1764
  }, "STORE_BUILD_");
1759
1765
  }
1760
- async function getRemoteStoreRuntimeBuild_() {
1761
- return fromCache(async () => {
1762
- console.log("getRemoteStoreRuntimeBuild_");
1763
- const data = {};
1764
- COLLECTIONS.forEach((key) => {
1765
- data[key] = [];
1766
- });
1767
- const store = getMockStoreFromData_(data);
1768
- return store;
1769
- }, "STORE_RUNTIME_BUILD_");
1770
- }
1771
1766
  async function getRemoteStore() {
1772
1767
  if (nextPhase === "phase-production-build" /* ProductionBuild */) {
1773
- if (buildStrategy === "runtime" /* Runtime */) {
1774
- return await getRemoteStoreRuntimeBuild_();
1775
- } else {
1776
- return await getRemoteStoreStaticBuild_();
1777
- }
1768
+ return await getRemoteStoreStaticBuild_();
1778
1769
  } else {
1779
1770
  return await getRemoteStore_();
1780
1771
  }
package/dist/index.mjs CHANGED
@@ -257,7 +257,7 @@ function itemsFilteredByMarket_(items, market) {
257
257
  });
258
258
  }
259
259
  function itemHasMarket_(item, market) {
260
- return Array.isArray(item.markets) ? item.markets.includes(market) : true;
260
+ return Array.isArray(item.markets) && item.markets.length > 0 ? item.markets.includes(market) : true;
261
261
  }
262
262
  function collectUndecoratedCategories(items, undecoratedCategories = []) {
263
263
  items.forEach((item) => {
@@ -713,6 +713,12 @@ var MockPageService = class extends MockService {
713
713
  locale: params.locale,
714
714
  depth: params.depth
715
715
  });
716
+ const invalidKeys = ["components"];
717
+ decoratedItems = decoratedItems.map((x) => Object.fromEntries(
718
+ Object.entries(x).filter(
719
+ ([k, v]) => !invalidKeys.includes(k)
720
+ )
721
+ ));
716
722
  return decoratedItems;
717
723
  }
718
724
  };
@@ -1641,7 +1647,7 @@ async function getRemoteStoreStaticBuild_() {
1641
1647
  return fromCache(async () => {
1642
1648
  console.log("getRemoteStoreStaticBuild_");
1643
1649
  let store = {};
1644
- const url = "/store";
1650
+ const url = `/store?strategy=${buildStrategy}`;
1645
1651
  const json = await remoteApiGet(url);
1646
1652
  if (json != null) {
1647
1653
  const data = Object.fromEntries(
@@ -1652,24 +1658,9 @@ async function getRemoteStoreStaticBuild_() {
1652
1658
  return store;
1653
1659
  }, "STORE_BUILD_");
1654
1660
  }
1655
- async function getRemoteStoreRuntimeBuild_() {
1656
- return fromCache(async () => {
1657
- console.log("getRemoteStoreRuntimeBuild_");
1658
- const data = {};
1659
- COLLECTIONS.forEach((key) => {
1660
- data[key] = [];
1661
- });
1662
- const store = getMockStoreFromData_(data);
1663
- return store;
1664
- }, "STORE_RUNTIME_BUILD_");
1665
- }
1666
1661
  async function getRemoteStore() {
1667
1662
  if (nextPhase === "phase-production-build" /* ProductionBuild */) {
1668
- if (buildStrategy === "runtime" /* Runtime */) {
1669
- return await getRemoteStoreRuntimeBuild_();
1670
- } else {
1671
- return await getRemoteStoreStaticBuild_();
1672
- }
1663
+ return await getRemoteStoreStaticBuild_();
1673
1664
  } else {
1674
1665
  return await getRemoteStore_();
1675
1666
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "1.8.8",
3
+ "version": "1.8.10",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -64,7 +64,7 @@ function itemsFilteredByMarket_(items: IUndecoratedMenuItem[], market: string):
64
64
  }
65
65
 
66
66
  function itemHasMarket_(item: IUndecoratedMenuItem, market: string): boolean {
67
- return Array.isArray(item.markets) ? item.markets.includes(market) : true;
67
+ return (Array.isArray(item.markets) && item.markets.length > 0) ? item.markets.includes(market) : true;
68
68
  }
69
69
 
70
70
  function collectUndecoratedCategories(items: IUndecoratedMenuItem[], undecoratedCategories: IUndecoratedMenuCategory[] = []): IUndecoratedMenuCategory[] {
@@ -39,8 +39,14 @@ export class MockPageService<T extends ICategorized = ICategorized> extends Mock
39
39
  locale: params.locale,
40
40
  depth: params.depth,
41
41
  });
42
+ // !!! optimization for index listing removing components
43
+ const invalidKeys = ['components'];
44
+ decoratedItems = decoratedItems.map(x => Object.fromEntries(
45
+ Object.entries(x).filter(
46
+ ([k, v]) => !invalidKeys.includes(k)
47
+ )
48
+ )) as B[];
42
49
  /*
43
- // !!! optimization for index listing
44
50
  decoratedItems = await decorateNavs_<B>(store, decoratedItems, params);
45
51
  */
46
52
  return decoratedItems;
@@ -2,7 +2,7 @@ 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
4
  import { getMockStore, getMockStoreFromData_ } from '../mock/mock.store';
5
- import { BuildStrategy, COLLECTIONS, KNOWN_COLLECTIONS, MOCK_COLLECTIONS, NextPhase, StoreStrategy, buildStrategy, nextPhase, storeStrategy } from '../store/store';
5
+ import { COLLECTIONS, KNOWN_COLLECTIONS, MOCK_COLLECTIONS, NextPhase, StoreStrategy, buildStrategy, nextPhase, storeStrategy } from '../store/store';
6
6
  import { RemoteMenuService } from './remote-menu.service';
7
7
  import { RemotePageService } from './remote-page.service';
8
8
  import { remoteApiGet } from './remote.api';
@@ -49,7 +49,7 @@ async function getRemoteStoreStaticBuild_<T extends IStore>(): Promise<T> {
49
49
  return fromCache<T>(async () => {
50
50
  console.log('getRemoteStoreStaticBuild_');
51
51
  let store: IStore = {};
52
- const url = '/store';
52
+ const url = `/store?strategy=${buildStrategy}`;
53
53
  const json = await remoteApiGet<IMemoryStore>(url);
54
54
  if (json != null) {
55
55
  const data = Object.fromEntries(
@@ -75,11 +75,14 @@ async function getRemoteStoreRuntimeBuild_<T extends IStore>(): Promise<T> {
75
75
 
76
76
  export async function getRemoteStore<T extends IStore>(): Promise<T> {
77
77
  if (nextPhase === NextPhase.ProductionBuild) {
78
+ /*
78
79
  if (buildStrategy === BuildStrategy.Runtime) {
79
80
  return await getRemoteStoreRuntimeBuild_();
80
81
  } else {
81
82
  return await getRemoteStoreStaticBuild_();
82
83
  }
84
+ */
85
+ return await getRemoteStoreStaticBuild_();
83
86
  } else {
84
87
  return await getRemoteStore_();
85
88
  }