@websolutespa/bom-core 0.6.1 → 0.6.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 +88 -76
- package/dist/index.d.ts +10 -7
- package/dist/index.js +21 -0
- package/dist/index.mjs +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,76 +1,88 @@
|
|
|
1
|
-
# @websolutespa/bom-core
|
|
2
|
-
|
|
3
|
-
## 0.6.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
## 0.6.
|
|
10
|
-
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
## 0.
|
|
16
|
-
|
|
17
|
-
###
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- Modified:
|
|
40
|
-
|
|
41
|
-
## 0.
|
|
42
|
-
|
|
43
|
-
###
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
## 0.
|
|
48
|
-
|
|
49
|
-
### Minor Changes
|
|
50
|
-
|
|
51
|
-
- Modified
|
|
52
|
-
|
|
53
|
-
## 0.1
|
|
54
|
-
|
|
55
|
-
### Patch Changes
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
## 0.
|
|
60
|
-
|
|
61
|
-
###
|
|
62
|
-
|
|
63
|
-
- Modified
|
|
64
|
-
|
|
65
|
-
## 0.1.
|
|
66
|
-
|
|
67
|
-
###
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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.
|
package/dist/index.d.ts
CHANGED
|
@@ -84,16 +84,18 @@ type ITitledEntity = IEntity & {
|
|
|
84
84
|
|
|
85
85
|
type IMediaType = 'image' | 'video' | string;
|
|
86
86
|
type IMedia = {
|
|
87
|
-
src: string;
|
|
88
|
-
type: IMediaType;
|
|
89
|
-
alt?: string;
|
|
90
|
-
title?: string;
|
|
91
87
|
abstract?: string;
|
|
92
|
-
|
|
88
|
+
alt?: string;
|
|
93
89
|
height?: number;
|
|
94
|
-
url?: string;
|
|
95
90
|
media?: IMedia;
|
|
91
|
+
mimeType?: string;
|
|
92
|
+
src: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
type: IMediaType;
|
|
95
|
+
url?: string;
|
|
96
|
+
width?: number;
|
|
96
97
|
};
|
|
98
|
+
declare function resolveMediaType(media: IMedia): IMediaType;
|
|
97
99
|
|
|
98
100
|
type ICategory = IEntity & {
|
|
99
101
|
category?: IEquatable | ICategory;
|
|
@@ -477,6 +479,7 @@ declare function getClassNames(...props: Array<IClassName>): string;
|
|
|
477
479
|
declare function getCollectionDescription(text: string): ICollectionDescription;
|
|
478
480
|
declare function camelToSnakeCase(text: string): string;
|
|
479
481
|
declare function isValidCollectionDescription(description: ICollectionDescription): boolean;
|
|
482
|
+
declare function isReservedCollectionDescription(description: ICollectionDescription): boolean;
|
|
480
483
|
declare function toDisplayName(text: string): string;
|
|
481
484
|
declare function toPluralName(text: string): string;
|
|
482
485
|
declare function toTitleCase(text: string): string;
|
|
@@ -623,4 +626,4 @@ declare function asServerProps(props: any): any;
|
|
|
623
626
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
624
627
|
declare function merge(target: any, source: any): any;
|
|
625
628
|
|
|
626
|
-
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, isStage, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, textToSlug, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, withSchema };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ __export(src_exports, {
|
|
|
75
75
|
isObject: () => isObject,
|
|
76
76
|
isProduction: () => isProduction,
|
|
77
77
|
isRelation: () => isRelation,
|
|
78
|
+
isReservedCollectionDescription: () => isReservedCollectionDescription,
|
|
78
79
|
isStage: () => isStage,
|
|
79
80
|
isUndecoratedMenuItem: () => isUndecoratedMenuItem,
|
|
80
81
|
isUndecoratedMenuPage: () => isUndecoratedMenuPage,
|
|
@@ -94,6 +95,7 @@ __export(src_exports, {
|
|
|
94
95
|
qsDeserializeRaw: () => qsDeserializeRaw,
|
|
95
96
|
qsSerialize: () => qsSerialize,
|
|
96
97
|
qsSerializeRaw: () => qsSerializeRaw,
|
|
98
|
+
resolveMediaType: () => resolveMediaType,
|
|
97
99
|
textToSlug: () => textToSlug,
|
|
98
100
|
toCamelCase: () => toCamelCase,
|
|
99
101
|
toCharCase: () => toCharCase,
|
|
@@ -241,6 +243,18 @@ function camelToSnakeCase(text) {
|
|
|
241
243
|
function isValidCollectionDescription(description) {
|
|
242
244
|
return description.singularName !== description.pluralName;
|
|
243
245
|
}
|
|
246
|
+
function isReservedCollectionDescription(description) {
|
|
247
|
+
return [
|
|
248
|
+
"category",
|
|
249
|
+
"label",
|
|
250
|
+
"locale",
|
|
251
|
+
"market",
|
|
252
|
+
"menu",
|
|
253
|
+
"redirect",
|
|
254
|
+
"route",
|
|
255
|
+
"template"
|
|
256
|
+
].includes(description.singularName);
|
|
257
|
+
}
|
|
244
258
|
function toDisplayName(text) {
|
|
245
259
|
return toTitleCase(text).replace(/\s/g, "");
|
|
246
260
|
}
|
|
@@ -1054,6 +1068,11 @@ function textToSlug(title) {
|
|
|
1054
1068
|
return title.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/&/g, "-and-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
1055
1069
|
}
|
|
1056
1070
|
|
|
1071
|
+
// src/types/media.ts
|
|
1072
|
+
function resolveMediaType(media) {
|
|
1073
|
+
return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1057
1076
|
// src/types/querable.ts
|
|
1058
1077
|
function toFindParams(idOrParams) {
|
|
1059
1078
|
if (typeof idOrParams === "number" || typeof idOrParams === "string") {
|
|
@@ -1119,6 +1138,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
|
|
|
1119
1138
|
isObject,
|
|
1120
1139
|
isProduction,
|
|
1121
1140
|
isRelation,
|
|
1141
|
+
isReservedCollectionDescription,
|
|
1122
1142
|
isStage,
|
|
1123
1143
|
isUndecoratedMenuItem,
|
|
1124
1144
|
isUndecoratedMenuPage,
|
|
@@ -1138,6 +1158,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
|
|
|
1138
1158
|
qsDeserializeRaw,
|
|
1139
1159
|
qsSerialize,
|
|
1140
1160
|
qsSerializeRaw,
|
|
1161
|
+
resolveMediaType,
|
|
1141
1162
|
textToSlug,
|
|
1142
1163
|
toCamelCase,
|
|
1143
1164
|
toCharCase,
|
package/dist/index.mjs
CHANGED
|
@@ -129,6 +129,18 @@ function camelToSnakeCase(text) {
|
|
|
129
129
|
function isValidCollectionDescription(description) {
|
|
130
130
|
return description.singularName !== description.pluralName;
|
|
131
131
|
}
|
|
132
|
+
function isReservedCollectionDescription(description) {
|
|
133
|
+
return [
|
|
134
|
+
"category",
|
|
135
|
+
"label",
|
|
136
|
+
"locale",
|
|
137
|
+
"market",
|
|
138
|
+
"menu",
|
|
139
|
+
"redirect",
|
|
140
|
+
"route",
|
|
141
|
+
"template"
|
|
142
|
+
].includes(description.singularName);
|
|
143
|
+
}
|
|
132
144
|
function toDisplayName(text) {
|
|
133
145
|
return toTitleCase(text).replace(/\s/g, "");
|
|
134
146
|
}
|
|
@@ -942,6 +954,11 @@ function textToSlug(title) {
|
|
|
942
954
|
return title.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/&/g, "-and-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
943
955
|
}
|
|
944
956
|
|
|
957
|
+
// src/types/media.ts
|
|
958
|
+
function resolveMediaType(media) {
|
|
959
|
+
return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
|
|
960
|
+
}
|
|
961
|
+
|
|
945
962
|
// src/types/querable.ts
|
|
946
963
|
function toFindParams(idOrParams) {
|
|
947
964
|
if (typeof idOrParams === "number" || typeof idOrParams === "string") {
|
|
@@ -1006,6 +1023,7 @@ export {
|
|
|
1006
1023
|
isObject,
|
|
1007
1024
|
isProduction,
|
|
1008
1025
|
isRelation,
|
|
1026
|
+
isReservedCollectionDescription,
|
|
1009
1027
|
isStage,
|
|
1010
1028
|
isUndecoratedMenuItem,
|
|
1011
1029
|
isUndecoratedMenuPage,
|
|
@@ -1025,6 +1043,7 @@ export {
|
|
|
1025
1043
|
qsDeserializeRaw,
|
|
1026
1044
|
qsSerialize,
|
|
1027
1045
|
qsSerializeRaw,
|
|
1046
|
+
resolveMediaType,
|
|
1028
1047
|
textToSlug,
|
|
1029
1048
|
toCamelCase,
|
|
1030
1049
|
toCharCase,
|