@websolutespa/bom-core 1.7.4 → 1.7.6

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.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: getProto
8
+
9
+ ## 1.7.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Modified: Logger
14
+
3
15
  ## 1.7.4
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -49,6 +49,9 @@ type StateValue = StateValue[] | {
49
49
  type IPartial<T> = {
50
50
  [P in keyof T]?: Partial<T[P]>;
51
51
  };
52
+ type DeepPartial<T> = T extends object ? {
53
+ [P in keyof T]?: DeepPartial<T[P]>;
54
+ } : T;
52
55
  type IPrettify<T> = {
53
56
  [K in keyof T]: T[K];
54
57
  } & {};
@@ -146,7 +149,8 @@ type IFeatureType = {
146
149
  };
147
150
 
148
151
  type IMediaType = 'image' | 'video' | string;
149
- type IMedia = {
152
+ type IMedia = Record<string, unknown> & {
153
+ id?: string;
150
154
  abstract?: string;
151
155
  alt?: string;
152
156
  media?: IMedia;
@@ -635,7 +639,8 @@ declare function qsDeserializeRaw(query?: string, deserializedParams?: {}): {};
635
639
  declare function isHeaders(headers?: IncomingHttpHeaders | Headers): headers is Headers;
636
640
  declare function isIncomingHttpHeaders(headers?: IncomingHttpHeaders | Headers): headers is IncomingHttpHeaders;
637
641
  declare function getHost(headers?: IncomingHttpHeaders | Headers): string | null;
638
- declare function getOrigin(headers?: IncomingHttpHeaders): string;
642
+ declare function getProto(headers?: IncomingHttpHeaders | Headers): string;
643
+ declare function getOrigin(headers?: IncomingHttpHeaders | Headers): string;
639
644
 
640
645
  declare function collectRoutes(store: IMemoryStore<ICategorized>, categories: ICategory[], markets: IMarket[], locales: ILocale[]): IRoute[];
641
646
  declare function eachMarketLocale(markets: IMarket[], locales: ILocale[], callback: (market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]) => void): void;
@@ -733,4 +738,4 @@ declare function asServerProps(props: any): any;
733
738
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
734
739
  declare function merge(target: any, source: any): any;
735
740
 
736
- export { Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IOverrideReturnValue, IOverrideValue, IPackages, IPage, 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, Json, JsonService, LiteralUnion, Logger, LoggerLevel, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, cloneItem, collectFeatureTypes, collectOptions, collectRoutes, consoleWarn, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, enumToList, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isCategory, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMenuHref, 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 };
741
+ export { DeepPartial, Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IOverrideReturnValue, IOverrideValue, IPackages, IPage, 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, Json, JsonService, LiteralUnion, Logger, LoggerLevel, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, cloneItem, collectFeatureTypes, collectOptions, collectRoutes, consoleWarn, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, enumToList, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getProto, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isCategory, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMenuHref, 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
@@ -61,6 +61,7 @@ __export(src_exports, {
61
61
  getIsProduction: () => getIsProduction,
62
62
  getOrigin: () => getOrigin,
63
63
  getParentCategoriesById: () => getParentCategoriesById,
64
+ getProto: () => getProto,
64
65
  getRootCategory: () => getRootCategory,
65
66
  getRouteHref: () => getRouteHref,
66
67
  httpDelete: () => httpDelete,
@@ -899,10 +900,10 @@ var Logger = class {
899
900
  this.level_ = level;
900
901
  }
901
902
  static getLevel() {
902
- if (isProduction) {
903
- return 1 /* ERROR */;
904
- } else {
903
+ if (isDevelopment) {
905
904
  return this.level_;
905
+ } else {
906
+ return 1 /* ERROR */;
906
907
  }
907
908
  }
908
909
  static error(...args) {
@@ -1067,10 +1068,19 @@ function getHost(headers) {
1067
1068
  return null;
1068
1069
  }
1069
1070
  }
1071
+ function getProto(headers) {
1072
+ if (isIncomingHttpHeaders(headers)) {
1073
+ return headers["x-forwarded-proto"] || "https://";
1074
+ } else if (isHeaders(headers)) {
1075
+ return headers.get("X-Forwarded-Proto") || "https://";
1076
+ } else {
1077
+ return "https://";
1078
+ }
1079
+ }
1070
1080
  function getOrigin(headers) {
1071
1081
  const host = getHost(headers);
1072
1082
  if (host) {
1073
- return host.indexOf("localhost") !== -1 ? "http://" + host : "https://" + host;
1083
+ return host.indexOf("localhost") !== -1 ? "http://" + host : getProto(headers) + host;
1074
1084
  } else {
1075
1085
  return process.env.NEXT_PUBLIC_URL || "";
1076
1086
  }
@@ -1263,6 +1273,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
1263
1273
  getIsProduction,
1264
1274
  getOrigin,
1265
1275
  getParentCategoriesById,
1276
+ getProto,
1266
1277
  getRootCategory,
1267
1278
  getRouteHref,
1268
1279
  httpDelete,
package/dist/index.mjs CHANGED
@@ -776,10 +776,10 @@ var Logger = class {
776
776
  this.level_ = level;
777
777
  }
778
778
  static getLevel() {
779
- if (isProduction) {
780
- return 1 /* ERROR */;
781
- } else {
779
+ if (isDevelopment) {
782
780
  return this.level_;
781
+ } else {
782
+ return 1 /* ERROR */;
783
783
  }
784
784
  }
785
785
  static error(...args) {
@@ -944,10 +944,19 @@ function getHost(headers) {
944
944
  return null;
945
945
  }
946
946
  }
947
+ function getProto(headers) {
948
+ if (isIncomingHttpHeaders(headers)) {
949
+ return headers["x-forwarded-proto"] || "https://";
950
+ } else if (isHeaders(headers)) {
951
+ return headers.get("X-Forwarded-Proto") || "https://";
952
+ } else {
953
+ return "https://";
954
+ }
955
+ }
947
956
  function getOrigin(headers) {
948
957
  const host = getHost(headers);
949
958
  if (host) {
950
- return host.indexOf("localhost") !== -1 ? "http://" + host : "https://" + host;
959
+ return host.indexOf("localhost") !== -1 ? "http://" + host : getProto(headers) + host;
951
960
  } else {
952
961
  return process.env.NEXT_PUBLIC_URL || "";
953
962
  }
@@ -1139,6 +1148,7 @@ export {
1139
1148
  getIsProduction,
1140
1149
  getOrigin,
1141
1150
  getParentCategoriesById,
1151
+ getProto,
1142
1152
  getRootCategory,
1143
1153
  getRouteHref,
1144
1154
  httpDelete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",