@websolutespa/bom-mixer-store 1.10.0 → 2.0.0

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,325 +1,339 @@
1
- # @websolutespa/bom-mixer-store
2
-
3
- ## 1.10.0
4
-
5
- ### Patch Changes
6
-
7
- - Modified: remote.service, Added: preview.handler
8
-
9
- ## 1.8.13
10
-
11
- ### Patch Changes
12
-
13
- - Fixing: decorators collectRelations\_ depth 0
14
-
15
- ## 1.8.12
16
-
17
- ### Patch Changes
18
-
19
- - Modified: menu category decorator
20
-
21
- ## 1.8.11
22
-
23
- ### Patch Changes
24
-
25
- - Modified: StoreHandler sorting api collections
26
-
27
- ## 1.8.10
28
-
29
- ### Patch Changes
30
-
31
- - f0d17f3: Modified: page market filtering
32
- - Updated dependencies [f0d17f3]
33
- - @websolutespa/bom-core@1.8.19
34
-
35
- ## 1.8.9
36
-
37
- ### Patch Changes
38
-
39
- - Modified: BuildStrategy.Runtime
40
-
41
- ## 1.8.8
42
-
43
- ### Patch Changes
44
-
45
- - Modified: request & response types
46
-
47
- ## 1.8.7
48
-
49
- ### Patch Changes
50
-
51
- - Modified: storeHandler
52
- - Updated dependencies
53
- - @websolutespa/bom-core@1.8.15
54
-
55
- ## 1.8.6
56
-
57
- ### Patch Changes
58
-
59
- - Modified: RemoteService
60
-
61
- ## 1.8.5
62
-
63
- ### Patch Changes
64
-
65
- - Modified: IQuerable
66
- - Updated dependencies
67
- - @websolutespa/bom-core@1.8.12
68
-
69
- ## 1.8.4
70
-
71
- ### Patch Changes
72
-
73
- - Modified: decorateCategory\_
74
- - Updated dependencies
75
- - @websolutespa/bom-core@1.8.11
76
-
77
- ## 1.8.3
78
-
79
- ### Patch Changes
80
-
81
- - Removed: optimizeMany\_
82
-
83
- ## 1.8.2
84
-
85
- ### Patch Changes
86
-
87
- - Modified: getRemoteStoreStaticBuild\_
88
-
89
- ## 1.8.1
90
-
91
- ### Patch Changes
92
-
93
- - 15ad595: Modified: getRemoteApiRequestOptions added user Bearer
94
-
95
- ## 1.8.0
96
-
97
- ### Minor Changes
98
-
99
- - f8a1d97: Modified: extracted all website sample components & features
100
-
101
- ### Patch Changes
102
-
103
- - Updated dependencies [f8a1d97]
104
- - @websolutespa/bom-core@1.8.0
105
-
106
- ## 1.7.9
107
-
108
- ### Patch Changes
109
-
110
- - Added: MenuCategory strategy
111
- - Updated dependencies
112
- - @websolutespa/bom-core@1.7.16
113
-
114
- ## 1.7.8
115
-
116
- ### Patch Changes
117
-
118
- - Modified: RouteService, MenuService to handle isHidden Category segments
119
- - Updated dependencies
120
- - @websolutespa/bom-core@1.7.12
121
-
122
- ## 1.7.7
123
-
124
- ### Patch Changes
125
-
126
- - Added: getRemoteApiRequestOptions, getLocalApiRequestOptions
127
-
128
- ## 1.7.6
129
-
130
- ### Patch Changes
131
-
132
- - 1b93080: Modified: default authorization api-key
133
-
134
- ## 1.7.5
135
-
136
- ### Patch Changes
137
-
138
- - Fixing: downgrading eslint to v8.56.0
139
- - Updated dependencies
140
- - @websolutespa/bom-core@1.7.8
141
-
142
- ## 1.7.4
143
-
144
- ### Patch Changes
145
-
146
- - Added: varsHandler
147
- - Updated dependencies
148
- - @websolutespa/bom-core@1.7.7
149
-
150
- ## 1.7.3
151
-
152
- ### Patch Changes
153
-
154
- - Updating: dependencies
155
- - Updated dependencies
156
- - @websolutespa/bom-core@1.7.3
157
-
158
- ## 1.7.2
159
-
160
- ### Patch Changes
161
-
162
- - 7898849: Modified: exporting getRemoteApiUrl
163
-
164
- ## 1.7.1
165
-
166
- ### Patch Changes
167
-
168
- - Fixing: findRoute redirects
169
-
170
- ## 1.7.0
171
-
172
- ### Minor Changes
173
-
174
- - 28e86bd: Modified: IPage, Store services & decorators
175
- - Updated dependencies [28e86bd]
176
- - @websolutespa/bom-core@1.7.0
177
-
178
- ## 1.6.0
179
-
180
- ### Patch Changes
181
-
182
- - f664993: Added: useLivePreview
183
- - Updated dependencies [6cbf4cb]
184
- - @websolutespa/bom-core@0.6.7
185
-
186
- ## 1.4.6
187
-
188
- ### Patch Changes
189
-
190
- - Fixing: CachedService findMany DecoratedApi
191
-
192
- ## 1.4.5
193
-
194
- ### Patch Changes
195
-
196
- - Fixing: decorateSchema
197
-
198
- ## 1.4.4
199
-
200
- ### Patch Changes
201
-
202
- - Added: Schema decorator
203
- - Modified: RemoteMenuService, RemotePageService, RemoteService
204
- - Updated dependencies
205
- - @websolutespa/bom-core@0.6.5
206
-
207
- ## 1.4.3
208
-
209
- ### Patch Changes
210
-
211
- - Modified: CachedService, Decorators, LocalApi, MockApi, MockStore, RemoteApi, RemoteStore, StoreHandler
212
-
213
- ## 1.4.2
214
-
215
- ### Patch Changes
216
-
217
- - Added: Decorators, CachedService, RemotePageService, RemoteMenuService, StoreStrategy.DecoratedApi, nextPhase, storeCacheDuration
218
- - Modified: RemoteStore
219
- - Updated dependencies
220
- - @websolutespa/bom-core@0.6.4
221
-
222
- ## 1.4.1
223
-
224
- ### Patch Changes
225
-
226
- - Modified: MockPageService
227
- - Updated dependencies
228
- - @websolutespa/bom-core@0.6.3
229
-
230
- ## 1.4.0
231
-
232
- ### Minor Changes
233
-
234
- - Added: BuildStrategy
235
-
236
- ## 1.3.0
237
-
238
- ### Minor Changes
239
-
240
- - Added: storeIndexHandler
241
- - Modified: Store, StoreHandler, RemoteService, MockService, MockPageService, MockMenuService, StaticService
242
-
243
- ## 1.2.2
244
-
245
- ### Patch Changes
246
-
247
- - Modified: MockMenuService IPageRelationResult
248
-
249
- ## 1.2.1
250
-
251
- ### Patch Changes
252
-
253
- - Fixing: MockMenuService collectPages
254
-
255
- ## 1.2.0
256
-
257
- ### Minor Changes
258
-
259
- - Updating: next 13
260
-
261
- ## 1.1.1
262
-
263
- ### Patch Changes
264
-
265
- - Fixing: check redirects by pattern
266
-
267
- ## 1.1.0
268
-
269
- ### Minor Changes
270
-
271
- - Modified: store refactor
272
-
273
- ## 1.0.1
274
-
275
- ### Patch Changes
276
-
277
- - Fixing: localhost url
278
-
279
- ## 1.0.0
280
-
281
- ### Minor Changes
282
-
283
- - Modified routes, added redirects
284
-
285
- ## 0.3.2
286
-
287
- ### Patch Changes
288
-
289
- - Modified: MockMenuService
290
-
291
- ## 0.3.1
292
-
293
- ### Patch Changes
294
-
295
- - Added: source files
296
-
297
- ## 0.3.0
298
-
299
- ### Minor Changes
300
-
301
- - Added: splat routes
302
-
303
- ## 0.2.0
304
-
305
- ### Minor Changes
306
-
307
- - Added: @websolutespa/bom-core
308
-
309
- ## 0.1.1
310
-
311
- ### Patch Changes
312
-
313
- - Modified: store service
314
-
315
- ## 0.1.0
316
-
317
- ### Minor Changes
318
-
319
- - mock refactor
320
-
321
- ## 0.0.2
322
-
323
- ### Patch Changes
324
-
325
- - Added: first release
1
+ # @websolutespa/bom-mixer-store
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Release: Bom 2.0
8
+
9
+ ## 1.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: IApp global
14
+ - Updated dependencies
15
+ - @websolutespa/bom-core@1.8.24
16
+
17
+ ## 1.10.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Modified: remote.service, Added: preview.handler
22
+
23
+ ## 1.8.13
24
+
25
+ ### Patch Changes
26
+
27
+ - Fixing: decorators collectRelations\_ depth 0
28
+
29
+ ## 1.8.12
30
+
31
+ ### Patch Changes
32
+
33
+ - Modified: menu category decorator
34
+
35
+ ## 1.8.11
36
+
37
+ ### Patch Changes
38
+
39
+ - Modified: StoreHandler sorting api collections
40
+
41
+ ## 1.8.10
42
+
43
+ ### Patch Changes
44
+
45
+ - f0d17f3: Modified: page market filtering
46
+ - Updated dependencies [f0d17f3]
47
+ - @websolutespa/bom-core@1.8.19
48
+
49
+ ## 1.8.9
50
+
51
+ ### Patch Changes
52
+
53
+ - Modified: BuildStrategy.Runtime
54
+
55
+ ## 1.8.8
56
+
57
+ ### Patch Changes
58
+
59
+ - Modified: request & response types
60
+
61
+ ## 1.8.7
62
+
63
+ ### Patch Changes
64
+
65
+ - Modified: storeHandler
66
+ - Updated dependencies
67
+ - @websolutespa/bom-core@1.8.15
68
+
69
+ ## 1.8.6
70
+
71
+ ### Patch Changes
72
+
73
+ - Modified: RemoteService
74
+
75
+ ## 1.8.5
76
+
77
+ ### Patch Changes
78
+
79
+ - Modified: IQuerable
80
+ - Updated dependencies
81
+ - @websolutespa/bom-core@1.8.12
82
+
83
+ ## 1.8.4
84
+
85
+ ### Patch Changes
86
+
87
+ - Modified: decorateCategory\_
88
+ - Updated dependencies
89
+ - @websolutespa/bom-core@1.8.11
90
+
91
+ ## 1.8.3
92
+
93
+ ### Patch Changes
94
+
95
+ - Removed: optimizeMany\_
96
+
97
+ ## 1.8.2
98
+
99
+ ### Patch Changes
100
+
101
+ - Modified: getRemoteStoreStaticBuild\_
102
+
103
+ ## 1.8.1
104
+
105
+ ### Patch Changes
106
+
107
+ - 15ad595: Modified: getRemoteApiRequestOptions added user Bearer
108
+
109
+ ## 1.8.0
110
+
111
+ ### Minor Changes
112
+
113
+ - f8a1d97: Modified: extracted all website sample components & features
114
+
115
+ ### Patch Changes
116
+
117
+ - Updated dependencies [f8a1d97]
118
+ - @websolutespa/bom-core@1.8.0
119
+
120
+ ## 1.7.9
121
+
122
+ ### Patch Changes
123
+
124
+ - Added: MenuCategory strategy
125
+ - Updated dependencies
126
+ - @websolutespa/bom-core@1.7.16
127
+
128
+ ## 1.7.8
129
+
130
+ ### Patch Changes
131
+
132
+ - Modified: RouteService, MenuService to handle isHidden Category segments
133
+ - Updated dependencies
134
+ - @websolutespa/bom-core@1.7.12
135
+
136
+ ## 1.7.7
137
+
138
+ ### Patch Changes
139
+
140
+ - Added: getRemoteApiRequestOptions, getLocalApiRequestOptions
141
+
142
+ ## 1.7.6
143
+
144
+ ### Patch Changes
145
+
146
+ - 1b93080: Modified: default authorization api-key
147
+
148
+ ## 1.7.5
149
+
150
+ ### Patch Changes
151
+
152
+ - Fixing: downgrading eslint to v8.56.0
153
+ - Updated dependencies
154
+ - @websolutespa/bom-core@1.7.8
155
+
156
+ ## 1.7.4
157
+
158
+ ### Patch Changes
159
+
160
+ - Added: varsHandler
161
+ - Updated dependencies
162
+ - @websolutespa/bom-core@1.7.7
163
+
164
+ ## 1.7.3
165
+
166
+ ### Patch Changes
167
+
168
+ - Updating: dependencies
169
+ - Updated dependencies
170
+ - @websolutespa/bom-core@1.7.3
171
+
172
+ ## 1.7.2
173
+
174
+ ### Patch Changes
175
+
176
+ - 7898849: Modified: exporting getRemoteApiUrl
177
+
178
+ ## 1.7.1
179
+
180
+ ### Patch Changes
181
+
182
+ - Fixing: findRoute redirects
183
+
184
+ ## 1.7.0
185
+
186
+ ### Minor Changes
187
+
188
+ - 28e86bd: Modified: IPage, Store services & decorators
189
+ - Updated dependencies [28e86bd]
190
+ - @websolutespa/bom-core@1.7.0
191
+
192
+ ## 1.6.0
193
+
194
+ ### Patch Changes
195
+
196
+ - f664993: Added: useLivePreview
197
+ - Updated dependencies [6cbf4cb]
198
+ - @websolutespa/bom-core@0.6.7
199
+
200
+ ## 1.4.6
201
+
202
+ ### Patch Changes
203
+
204
+ - Fixing: CachedService findMany DecoratedApi
205
+
206
+ ## 1.4.5
207
+
208
+ ### Patch Changes
209
+
210
+ - Fixing: decorateSchema
211
+
212
+ ## 1.4.4
213
+
214
+ ### Patch Changes
215
+
216
+ - Added: Schema decorator
217
+ - Modified: RemoteMenuService, RemotePageService, RemoteService
218
+ - Updated dependencies
219
+ - @websolutespa/bom-core@0.6.5
220
+
221
+ ## 1.4.3
222
+
223
+ ### Patch Changes
224
+
225
+ - Modified: CachedService, Decorators, LocalApi, MockApi, MockStore, RemoteApi, RemoteStore, StoreHandler
226
+
227
+ ## 1.4.2
228
+
229
+ ### Patch Changes
230
+
231
+ - Added: Decorators, CachedService, RemotePageService, RemoteMenuService, StoreStrategy.DecoratedApi, nextPhase, storeCacheDuration
232
+ - Modified: RemoteStore
233
+ - Updated dependencies
234
+ - @websolutespa/bom-core@0.6.4
235
+
236
+ ## 1.4.1
237
+
238
+ ### Patch Changes
239
+
240
+ - Modified: MockPageService
241
+ - Updated dependencies
242
+ - @websolutespa/bom-core@0.6.3
243
+
244
+ ## 1.4.0
245
+
246
+ ### Minor Changes
247
+
248
+ - Added: BuildStrategy
249
+
250
+ ## 1.3.0
251
+
252
+ ### Minor Changes
253
+
254
+ - Added: storeIndexHandler
255
+ - Modified: Store, StoreHandler, RemoteService, MockService, MockPageService, MockMenuService, StaticService
256
+
257
+ ## 1.2.2
258
+
259
+ ### Patch Changes
260
+
261
+ - Modified: MockMenuService IPageRelationResult
262
+
263
+ ## 1.2.1
264
+
265
+ ### Patch Changes
266
+
267
+ - Fixing: MockMenuService collectPages
268
+
269
+ ## 1.2.0
270
+
271
+ ### Minor Changes
272
+
273
+ - Updating: next 13
274
+
275
+ ## 1.1.1
276
+
277
+ ### Patch Changes
278
+
279
+ - Fixing: check redirects by pattern
280
+
281
+ ## 1.1.0
282
+
283
+ ### Minor Changes
284
+
285
+ - Modified: store refactor
286
+
287
+ ## 1.0.1
288
+
289
+ ### Patch Changes
290
+
291
+ - Fixing: localhost url
292
+
293
+ ## 1.0.0
294
+
295
+ ### Minor Changes
296
+
297
+ - Modified routes, added redirects
298
+
299
+ ## 0.3.2
300
+
301
+ ### Patch Changes
302
+
303
+ - Modified: MockMenuService
304
+
305
+ ## 0.3.1
306
+
307
+ ### Patch Changes
308
+
309
+ - Added: source files
310
+
311
+ ## 0.3.0
312
+
313
+ ### Minor Changes
314
+
315
+ - Added: splat routes
316
+
317
+ ## 0.2.0
318
+
319
+ ### Minor Changes
320
+
321
+ - Added: @websolutespa/bom-core
322
+
323
+ ## 0.1.1
324
+
325
+ ### Patch Changes
326
+
327
+ - Modified: store service
328
+
329
+ ## 0.1.0
330
+
331
+ ### Minor Changes
332
+
333
+ - mock refactor
334
+
335
+ ## 0.0.2
336
+
337
+ ### Patch Changes
338
+
339
+ - Added: first release
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FetchRequestOptions, IEquatable, ICategory, IStore, QueryParams, ICategorized, IRoute, ISchema, IUndecoratedMenu, IMenu, IEntity, JsonService, IMemoryStore, IQuerable, IPagedResult } from '@websolutespa/bom-core';
1
+ import { FetchRequestOptions, IEquatable, ICategory, IStore, QueryParams, ICategorized, IRoute, ISchema, IUndecoratedMenu, IMenu, IEntity, JsonService, IMemoryStore, IQuerable, GlobalQueryParams, IPagedResult } from '@websolutespa/bom-core';
2
2
  import { NextApiRequest, NextApiResponse } from 'next';
