@websolutespa/bom-mixer-store 1.2.0 → 1.2.1

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,73 +1,79 @@
1
- # @websolutespa/bom-mixer-store
2
-
3
- ## 1.2.0
4
-
5
- ### Minor Changes
6
-
7
- - Updating: next 13.
8
-
9
- ## 1.1.1
10
-
11
- ### Patch Changes
12
-
13
- - Fixing: check redirects by pattern.
14
-
15
- ## 1.1.0
16
-
17
- ### Minor Changes
18
-
19
- - Modified: store refactor.
20
-
21
- ## 1.0.1
22
-
23
- ### Patch Changes
24
-
25
- - Fixing: localhost url.
26
-
27
- ## 1.0.0
28
-
29
- ### Minor Changes
30
-
31
- - Modified routes, added redirects.
32
-
33
- ## 0.3.2
34
-
35
- ### Patch Changes
36
-
37
- - Modified: MockMenuService.
38
-
39
- ## 0.3.1
40
-
41
- ### Patch Changes
42
-
43
- - Added: source files.
44
-
45
- ## 0.3.0
46
-
47
- ### Minor Changes
48
-
49
- - Added: splat routes.
50
-
51
- ## 0.2.0
52
-
53
- ### Minor Changes
54
-
55
- - Added: @websolutespa/bom-core.
56
-
57
- ## 0.1.1
58
-
59
- ### Patch Changes
60
-
61
- - Modified: store service.
62
-
63
- ## 0.1.0
64
-
65
- ### Minor Changes
66
-
67
- - mock refactor.
68
-
69
- ## 0.0.2
70
-
71
- ### Patch Changes
72
-
73
- - Added: first release.
1
+ # @websolutespa/bom-mixer-store
2
+
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixing: MockMenuService collectPages.
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Updating: next 13.
14
+
15
+ ## 1.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Fixing: check redirects by pattern.
20
+
21
+ ## 1.1.0
22
+
23
+ ### Minor Changes
24
+
25
+ - Modified: store refactor.
26
+
27
+ ## 1.0.1
28
+
29
+ ### Patch Changes
30
+
31
+ - Fixing: localhost url.
32
+
33
+ ## 1.0.0
34
+
35
+ ### Minor Changes
36
+
37
+ - Modified routes, added redirects.
38
+
39
+ ## 0.3.2
40
+
41
+ ### Patch Changes
42
+
43
+ - Modified: MockMenuService.
44
+
45
+ ## 0.3.1
46
+
47
+ ### Patch Changes
48
+
49
+ - Added: source files.
50
+
51
+ ## 0.3.0
52
+
53
+ ### Minor Changes
54
+
55
+ - Added: splat routes.
56
+
57
+ ## 0.2.0
58
+
59
+ ### Minor Changes
60
+
61
+ - Added: @websolutespa/bom-core.
62
+
63
+ ## 0.1.1
64
+
65
+ ### Patch Changes
66
+
67
+ - Modified: store service.
68
+
69
+ ## 0.1.0
70
+
71
+ ### Minor Changes
72
+
73
+ - mock refactor.
74
+
75
+ ## 0.0.2
76
+
77
+ ### Patch Changes
78
+
79
+ - Added: first release.
package/dist/index.js CHANGED
@@ -695,7 +695,7 @@ async function collectPages(store, items, params = {}) {
695
695
  }
696
696
  for (const item of items) {
697
697
  if (item.type === "page" && typeof item.page.value === "number" && store[item.page.relationTo] !== void 0) {
698
- const value = await store[item.page.relationTo].findOne(item.page.value, params);
698
+ const value = await store[item.page.relationTo].findOne(item.page.value, { ...params });
699
699
  if (value) {
700
700
  item.page.value = value;
701
701
  }
package/dist/index.mjs CHANGED
@@ -616,7 +616,7 @@ async function collectPages(store, items, params = {}) {
616
616
  }
617
617
  for (const item of items) {
618
618
  if (item.type === "page" && typeof item.page.value === "number" && store[item.page.relationTo] !== void 0) {
619
- const value = await store[item.page.relationTo].findOne(item.page.value, params);
619
+ const value = await store[item.page.relationTo].findOne(item.page.value, { ...params });
620
620
  if (value) {
621
621
  item.page.value = value;
622
622
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -59,7 +59,9 @@ async function collectPages(store: IStore, items?: IUndecoratedMenuItem[], param
59
59
  typeof item.page.value === 'number' &&
60
60
  store[item.page.relationTo] !== undefined
61
61
  ) {
62
- const value = await store[item.page.relationTo].findOne<ICategorized>(item.page.value, params);
62
+ // console.log('collectPages', item.page.relationTo, item.page.value);
63
+ // !!! cloned params due to recursion
64
+ const value = await store[item.page.relationTo].findOne<ICategorized>(item.page.value, { ...params });
63
65
  if (value) {
64
66
  item.page.value = value;
65
67
  }
@@ -88,9 +90,9 @@ export async function decorateMenu(store: IStore, item: IUndecoratedMenu, market
88
90
  },
89
91
  locale: {
90
92
  equals: locale,
91
- }
93
+ },
92
94
  },
93
- market, locale
95
+ market, locale,
94
96
  });
95
97
  await collectPages(store, items, { market, locale });
96
98
  decoratedItem.items = items.filter(x => hasMarket(x, market)).map(x => decorateMenuItem(x, categories, routes, market));
@@ -106,7 +108,7 @@ export function decorateMenuCategory(
106
108
  categories: ICategory[],
107
109
  routes: IRoute[],
108
110
  market: string,
109
- depth: number = 0,
111
+ depth: number = 0
110
112
  ): IMenuItem {
111
113
  const decoratedItem: IMenuCategory = {
112
114
  abstract: item.abstract,
@@ -174,7 +176,7 @@ export function decorateMenuCategory(
174
176
  }
175
177
 
176
178
  export function decorateMenuRoute(
177
- item: IRoute,
179
+ item: IRoute
178
180
  ): IMenuItem {
179
181
  const decoratedItem: IMenuRoute = {
180
182
  id: item.page,
@@ -192,7 +194,7 @@ export function decorateMenuGroup(
192
194
  item: IUndecoratedMenuGroup,
193
195
  categories: ICategory[],
194
196
  routes: IRoute[],
195
- market: string,
197
+ market: string
196
198
  ): IMenuItem {
197
199
  const items = item.items || [];
198
200
  const decoratedItem: IMenuGroup = {
@@ -210,7 +212,7 @@ export function decorateMenuLink(
210
212
  item: IUndecoratedMenuLink,
211
213
  categories: ICategory[],
212
214
  routes: IRoute[],
213
- market: string,
215
+ market: string
214
216
  ): IMenuItem {
215
217
  const items = item.items || [];
216
218
  const decoratedItem: IMenuLink = {
@@ -230,7 +232,7 @@ export function decorateMenuPage(
230
232
  item: IUndecoratedMenuPage,
231
233
  categories: ICategory[],
232
234
  routes: IRoute[],
233
- market: string,
235
+ market: string
234
236
  ): IMenuItem {
235
237
  const items = item.items || [];
236
238
  const route = routes.find(x => x.schema === item.page.relationTo && x.page === item.page.value.id);
@@ -254,7 +256,7 @@ export function decorateMenuItem(
254
256
  categories: ICategory[],
255
257
  routes: IRoute[],
256
258
  market: string,
257
- depth: number = 0,
259
+ depth: number = 0
258
260
  ): IMenuItem {
259
261
  let decoratedItem: IMenuItem;
260
262
  switch (item.type) {