@websolutespa/bom-core 0.6.3 → 0.6.4

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,88 +1,95 @@
1
- # @websolutespa/bom-core
2
-
3
- ## 0.6.3
4
-
5
- ### Patch Changes
6
-
7
- - Added: isReservedCollectionDescription
8
-
9
- ## 0.6.2
10
-
11
- ### Patch Changes
12
-
13
- - Modified: IMedia.
14
-
15
- ## 0.6.1
16
-
17
- ### Patch Changes
18
-
19
- - Added: defaultMarket, defaultLocale
20
-
21
- ## 0.6.0
22
-
23
- ### Minor Changes
24
-
25
- - Added Logger, IPaginationResult.
26
-
27
- ## 0.5.0
28
-
29
- ### Minor Changes
30
-
31
- - Modified: JsonService, qs.
32
- - Added: asEquatable, cloneItem, typeGuards.
33
-
34
- ## 0.4.1
35
-
36
- ### Patch Changes
37
-
38
- - Added: IAnchor, babelCase.
39
- - Modified: IApplication, IPageRelation.
40
-
41
- ## 0.4.0
42
-
43
- ### Minor Changes
44
-
45
- - Updating: next 13.
46
-
47
- ## 0.3.0
48
-
49
- ### Minor Changes
50
-
51
- - Modified: HttpService.
52
-
53
- ## 0.2.1
54
-
55
- ### Patch Changes
56
-
57
- - Added: env ROOT_CATEGORY.
58
-
59
- ## 0.2.0
60
-
61
- ### Minor Changes
62
-
63
- - Modified routes, added redirects.
64
-
65
- ## 0.1.2
66
-
67
- ### Patch Changes
68
-
69
- - Modified: MockMenuService.
70
-
71
- ## 0.1.1
72
-
73
- ### Patch Changes
74
-
75
- - Modified: ILocalizable.
76
-
77
- ## 0.1.0
78
-
79
- ### Minor Changes
80
-
81
- - Added: splat routes.
82
- - Added: variants.
83
-
84
- ## 0.0.1
85
-
86
- ### Patch Changes
87
-
88
- - Added: first release.
1
+ # @websolutespa/bom-core
2
+
3
+ ## 0.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: typeGuards, IPagedResult.
8
+ - Modified: IUndecoratedMenuCustom.
9
+
10
+ ## 0.6.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Added: isReservedCollectionDescription.
15
+
16
+ ## 0.6.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Modified: IMedia.
21
+
22
+ ## 0.6.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Added: defaultMarket, defaultLocale.
27
+
28
+ ## 0.6.0
29
+
30
+ ### Minor Changes
31
+
32
+ - Added Logger, IPaginationResult.
33
+
34
+ ## 0.5.0
35
+
36
+ ### Minor Changes
37
+
38
+ - Modified: JsonService, qs.
39
+ - Added: asEquatable, cloneItem, typeGuards.
40
+
41
+ ## 0.4.1
42
+
43
+ ### Patch Changes
44
+
45
+ - Added: IAnchor, babelCase.
46
+ - Modified: IApplication, IPageRelation.
47
+
48
+ ## 0.4.0
49
+
50
+ ### Minor Changes
51
+
52
+ - Updating: next 13.
53
+
54
+ ## 0.3.0
55
+
56
+ ### Minor Changes
57
+
58
+ - Modified: HttpService.
59
+
60
+ ## 0.2.1
61
+
62
+ ### Patch Changes
63
+
64
+ - Added: env ROOT_CATEGORY.
65
+
66
+ ## 0.2.0
67
+
68
+ ### Minor Changes
69
+
70
+ - Modified routes, added redirects.
71
+
72
+ ## 0.1.2
73
+
74
+ ### Patch Changes
75
+
76
+ - Modified: MockMenuService.
77
+
78
+ ## 0.1.1
79
+
80
+ ### Patch Changes
81
+
82
+ - Modified: ILocalizable.
83
+
84
+ ## 0.1.0
85
+
86
+ ### Minor Changes
87
+
88
+ - Added: splat routes.
89
+ - Added: variants.
90
+
91
+ ## 0.0.1
92
+
93
+ ### Patch Changes
94
+
95
+ - Added: first release.
package/dist/index.d.ts CHANGED
@@ -324,8 +324,7 @@ type IUndecoratedMenuPage = Omit<IUndecoratedMenuBase, 'type'> & {
324
324
  page: IPageRelation;
325
325
  title?: ILocalizable;
326
326
  };