3
3
  import { NextRequest } from 'next/server';
4
4
 
@@ -141,6 +141,7 @@ declare class RemoteService<T extends IEntity = IEntity> implements IQuerable<T>
141
141
  key: string;
142
142
  store: IStore;
143
143
  constructor(key: string, store: IStore);
144
+ findGlobal<B extends T = T>(params?: GlobalQueryParams, token?: string): Promise<B | undefined>;
144
145
  findOne<B extends T = T>(id: IEquatable, params?: Omit<QueryParams, 'where'>, token?: string): Promise<B | undefined>;
145
146
  findMany<B extends T = T>(params?: QueryParams, token?: string): Promise<B[]>;
146
147
  findPaged<B extends T = T>(params?: QueryParams, token?: string): Promise<IPagedResult<B>>;
package/dist/index.js CHANGED
@@ -1178,6 +1178,7 @@ var ENV_COLLECTIONS = process.env.COLLECTIONS ? process.env.COLLECTIONS.split(",
1178
1178
  var MOCK_COLLECTIONS = process.env.MOCKS ? process.env.MOCKS.split(",") : [];
1179
1179
  var STATIC_COLLECTIONS = staticCollections.map((x) => x.slug);
1180
1180
  var KNOWN_COLLECTIONS = [
1181
+ "app",
1181
1182
  "category",
1182
1183
  "label",
1183
1184
  "locale",
@@ -1428,6 +1429,13 @@ var CachedService = class extends import_bom_core12.JsonService {
1428
1429
  data
1429
1430
  });
1430
1431
  }
