@websolutespa/bom-core 0.6.6 → 1.6.0

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,11 @@
1
1
  # @websolutespa/bom-core
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 6cbf4cb: Added: IAction, IEndUser, IConsentPreference, IPreference, ILegalNotice
8
+
3
9
  ## 0.6.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -59,6 +59,44 @@ type ILocalizedString = Record<string, string>;
59
59
  type ILocalizable = string | ILocalizedString;
60
60
  type ILocalized<T> = IOverride<T, ILocalizable, string>;
61
61
 
62
+ type ILegalNotice = {
63
+ id: string;
64
+ text: ILocalizable;
65
+ };
66
+ type IPreference = {
67
+ id: string;
68
+ description: string;
69
+ legalNotice: ILegalNotice;
70
+ };
71
+ type IConsentPreference = {
72
+ id: string;
73
+ consentPreference: IPreference;
74
+ date: Date | string;
75
+ };
76
+
77
+ type User = Record<string, unknown> & {
78
+ collection: string;
79
+ id: string;
80
+ email: string;
81
+ };
82
+ type UserRole = 'admin' | 'editor' | 'user' | string;
83
+ type UserWithRoles = User & {
84
+ roles: UserRole[];
85
+ };
86
+ type IEndUser = UserWithRoles & {
87
+ email: string;
88
+ consentPreferences: IConsentPreference[];
89
+ };
90
+
91
+ type IAction = Record<string, unknown> & {
92
+ id: string;
93
+ consentPreferences: IConsentPreference[];
94
+ endUser: IEndUser;
95
+ loggedEndUser?: IEndUser;
96
+ email?: string;
97
+ password?: string;
98
+ };
99
+
62
100
  type IAnchor = {
63
101
  id: string;
64
102
  title?: ILocalizable;
@@ -297,6 +335,8 @@ type IMenuCustom = Record<string, unknown> & {
297
335
  type: string;
298
336
  };
299
337
  type IMenuItem = IMenuCategory | IMenuGroup | IMenuLink | IMenuPage | IMenuRoute;
338
+ type IMenuHref = IMenuCategory | IMenuLink | IMenuPage | IMenuRoute;
339
+ declare function isMenuHref(item: IMenuItem): item is IMenuHref;
300
340
  type IMenu = {
301
341
  id: string;
302
342
  items: IMenuItem[];
@@ -642,4 +682,4 @@ declare function asServerProps(props: any): any;
642
682
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
643
683
  declare function merge(target: any, source: any): any;
644
684
 
645
- export { FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IContextBaseParams, IContextParams, IDecoratedNav, IEntity, IEquatable, IFeature, IFeatureType, 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, collectFeatureTypes, collectOptions, 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 };
685
+ export { FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, ILabel, ILayout, ILegalNotice, ILocale, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IPackages, IPage, IPageRelation, IPageRelationResult, IPageResult, 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, 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, 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, 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
@@ -73,6 +73,7 @@ __export(src_exports, {
73
73
  isEntity: () => isEntity,
74
74
  isEquatable: () => isEquatable,
75
75
  isLocalizedString: () => isLocalizedString,
76
+ isMenuHref: () => isMenuHref,
76
77
  isNotNullString: () => isNotNullString,
77
78
  isObject: () => isObject,
78
79
  isProduction: () => isProduction,
@@ -1129,6 +1130,11 @@ function resolveMediaType(media) {
1129
1130
  return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
1130
1131
  }
1131
1132
 
1133
+ // src/types/menu.ts
1134
+ function isMenuHref(item) {
1135
+ return ["category", "link", "page", "route"].includes(item.type);
1136
+ }
1137
+
1132
1138
  // src/types/querable.ts
1133
1139
  function toFindParams(idOrParams) {
1134
1140
  if (typeof idOrParams === "number" || typeof idOrParams === "string") {
@@ -1192,6 +1198,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
1192
1198
  isEntity,
1193
1199
  isEquatable,
1194
1200
  isLocalizedString,
1201
+ isMenuHref,
1195
1202
  isNotNullString,
1196
1203
  isObject,
1197
1204
  isProduction,
package/dist/index.mjs CHANGED
@@ -1012,6 +1012,11 @@ function resolveMediaType(media) {
1012
1012
  return media.type || (media.mimeType ? media.mimeType.split("/")[0] : "image");
1013
1013
  }
1014
1014
 
1015
+ // src/types/menu.ts
1016
+ function isMenuHref(item) {
1017
+ return ["category", "link", "page", "route"].includes(item.type);
1018
+ }
1019
+
1015
1020
  // src/types/querable.ts
1016
1021
  function toFindParams(idOrParams) {
1017
1022
  if (typeof idOrParams === "number" || typeof idOrParams === "string") {
@@ -1074,6 +1079,7 @@ export {
1074
1079
  isEntity,
1075
1080
  isEquatable,
1076
1081
  isLocalizedString,
1082
+ isMenuHref,
1077
1083
  isNotNullString,
1078
1084
  isObject,
1079
1085
  isProduction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "0.6.6",
3
+ "version": "1.6.0",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",