@websolutespa/bom-core 2.0.1-next.2 → 3.0.1

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,28 +1,28 @@
1
1
  # @websolutespa/bom-core
2
2
 
3
- ## 2.0.1-next.2
3
+ ## 3.0.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updating: dependencies and build step
7
+ - Updating: dependencies
8
8
 
9
- ## 2.0.1-next.0
9
+ ## 3.0.0
10
10
 
11
11
  ### Major Changes
12
12
 
13
- - e74b305: Release: Payload 3.7.0
13
+ - Release: Bom 3.0
14
14
 
15
- ## 1.10.0-next.1
15
+ ## 1.8.24
16
16
 
17
17
  ### Patch Changes
18
18
 
19
- - 64289c4: Updating: React 19.x, Payload 3.x
19
+ - Added: IApp global
20
20
 
21
- ## 1.10.0-next.0
21
+ ## 1.8.23
22
22
 
23
- ### Minor Changes
23
+ ### Patch Changes
24
24
 
25
- - Updating: React 19.x, Payload 3.x
25
+ - 0c7f05f: Modified: IRoute isRoot noindex, routeService
26
26
 
27
27
  ## 1.8.22
28
28
 
package/dist/index.d.ts CHANGED
@@ -144,45 +144,6 @@ type IAnchor = {
144
144
  title: string;
145
145
  };
146
146
 
147
- type IEquatable = number | string;
148
- type SchemaType = string;
149
- type ISchema = {
150
- id: IEquatable;
151
- schema?: string;
152
- };
153
- type IEntity = ISchema & Record<string, unknown>;
154
- type INamedEntity = IEntity & {
155
- name: ILocalizable;
156
- };
157
- type ITitledEntity = IEntity & {
158
- title: ILocalizable;
159
- };
160
- type IOption = Record<string, any> & {
161
- id: IEquatable;
162
- name: string;
163
- };
164
- type IFeature = Record<string, any> & {
165
- id: IEquatable;
166
- title: string;
167
- };
168
- type IFeatureType = IEntity & {
169
- id: string;
170
- title: string;
171
- mode: string;
172
- features: IFeature[];
173
- };
174
-
175
- type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
176
-
177
- type IComponent = {
178
- id?: IEquatable;
179
- blockType?: string;
180
- schema?: string;
181
- anchor?: IAnchor;
182
- seoWeight?: Headings;
183
- [key: string]: unknown;
184
- };
185
-
186
147
  type IMediaType = 'image' | 'video' | 'json' | 'pdf' | string;
