@websolutespa/bom-core 0.6.1 → 0.6.2

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,76 +1,82 @@
1
- # @websolutespa/bom-core
2
-
3
- ## 0.6.1
4
-
5
- ### Patch Changes
6
-
7
- - dad63747: Added defaultMarket, defaultLocale
8
-
9
- ## 0.6.0
10
-
11
- ### Minor Changes
12
-
13
- - Added Logger, IPaginationResult.
14
-
15
- ## 0.5.0
16
-
17
- ### Minor Changes
18
-
19
- - Modified: JsonService, qs.
20
- - Added: asEquatable, cloneItem, typeGuards.
21
-
22
- ## 0.4.1
23
-
24
- ### Patch Changes
25
-
26
- - Added: IAnchor, babelCase.
27
- - Modified: IApplication, IPageRelation.
28
-
29
- ## 0.4.0
30
-
31
- ### Minor Changes
32
-
33
- - Updating: next 13.
34
-
35
- ## 0.3.0
36
-
37
- ### Minor Changes
38
-
39
- - Modified: HttpService.
40
-
41
- ## 0.2.1
42
-
43
- ### Patch Changes
44
-
45
- - Added: env ROOT_CATEGORY.
46
-
47
- ## 0.2.0
48
-
49
- ### Minor Changes
50
-
51
- - Modified routes, added redirects.
52
-
53
- ## 0.1.2
54
-
55
- ### Patch Changes
56
-
57
- - Modified: MockMenuService.
58
-
59
- ## 0.1.1
60
-
61
- ### Patch Changes
62
-
63
- - Modified: ILocalizable.
64
-
65
- ## 0.1.0
66
-
67
- ### Minor Changes
68
-
69
- - Added: splat routes.
70
- - Added: variants.
71
-
72
- ## 0.0.1
73
-
74
- ### Patch Changes
75
-
76
- - Added: first release.
1
+ # @websolutespa/bom-core
2
+
3
+ ## 0.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: IMedia.
8
+
9
+ ## 0.6.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: defaultMarket, defaultLocale
14
+
15
+ ## 0.6.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Added Logger, IPaginationResult.
20
+
21
+ ## 0.5.0
22
+
23
+ ### Minor Changes
24
+
25
+ - Modified: JsonService, qs.
26
+ - Added: asEquatable, cloneItem, typeGuards.
27
+
28
+ ## 0.4.1
29
+
30
+ ### Patch Changes
31
+
32
+ - Added: IAnchor, babelCase.
33
+ - Modified: IApplication, IPageRelation.
34
+
35
+ ## 0.4.0
36
+
37
+ ### Minor Changes
38
+
39
+ - Updating: next 13.
40
+
41
+ ## 0.3.0
42
+
43
+ ### Minor Changes
44
+
45
+ - Modified: HttpService.
46
+
47
+ ## 0.2.1
48
+
49
+ ### Patch Changes
50
+
51
+ - Added: env ROOT_CATEGORY.
52
+
53
+ ## 0.2.0
54
+
55
+ ### Minor Changes
56
+
57
+ - Modified routes, added redirects.
58
+
59
+ ## 0.1.2
60
+
61
+ ### Patch Changes
62
+
63
+ - Modified: MockMenuService.
64
+
65
+ ## 0.1.1
66
+
67
+ ### Patch Changes
68
+
69
+ - Modified: ILocalizable.
70
+
71
+ ## 0.1.0
72
+
73
+ ### Minor Changes
74
+
75
+ - Added: splat routes.
76
+ - Added: variants.
77
+
78
+ ## 0.0.1
79
+
80
+ ### Patch Changes
81
+
82
+ - 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
- width?: number;
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;
@@ -623,4 +625,4 @@ declare function asServerProps(props: any): any;
623
625
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
624
626
  declare function merge(target: any, source: any): any;
625
627
 
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 };
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, 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, resolveMediaType, textToSlug, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, withSchema };
package/dist/index.js CHANGED
@@ -94,6 +94,7 @@ __export(src_exports, {
94
94
  qsDeserializeRaw: () => qsDeserializeRaw,
95
95
  qsSerialize: () => qsSerialize,
96
96
  qsSerializeRaw: () => qsSerializeRaw,
97
+ resolveMediaType: () => resolveMediaType,
97
98
  textToSlug: () => textToSlug,
98
99
  toCamelCase: () => toCamelCase,
99
100
  toCharCase: () => toCharCase,
@@ -1054,6 +1055,11 @@ function textToSlug(title) {
1054
1055
  return title.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/&/g, "-and-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
1055
1056
  }
1056
1057
 
1058
+ // src/types/media.ts
1059
+ function resolveMediaType(media) {
1060
+ return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
1061
+ }
1062
+
1057
1063
  // src/types/querable.ts
1058
1064
  function toFindParams(idOrParams) {
1059
1065
  if (typeof idOrParams === "number" || typeof idOrParams === "string") {
@@ -1138,6 +1144,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
1138
1144
  qsDeserializeRaw,
1139
1145
  qsSerialize,
1140
1146
  qsSerializeRaw,
1147
+ resolveMediaType,
1141
1148
  textToSlug,
1142
1149
  toCamelCase,
1143
1150
  toCharCase,
package/dist/index.mjs CHANGED
@@ -942,6 +942,11 @@ function textToSlug(title) {
942
942
  return title.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/&/g, "-and-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
943
943
  }
944
944
 
945
+ // src/types/media.ts
946
+ function resolveMediaType(media) {
947
+ return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
948
+ }
949
+
945
950
  // src/types/querable.ts
946
951
  function toFindParams(idOrParams) {
947
952
  if (typeof idOrParams === "number" || typeof idOrParams === "string") {
@@ -1025,6 +1030,7 @@ export {
1025
1030
  qsDeserializeRaw,
1026
1031
  qsSerialize,
1027
1032
  qsSerializeRaw,
1033
+ resolveMediaType,
1028
1034
  textToSlug,
1029
1035
  toCamelCase,
1030
1036
  toCharCase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",