@websolutespa/bom-mixer-models 1.10.2 → 1.10.3

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,14 @@
1
1
  # @websolutespa/bom-mixer-models
2
2
 
3
+ ## 1.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: IApp global
8
+ - Updated dependencies
9
+ - @websolutespa/bom-mixer-store@1.10.1
10
+ - @websolutespa/bom-core@1.8.24
11
+
3
12
  ## 1.10.2
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IOption, ILayout, IPage, IRouteParams, QueryParams, ICategory, IEquatable, ICategorized, IEntity, IPaginationResult, INamedEntity, ILabel, IComponent, PageProps, ILocale, IMarket, IMenu, ILocalized, IRoute, IRedirect, IRouteLink, IQuerable } from '@websolutespa/bom-core';
1
+ import { IOption, ILayout, IPage, IRouteParams, QueryParams, ICategory, IEquatable, ICategorized, IEntity, IPaginationResult, INamedEntity, ILabel, IAppExtended, IComponent, PageProps, ILocale, IMarket, IMenu, ILocalized, IRoute, IRedirect, IRouteLink, IQuerable, IApp } from '@websolutespa/bom-core';
2
2
  import { AppProps } from 'next/app';
3
3
  import { FC, ReactNode, ComponentType } from 'react';
4
4
  import { GetServerSideProps, Redirect, NextApiRequest, NextApiResponse } from 'next';
@@ -93,7 +93,7 @@ declare function getLabels(params?: QueryParams): Promise<ILabel[]>;
93
93
  declare function getLabel(id: IEquatable, params?: QueryParams): Promise<ILabel | undefined>;
94
94
  declare function resolveLabel(labels: ILabel[], id: string): string;
95
95
 
96
- declare function getLayout(market: string, locale: string): Promise<ILayout>;
96
+ declare function getLayout<T extends IAppExtended = IAppExtended>(market: string, locale: string): Promise<ILayout<T>>;
97
97
 
98
98
  type ILazyComponent = IComponent;