187
148
  type IMediaInfo = {
188
149
  id: string;
@@ -239,6 +200,68 @@ declare function isMediaPdf(media: {
239
200
  }): media is IMediaPdf;
240
201
  declare function isMedia(item: unknown): item is IMedia;
241
202
 
203
+ type IAppExtended = Record<string, any>;
204
+ type IApp<T extends IAppExtended = IAppExtended> = {
205
+ id: 'app';
206
+ brand: {
207
+ name: string;
208
+ businessName?: string;
209
+ appName?: string;
210
+ logo?: IMedia;
211
+ email?: string;
212
+ telephone?: string;
213
+ address?: string;
214
+ city?: string;
215
+ provinceCode?: string;
216
+ zipCode?: string;
217
+ countryCode?: string;
218
+ twitterName?: string;
219
+ social: {
220
+ key: string;
221
+ url: string;
222
+ }[];
223
+ };
224
+ } & T;
225
+
226
+ type IEquatable = number | string;
227
+ type SchemaType = string;
228
+ type ISchema = {
229
+ id: IEquatable;
230
+ schema?: string;
231
+ };
232
+ type IEntity = ISchema & Record<string, unknown>;
233
+ type INamedEntity = IEntity & {
234
+ name: ILocalizable;
235
+ };
236
+ type ITitledEntity = IEntity & {
237
+ title: ILocalizable;
238
+ };
239
+ type IOption = Record<string, any> & {
240
+ id: IEquatable;
241
+ name: string;
242
+ };
243
+ type IFeature = Record<string, any> & {
244
+ id: IEquatable;
245
+ title: string;
246
+ };
247
+ type IFeatureType = IEntity & {
248
+ id: string;
249
+ title: string;
250
+ mode: string;
251
+ features: IFeature[];
252
+ };
253
+
254
+ type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
255
+
256
+ type IComponent = {
257
+ id?: IEquatable;
258
+ blockType?: string;
259
+ schema?: string;
260
+ anchor?: IAnchor;
261
+ seoWeight?: Headings;
262
+ [key: string]: unknown;
263
+ };
264
+
242
265
  type IMeta = {
243
266
  title?: string;
244
267
  description?: string;
@@ -359,14 +382,16 @@ type IMarket = IEntity & {
359
382
 
360
383
  type IRoute = {
361
384
  category: IEquatable;
362
- resolvedCategory: IEquatable;
363
385
  id: string;
364
386
  isDefault?: boolean;
387
+ isRoot?: boolean;
365
388
  locale: string;
366
389
  market: string;
367
390
  media?: IMedia;
391
+ noindex?: boolean;
368
392
  order?: number;
369
393
  page: IEquatable;
394
+ resolvedCategory: IEquatable;
370
395
  schema: string;
371
396
  template?: string;
372
397
  title: string;
@@ -457,6 +482,10 @@ type IPageUnresolvedRelation = {
457
482
  value: IEquatable | IEquatable[];
458
483
  };
459
484
 
485
+ declare enum MenuCategoryStrategy {
486
+ Default = "default",// show hidden categories recursively,
487
+ ExcludeHidden = "exclude-hidden"
488
+ }
460
489
  type IMenuBase = {
461
490
  abstract?: ILocalizable;
462
491
  extra?: ILocalizable;
@@ -526,10 +555,6 @@ type IUndecoratedMenuBase = {
526
555
  media?: IMedia;
527
556
  type: string;
528
557
  };
529
- declare enum MenuCategoryStrategy {
530
- Default = "default",// show hidden categories recursively,
531
- ExcludeHidden = "exclude-hidden"
532
- }
533
558
  type IUndecoratedMenuCategory = Omit<IUndecoratedMenuBase, 'type'> & {
534
559
  type: 'category';
535
560
  category: string;
@@ -562,12 +587,13 @@ type IUndecoratedMenu = IEntity & {
562
587
  items: IUndecoratedMenuItem[];
563
588
  };
564
589
 
565
- type ILayout = {
590
+ type ILayout<T extends IAppExtended = IAppExtended> = {
566
591
  labels: ILabel[];
567
592
  locale: string;
568
593
  locales: ILocale[];
569
594
  market: string;
570
595
  markets: IMarket[];
596
+ app: IPrettify<IApp<T>>;
571
597
  menu: Record<string, ILocalizedMenu>;
572
598
  topLevelHrefs: Record<string, string>;
573
599
  topLevelRoutes: Record<string, IRouteLink>;
@@ -631,11 +657,19 @@ type QueryParams = {
631
657
  sort?: string;
632
658
  where?: Where;
633
659
  };
660
+ type GlobalQueryParams = {
661
+ depth?: number;
662
+ draft?: boolean;
663
+ locale?: string;
664
+ market?: string;
665
+ richText?: boolean;
666
+ };
634
667
 
635
668
  type IPagedResult<T extends IEntity = IEntity> = {
636
669
  docs: T[];
637
670
  } & Pagination;
638
671
  type IQuerable<T extends IEntity = IEntity> = {
672
+ findGlobal<B extends T = T>(params?: GlobalQueryParams, token?: string): Promise<B | undefined>;
639
673
  findOne<B extends T = T>(id: IEquatable, params?: QueryParams, token?: string): Promise<B | undefined>;
640
674
  findMany<B extends T = T>(params?: QueryParams, token?: string): Promise<B[]>;
641
675
  findPaged<B extends T = T>(params?: QueryParams, token?: string): Promise<IPagedResult<B>>;
@@ -892,6 +926,7 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
892
926
  constructor(items: T[]);
893
927
  getItems<B extends T = T>(): Promise<B[]>;
894
928
  protected whereId_(id: IEquatable): WhereField;
929
+ findGlobal<B extends T = T>(params?: GlobalQueryParams): Promise<B | undefined>;
895
930
  findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
896
931
  findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
897
932
  findPaged<B extends T = T>(params?: QueryParams): Promise<IPagedResult<B>>;
@@ -1003,6 +1038,170 @@ declare class Logger {
1003
1038
 
1004
1039
  declare const defaultMarket: string;
1005
1040
 
1041
+ /**
1042
+ * STORE
1043
+ */
1044
+
1045
+ type IMockStore = {
1046
+ collections: {
1047
+ [key: string]: IMockCollection[];
1048
+ } & {
1049
+ category: IMockCategory[];
1050
+ label: IMockLabel[];
1051
+ locale: IMockLocale[];
1052
+ market: IMockMarket[];
1053
+ menu?: IMockMenu[];
1054
+ redirect?: IMockCollection[];
1055
+ template?: IMockTemplate[];
1056
+ };
1057
+ pages: Record<string, IMockPage[]>;
1058
+ };
1059
+ type IMockPage = {
1060
+ id?: IEquatable;
1061
+ title: ILocalizable;
1062
+ abstract?: ILocalizable;
1063
+ description?: ILocalizable;
1064
+ media?: IMockMedia;
1065
+ meta?: IMockMeta;
1066
+ components?: IMockComponent[];
1067
+ category: string;
1068
+ slug?: ILocalizable;
1069
+ template?: string;
1070
+ isDefault?: boolean;
1071
+ isProtected?: boolean;
1072
+ useSplat?: boolean;
1073
+ order?: number;
1074
+ markets?: string[];
1075
+ $inherit?: boolean;
1076
+ [key: string]: unknown;
1077
+ };
1078
+ type IMockComponent = {
1079
+ schema?: string;
1080
+ anchor?: IAnchor;
1081
+ [key: string]: unknown;
1082
+ };
1083
+ type IMockMeta = {
1084
+ title?: ILocalizable;
1085
+ description?: ILocalizable;
1086
+ keywords?: ILocalizable;
1087
+ robots?: ILocalizable;
1088
+ };
1089
+ type IMockTemplate = {
1090
+ id: string;
1091
+ name: string;
1092
+ collections?: string[];
1093
+ };
1094
+ type IMockCategory = {
1095
+ id: string;
1096
+ title: ILocalizable;
1097
+ slug?: ILocalizable;
1098
+ category?: string;
1099
+ isHidden?: boolean;
1100
+ };
1101
+ type IMockLocale = {
1102
+ id: ILocaleId;
1103
+ title: ILocalizable;
1104
+ isDefault?: boolean;
1105
+ };
1106
+ type IMockMarket = {
1107
+ id: string;
1108
+ title: ILocalizable;
1109
+ isDefault?: boolean;
1110
+ isActive?: boolean;
1111
+ defaultLanguage?: ILocaleId;
1112
+ countries?: string[];
1113
+ languages?: ILocaleId[];
1114
+ };
1115
+ type IMockLabel = {
1116
+ id: string;
1117
+ text: ILocalizable;
1118
+ };
1119
+ type IMockMedia = {
1120
+ id?: IEquatable;
1121
+ title?: ILocalizable;
1122
+ abstract?: ILocalizable;
1123
+ alt?: ILocalizable;
1124
+ type: IMediaType;
1125
+ src: string;
1126
+ [key: string]: unknown;
1127
+ };
1128
+ type IMockCollection = {
1129
+ id?: IEquatable;
1130
+ title?: ILocalizable;
1131
+ abstract?: ILocalizable;
1132
+ description?: ILocalizable;
1133
+ media?: IMockMedia;
1134
+ order?: number;
1135
+ markets?: string[];
1136
+ $inherit?: boolean;
1137
+ [key: string]: unknown;
1138
+ };
1139
+ type IMockRedirect = {
1140
+ status: string;
1141
+ from: string;
1142
+ to?: string;
1143
+ name: string;
1144
+ order?: number;
1145
+ isActive?: boolean;
1146
+ };
1147
+ /**
1148
+ * MENU
1149
+ */
1150
+ type IMockMenu = {
1151
+ id: string;
1152
+ items: IMockMenuItem[];
1153
+ };
1154
+ type IMockMenuItem = IMockMenuGroup | IMockMenuCategory | IMockMenuPage | IMockMenuLink | IMockMenuCustom;
1155
+ type IMockMenuGroup = IMockMenuBase & {
1156
+ type: 'group';
1157
+ title?: ILocalizable;
1158
+ items: IMockMenuItem[];
1159
+ };
1160
+ type IMockMenuCategory = IMockMenuBase & IMockMenuExtra & {
1161
+ type: 'category';
1162
+ category: string;
1163
+ customTitle?: ILocalizable;
1164
+ strategy?: MenuCategoryStrategy;
1165
+ maxDepth?: number;
1166
+ };
1167
+ type IMockMenuPage = IMockMenuBase & IMockMenuExtra & {
1168
+ type: 'page';
1169
+ page: IMockSingleRelation;
1170
+ customTitle?: ILocalizable;
1171
+ };
1172
+ type IMockMenuLink = IMockMenuBase & {
1173
+ type: 'link';
1174
+ title: ILocalizable;
1175
+ href: string;
1176
+ target?: ('_self' | '_blank' | '_parent' | '_top' | '_unfencedTop') & string;
1177
+ };
1178
+ type IMockMenuCustom = IMockMenuBase & {
1179
+ type: 'custom';
1180
+ title: ILocalizable;
1181
+ blockType: string;
1182
+ };
1183
+ type IMockMenuBase = {
1184
+ abstract?: ILocalizable;
1185
+ media?: IMockMedia;
1186
+ markets?: string[];
1187
+ customClass?: string;
1188
+ };
1189
+ type IMockMenuExtra = {
1190
+ extra?: ILocalizable;
1191
+ };
1192
+ type IMockRelation = {
1193
+ relationTo: string;
1194
+ value: IEquatable | IEquatable[];
1195
+ };
1196
+ type IMockSingleRelation = {
1197
+ relationTo: string;
1198
+ value: IEquatable;
1199
+ };
1200
+ type IMockManyRelation = {
1201
+ relationTo: string;
1202
+ value: IEquatable[];
1203
+ };
1204
+
1006
1205
  declare const passwordStrategy: string;
1007
1206
 
1008
1207
  /**
@@ -1065,6 +1264,9 @@ declare function getOrigin(headers?: IncomingHttpHeaders | Headers): string;
1065
1264
 
1066
1265
  /**
1067
1266
  * Represents the route strategy options.
1267
+ * - **Auto** dynamically add/remove prefixes based on number of markets & languages.
1268
+ * - **Default** add prefixes based on !isDefault market or language flag.
1269
+ * - **Manual** add prefixes based on !isHidden market or language flag.
1068
1270
  */
1069
1271
  declare enum RouteStrategy {
1070
1272
  Auto = "auto",
@@ -1366,4 +1568,4 @@ declare function asServerProps(props: any): any;
1366
1568
  declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
1367
1569
  declare function merge(target: any, source: any): any;
1368
1570
 
1369
- export { type DeepPartial, type DeepRequired, type DeepRequiredProps, type Dynamic, type FetchError, type FetchRequestOptions, type FetchService, type FindParams, type FindWhereParams, type Headings, type IAction, type IActionEmailData, type IAnchor, type ICategorized, type ICategory, type ICategoryItem, type IClassName, type IClassNameCollection, type IClassNameValue, type ICollectionDescription, type IComponent, type IConfig, type IConsentPreference, type IContextBaseParams, type IContextParams, type IDecoratedNav, type IEmailConfig, type IEndUser, type IEntity, type IEquatable, type IFeature, type IFeatureType, type IImageResize, type ILabel, type ILayout, type ILegalNotice, type ILetter, type ILocale, type ILocaleId, type ILocalizable, type ILocalized, type ILocalizedMenu, type ILocalizedString, type IMarket, type IMedia, type IMediaImage, type IMediaInfo, type IMediaJson, type IMediaPdf, type IMediaType, type IMediaVideo, type IMemoryStore, type IMenu, type IMenuBase, type IMenuCategory, type IMenuCustom, type IMenuGroup, type IMenuHref, type IMenuItem, type IMenuLink, type IMenuPage, type IMenuRoute, type INamedEntity, type IOption, type IOverride, type IOverrideReturnValue, type IOverrideValue, type IPackages, type IPage, type IPageItem, type IPageRelation, type IPageRelationResult, type IPageUnresolvedRelation, type IPagedResult, type IPaginationResult, type IPartial, type IPreference, type IPrettify, type IQuerable, type IRedirect, type IRoute, type IRouteCanonical, type IRouteLink, type IRouteParams, type ISchema, type ISerializedCollection, type ISerializedStore, type IServerSideContext, type IServerSideSplatContext, type IStaticContext, type IStore, type ITemplate, type ITitledEntity, type IUndecoratedMenu, type IUndecoratedMenuBase, type IUndecoratedMenuCategory, type IUndecoratedMenuCustom, type IUndecoratedMenuGroup, type IUndecoratedMenuItem, type IUndecoratedMenuLink, type IUndecoratedMenuPage, type IUndecoratedNav, ImageStrategy, type Json, JsonService, type LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, type NextApiRequestCookies, type Operator, type PageProps, type Pagination, type PreviewData, type Primitive, type QueryParams, RedirectReason, type RequireAtLeastOne, RouteStrategy, type SchemaType, type ServerSidePropsContext, type Shift, type ShiftUnion, type StaticPropsContext, type User, type UserRole, type UserWithRoles, type ValueOf, type Where, type WhereAndOr, type WhereBase, type WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, base64ToString, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, eachMedia, eachValue, encryptImageToken, enumToList, excludeComponent, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, groupComponents, hasComponents, hasMarket, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isComponent, isComponentOfType, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMedia, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuCategory, isMenuGroup, isMenuHref, isMenuLink, isMenuPage, isMenuRoute, isNonEmptyArray, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedCategory, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedCategory, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, passwordStrategy, pickComponent, pickHero, prependHero, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, stringToBase64, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
1571
+ export { type DeepPartial, type DeepRequired, type DeepRequiredProps, type Dynamic, type FetchError, type FetchRequestOptions, type FetchService, type FindParams, type FindWhereParams, type GlobalQueryParams, type Headings, type IAction, type IActionEmailData, type IAnchor, type IApp, type IAppExtended, type ICategorized, type ICategory, type ICategoryItem, type IClassName, type IClassNameCollection, type IClassNameValue, type ICollectionDescription, type IComponent, type IConfig, type IConsentPreference, type IContextBaseParams, type IContextParams, type IDecoratedNav, type IEmailConfig, type IEndUser, type IEntity, type IEquatable, type IFeature, type IFeatureType, type IImageResize, type ILabel, type ILayout, type ILegalNotice, type ILetter, type ILocale, type ILocaleId, type ILocalizable, type ILocalized, type ILocalizedMenu, type ILocalizedString, type IMarket, type IMedia, type IMediaImage, type IMediaInfo, type IMediaJson, type IMediaPdf, type IMediaType, type IMediaVideo, type IMemoryStore, type IMenu, type IMenuBase, type IMenuCategory, type IMenuCustom, type IMenuGroup, type IMenuHref, type IMenuItem, type IMenuLink, type IMenuPage, type IMenuRoute, type IMockCategory, type IMockCollection, type IMockComponent, type IMockLabel, type IMockLocale, type IMockManyRelation, type IMockMarket, type IMockMedia, type IMockMenu, type IMockMenuBase, type IMockMenuCategory, type IMockMenuCustom, type IMockMenuExtra, type IMockMenuGroup, type IMockMenuItem, type IMockMenuLink, type IMockMenuPage, type IMockMeta, type IMockPage, type IMockRedirect, type IMockRelation, type IMockSingleRelation, type IMockStore, type IMockTemplate, type INamedEntity, type IOption, type IOverride, type IOverrideReturnValue, type IOverrideValue, type IPackages, type IPage, type IPageItem, type IPageRelation, type IPageRelationResult, type IPageUnresolvedRelation, type IPagedResult, type IPaginationResult, type IPartial, type IPreference, type IPrettify, type IQuerable, type IRedirect, type IRoute, type IRouteCanonical, type IRouteLink, type IRouteParams, type ISchema, type ISerializedCollection, type ISerializedStore, type IServerSideContext, type IServerSideSplatContext, type IStaticContext, type IStore, type ITemplate, type ITitledEntity, type IUndecoratedMenu, type IUndecoratedMenuBase, type IUndecoratedMenuCategory, type IUndecoratedMenuCustom, type IUndecoratedMenuGroup, type IUndecoratedMenuItem, type IUndecoratedMenuLink, type IUndecoratedMenuPage, type IUndecoratedNav, ImageStrategy, type Json, JsonService, type LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, type NextApiRequestCookies, type Operator, type PageProps, type Pagination, type PreviewData, type Primitive, type QueryParams, RedirectReason, type RequireAtLeastOne, RouteStrategy, type SchemaType, type ServerSidePropsContext, type Shift, type ShiftUnion, type StaticPropsContext, type User, type UserRole, type UserWithRoles, type ValueOf, type Where, type WhereAndOr, type WhereBase, type WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, base64ToString, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, eachMedia, eachValue, encryptImageToken, enumToList, excludeComponent, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, groupComponents, hasComponents, hasMarket, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isComponent, isComponentOfType, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMedia, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuCategory, isMenuGroup, isMenuHref, isMenuLink, isMenuPage, isMenuRoute, isNonEmptyArray, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedCategory, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedCategory, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, passwordStrategy, pickComponent, pickHero, prependHero, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, stringToBase64, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
package/dist/index.js CHANGED
@@ -414,6 +414,11 @@ function isMedia(item) {
414
414
  }
415
415
 
416
416
  // src/types/menu.ts
417
+ var MenuCategoryStrategy = /* @__PURE__ */ ((MenuCategoryStrategy2) => {
418
+ MenuCategoryStrategy2["Default"] = "default";
419
+ MenuCategoryStrategy2["ExcludeHidden"] = "exclude-hidden";
420
+ return MenuCategoryStrategy2;
421
+ })(MenuCategoryStrategy || {});
417
422
  function isMenuHref(item) {
418
423
  return ["category", "link", "page", "route"].includes(item.type);
419
424
  }
@@ -432,11 +437,6 @@ function isMenuPage(item) {
432
437
  function isMenuRoute(item) {
433
438
  return item.type === "route";
434
439
  }
435
- var MenuCategoryStrategy = /* @__PURE__ */ ((MenuCategoryStrategy2) => {
436
- MenuCategoryStrategy2["Default"] = "default";
437
- MenuCategoryStrategy2["ExcludeHidden"] = "exclude-hidden";
438
- return MenuCategoryStrategy2;
439
- })(MenuCategoryStrategy || {});
440
440
 
441
441
  // src/types/querable.ts
442
442
  function toFindParams(idOrParams) {
@@ -778,8 +778,12 @@ async function httpDelete(url, options = {}) {
778
778
  }
779
779
 
780
780
  // src/image/image.ts
781
- function getSecret() {
782
- return process.env.IMAGE_SECRET || "IMAGE_SECRET";
781
+ function getImageSecret() {
782
+ const secret = process.env.MIXER_SECRET || "";
783
+ if (!secret) {
784
+ throw "getImageSecret MIXER_SECRET not defined";
785
+ }
786
+ return secret;
783
787
  }
784
788
  function textToArrayBuffer_(text) {
785
789
  const encoder = new TextEncoder();
@@ -812,11 +816,11 @@ function decrypt_(base64, secret) {
812
816
  }
813
817
  function encryptImageToken(imageResize) {
814
818
  const text = JSON.stringify(imageResize);
815
- const token = encrypt_(text, getSecret());
819
+ const token = encrypt_(text, getImageSecret());
816
820
  return token;
817
821
  }
818
822
  function decryptImageResize(token) {
819
- const text = decrypt_(token, getSecret());
823
+ const text = decrypt_(token, getImageSecret());
820
824
  const data = JSON.parse(text);
821
825
  return data;
822
826
  }
@@ -837,6 +841,15 @@ var JsonService = class {
837
841
  equals: id
838
842
  };
839
843
  }
844
+ async findGlobal(params = {}) {
845
+ const items = await this.getItems();
846
+ if (items.length > 0) {
847
+ return await this.decorateOne_(items[0], params);
848
+ } else {
849
+ console.log("JsonService.findGlobal.notfound", params);
850
+ return void 0;
851
+ }
852
+ }
840
853
  async findOne(id, params = {}) {
841
854
  let items = await this.getItems();
842
855
  params.where = params.where || {};
@@ -1520,60 +1533,71 @@ var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
1520
1533
  RouteStrategy2["Manual"] = "manual";
1521
1534
  return RouteStrategy2;
1522
1535
  })(RouteStrategy || {});
1523
- var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "auto" /* Auto */;
1524
- function getPickedProps(item) {
1525
- const pickedProps = Object.fromEntries(Object.entries(item).filter(([k, v]) => [
1526
- "category",
1527
- "isDefault",
1528
- "media",
1529
- "order",
1530
- "template",
1531
- "updatedAt",
1532
- "useSplat",
1533
- // 'createdAt',
1534
- "updatedAt",
1535
- "_status"
1536
- ].includes(k)));
1537
- return pickedProps;
1538
- }
1536
+ var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "manual" /* Manual */;
1539
1537
  function collectRoutes(store, categories, markets, locales, medias) {
1540
1538
  const routes = [];
1541
1539
  if (locales.length > 0 && markets.length > 0) {
1542
1540
  const rootCategory = getRootCategory(categories);
1543
1541
  eachCategorized(store, (item, key) => {
1544
1542
  const segments = getCategorySegments(categories, item);
1545
- const visibleSegments = segments.filter((x) => Boolean(x.isHidden) === false);
1543
+ const visibleSegments = segments.filter((x) => x.id !== rootCategory?.id && Boolean(x.isHidden) === false);
1546
1544
  const visibleCategory = visibleSegments.length > 0 ? visibleSegments[visibleSegments.length - 1] : rootCategory;
1547
1545
  if (visibleCategory) {
1548
1546
  const slugs = visibleSegments.map((x) => ({ slug: x.slug }));
1549
1547
  if (Boolean(item.isDefault) === false) {
1550
1548
  slugs.push({ slug: item.slug });
1551
1549
  }
1552
- const defaultLocale2 = locales.find((x) => x.isDefault) || locales[0];
1553
- const defaultMarket2 = markets.find((x) => x.isDefault) || markets[0];
1554
- const defaultMarketLocale = defaultMarket2 && defaultMarket2.defaultLanguage ? asEntityId(defaultMarket2.defaultLanguage) : defaultLocale2.id;
1555
1550
  const isRootCategory = rootCategory && item.category === rootCategory.id && item.isDefault;
1556
1551
  eachMarketLocale(markets, locales, (market, locale, markets2, locales2) => {
1557
1552
  if (hasMarket(item, market)) {
1558
1553
  const title = localize(item.title, locale.id);
1559
1554
  const id = getRouteHref(slugs, market, locale, markets2, locales2);
1560
- const isDefaultRootCategory = isRootCategory && market.id === defaultMarket2.id && locale.id === defaultMarketLocale;
1561
- const pickedProps = getPickedProps(item);
1555
+ const {
1556
+ _status,
1557
+ category,
1558
+ isDefault,
1559
+ media,
1560
+ order,
1561
+ template,
1562
+ updatedAt,
1563
+ useSplat
1564
+ } = item;
1562
1565
  const route = {
1563
- ...pickedProps,
1564
- resolvedCategory: visibleCategory.id,
1565
- id: isDefaultRootCategory ? "/" : id,
1566
+ _status,
1567
+ category,
1568
+ // id: isDefaultRootCategory ? '/' : id,
1569
+ id,
1566
1570
  locale: locale.id,
1567
1571
  market: market.id,
1572
+ media,
1568
1573
  page: item.id,
1574
+ resolvedCategory: visibleCategory.id,
1569
1575
  schema: key,
1570
- title
1576
+ template,
1577
+ title,
1578
+ updatedAt
1571
1579
  };
1580
+ if (isDefault) {
1581
+ route.isDefault = true;
1582
+ }
1583
+ if (isRootCategory) {
1584
+ route.isRoot = true;
1585
+ }
1586
+ const noindex = (item.meta?.robots || "").includes("noindex");
1587
+ if (noindex) {
1588
+ route.noindex = true;
1589
+ }
1590
+ if (order != null) {
1591
+ route.order = order;
1592
+ }
1593
+ if (useSplat) {
1594
+ route.useSplat = true;
1595
+ }
1572
1596
  const mediaId = typeof item.media === "string" ? item.media : void 0;
1573
1597
  if (Array.isArray(medias) && mediaId) {
1574
- const media = item.media && medias.find((x) => x.id === mediaId);
1575
- if (media) {
1576
- route.media = media;
1598
+ const media2 = item.media && medias.find((x) => x.id === mediaId);
1599
+ if (media2) {
1600
+ route.media = media2;
1577
1601
  }
1578
1602
  }
1579
1603
  routes.push(route);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "2.0.1-next.2",
3
+ "version": "3.0.1",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -29,14 +29,14 @@
29
29
  "peerDependencies": {},
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.33",
32
- "@types/react": "19.2.1",
33
- "@websolutespa/eslint-config": "2.0.1-next.2",
34
- "@websolutespa/test": "2.0.1-next.2",
35
- "@websolutespa/tsconfig": "2.0.1-next.2",
32
+ "@types/react": "19.2.10",
33
+ "@websolutespa/eslint-config": "^3.0.0",
34
+ "@websolutespa/test": "^3.0.1",
35
+ "@websolutespa/tsconfig": "^3.0.0",
36
36
  "eslint": "9.31.0",
37
37
  "npm-run-all": "4.1.5",
38
38
  "raw-loader": "4.0.2",
39
- "react": "19.2.1",
39
+ "react": "19.2.3",
40
40
  "tsup": "8.5.0",
41
41
  "typescript": "5.8.3",
42
42
  "vitest": "3.2.3"