1432
+ async findGlobal(params = {}) {
1433
+ const serializedParams = (0, import_bom_core12.qsSerialize)(params);
1434
+ const key = `findGlobal?${serializedParams}`;
1435
+ return await this.fromCache_(async () => {
1436
+ return await this.service_.findGlobal(params);
1437
+ }, key);
1438
+ }
1431
1439
  async findOne(id, params = {}) {
1432
1440
  const serializedParams = (0, import_bom_core12.qsSerialize)(params);
1433
1441
  const key = `findOne[${id}]?${serializedParams}`;
@@ -1539,6 +1547,21 @@ var RemoteService = class {
1539
1547
  this.key = key;
1540
1548
  this.store = store;
1541
1549
  }
1550
+ async findGlobal(params = {}, token) {
1551
+ params.richText = String(params.richText) === "true" ? true : false;
1552
+ const query = (0, import_bom_core14.qsSerialize)(params);
1553
+ const search = query ? `?${query}` : "";
1554
+ const url = `/globals/${this.key}${search}`;
1555
+ try {
1556
+ const item = await remoteApiGet(url, getRemoteApiRequestOptions(token));
1557
+ if (item) {
1558
+ return await this.decorateOne_(item, params);
1559
+ }
1560
+ } catch (error) {
1561
+ console.log("RemoteService", this.key, "findGlobal.error");
1562
+ }
1563
+ return;
1564
+ }
1542
1565
  async findOne(id, params = {}, token) {
1543
1566
  params.richText = String(params.richText) === "true" ? true : false;
1544
1567
  const query = (0, import_bom_core14.qsSerialize)(params);
@@ -2278,6 +2301,13 @@ async function getLabels(params = {}) {
2278
2301
  return items;
2279
2302
  }
2280
2303
 
2304
+ // ../models/src/app/app.service.ts
2305
+ async function getApp(params = {}) {
2306
+ const store = await getStore();
2307
+ const item = await store.app.findGlobal(params);
2308
+ return item;
2309
+ }
2310
+
2281
2311
  // ../models/src/locale/locale.service.ts
2282
2312
  async function getLocales(params = {}) {
2283
2313
  const store = await getStore();
@@ -2364,6 +2394,7 @@ async function getLayout(market, locale) {
2364
2394
  const markets = await getMarkets({ locale });
2365
2395
  const locales = await getLocales({ locale });
2366
2396
  const labels = await getLabels({ locale });
2397
+ const app = await getApp({ locale }) || {};
2367
2398
  const tree = await getRouteLinkTree(market, locale);
2368
2399
  const firstLevelRoutes = tree?.items || [];
2369
2400
  const flatTopLevelRoutes = tree ? [tree, ...firstLevelRoutes] : [];
@@ -2390,6 +2421,7 @@ async function getLayout(market, locale) {
2390
2421
  locales,
2391
2422
  market,
2392
2423
  markets,
2424
+ app,
2393
2425
  menu,
2394
2426
  topLevelHrefs,
2395
2427
  topLevelRoutes,
package/dist/index.mjs CHANGED
@@ -1073,6 +1073,7 @@ var ENV_COLLECTIONS = process.env.COLLECTIONS ? process.env.COLLECTIONS.split(",
1073
1073
  var MOCK_COLLECTIONS = process.env.MOCKS ? process.env.MOCKS.split(",") : [];
1074
1074
  var STATIC_COLLECTIONS = staticCollections.map((x) => x.slug);
1075
1075
  var KNOWN_COLLECTIONS = [
1076
+ "app",
1076
1077
  "category",
1077
1078
  "label",
1078
1079
  "locale",
@@ -1323,6 +1324,13 @@ var CachedService = class extends JsonService3 {
1323
1324
  data
1324
1325
  });
1325
1326
  }
1327
+ async findGlobal(params = {}) {
1328
+ const serializedParams = qsSerialize(params);
1329
+ const key = `findGlobal?${serializedParams}`;
1330
+ return await this.fromCache_(async () => {
1331
+ return await this.service_.findGlobal(params);
1332
+ }, key);
1333
+ }
1326
1334
  async findOne(id, params = {}) {
1327
1335
  const serializedParams = qsSerialize(params);
1328
1336
  const key = `findOne[${id}]?${serializedParams}`;
@@ -1434,6 +1442,21 @@ var RemoteService = class {
1434
1442
  this.key = key;
1435
1443
  this.store = store;
1436
1444
  }
1445
+ async findGlobal(params = {}, token) {
1446
+ params.richText = String(params.richText) === "true" ? true : false;
1447
+ const query = qsSerialize2(params);
1448
+ const search = query ? `?${query}` : "";
1449
+ const url = `/globals/${this.key}${search}`;
1450
+ try {
1451
+ const item = await remoteApiGet(url, getRemoteApiRequestOptions(token));
1452
+ if (item) {
1453
+ return await this.decorateOne_(item, params);
1454
+ }
1455
+ } catch (error) {
1456
+ console.log("RemoteService", this.key, "findGlobal.error");
1457
+ }
1458
+ return;
1459
+ }
1437
1460
  async findOne(id, params = {}, token) {
1438
1461
  params.richText = String(params.richText) === "true" ? true : false;
1439
1462
  const query = qsSerialize2(params);
@@ -2173,6 +2196,13 @@ async function getLabels(params = {}) {
2173
2196
  return items;
2174
2197
  }
2175
2198
 
2199
+ // ../models/src/app/app.service.ts
2200
+ async function getApp(params = {}) {
2201
+ const store = await getStore();
2202
+ const item = await store.app.findGlobal(params);
2203
+ return item;
2204
+ }
2205
+
2176
2206
  // ../models/src/locale/locale.service.ts
2177
2207
  async function getLocales(params = {}) {
2178
2208
  const store = await getStore();
@@ -2259,6 +2289,7 @@ async function getLayout(market, locale) {
2259
2289
  const markets = await getMarkets({ locale });
2260
2290
  const locales = await getLocales({ locale });
2261
2291
  const labels = await getLabels({ locale });
2292
+ const app = await getApp({ locale }) || {};
2262
2293
  const tree = await getRouteLinkTree(market, locale);
2263
2294
  const firstLevelRoutes = tree?.items || [];
2264
2295
  const flatTopLevelRoutes = tree ? [tree, ...firstLevelRoutes] : [];
@@ -2285,6 +2316,7 @@ async function getLayout(market, locale) {
2285
2316
  locales,
2286
2317
  market,
2287
2318
  markets,
2319
+ app,
2288
2320
  menu,
2289
2321
  topLevelHrefs,
2290
2322
  topLevelRoutes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "1.10.0",
3
+ "version": "2.0.0",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -26,17 +26,17 @@
26
26
  "mime": "^3.0.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@websolutespa/bom-core": "*",
29
+ "@websolutespa/bom-core": "^2.0.0",
30
30
  "iron-session": ">= 8.0.3",
31
31
  "next": ">= 14.1.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/mime": "^3.0.1",
35
- "@websolutespa/bom-cli": "*",
36
- "@websolutespa/test": "*",
37
- "@websolutespa/tsconfig": "*",
35
+ "@websolutespa/bom-cli": "^2.0.0",
36
+ "@websolutespa/test": "^2.0.0",
37
+ "@websolutespa/tsconfig": "^2.0.0",
38
38
  "eslint": "^8.56.0",
39
- "eslint-config-websolute": "*",
39
+ "eslint-config-websolute": "^2.0.0",
40
40
  "npm-run-all": "^4.1.5",
41
41
  "ts-node": "^10.9.2",
42
42
  "tsup": "^6.7.0",
@@ -1,4 +1,4 @@
1
- import { IEntity, IEquatable, IPagedResult, IQuerable, JsonService, QueryParams, qsSerialize } from '@websolutespa/bom-core';
1
+ import { GlobalQueryParams, IEntity, IEquatable, IPagedResult, IQuerable, JsonService, QueryParams, qsSerialize } from '@websolutespa/bom-core';
2
2
  import { StoreStrategy, storeCacheDuration, storeStrategy } from '../store/store';
3
3
 
4
4
  export type ICacheResult<T extends IEntity = IEntity> = T | T[] | IPagedResult<T> | undefined;
@@ -60,6 +60,14 @@ export class CachedService<T extends IEntity = IEntity> extends JsonService<T> {
60
60
  });
61
61
  }
62
62
 
63
+ async findGlobal<B extends T = T>(params: GlobalQueryParams = {}): Promise<B | undefined> {
64
+ const serializedParams = qsSerialize(params);
65
+ const key = `findGlobal?${serializedParams}`;
66
+ return await this.fromCache_(async () => {
67
+ return await this.service_.findGlobal(params);
68
+ }, key) as B | undefined;
69
+ }
70
+
63
71
  async findOne<B extends T = T>(id: IEquatable, params: QueryParams = {}): Promise<B | undefined> {
64
72
  const serializedParams = qsSerialize(params);
65
73
  const key = `findOne[${id}]?${serializedParams}`;
@@ -1,4 +1,4 @@
1
- import { IEntity, IEquatable, IPagedResult, IQuerable, IStore, qsSerialize, QueryParams } from '@websolutespa/bom-core';
1
+ import { GlobalQueryParams, IEntity, IEquatable, IPagedResult, IQuerable, IStore, qsSerialize, QueryParams } from '@websolutespa/bom-core';
2
2
  import { getRemoteApiRequestOptions } from '../api/api';
3
3
  import { decorateSchema_, decorateSchemas_ } from '../decorators';
4
4
  import { remoteApiDelete, remoteApiGet, remoteApiPatch, remoteApiPost } from './remote.api';
@@ -22,6 +22,23 @@ export class RemoteService<T extends IEntity = IEntity> implements IQuerable<T>
22
22
  this.store = store;
23
23
  }
24
24
 
25
+ async findGlobal<B extends T = T>(params: GlobalQueryParams = {}, token?: string): Promise<B | undefined> {
26
+ params.richText = String(params.richText) === 'true' ? true : false;
27
+ const query = qsSerialize(params);
28
+ const search = query ? `?${query}` : '';
29
+ const url = `/globals/${this.key}${search}`;
30
+ // console.log('RemoteService', this.key, 'findGlobal', url);
31
+ try {
32
+ const item = await remoteApiGet<B>(url, getRemoteApiRequestOptions(token));
33
+ if (item) {
34
+ return await this.decorateOne_(item, params);
35
+ }
36
+ } catch (error) {
37
+ console.log('RemoteService', this.key, 'findGlobal.error');
38
+ }
39
+ return;
40
+ }
41
+
25
42
  async findOne<B extends T = T>(id: IEquatable, params: Omit<QueryParams, 'where'> = {}, token?: string): Promise<B | undefined> {
26
43
  params.richText = String(params.richText) === 'true' ? true : false;
27
44
  const query = qsSerialize(params);
@@ -69,6 +69,7 @@ const ENV_COLLECTIONS: string[] = process.env.COLLECTIONS ? process.env.COLLECTI
69
69
  export const MOCK_COLLECTIONS: string[] = process.env.MOCKS ? process.env.MOCKS.split(',') : [];
70
70
  export const STATIC_COLLECTIONS: string[] = staticCollections.map(x => x.slug);
71
71
  export const KNOWN_COLLECTIONS: string[] = [
72
+ 'app',
72
73
  'category',
73
74
  'label',
74
75
  'locale',