@websolutespa/bom-core 1.8.9 → 1.8.11

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,17 @@
1
1
  # @websolutespa/bom-core
2
2
 
3
+ ## 1.8.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: isUnresolvedCategory, isUndecoratedCategory
8
+
9
+ ## 1.8.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Modified: ILayout, IMenu
14
+
3
15
  ## 1.8.9
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -450,6 +450,7 @@ type IMenuCategory = IMenuBase & {
450
450
  type: 'category';
451
451
  href: string;
452
452
  category: IEquatable;
453
+ customTitle?: ILocalizable;
453
454
  };
454
455
  type IMenuGroup = IMenuBase & {
455
456
  type: 'group';
@@ -470,6 +471,7 @@ type IMenuPage = IMenuBase & {
470
471
  href: string;
471
472
  page: IEquatable;
472
473
  schema: string;
474
+ customTitle?: ILocalizable;
473
475
  };
474
476
  type IMenuCustom = Record<string, unknown> & {
475
477
  id: IEquatable;
@@ -487,6 +489,10 @@ type IMenu = {
487
489
  id: string;
488
490
  items: IMenuItem[];
489
491
  };
492
+ type ILocalizedMenu = {
493
+ id: string;
494
+ items: ILocalized<IMenuItem>[];
495
+ };
490
496
  /**
491
497
  * this is the original menu model from cms
492
498
  */
@@ -542,7 +548,7 @@ type ILayout = {
542
548
  locales: ILocale[];
543
549
  market: string;
544
550
  markets: IMarket[];
545
- menu: Record<string, ILocalized<IMenu>>;
551
+ menu: Record<string, ILocalizedMenu>;
546
552
  topLevelHrefs: Record<string, string>;
547
553
  topLevelRoutes: Record<string, IRouteLink>;
548
554
  tree?: IRouteLink;
@@ -1261,6 +1267,8 @@ declare function isUnresolvedRelation(item: unknown): item is IPageUnresolvedRel
1261
1267
  * @returns True if the item is a relation, false otherwise.
1262
1268
  */
1263
1269
  declare function isRelation(item: unknown): item is IPageRelation;
1270
+ declare function isUnresolvedCategory(category?: IEquatable | ICategory): category is IEquatable;
1271
+ declare function isUndecoratedCategory(category: unknown): category is Omit<ICategory, 'href'>;
1264
1272
  /**
1265
1273
  * Checks if the given item is an undecorated menu item.
1266
1274
  * @param item The item to check.
@@ -1305,4 +1313,4 @@ declare function asServerProps(props: any): any;
1305
1313
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
1306
1314
  declare function merge(target: any, source: any): any;
1307
1315
 
1308
- export { DeepPartial, Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IActionEmailData, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEmailConfig, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, IImageResize, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaImage, IMediaInfo, IMediaJson, IMediaPdf, IMediaType, IMediaVideo, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IOverrideReturnValue, IOverrideValue, IPackages, IPage, IPageItem, IPageRelation, IPageRelationResult, IPageUnresolvedRelation, IPagedResult, IPaginationResult, IPartial, IPreference, IPrettify, IQuerable, IRedirect, IRoute, IRouteCanonical, IRouteLink, IRouteParams, ISchema, ISerializedCollection, ISerializedStore, IServerSideContext, IServerSideSplatContext, IStaticContext, IStore, ITemplate, ITitledEntity, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNav, ImageStrategy, Json, JsonService, LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RequireAtLeastOne, RouteStrategy, SchemaType, ServerSidePropsContext, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, base64ToString, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, encryptImageToken, enumToList, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuCategory, isMenuGroup, isMenuHref, isMenuLink, isMenuPage, isMenuRoute, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, stringToBase64, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
1316
+ export { DeepPartial, Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IActionEmailData, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEmailConfig, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, IImageResize, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedMenu, ILocalizedString, IMarket, IMedia, IMediaImage, IMediaInfo, IMediaJson, IMediaPdf, IMediaType, IMediaVideo, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IOverrideReturnValue, IOverrideValue, IPackages, IPage, IPageItem, IPageRelation, IPageRelationResult, IPageUnresolvedRelation, IPagedResult, IPaginationResult, IPartial, IPreference, IPrettify, IQuerable, IRedirect, IRoute, IRouteCanonical, IRouteLink, IRouteParams, ISchema, ISerializedCollection, ISerializedStore, IServerSideContext, IServerSideSplatContext, IStaticContext, IStore, ITemplate, ITitledEntity, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNav, ImageStrategy, Json, JsonService, LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RequireAtLeastOne, RouteStrategy, SchemaType, ServerSidePropsContext, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, base64ToString, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, encryptImageToken, enumToList, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuCategory, isMenuGroup, isMenuHref, isMenuLink, isMenuPage, isMenuRoute, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedCategory, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedCategory, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, stringToBase64, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
package/dist/index.js CHANGED
@@ -113,10 +113,12 @@ __export(src_exports, {
113
113
  isReservedCollectionDescription: () => isReservedCollectionDescription,
114
114
  isStage: () => isStage,
115
115
  isString: () => isString,
116
+ isUndecoratedCategory: () => isUndecoratedCategory,
116
117
  isUndecoratedMenuCategory: () => isUndecoratedMenuCategory,
117
118
  isUndecoratedMenuItem: () => isUndecoratedMenuItem,
118
119
  isUndecoratedMenuPage: () => isUndecoratedMenuPage,
119
120
  isUndecoratedNav: () => isUndecoratedNav,
121
+ isUnresolvedCategory: () => isUnresolvedCategory,
120
122
  isUnresolvedRelation: () => isUnresolvedRelation,
121
123
  isValidCollectionDescription: () => isValidCollectionDescription,
122
124
  isValidString: () => isValidString,
@@ -190,6 +192,12 @@ function isUnresolvedRelation(item) {
190
192
  function isRelation(item) {
191
193
  return isObject(item) && isNotNullString(item.relationTo) && isEntity(item.value);
192
194
  }
195
+ function isUnresolvedCategory(category) {
196
+ return category ? typeof category === "string" : false;
197
+ }
198
+ function isUndecoratedCategory(category) {
199
+ return isObject(category) && !category.href;
200
+ }
193
201
  function isUndecoratedMenuItem(item) {
194
202
  return isObject(item) && (item.type === "category" && isEquatable(item.category) || item.type === "page" && isEquatable(item.page.value));
195
203
  }
@@ -1689,10 +1697,12 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
1689
1697
  isReservedCollectionDescription,
1690
1698
  isStage,
1691
1699
  isString,
1700
+ isUndecoratedCategory,
1692
1701
  isUndecoratedMenuCategory,
1693
1702
  isUndecoratedMenuItem,
1694
1703
  isUndecoratedMenuPage,
1695
1704
  isUndecoratedNav,
1705
+ isUnresolvedCategory,
1696
1706
  isUnresolvedRelation,
1697
1707
  isValidCollectionDescription,
1698
1708
  isValidString,
package/dist/index.mjs CHANGED
@@ -37,6 +37,12 @@ function isUnresolvedRelation(item) {
37
37
  function isRelation(item) {
38
38
  return isObject(item) && isNotNullString(item.relationTo) && isEntity(item.value);
39
39
  }
40
+ function isUnresolvedCategory(category) {
41
+ return category ? typeof category === "string" : false;
42
+ }
43
+ function isUndecoratedCategory(category) {
44
+ return isObject(category) && !category.href;
45
+ }
40
46
  function isUndecoratedMenuItem(item) {
41
47
  return isObject(item) && (item.type === "category" && isEquatable(item.category) || item.type === "page" && isEquatable(item.page.value));
42
48
  }
@@ -1535,10 +1541,12 @@ export {
1535
1541
  isReservedCollectionDescription,
1536
1542
  isStage,
1537
1543
  isString,
1544
+ isUndecoratedCategory,
1538
1545
  isUndecoratedMenuCategory,
1539
1546
  isUndecoratedMenuItem,
1540
1547
  isUndecoratedMenuPage,
1541
1548
  isUndecoratedNav,
1549
+ isUnresolvedCategory,
1542
1550
  isUnresolvedRelation,
1543
1551
  isValidCollectionDescription,
1544
1552
  isValidString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "1.8.9",
3
+ "version": "1.8.11",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",