327
- type IUndecoratedMenuCustom = Record<string, unknown> & {
328
- id: IEquatable;
327
+ type IUndecoratedMenuCustom = Omit<IUndecoratedMenuBase, 'type'> & {
329
328
  type: 'custom';
330
329
  blockType: string;
331
330
  };
@@ -394,12 +393,13 @@ type QueryParams = {
394
393
  richText?: boolean;
395
394
  };
396
395
 
396
+ type IPagedResult<T extends IEntity = IEntity> = {
397
+ docs: T[];
398
+ } & Pagination;
397
399
  type IQuerable<T extends IEntity = IEntity> = {
398
400
  findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
399
401
  findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
400
- findPaged<B extends T = T>(params?: QueryParams): Promise<{
401
- docs: B[];
402
- } & Pagination>;
402
+ findPaged<B extends T = T>(params?: QueryParams): Promise<IPagedResult<B>>;
403
403
  create<B extends T = T>(payload: Omit<B, 'id'>): Promise<B>;
404
404
  update<B extends T = T>(payload: Partial<B>): Promise<B>;
405
405
  delete<B extends T = T>(id: IEquatable): Promise<B | undefined>;
@@ -500,9 +500,7 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
500
500
  getItems<B extends T = T>(): Promise<B[]>;
501
501
  findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
502
502
  findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
503
- findPaged<B extends T = T>(params?: QueryParams): Promise<{
504
- docs: B[];
505
- } & Pagination>;
503
+ findPaged<B extends T = T>(params?: QueryParams): Promise<IPagedResult<B>>;
506
504
  create<B extends T = T>(payload: Omit<B, 'id'>): Promise<B>;
507
505
  update<B extends T = T>(payload: Partial<B>): Promise<B>;
508
506
  delete<B extends T = T>(id: IEquatable): Promise<B | undefined>;
@@ -612,6 +610,7 @@ declare function isUnresolvedRelation(item: unknown): item is IPageUnresolvedRel
612
610
  declare function isRelation(item: unknown): item is IPageRelation;
613
611
  declare function isUndecoratedMenuItem(item: unknown): item is IUndecoratedMenuItem;
614
612
  declare function isUndecoratedNav<T>(item: unknown): item is IUndecoratedNav<T>;
613
+ declare function isUndecoratedMenuCategory(item: unknown): item is IUndecoratedMenuCategory;
615
614
  declare function isUndecoratedMenuPage(item: unknown): item is IUndecoratedMenuPage;
616
615
 
617
616
  declare function getIsDevelopment(): boolean;
@@ -626,4 +625,4 @@ declare function asServerProps(props: any): any;
626
625
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
627
626
  declare function merge(target: any, source: any): any;
628
627
 
629
- export { FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IContextBaseParams, IContextParams, IDecoratedNav, IEntity, IEquatable, ILabel, ILayout, ILocale, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IPackages, IPage, IPageRelation, IPageRelationResult, IPageResult, IPageUnresolvedRelation, IPaginationResult, IPartial, 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, Json, JsonService, LiteralUnion, Logger, LoggerLevel, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, cloneItem, collectRoutes, consoleWarn, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, enumToList, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getIsDevelopment, getIsProduction, getParentCategoriesById, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isCategory, isDevelopment, isEntity, isEquatable, isLocalizedString, isNotNullString, isObject, isProduction, isRelation, isReservedCollectionDescription, isStage, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, textToSlug, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, withSchema };
628
+ export { FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IContextBaseParams, IContextParams, IDecoratedNav, IEntity, IEquatable, ILabel, ILayout, ILocale, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IPackages, IPage, IPageRelation, IPageRelationResult, IPageResult, IPageUnresolvedRelation, IPagedResult, IPaginationResult, IPartial, 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, Json, JsonService, LiteralUnion, Logger, LoggerLevel, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, cloneItem, collectRoutes, consoleWarn, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, enumToList, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getIsDevelopment, getIsProduction, getParentCategoriesById, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isCategory, isDevelopment, isEntity, isEquatable, isLocalizedString, isNotNullString, isObject, isProduction, isRelation, isReservedCollectionDescription, isStage, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, textToSlug, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, withSchema };
package/dist/index.js CHANGED
@@ -77,6 +77,7 @@ __export(src_exports, {
77
77
  isRelation: () => isRelation,
78
78
  isReservedCollectionDescription: () => isReservedCollectionDescription,
79
79
  isStage: () => isStage,
80
+ isUndecoratedMenuCategory: () => isUndecoratedMenuCategory,
80
81
  isUndecoratedMenuItem: () => isUndecoratedMenuItem,
81
82
  isUndecoratedMenuPage: () => isUndecoratedMenuPage,
82
83
  isUndecoratedNav: () => isUndecoratedNav,
@@ -376,8 +377,11 @@ function isUndecoratedMenuItem(item) {
376
377
  function isUndecoratedNav(item) {
377
378
  return isObject(item) && isUndecoratedMenuPage(item.nav);
378
379
  }
380
+ function isUndecoratedMenuCategory(item) {
381
+ return isObject(item) && item.type === "category" && isNotNullString(item.category) && item.id === void 0 && item.href === void 0;
382
+ }
379
383
  function isUndecoratedMenuPage(item) {
380
- return isObject(item) && item.type === "page" && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
384
+ return isObject(item) && item.type === "page" && isObject(item.page) && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
381
385
  }
382
386
 
383
387
  // src/utils/cloneItem.ts
@@ -1140,6 +1144,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
1140
1144
  isRelation,
1141
1145
  isReservedCollectionDescription,
1142
1146
  isStage,
1147
+ isUndecoratedMenuCategory,
1143
1148
  isUndecoratedMenuItem,
1144
1149
  isUndecoratedMenuPage,
1145
1150
  isUndecoratedNav,
package/dist/index.mjs CHANGED
@@ -262,8 +262,11 @@ function isUndecoratedMenuItem(item) {
262
262
  function isUndecoratedNav(item) {
263
263
  return isObject(item) && isUndecoratedMenuPage(item.nav);
264
264
  }
265
+ function isUndecoratedMenuCategory(item) {
266
+ return isObject(item) && item.type === "category" && isNotNullString(item.category) && item.id === void 0 && item.href === void 0;
267
+ }
265
268
  function isUndecoratedMenuPage(item) {
266
- return isObject(item) && item.type === "page" && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
269
+ return isObject(item) && item.type === "page" && isObject(item.page) && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
267
270
  }
268
271
 
269
272
  // src/utils/cloneItem.ts
@@ -1025,6 +1028,7 @@ export {
1025
1028
  isRelation,
1026
1029
  isReservedCollectionDescription,
1027
1030
  isStage,
1031
+ isUndecoratedMenuCategory,
1028
1032
  isUndecoratedMenuItem,
1029
1033
  isUndecoratedMenuPage,
1030
1034
  isUndecoratedNav,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",