99
99
  type ILazyProps<T> = {
@@ -477,6 +477,7 @@ declare function getSiteMapXML(origin: string, marketId?: string, localeId?: str
477
477
  declare function getSiteMapXSL(localeId?: string): Promise<string>;
478
478
 
479
479
  type IModelStore = {
480
+ app: IQuerable<IApp>;
480
481
  category: IQuerable<ICategory>;
481
482
  label: IQuerable<ILabel>;
482
483
  locale: IQuerable<ILocale>;
package/dist/index.js CHANGED
@@ -252,15 +252,23 @@ function resolveLabel(labels, id) {
252
252
  return label && label.text ? label.text.toString() : id;
253
253
  }
254
254
 
255
- // src/locale/locale.service.ts
255
+ // src/app/app.service.ts
256
256
  var import_bom_mixer_store7 = require("@websolutespa/bom-mixer-store");
257
- async function getLocales(params = {}) {
257
+ async function getApp(params = {}) {
258
258
  const store = await (0, import_bom_mixer_store7.getStore)();
259
+ const item = await store.app.findGlobal(params);
260
+ return item;
261
+ }
262
+
263
+ // src/locale/locale.service.ts
264
+ var import_bom_mixer_store8 = require("@websolutespa/bom-mixer-store");
265
+ async function getLocales(params = {}) {
266
+ const store = await (0, import_bom_mixer_store8.getStore)();
259
267
  const items = await store.locale.findMany(params);
260
268
  return items;
261
269
  }
262
270
  async function getLocale(id, params = {}) {
263
- const store = await (0, import_bom_mixer_store7.getStore)();
271
+ const store = await (0, import_bom_mixer_store8.getStore)();
264
272
  const item = await store.locale.findOne(id, params);
265
273
  return item;
266
274
  }
@@ -269,46 +277,46 @@ function getLocaleFromProps(props) {
269
277
  }
270
278
 
271
279
  // src/market/market.service.ts
272
- var import_bom_mixer_store8 = require("@websolutespa/bom-mixer-store");
280
+ var import_bom_mixer_store9 = require("@websolutespa/bom-mixer-store");
273
281
  async function getMarkets(params = {}) {
274
- const store = await (0, import_bom_mixer_store8.getStore)();
282
+ const store = await (0, import_bom_mixer_store9.getStore)();
275
283
  const items = await store.market.findMany(params);
276
284
  return items;
277
285
  }
278
286
  async function getMarket(id, params = {}) {
279
- const store = await (0, import_bom_mixer_store8.getStore)();
287
+ const store = await (0, import_bom_mixer_store9.getStore)();
280
288
  const item = await store.market.findOne(id, params);
281
289
  return item;
282
290
  }
283
291
 
284
292
  // src/menu/menu.service.ts
285
- var import_bom_mixer_store9 = require("@websolutespa/bom-mixer-store");
293
+ var import_bom_mixer_store10 = require("@websolutespa/bom-mixer-store");
286
294
  async function getMenus(params = {}) {
287
- const store = await (0, import_bom_mixer_store9.getStore)();
295
+ const store = await (0, import_bom_mixer_store10.getStore)();
288
296
  const items = await store.menu.findMany(params);
289
297
  return items;
290
298
  }
291
299
  async function getMenu(id, params = {}) {
292
- const store = await (0, import_bom_mixer_store9.getStore)();
300
+ const store = await (0, import_bom_mixer_store10.getStore)();
293
301
  const item = await store.menu.findOne(id, params);
294
302
  return item;
295
303
  }
296
304
 
297
305
  // src/route/route.service.ts
298
306
  var import_bom_core3 = require("@websolutespa/bom-core");
299
- var import_bom_mixer_store10 = require("@websolutespa/bom-mixer-store");
307
+ var import_bom_mixer_store11 = require("@websolutespa/bom-mixer-store");
300
308
  async function getRoutes(params = {}) {
301
- const store = await (0, import_bom_mixer_store10.getStore)();
309
+ const store = await (0, import_bom_mixer_store11.getStore)();
302
310
  const routes = await store.route.findMany(params);
303
311
  return routes;
304
312
  }
305
313
  async function getRoute(id) {
306
- const store = await (0, import_bom_mixer_store10.getStore)();
314
+ const store = await (0, import_bom_mixer_store11.getStore)();
307
315
  const route = await store.route.findOne(id);
308
316
  return route;
309
317
  }
310
318
  async function getRoutesForSchemas(schemas, market, locale) {
311
- const store = await (0, import_bom_mixer_store10.getStore)();
319
+ const store = await (0, import_bom_mixer_store11.getStore)();
312
320
  const routes = await store.route.findMany({
313
321
  where: {
314
322
  schema: {
@@ -329,7 +337,7 @@ async function getRoutesForSchemas(schemas, market, locale) {
329
337
  return items;
330
338
  }
331
339
  async function getRoutesForTemplates(templates, market, locale) {
332
- const store = await (0, import_bom_mixer_store10.getStore)();
340
+ const store = await (0, import_bom_mixer_store11.getStore)();
333
341
  const routes = await store.route.findMany({
334
342
  where: {
335
343
  template: {
@@ -352,10 +360,10 @@ async function getRoutesForTemplates(templates, market, locale) {
352
360
  return items;
353
361
  }
354
362
  async function getStaticPathsForSchema(schema, template) {
355
- if (import_bom_mixer_store10.buildStrategy === import_bom_mixer_store10.BuildStrategy.Runtime) {
363
+ if (import_bom_mixer_store11.buildStrategy === import_bom_mixer_store11.BuildStrategy.Runtime) {
356
364
  return [];
357
365
  }
358
- const store = await (0, import_bom_mixer_store10.getStore)();
366
+ const store = await (0, import_bom_mixer_store11.getStore)();
359
367
  const routes = await store.route.findMany({
360
368
  where: template ? {
361
369
  and: [{
@@ -376,7 +384,7 @@ async function getStaticPathsForSchema(schema, template) {
376
384
  return routes.map((x) => ({ params: { id: x.page.toString(), market: x.market, locale: x.locale } }));
377
385
  }
378
386
  async function getStaticPathsForSchemaAndFallback(schema, fallback = "blocking", template) {
379
- if (import_bom_mixer_store10.buildStrategy === import_bom_mixer_store10.BuildStrategy.Runtime || fallback === "blocking" && import_bom_mixer_store10.storeStrategy !== import_bom_mixer_store10.StoreStrategy.Mock) {
387
+ if (import_bom_mixer_store11.buildStrategy === import_bom_mixer_store11.BuildStrategy.Runtime || fallback === "blocking" && import_bom_mixer_store11.storeStrategy !== import_bom_mixer_store11.StoreStrategy.Mock) {
380
388
  return { paths: [], fallback };
381
389
  }
382
390
  const paths = await getStaticPathsForSchema(schema, template);
@@ -418,7 +426,7 @@ async function getBreadcrumbFromSegments(segments, route) {
418
426
  return tree;
419
427
  }
420
428
  async function getRouteLinkTree(market, locale) {
421
- const store = await (0, import_bom_mixer_store10.getStore)();
429
+ const store = await (0, import_bom_mixer_store11.getStore)();
422
430
  const routes = await store.route.findMany({
423
431
  where: {
424
432
  market: {
@@ -497,6 +505,7 @@ async function getLayout(market, locale) {
497
505
  const markets = await getMarkets({ locale });
498
506
  const locales = await getLocales({ locale });
499
507
  const labels = await getLabels({ locale });
508
+ const app = await getApp({ locale }) || {};
500
509
  const tree = await getRouteLinkTree(market, locale);
501
510
  const firstLevelRoutes = tree?.items || [];
502
511
  const flatTopLevelRoutes = tree ? [tree, ...firstLevelRoutes] : [];
@@ -523,6 +532,7 @@ async function getLayout(market, locale) {
523
532
  locales,
524
533
  market,
525
534
  markets,
535
+ app,
526
536
  menu,
527
537
  topLevelHrefs,
528
538
  topLevelRoutes,
@@ -575,9 +585,9 @@ function getLink(category, layout) {
575
585
 
576
586
  // src/page/page.service.ts
577
587
  var import_bom_core4 = require("@websolutespa/bom-core");
578
- var import_bom_mixer_store11 = require("@websolutespa/bom-mixer-store");
588
+ var import_bom_mixer_store12 = require("@websolutespa/bom-mixer-store");
579
589
  async function findOnePage(schema, id, params) {
580
- const store = await (0, import_bom_mixer_store11.getStore)();
590
+ const store = await (0, import_bom_mixer_store12.getStore)();
581
591
  const collection = store[schema];
582
592
  if (!collection) {
583
593
  throw `PageService.findOnePage: Collection not found [${schema}]`;
@@ -591,7 +601,7 @@ async function findOnePage(schema, id, params) {
591
601
  }
592
602
  }
593
603
  async function findManyPages(schema, params) {
594
- const store = await (0, import_bom_mixer_store11.getStore)();
604
+ const store = await (0, import_bom_mixer_store12.getStore)();
595
605
  const collection = store[schema];
596
606
  if (!collection) {
597
607
  throw `PageService.findManyPages: Collection not found [${schema}]`;
@@ -649,7 +659,7 @@ async function NotFound(market, locale) {
649
659
  return;
650
660
  }
651
661
  async function getPageRoutes(schema, id) {
652
- const store = await (0, import_bom_mixer_store11.getStore)();
662
+ const store = await (0, import_bom_mixer_store12.getStore)();
653
663
  let routes = [];
654
664
  try {
655
665
  routes = await store.route.findMany({
@@ -671,7 +681,7 @@ async function getPageCategory(schema, page, market, locale) {
671
681
  if (!page) {
672
682
  return;
673
683
  }
674
- const store = await (0, import_bom_mixer_store11.getStore)();
684
+ const store = await (0, import_bom_mixer_store12.getStore)();
675
685
  const pages = await findManyPages(schema, {
676
686
  where: {
677
687
  category: {
@@ -759,19 +769,19 @@ function resolveHref(href) {
759
769
  }
760
770
 
761
771
  // src/redirect/redirect.service.ts
762
- var import_bom_mixer_store12 = require("@websolutespa/bom-mixer-store");
772
+ var import_bom_mixer_store13 = require("@websolutespa/bom-mixer-store");
763
773
  async function getRedirects(locale) {
764
- const store = await (0, import_bom_mixer_store12.getStore)();
774
+ const store = await (0, import_bom_mixer_store13.getStore)();
765
775
  const items = await store.redirect.findMany({ locale });
766
776
  return items;
767
777
  }
768
778
  async function getRedirect(id, params = {}) {
769
- const store = await (0, import_bom_mixer_store12.getStore)();
779
+ const store = await (0, import_bom_mixer_store13.getStore)();
770
780
  const item = await store.redirect.findOne(id, params);
771
781
  return item;
772
782
  }
773
783
  async function getRedirectsPagination(params = {}) {
774
- const store = await (0, import_bom_mixer_store12.getStore)();
784
+ const store = await (0, import_bom_mixer_store13.getStore)();
775
785
  const pagination = await store.redirect.findPaged(params);
776
786
  return pagination;
777
787
  }
@@ -785,9 +795,9 @@ function redirectTo(layout, key = "not_found") {
785
795
  }
786
796
 
787
797
  // src/route/route-revalidate.handler.ts
788
- var import_bom_mixer_store13 = require("@websolutespa/bom-mixer-store");
798
+ var import_bom_mixer_store14 = require("@websolutespa/bom-mixer-store");
789
799
  function routeRevalidateHandler() {
790
- return (0, import_bom_mixer_store13.apiHandler)({
800
+ return (0, import_bom_mixer_store14.apiHandler)({
791
801
  post: async (request, response) => {
792
802
  const authorization = request.headers.authorization;
793
803
  const bearer = authorization && authorization.replace("Bearer ", "");
@@ -819,7 +829,7 @@ function routeRevalidateHandler() {
819
829
 
820
830
  // src/route/route.interceptor.ts
821
831
  var import_bom_core5 = require("@websolutespa/bom-core");
822
- var import_bom_mixer_store14 = require("@websolutespa/bom-mixer-store");
832
+ var import_bom_mixer_store15 = require("@websolutespa/bom-mixer-store");
823
833
  var import_server = require("next/server");
824
834
  async function detectLocale(request, defaultLocale4) {
825
835
  const acceptLanguage = request.headers.get("accept-language")?.split(",")[0];
@@ -855,19 +865,19 @@ async function detectCountry(request, defaultMarket4) {
855
865
  }
856
866
  async function getMarkets2() {
857
867
  let routes = [];
858
- if (import_bom_mixer_store14.storeStrategy === import_bom_mixer_store14.StoreStrategy.DecoratedApi) {
859
- routes = await (0, import_bom_mixer_store14.localApiGet)("/market");
868
+ if (import_bom_mixer_store15.storeStrategy === import_bom_mixer_store15.StoreStrategy.DecoratedApi) {
869
+ routes = await (0, import_bom_mixer_store15.localApiGet)("/market");
860
870
  } else {
861
- routes = await (0, import_bom_mixer_store14.storeApiGet)("/market");
871
+ routes = await (0, import_bom_mixer_store15.storeApiGet)("/market");
862
872
  }
863
873
  return routes;
864
874
  }
865
875
  async function getRootRoutes() {
866
876
  let routes = [];
867
- if (import_bom_mixer_store14.storeStrategy === import_bom_mixer_store14.StoreStrategy.DecoratedApi) {
868
- routes = await (0, import_bom_mixer_store14.localApiGet)("/route?where[isRoot][equals]=true");
877
+ if (import_bom_mixer_store15.storeStrategy === import_bom_mixer_store15.StoreStrategy.DecoratedApi) {
878
+ routes = await (0, import_bom_mixer_store15.localApiGet)("/route?where[isRoot][equals]=true");
869
879
  } else {
870
- routes = await (0, import_bom_mixer_store14.storeApiGet)("/route?where[isRoot][equals]=true");
880
+ routes = await (0, import_bom_mixer_store15.storeApiGet)("/route?where[isRoot][equals]=true");
871
881
  }
872
882
  return routes;
873
883
  }
@@ -929,10 +939,10 @@ async function routeInterceptor(request, next) {
929
939
  });
930
940
  return response2;
931
941
  }
932
- if (import_bom_mixer_store14.storeStrategy === import_bom_mixer_store14.StoreStrategy.DecoratedApi) {
933
- route = await (0, import_bom_mixer_store14.localApiPost)("/route", { pathname: url.pathname, href: url.href, hrefBeforeRedirect });
942
+ if (import_bom_mixer_store15.storeStrategy === import_bom_mixer_store15.StoreStrategy.DecoratedApi) {
943
+ route = await (0, import_bom_mixer_store15.localApiPost)("/route", { pathname: url.pathname, href: url.href, hrefBeforeRedirect });
934
944
  } else {
935
- route = await (0, import_bom_mixer_store14.storeApiPost)("/route", { pathname: url.pathname, href: url.href, hrefBeforeRedirect });
945
+ route = await (0, import_bom_mixer_store15.storeApiPost)("/route", { pathname: url.pathname, href: url.href, hrefBeforeRedirect });
936
946
  }
937
947
  if (!route) {
938
948
  console.log("routeInterceptor.route.notfound", url.pathname);
package/dist/index.mjs CHANGED
@@ -152,15 +152,23 @@ function resolveLabel(labels, id) {
152
152
  return label && label.text ? label.text.toString() : id;
153
153
  }
154
154
 
155
- // src/locale/locale.service.ts
155
+ // src/app/app.service.ts
156
156
  import { getStore as getStore7 } from "@websolutespa/bom-mixer-store";
157
- async function getLocales(params = {}) {
157
+ async function getApp(params = {}) {
158
158
  const store = await getStore7();
159
+ const item = await store.app.findGlobal(params);
160
+ return item;
161
+ }
162
+
163
+ // src/locale/locale.service.ts
164
+ import { getStore as getStore8 } from "@websolutespa/bom-mixer-store";
165
+ async function getLocales(params = {}) {
166
+ const store = await getStore8();
159
167
  const items = await store.locale.findMany(params);
160
168
  return items;
161
169
  }
162
170
  async function getLocale(id, params = {}) {
163
- const store = await getStore7();
171
+ const store = await getStore8();
164
172
  const item = await store.locale.findOne(id, params);
165
173
  return item;
166
174
  }
@@ -169,46 +177,46 @@ function getLocaleFromProps(props) {
169
177
  }
170
178
 
171
179
  // src/market/market.service.ts
172
- import { getStore as getStore8 } from "@websolutespa/bom-mixer-store";
180
+ import { getStore as getStore9 } from "@websolutespa/bom-mixer-store";
173
181
  async function getMarkets(params = {}) {
174
- const store = await getStore8();
182
+ const store = await getStore9();
175
183
  const items = await store.market.findMany(params);
176
184
  return items;
177
185
  }
178
186
  async function getMarket(id, params = {}) {
179
- const store = await getStore8();
187
+ const store = await getStore9();
180
188
  const item = await store.market.findOne(id, params);
181
189
  return item;
182
190
  }
183
191
 
184
192
  // src/menu/menu.service.ts
185
- import { getStore as getStore9 } from "@websolutespa/bom-mixer-store";
193
+ import { getStore as getStore10 } from "@websolutespa/bom-mixer-store";
186
194
  async function getMenus(params = {}) {
187
- const store = await getStore9();
195
+ const store = await getStore10();
188
196
  const items = await store.menu.findMany(params);
189
197
  return items;
190
198
  }
191
199
  async function getMenu(id, params = {}) {
192
- const store = await getStore9();
200
+ const store = await getStore10();
193
201
  const item = await store.menu.findOne(id, params);
194
202
  return item;
195
203
  }
196
204
 
197
205
  // src/route/route.service.ts
198
206
  import { asCategoryId, defaultLocale, defaultMarket, findRouteOfCategory, getRootCategory, localize } from "@websolutespa/bom-core";
199
- import { buildStrategy, BuildStrategy, getStore as getStore10, StoreStrategy, storeStrategy } from "@websolutespa/bom-mixer-store";
207
+ import { buildStrategy, BuildStrategy, getStore as getStore11, StoreStrategy, storeStrategy } from "@websolutespa/bom-mixer-store";
200
208
  async function getRoutes(params = {}) {
201
- const store = await getStore10();
209
+ const store = await getStore11();
202
210
  const routes = await store.route.findMany(params);
203
211
  return routes;
204
212
  }
205
213
  async function getRoute(id) {
206
- const store = await getStore10();
214
+ const store = await getStore11();
207
215
  const route = await store.route.findOne(id);
208
216
  return route;
209
217
  }
210
218
  async function getRoutesForSchemas(schemas, market, locale) {
211
- const store = await getStore10();
219
+ const store = await getStore11();
212
220
  const routes = await store.route.findMany({
213
221
  where: {
214
222
  schema: {
@@ -229,7 +237,7 @@ async function getRoutesForSchemas(schemas, market, locale) {
229
237
  return items;
230
238
  }
231
239
  async function getRoutesForTemplates(templates, market, locale) {
232
- const store = await getStore10();
240
+ const store = await getStore11();
233
241
  const routes = await store.route.findMany({
234
242
  where: {
235
243
  template: {
@@ -255,7 +263,7 @@ async function getStaticPathsForSchema(schema, template) {
255
263
  if (buildStrategy === BuildStrategy.Runtime) {
256
264
  return [];
257
265
  }
258
- const store = await getStore10();
266
+ const store = await getStore11();
259
267
  const routes = await store.route.findMany({
260
268
  where: template ? {
261
269
  and: [{
@@ -318,7 +326,7 @@ async function getBreadcrumbFromSegments(segments, route) {
318
326
  return tree;
319
327
  }
320
328
  async function getRouteLinkTree(market, locale) {
321
- const store = await getStore10();
329
+ const store = await getStore11();
322
330
  const routes = await store.route.findMany({
323
331
  where: {
324
332
  market: {
@@ -397,6 +405,7 @@ async function getLayout(market, locale) {
397
405
  const markets = await getMarkets({ locale });
398
406
  const locales = await getLocales({ locale });
399
407
  const labels = await getLabels({ locale });
408
+ const app = await getApp({ locale }) || {};
400
409
  const tree = await getRouteLinkTree(market, locale);
401
410
  const firstLevelRoutes = tree?.items || [];
402
411
  const flatTopLevelRoutes = tree ? [tree, ...firstLevelRoutes] : [];
@@ -423,6 +432,7 @@ async function getLayout(market, locale) {
423
432
  locales,
424
433
  market,
425
434
  markets,
435
+ app,
426
436
  menu,
427
437
  topLevelHrefs,
428
438
  topLevelRoutes,
@@ -475,9 +485,9 @@ function getLink(category, layout) {
475
485
 
476
486
  // src/page/page.service.ts
477
487
  import { asCategoryId as asCategoryId2, asServerProps, defaultLocale as defaultLocale2, defaultMarket as defaultMarket2 } from "@websolutespa/bom-core";
478
- import { getStore as getStore11 } from "@websolutespa/bom-mixer-store";
488
+ import { getStore as getStore12 } from "@websolutespa/bom-mixer-store";
479
489
  async function findOnePage(schema, id, params) {
480
- const store = await getStore11();
490
+ const store = await getStore12();
481
491
  const collection = store[schema];
482
492
  if (!collection) {
483
493
  throw `PageService.findOnePage: Collection not found [${schema}]`;
@@ -491,7 +501,7 @@ async function findOnePage(schema, id, params) {
491
501
  }
492
502
  }
493
503
  async function findManyPages(schema, params) {
494
- const store = await getStore11();
504
+ const store = await getStore12();
495
505
  const collection = store[schema];
496
506
  if (!collection) {
497
507
  throw `PageService.findManyPages: Collection not found [${schema}]`;
@@ -549,7 +559,7 @@ async function NotFound(market, locale) {
549
559
  return;
550
560
  }
551
561
  async function getPageRoutes(schema, id) {
552
- const store = await getStore11();
562
+ const store = await getStore12();
553
563
  let routes = [];
554
564
  try {
555
565
  routes = await store.route.findMany({
@@ -571,7 +581,7 @@ async function getPageCategory(schema, page, market, locale) {
571
581
  if (!page) {
572
582
  return;
573
583
  }
574
- const store = await getStore11();
584
+ const store = await getStore12();
575
585
  const pages = await findManyPages(schema, {
576
586
  where: {
577
587
  category: {
@@ -659,19 +669,19 @@ function resolveHref(href) {
659
669
  }
660
670
 
661
671
  // src/redirect/redirect.service.ts
662
- import { getStore as getStore12 } from "@websolutespa/bom-mixer-store";
672
+ import { getStore as getStore13 } from "@websolutespa/bom-mixer-store";
663
673
  async function getRedirects(locale) {
664
- const store = await getStore12();
674
+ const store = await getStore13();
665
675
  const items = await store.redirect.findMany({ locale });
666
676
  return items;
667
677
  }
668
678
  async function getRedirect(id, params = {}) {
669
- const store = await getStore12();
679
+ const store = await getStore13();
670
680
  const item = await store.redirect.findOne(id, params);
671
681
  return item;
672
682
  }
673
683
  async function getRedirectsPagination(params = {}) {
674
- const store = await getStore12();
684
+ const store = await getStore13();
675
685
  const pagination = await store.redirect.findPaged(params);
676
686
  return pagination;
677
687
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-models",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "description": "Mixer Models module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -0,0 +1,9 @@
1
+ import { IApp, IAppExtended, QueryParams } from '@websolutespa/bom-core';
2
+ import { getStore } from '@websolutespa/bom-mixer-store';
3
+ import { IModelStore } from '../store/store';
4
+
5
+ export async function getApp<T extends IAppExtended = IAppExtended>(params: QueryParams = {}): Promise<IApp<T> | undefined> {
6
+ const store = await getStore<IModelStore>();
7
+ const item = await store.app.findGlobal(params);
8
+ return item as IApp<T>;
9
+ }
@@ -1,17 +1,19 @@
1
- import { ILabel, ILayout, ILocale, ILocalizedMenu, IMarket, IRouteLink } from '@websolutespa/bom-core';
1
+ import { IApp, IAppExtended, ILabel, ILayout, ILocale, ILocalizedMenu, IMarket, IRouteLink } from '@websolutespa/bom-core';
2
+ import { getApp } from '../app/app.service';
2
3
  import { getLabels } from '../label/label.service';
3
4
  import { getLocales } from '../locale/locale.service';
4
5
  import { getMarkets } from '../market/market.service';
5
6
  import { getMenus } from '../menu/menu.service';
6
7
  import { getRouteLinkTree } from '../route/route.service';
7
8
 
8
- export async function getLayout(market: string, locale: string): Promise<ILayout> {
9
+ export async function getLayout<T extends IAppExtended = IAppExtended>(market: string, locale: string): Promise<ILayout<T>> {
9
10
  const markets: IMarket[] = await getMarkets({ locale });
10
11
  // console.log('markets', markets);
11
12
  const locales: ILocale[] = await getLocales({ locale });
12
13
  // console.log('locales', locales);
13
14
  const labels: ILabel[] = await getLabels({ locale });
14
15
  // console.log('labels', labels);
16
+ const app = (await getApp<T>({ locale }) || {}) as IApp<T>;
15
17
  const tree = await getRouteLinkTree(market, locale);
16
18
  // console.log('tree', tree);
17
19
  const firstLevelRoutes = tree?.items || [];
@@ -46,6 +48,7 @@ export async function getLayout(market: string, locale: string): Promise<ILayout
46
48
  locales,
47
49
  market,
48
50
  markets,
51
+ app,
49
52
  menu,
50
53
  topLevelHrefs,
51
54
  topLevelRoutes,
@@ -1,6 +1,7 @@
1
- import { ICategory, IEntity, ILabel, ILocale, IMarket, IMenu, INamedEntity, IQuerable, IRedirect, IRoute } from '@websolutespa/bom-core';
1
+ import { IApp, ICategory, IEntity, ILabel, ILocale, IMarket, IMenu, INamedEntity, IQuerable, IRedirect, IRoute } from '@websolutespa/bom-core';
2
2
 
3
3
  export type IModelStore = {
4
+ app: IQuerable<IApp>;
4
5
  category: IQuerable<ICategory>;
5
6
  label: IQuerable<ILabel>;
6
7
  locale: IQuerable<ILocale>;