@websolutespa/bom-core 1.8.22 → 1.8.23
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 +7 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +39 -28
- package/dist/index.mjs +39 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# @websolutespa/bom-core
|
|
2
2
|
|
|
3
|
+
## 1.8.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0c7f05f: Modified: IRoute isRoot noindex, routeService
|
|
8
|
+
|
|
3
9
|
## 1.8.22
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
- Fixing: JsonService
|
|
13
|
+
- Fixing: JsonService whereItem\_ unresolved relations
|
|
8
14
|
|
|
9
15
|
## 1.8.21
|
|
10
16
|
|
package/dist/index.d.ts
CHANGED
|
@@ -347,14 +347,16 @@ type IMarket = IEntity & {
|
|
|
347
347
|
|
|
348
348
|
type IRoute = {
|
|
349
349
|
category: IEquatable;
|
|
350
|
-
resolvedCategory: IEquatable;
|
|
351
350
|
id: string;
|
|
352
351
|
isDefault?: boolean;
|
|
352
|
+
isRoot?: boolean;
|
|
353
353
|
locale: string;
|
|
354
354
|
market: string;
|
|
355
355
|
media?: IMedia;
|
|
356
|
+
noindex?: boolean;
|
|
356
357
|
order?: number;
|
|
357
358
|
page: IEquatable;
|
|
359
|
+
resolvedCategory: IEquatable;
|
|
358
360
|
schema: string;
|
|
359
361
|
template?: string;
|
|
360
362
|
title: string;
|
|
@@ -1052,6 +1054,9 @@ declare function getOrigin(headers?: IncomingHttpHeaders | Headers): string;
|
|
|
1052
1054
|
|
|
1053
1055
|
/**
|
|
1054
1056
|
* Represents the route strategy options.
|
|
1057
|
+
* - **Auto** dynamically add/remove prefixes based on number of markets & languages.
|
|
1058
|
+
* - **Default** add prefixes based on !isDefault market or language flag.
|
|
1059
|
+
* - **Manual** add prefixes based on !isHidden market or language flag.
|
|
1055
1060
|
*/
|
|
1056
1061
|
declare enum RouteStrategy {
|
|
1057
1062
|
Auto = "auto",
|
package/dist/index.js
CHANGED
|
@@ -1681,22 +1681,7 @@ var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
|
|
|
1681
1681
|
RouteStrategy2["Manual"] = "manual";
|
|
1682
1682
|
return RouteStrategy2;
|
|
1683
1683
|
})(RouteStrategy || {});
|
|
1684
|
-
var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "
|
|
1685
|
-
function getPickedProps(item) {
|
|
1686
|
-
const pickedProps = Object.fromEntries(Object.entries(item).filter(([k, v]) => [
|
|
1687
|
-
"category",
|
|
1688
|
-
"isDefault",
|
|
1689
|
-
"media",
|
|
1690
|
-
"order",
|
|
1691
|
-
"template",
|
|
1692
|
-
"updatedAt",
|
|
1693
|
-
"useSplat",
|
|
1694
|
-
// 'createdAt',
|
|
1695
|
-
"updatedAt",
|
|
1696
|
-
"_status"
|
|
1697
|
-
].includes(k)));
|
|
1698
|
-
return pickedProps;
|
|
1699
|
-
}
|
|
1684
|
+
var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "manual" /* Manual */;
|
|
1700
1685
|
function collectRoutes(store, categories, markets, locales, medias) {
|
|
1701
1686
|
const routes = [];
|
|
1702
1687
|
if (locales.length > 0 && markets.length > 0) {
|
|
@@ -1710,31 +1695,57 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1710
1695
|
if (Boolean(item.isDefault) === false) {
|
|
1711
1696
|
slugs.push({ slug: item.slug });
|
|
1712
1697
|
}
|
|
1713
|
-
const defaultLocale2 = locales.find((x) => x.isDefault) || locales[0];
|
|
1714
|
-
const defaultMarket2 = markets.find((x) => x.isDefault) || markets[0];
|
|
1715
|
-
const defaultMarketLocale = defaultMarket2 && defaultMarket2.defaultLanguage ? asEntityId(defaultMarket2.defaultLanguage) : defaultLocale2.id;
|
|
1716
1698
|
const isRootCategory = rootCategory && item.category === rootCategory.id && item.isDefault;
|
|
1717
1699
|
eachMarketLocale(markets, locales, (market, locale, markets2, locales2) => {
|
|
1718
1700
|
if (hasMarket(item, market)) {
|
|
1719
1701
|
const title = localize(item.title, locale.id);
|
|
1720
1702
|
const id = getRouteHref(slugs, market, locale, markets2, locales2);
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1703
|
+
const {
|
|
1704
|
+
_status,
|
|
1705
|
+
category,
|
|
1706
|
+
isDefault,
|
|
1707
|
+
media,
|
|
1708
|
+
order,
|
|
1709
|
+
template,
|
|
1710
|
+
updatedAt,
|
|
1711
|
+
useSplat
|
|
1712
|
+
} = item;
|
|
1723
1713
|
const route = {
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
id: isDefaultRootCategory ?
|
|
1714
|
+
_status,
|
|
1715
|
+
category,
|
|
1716
|
+
// id: isDefaultRootCategory ? '/' : id,
|
|
1717
|
+
id,
|
|
1727
1718
|
locale: locale.id,
|
|
1728
1719
|
market: market.id,
|
|
1720
|
+
media,
|
|
1729
1721
|
page: item.id,
|
|
1722
|
+
resolvedCategory: visibleCategory.id,
|
|
1730
1723
|
schema: key,
|
|
1731
|
-
|
|
1724
|
+
template,
|
|
1725
|
+
title,
|
|
1726
|
+
updatedAt
|
|
1732
1727
|
};
|
|
1728
|
+
if (isDefault) {
|
|
1729
|
+
route.isDefault = true;
|
|
1730
|
+
}
|
|
1731
|
+
if (isRootCategory) {
|
|
1732
|
+
route.isRoot = true;
|
|
1733
|
+
}
|
|
1734
|
+
const noindex = (item.meta?.robots || "").includes("noindex");
|
|
1735
|
+
if (noindex) {
|
|
1736
|
+
route.noindex = true;
|
|
1737
|
+
}
|
|
1738
|
+
if (order != null) {
|
|
1739
|
+
route.order = order;
|
|
1740
|
+
}
|
|
1741
|
+
if (useSplat) {
|
|
1742
|
+
route.useSplat = true;
|
|
1743
|
+
}
|
|
1733
1744
|
const mediaId = typeof item.media === "string" ? item.media : void 0;
|
|
1734
1745
|
if (Array.isArray(medias) && mediaId) {
|
|
1735
|
-
const
|
|
1736
|
-
if (
|
|
1737
|
-
route.media =
|
|
1746
|
+
const media2 = item.media && medias.find((x) => x.id === mediaId);
|
|
1747
|
+
if (media2) {
|
|
1748
|
+
route.media = media2;
|
|
1738
1749
|
}
|
|
1739
1750
|
}
|
|
1740
1751
|
routes.push(route);
|
package/dist/index.mjs
CHANGED
|
@@ -1512,22 +1512,7 @@ var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
|
|
|
1512
1512
|
RouteStrategy2["Manual"] = "manual";
|
|
1513
1513
|
return RouteStrategy2;
|
|
1514
1514
|
})(RouteStrategy || {});
|
|
1515
|
-
var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "
|
|
1516
|
-
function getPickedProps(item) {
|
|
1517
|
-
const pickedProps = Object.fromEntries(Object.entries(item).filter(([k, v]) => [
|
|
1518
|
-
"category",
|
|
1519
|
-
"isDefault",
|
|
1520
|
-
"media",
|
|
1521
|
-
"order",
|
|
1522
|
-
"template",
|
|
1523
|
-
"updatedAt",
|
|
1524
|
-
"useSplat",
|
|
1525
|
-
// 'createdAt',
|
|
1526
|
-
"updatedAt",
|
|
1527
|
-
"_status"
|
|
1528
|
-
].includes(k)));
|
|
1529
|
-
return pickedProps;
|
|
1530
|
-
}
|
|
1515
|
+
var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "manual" /* Manual */;
|
|
1531
1516
|
function collectRoutes(store, categories, markets, locales, medias) {
|
|
1532
1517
|
const routes = [];
|
|
1533
1518
|
if (locales.length > 0 && markets.length > 0) {
|
|
@@ -1541,31 +1526,57 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1541
1526
|
if (Boolean(item.isDefault) === false) {
|
|
1542
1527
|
slugs.push({ slug: item.slug });
|
|
1543
1528
|
}
|
|
1544
|
-
const defaultLocale2 = locales.find((x) => x.isDefault) || locales[0];
|
|
1545
|
-
const defaultMarket2 = markets.find((x) => x.isDefault) || markets[0];
|
|
1546
|
-
const defaultMarketLocale = defaultMarket2 && defaultMarket2.defaultLanguage ? asEntityId(defaultMarket2.defaultLanguage) : defaultLocale2.id;
|
|
1547
1529
|
const isRootCategory = rootCategory && item.category === rootCategory.id && item.isDefault;
|
|
1548
1530
|
eachMarketLocale(markets, locales, (market, locale, markets2, locales2) => {
|
|
1549
1531
|
if (hasMarket(item, market)) {
|
|
1550
1532
|
const title = localize(item.title, locale.id);
|
|
1551
1533
|
const id = getRouteHref(slugs, market, locale, markets2, locales2);
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1534
|
+
const {
|
|
1535
|
+
_status,
|
|
1536
|
+
category,
|
|
1537
|
+
isDefault,
|
|
1538
|
+
media,
|
|
1539
|
+
order,
|
|
1540
|
+
template,
|
|
1541
|
+
updatedAt,
|
|
1542
|
+
useSplat
|
|
1543
|
+
} = item;
|
|
1554
1544
|
const route = {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
id: isDefaultRootCategory ?
|
|
1545
|
+
_status,
|
|
1546
|
+
category,
|
|
1547
|
+
// id: isDefaultRootCategory ? '/' : id,
|
|
1548
|
+
id,
|
|
1558
1549
|
locale: locale.id,
|
|
1559
1550
|
market: market.id,
|
|
1551
|
+
media,
|
|
1560
1552
|
page: item.id,
|
|
1553
|
+
resolvedCategory: visibleCategory.id,
|
|
1561
1554
|
schema: key,
|
|
1562
|
-
|
|
1555
|
+
template,
|
|
1556
|
+
title,
|
|
1557
|
+
updatedAt
|
|
1563
1558
|
};
|
|
1559
|
+
if (isDefault) {
|
|
1560
|
+
route.isDefault = true;
|
|
1561
|
+
}
|
|
1562
|
+
if (isRootCategory) {
|
|
1563
|
+
route.isRoot = true;
|
|
1564
|
+
}
|
|
1565
|
+
const noindex = (item.meta?.robots || "").includes("noindex");
|
|
1566
|
+
if (noindex) {
|
|
1567
|
+
route.noindex = true;
|
|
1568
|
+
}
|
|
1569
|
+
if (order != null) {
|
|
1570
|
+
route.order = order;
|
|
1571
|
+
}
|
|
1572
|
+
if (useSplat) {
|
|
1573
|
+
route.useSplat = true;
|
|
1574
|
+
}
|
|
1564
1575
|
const mediaId = typeof item.media === "string" ? item.media : void 0;
|
|
1565
1576
|
if (Array.isArray(medias) && mediaId) {
|
|
1566
|
-
const
|
|
1567
|
-
if (
|
|
1568
|
-
route.media =
|
|
1577
|
+
const media2 = item.media && medias.find((x) => x.id === mediaId);
|
|
1578
|
+
if (media2) {
|
|
1579
|
+
route.media = media2;
|
|
1569
1580
|
}
|
|
1570
1581
|
}
|
|
1571
1582
|
routes.push(route);
|