@websolutespa/bom-core 3.0.4 → 3.1.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 +21 -0
- package/dist/index.d.ts +199 -194
- package/dist/index.js +31 -2
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @websolutespa/bom-core
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f7c21b: - Payload 3.91.0 and Next.js 16.4.2 (React 19.2.9): peer dependencies are now ranges, `payload` / `@payloadcms/*` `^3.91.0`, `next` `^16.3.3`, `react` / `react-dom` `^19.2.1`
|
|
8
|
+
- payload-plugin-bowl: the mixer context is built only for reads by an authenticated user (payload 3.90+ resolves the jwt user with the request query, populating tenants before `req.user` is set); email options typed with payload `SendEmailOptions`, no direct nodemailer dependency
|
|
9
|
+
- payload-plugin-storage: `AZURE_STORAGE_CONTAINER_ACCESS` (`private` default since payload 3.90, `blob`, `container`) for containers created by the plugin
|
|
10
|
+
- mixer web: `images.qualities` includes `IMAGE_QUALITY` (next 16 defaults to `[75]`)
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 12b6e2f: - test: replace the jest presets with shared vitest configurations, `@websolutespa/test/vitest` (`defineNodeConfig`, `defineDomConfig`, `definePayloadConfig`); drop jest dependencies
|
|
15
|
+
- declare every imported package and script binary in the package that uses it (no more reliance on hoisting), drop unused dependencies
|
|
16
|
+
- bom-mixer-checkout: `useCart.add` no longer mutates the previous cart state
|
|
17
|
+
|
|
18
|
+
## 3.0.5
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- added: IRoute isProtected
|
|
23
|
+
|
|
3
24
|
## 3.0.4
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -270,92 +270,6 @@ type IMeta = {
|
|
|
270
270
|
image?: IMedia;
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
type ICategory = IEntity & {
|
|
274
|
-
category?: IEquatable | ICategory;
|
|
275
|
-
id: IEquatable;
|
|
276
|
-
media?: IMedia;
|
|
277
|
-
order?: number;
|
|
278
|
-
slug: ILocalizable;
|
|
279
|
-
title: ILocalizable;
|
|
280
|
-
isHidden?: boolean;
|
|
281
|
-
};
|
|
282
|
-
type ICategoryItem = ICategory & {
|
|
283
|
-
items: ICategory[];
|
|
284
|
-
};
|
|
285
|
-
type ICategorized = IEntity & {
|
|
286
|
-
title: ILocalizable;
|
|
287
|
-
abstract?: string;
|
|
288
|
-
description?: string;
|
|
289
|
-
media?: IMedia;
|
|
290
|
-
meta?: IMeta;
|
|
291
|
-
components?: IComponent[];
|
|
292
|
-
category: IEquatable | ICategory;
|
|
293
|
-
slug: ILocalizable;
|
|
294
|
-
template?: string;
|
|
295
|
-
isDefault?: boolean;
|
|
296
|
-
useSplat?: boolean;
|
|
297
|
-
order?: number;
|
|
298
|
-
markets?: string[];
|
|
299
|
-
createdAt?: Date;
|
|
300
|
-
updatedAt?: Date;
|
|
301
|
-
_status?: string;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
type IClassNameValue = string | boolean | number | null | undefined;
|
|
305
|
-
type IClassNameCollection = Record<string, IClassNameValue>;
|
|
306
|
-
type IClassName = IClassNameCollection | IClassNameValue;
|
|
307
|
-
|
|
308
|
-
type IEmailConfig = IEntity & {
|
|
309
|
-
id: string;
|
|
310
|
-
subject: string;
|
|
311
|
-
fromAddress: string;
|
|
312
|
-
to: [{
|
|
313
|
-
address: string;
|
|
314
|
-
}];
|
|
315
|
-
cc: [{
|
|
316
|
-
address: string;
|
|
317
|
-
}];
|
|
318
|
-
bcc: [{
|
|
319
|
-
address: string;
|
|
320
|
-
}];
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
type FetchRequestOptions = {
|
|
324
|
-
method?: string;
|
|
325
|
-
headers?: {
|
|
326
|
-
[key: string]: string;
|
|
327
|
-
};
|
|
328
|
-
body?: Blob | BufferSource | FormData | URLSearchParams | string | ReadableStream;
|
|
329
|
-
mode?: 'cors' | 'no-cors' | 'same-origin';
|
|
330
|
-
credentials?: 'omit' | 'same-origin' | 'include';
|
|
331
|
-
cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached';
|
|
332
|
-
redirect?: 'follow' | 'error' | 'manual';
|
|
333
|
-
referrer?: string;
|
|
334
|
-
referrerPolicy?: 'no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url';
|
|
335
|
-
integrity?: string;
|
|
336
|
-
keepalive?: boolean;
|
|
337
|
-
signal?: AbortSignal;
|
|
338
|
-
};
|
|
339
|
-
type FetchService<T = unknown> = (url: string, options?: FetchRequestOptions, serviceOptions?: any) => Promise<T>;
|
|
340
|
-
type FetchError = any;
|
|
341
|
-
|
|
342
|
-
declare enum ImageStrategy {
|
|
343
|
-
None = "none",
|
|
344
|
-
Next = "next",
|
|
345
|
-
Mixer = "mixer",
|
|
346
|
-
Oven = "oven",
|
|
347
|
-
Token = "token",
|
|
348
|
-
Custom = "custom"
|
|
349
|
-
}
|
|
350
|
-
type IImageResize = {
|
|
351
|
-
q: number;
|
|
352
|
-
w: number;
|
|
353
|
-
h?: number;
|
|
354
|
-
x?: number;
|
|
355
|
-
y?: number;
|
|
356
|
-
src: string;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
273
|
type ILabel = IEntity & {
|
|
360
274
|
id: IEquatable;
|
|
361
275
|
text?: ILocalizable;
|
|
@@ -380,6 +294,113 @@ type IMarket = IEntity & {
|
|
|
380
294
|
isHidden?: boolean;
|
|
381
295
|
};
|
|
382
296
|
|
|
297
|
+
declare enum MenuCategoryStrategy {
|
|
298
|
+
Default = "default",// show hidden categories recursively,
|
|
299
|
+
ExcludeHidden = "exclude-hidden",
|
|
300
|
+
ExcludeRoute = "exclude-route",
|
|
301
|
+
ExcludeHiddenAndRoute = "exclude-hidden-and-route"
|
|
302
|
+
}
|
|
303
|
+
type IMenuBase = {
|
|
304
|
+
abstract?: ILocalizable;
|
|
305
|
+
extra?: ILocalizable;
|
|
306
|
+
customClass?: string;
|
|
307
|
+
id: IEquatable;
|
|
308
|
+
items?: IMenuItem[];
|
|
309
|
+
media?: IMedia;
|
|
310
|
+
title: ILocalizable;
|
|
311
|
+
};
|
|
312
|
+
type IMenuCategory = IMenuBase & {
|
|
313
|
+
type: 'category';
|
|
314
|
+
href: string;
|
|
315
|
+
category: IEquatable;
|
|
316
|
+
customTitle?: ILocalizable;
|
|
317
|
+
};
|
|
318
|
+
type IMenuGroup = IMenuBase & {
|
|
319
|
+
type: 'group';
|
|
320
|
+
};
|
|
321
|
+
type IMenuLink = IMenuBase & {
|
|
322
|
+
type: 'link';
|
|
323
|
+
href: string;
|
|
324
|
+
target: string;
|
|
325
|
+
};
|
|
326
|
+
type IMenuRoute = IMenuBase & {
|
|
327
|
+
type: 'route';
|
|
328
|
+
href: string;
|
|
329
|
+
page: IEquatable;
|
|
330
|
+
schema: string;
|
|
331
|
+
};
|
|
332
|
+
type IMenuPage = IMenuBase & {
|
|
333
|
+
type: 'page';
|
|
334
|
+
href: string;
|
|
335
|
+
page: IEquatable;
|
|
336
|
+
schema: string;
|
|
337
|
+
customTitle?: ILocalizable;
|
|
338
|
+
};
|
|
339
|
+
type IMenuCustom = Record<string, unknown> & {
|
|
340
|
+
id: IEquatable;
|
|
341
|
+
type: string;
|
|
342
|
+
};
|
|
343
|
+
type IMenuItem = IMenuCategory | IMenuGroup | IMenuLink | IMenuPage | IMenuRoute;
|
|
344
|
+
type IMenuHref = IMenuCategory | IMenuLink | IMenuPage | IMenuRoute;
|
|
345
|
+
declare function isMenuHref(item: IMenuItem): item is IMenuHref;
|
|
346
|
+
declare function isMenuCategory(item: IMenuItem): item is IMenuCategory;
|
|
347
|
+
declare function isMenuGroup(item: IMenuItem): item is IMenuGroup;
|
|
348
|
+
declare function isMenuLink(item: IMenuItem): item is IMenuLink;
|
|
349
|
+
declare function isMenuPage(item: IMenuItem): item is IMenuPage;
|
|
350
|
+
declare function isMenuRoute(item: IMenuItem): item is IMenuRoute;
|
|
351
|
+
type IMenu = {
|
|
352
|
+
id: string;
|
|
353
|
+
items: IMenuItem[];
|
|
354
|
+
};
|
|
355
|
+
type ILocalizedMenu = {
|
|
356
|
+
id: string;
|
|
357
|
+
items: ILocalized<IMenuItem>[];
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* this is the original menu model from cms
|
|
361
|
+
*/
|
|
362
|
+
type IUndecoratedMenuBase = {
|
|
363
|
+
abstract?: ILocalizable;
|
|
364
|
+
extra?: ILocalizable;
|
|
365
|
+
customClass?: string;
|
|
366
|
+
id?: string;
|
|
367
|
+
items: IUndecoratedMenuItem[];
|
|
368
|
+
markets?: string[];
|
|
369
|
+
media?: IMedia;
|
|
370
|
+
type: string;
|
|
371
|
+
};
|
|
372
|
+
type IUndecoratedMenuCategory = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
373
|
+
type: 'category';
|
|
374
|
+
category: string;
|
|
375
|
+
maxDepth?: number;
|
|
376
|
+
strategy?: MenuCategoryStrategy;
|
|
377
|
+
title?: ILocalizable;
|
|
378
|
+
};
|
|
379
|
+
type IUndecoratedMenuGroup = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
380
|
+
type: 'group';
|
|
381
|
+
title: ILocalizable;
|
|
382
|
+
};
|
|
383
|
+
type IUndecoratedMenuLink = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
384
|
+
type: 'link';
|
|
385
|
+
title: ILocalizable;
|
|
386
|
+
href: string;
|
|
387
|
+
target?: string;
|
|
388
|
+
};
|
|
389
|
+
type IUndecoratedMenuPage = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
390
|
+
type: 'page';
|
|
391
|
+
page: IPageRelation;
|
|
392
|
+
title?: ILocalizable;
|
|
393
|
+
};
|
|
394
|
+
type IUndecoratedMenuCustom = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
395
|
+
type: 'custom';
|
|
396
|
+
blockType: string;
|
|
397
|
+
};
|
|
398
|
+
type IUndecoratedMenuItem = IUndecoratedMenuCategory | IUndecoratedMenuGroup | IUndecoratedMenuLink | IUndecoratedMenuPage | IUndecoratedMenuCustom;
|
|
399
|
+
type IUndecoratedMenu = IEntity & {
|
|
400
|
+
id: string;
|
|
401
|
+
items: IUndecoratedMenuItem[];
|
|
402
|
+
};
|
|
403
|
+
|
|
383
404
|
type IRoute = {
|
|
384
405
|
category: IEquatable;
|
|
385
406
|
id: string;
|
|
@@ -391,6 +412,7 @@ type IRoute = {
|
|
|
391
412
|
title: string;
|
|
392
413
|
_status?: 'published' | 'draft';
|
|
393
414
|
isDefault?: boolean;
|
|
415
|
+
isProtected?: boolean;
|
|
394
416
|
isRoot?: boolean;
|
|
395
417
|
media?: {
|
|
396
418
|
url: string;
|
|
@@ -400,6 +422,7 @@ type IRoute = {
|
|
|
400
422
|
};
|
|
401
423
|
noindex?: boolean;
|
|
402
424
|
order?: number;
|
|
425
|
+
publicRedirect?: string;
|
|
403
426
|
template?: string;
|
|
404
427
|
updatedAt?: Date | string;
|
|
405
428
|
useSplat?: boolean;
|
|
@@ -422,6 +445,19 @@ type IRouteParams = Record<string, any> & {
|
|
|
422
445
|
market: string;
|
|
423
446
|
};
|
|
424
447
|
|
|
448
|
+
type ILayout<T extends IAppExtended = IAppExtended> = {
|
|
449
|
+
labels: ILabel[];
|
|
450
|
+
locale: string;
|
|
451
|
+
locales: ILocale[];
|
|
452
|
+
market: string;
|
|
453
|
+
markets: IMarket[];
|
|
454
|
+
app: IPrettify<IApp<T>>;
|
|
455
|
+
menu: Record<string, ILocalizedMenu>;
|
|
456
|
+
topLevelHrefs: Record<string, string>;
|
|
457
|
+
topLevelRoutes: Record<string, IRouteLink>;
|
|
458
|
+
tree?: IRouteLink;
|
|
459
|
+
};
|
|
460
|
+
|
|
425
461
|
/**
|
|
426
462
|
* Represents a listing item returned from the findMany method of a page collection.
|
|
427
463
|
* @template T - The type of the categorized item.
|
|
@@ -488,124 +524,92 @@ type IPageUnresolvedRelation = {
|
|
|
488
524
|
value: IEquatable | IEquatable[];
|
|
489
525
|
};
|
|
490
526
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
ExcludeHidden = "exclude-hidden",
|
|
494
|
-
ExcludeRoute = "exclude-route",
|
|
495
|
-
ExcludeHiddenAndRoute = "exclude-hidden-and-route"
|
|
496
|
-
}
|
|
497
|
-
type IMenuBase = {
|
|
498
|
-
abstract?: ILocalizable;
|
|
499
|
-
extra?: ILocalizable;
|
|
500
|
-
customClass?: string;
|
|
527
|
+
type ICategory = IEntity & {
|
|
528
|
+
category?: IEquatable | ICategory;
|
|
501
529
|
id: IEquatable;
|
|
502
|
-
items?: IMenuItem[];
|
|
503
530
|
media?: IMedia;
|
|
531
|
+
order?: number;
|
|
532
|
+
slug: ILocalizable;
|
|
504
533
|
title: ILocalizable;
|
|
534
|
+
isHidden?: boolean;
|
|
505
535
|
};
|
|
506
|
-
type
|
|
507
|
-
|
|
508
|
-
href: string;
|
|
509
|
-
category: IEquatable;
|
|
510
|
-
customTitle?: ILocalizable;
|
|
511
|
-
};
|
|
512
|
-
type IMenuGroup = IMenuBase & {
|
|
513
|
-
type: 'group';
|
|
514
|
-
};
|
|
515
|
-
type IMenuLink = IMenuBase & {
|
|
516
|
-
type: 'link';
|
|
517
|
-
href: string;
|
|
518
|
-
target: string;
|
|
519
|
-
};
|
|
520
|
-
type IMenuRoute = IMenuBase & {
|
|
521
|
-
type: 'route';
|
|
522
|
-
href: string;
|
|
523
|
-
page: IEquatable;
|
|
524
|
-
schema: string;
|
|
525
|
-
};
|
|
526
|
-
type IMenuPage = IMenuBase & {
|
|
527
|
-
type: 'page';
|
|
528
|
-
href: string;
|
|
529
|
-
page: IEquatable;
|
|
530
|
-
schema: string;
|
|
531
|
-
customTitle?: ILocalizable;
|
|
532
|
-
};
|
|
533
|
-
type IMenuCustom = Record<string, unknown> & {
|
|
534
|
-
id: IEquatable;
|
|
535
|
-
type: string;
|
|
536
|
-
};
|
|
537
|
-
type IMenuItem = IMenuCategory | IMenuGroup | IMenuLink | IMenuPage | IMenuRoute;
|
|
538
|
-
type IMenuHref = IMenuCategory | IMenuLink | IMenuPage | IMenuRoute;
|
|
539
|
-
declare function isMenuHref(item: IMenuItem): item is IMenuHref;
|
|
540
|
-
declare function isMenuCategory(item: IMenuItem): item is IMenuCategory;
|
|
541
|
-
declare function isMenuGroup(item: IMenuItem): item is IMenuGroup;
|
|
542
|
-
declare function isMenuLink(item: IMenuItem): item is IMenuLink;
|
|
543
|
-
declare function isMenuPage(item: IMenuItem): item is IMenuPage;
|
|
544
|
-
declare function isMenuRoute(item: IMenuItem): item is IMenuRoute;
|
|
545
|
-
type IMenu = {
|
|
546
|
-
id: string;
|
|
547
|
-
items: IMenuItem[];
|
|
548
|
-
};
|
|
549
|
-
type ILocalizedMenu = {
|
|
550
|
-
id: string;
|
|
551
|
-
items: ILocalized<IMenuItem>[];
|
|
536
|
+
type ICategoryItem = ICategory & {
|
|
537
|
+
items: ICategory[];
|
|
552
538
|
};
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
539
|
+
type ICategorized = IEntity & {
|
|
540
|
+
category: IEquatable | ICategory;
|
|
541
|
+
slug: ILocalizable;
|
|
542
|
+
title: ILocalizable;
|
|
543
|
+
_status?: string;
|
|
544
|
+
abstract?: string;
|
|
545
|
+
components?: IComponent[];
|
|
546
|
+
createdAt?: Date;
|
|
547
|
+
description?: string;
|
|
548
|
+
isDefault?: boolean;
|
|
549
|
+
isProtected?: boolean;
|
|
562
550
|
markets?: string[];
|
|
563
551
|
media?: IMedia;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
strategy?: MenuCategoryStrategy;
|
|
571
|
-
title?: ILocalizable;
|
|
572
|
-
};
|
|
573
|
-
type IUndecoratedMenuGroup = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
574
|
-
type: 'group';
|
|
575
|
-
title: ILocalizable;
|
|
576
|
-
};
|
|
577
|
-
type IUndecoratedMenuLink = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
578
|
-
type: 'link';
|
|
579
|
-
title: ILocalizable;
|
|
580
|
-
href: string;
|
|
581
|
-
target?: string;
|
|
582
|
-
};
|
|
583
|
-
type IUndecoratedMenuPage = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
584
|
-
type: 'page';
|
|
585
|
-
page: IPageRelation;
|
|
586
|
-
title?: ILocalizable;
|
|
587
|
-
};
|
|
588
|
-
type IUndecoratedMenuCustom = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
589
|
-
type: 'custom';
|
|
590
|
-
blockType: string;
|
|
552
|
+
meta?: IMeta;
|
|
553
|
+
order?: number;
|
|
554
|
+
publicRedirect?: IEquatable | IEntity | IPageUnresolvedRelation;
|
|
555
|
+
template?: string;
|
|
556
|
+
updatedAt?: Date;
|
|
557
|
+
useSplat?: boolean;
|
|
591
558
|
};
|
|
592
|
-
|
|
593
|
-
type
|
|
559
|
+
|
|
560
|
+
type IClassNameValue = string | boolean | number | null | undefined;
|
|
561
|
+
type IClassNameCollection = Record<string, IClassNameValue>;
|
|
562
|
+
type IClassName = IClassNameCollection | IClassNameValue;
|
|
563
|
+
|
|
564
|
+
type IEmailConfig = IEntity & {
|
|
594
565
|
id: string;
|
|
595
|
-
|
|
566
|
+
subject: string;
|
|
567
|
+
fromAddress: string;
|
|
568
|
+
to: [{
|
|
569
|
+
address: string;
|
|
570
|
+
}];
|
|
571
|
+
cc: [{
|
|
572
|
+
address: string;
|
|
573
|
+
}];
|
|
574
|
+
bcc: [{
|
|
575
|
+
address: string;
|
|
576
|
+
}];
|
|
596
577
|
};
|
|
597
578
|
|
|
598
|
-
type
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
579
|
+
type FetchRequestOptions = {
|
|
580
|
+
method?: string;
|
|
581
|
+
headers?: {
|
|
582
|
+
[key: string]: string;
|
|
583
|
+
};
|
|
584
|
+
body?: Blob | BufferSource | FormData | URLSearchParams | string | ReadableStream;
|
|
585
|
+
mode?: 'cors' | 'no-cors' | 'same-origin';
|
|
586
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
587
|
+
cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached';
|
|
588
|
+
redirect?: 'follow' | 'error' | 'manual';
|
|
589
|
+
referrer?: string;
|
|
590
|
+
referrerPolicy?: 'no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url';
|
|
591
|
+
integrity?: string;
|
|
592
|
+
keepalive?: boolean;
|
|
593
|
+
signal?: AbortSignal;
|
|
594
|
+
};
|
|
595
|
+
type FetchService<T = unknown> = (url: string, options?: FetchRequestOptions, serviceOptions?: any) => Promise<T>;
|
|
596
|
+
type FetchError = any;
|
|
597
|
+
|
|
598
|
+
declare enum ImageStrategy {
|
|
599
|
+
None = "none",
|
|
600
|
+
Next = "next",
|
|
601
|
+
Mixer = "mixer",
|
|
602
|
+
Oven = "oven",
|
|
603
|
+
Token = "token",
|
|
604
|
+
Custom = "custom"
|
|
605
|
+
}
|
|
606
|
+
type IImageResize = {
|
|
607
|
+
q: number;
|
|
608
|
+
w: number;
|
|
609
|
+
h?: number;
|
|
610
|
+
x?: number;
|
|
611
|
+
y?: number;
|
|
612
|
+
src: string;
|
|
609
613
|
};
|
|
610
614
|
|
|
611
615
|
type IUndecoratedNav = IUndecoratedMenuPage;
|
|
@@ -1576,4 +1580,5 @@ declare function asServerProps(props: any): any;
|
|
|
1576
1580
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
1577
1581
|
declare function merge(target: any, source: any): any;
|
|
1578
1582
|
|
|
1579
|
-
export {
|
|
1583
|
+
export { ImageStrategy, JsonService, Logger, LoggerLevel, MenuCategoryStrategy, RedirectReason, RouteStrategy, 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 };
|
|
1584
|
+
export type { DeepPartial, DeepRequired, DeepRequiredProps, Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, GlobalQueryParams, Headings, IAction, IActionEmailData, IAnchor, IApp, IAppExtended, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEmailConfig, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, IImageResize, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedMenu, ILocalizedString, IMarket, IMedia, IMediaImage, IMediaInfo, IMediaJson, IMediaPdf, IMediaType, IMediaVideo, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuHref, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, IMockCategory, IMockCollection, IMockComponent, IMockLabel, IMockLocale, IMockManyRelation, IMockMarket, IMockMedia, IMockMenu, IMockMenuBase, IMockMenuCategory, IMockMenuCustom, IMockMenuExtra, IMockMenuGroup, IMockMenuItem, IMockMenuLink, IMockMenuPage, IMockMeta, IMockPage, IMockRedirect, IMockRelation, IMockSingleRelation, IMockStore, IMockTemplate, INamedEntity, IOption, IOverride, IOverrideReturnValue, IOverrideValue, IPackages, IPage, IPageItem, 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, LiteralUnion, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RequireAtLeastOne, SchemaType, ServerSidePropsContext, Shift, ShiftUnion, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField };
|
package/dist/index.js
CHANGED
|
@@ -1535,8 +1535,16 @@ var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
|
|
|
1535
1535
|
return RouteStrategy2;
|
|
1536
1536
|
})(RouteStrategy || {});
|
|
1537
1537
|
var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "manual" /* Manual */;
|
|
1538
|
+
function getPublicRedirectId(value) {
|
|
1539
|
+
if (value && typeof value === "object" && "relationTo" in value && "value" in value) {
|
|
1540
|
+
const relationValue = value.value;
|
|
1541
|
+
return Array.isArray(relationValue) ? void 0 : asEntityId(relationValue);
|
|
1542
|
+
}
|
|
1543
|
+
return asEntityId(value);
|
|
1544
|
+
}
|
|
1538
1545
|
function collectRoutes(store, categories, markets, locales, medias) {
|
|
1539
1546
|
const routes = [];
|
|
1547
|
+
const redirects = /* @__PURE__ */ new Map();
|
|
1540
1548
|
if (locales.length > 0 && markets.length > 0) {
|
|
1541
1549
|
const rootCategory = getRootCategory(categories);
|
|
1542
1550
|
const activeLocales = locales.filter((locale) => locale.isActive !== false);
|
|
@@ -1588,6 +1596,7 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1588
1596
|
isDefault,
|
|
1589
1597
|
media,
|
|
1590
1598
|
order,
|
|
1599
|
+
isProtected,
|
|
1591
1600
|
template,
|
|
1592
1601
|
updatedAt,
|
|
1593
1602
|
useSplat
|
|
@@ -1609,6 +1618,13 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1609
1618
|
if (isDefault) {
|
|
1610
1619
|
route.isDefault = true;
|
|
1611
1620
|
}
|
|
1621
|
+
if (isProtected) {
|
|
1622
|
+
route.isProtected = true;
|
|
1623
|
+
const publicRedirect = getPublicRedirectId(item.publicRedirect);
|
|
1624
|
+
if (publicRedirect != null) {
|
|
1625
|
+
redirects.set(item.id, publicRedirect);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1612
1628
|
if (isRootCategory) {
|
|
1613
1629
|
route.isRoot = true;
|
|
1614
1630
|
}
|
|
@@ -1634,6 +1650,19 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1634
1650
|
});
|
|
1635
1651
|
}
|
|
1636
1652
|
});
|
|
1653
|
+
const routeByPageContext = /* @__PURE__ */ new Map();
|
|
1654
|
+
for (const route of routes) {
|
|
1655
|
+
routeByPageContext.set(JSON.stringify([route.page, route.market, route.locale]), route);
|
|
1656
|
+
}
|
|
1657
|
+
for (const route of routes) {
|
|
1658
|
+
const targetPage = redirects.get(route.page);
|
|
1659
|
+
if (targetPage != null) {
|
|
1660
|
+
const target = routeByPageContext.get(JSON.stringify([targetPage, route.market, route.locale]));
|
|
1661
|
+
if (target) {
|
|
1662
|
+
route.publicRedirect = target.id;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1637
1666
|
}
|
|
1638
1667
|
return routes;
|
|
1639
1668
|
}
|
|
@@ -1669,7 +1698,7 @@ function eachCategorized(store, callback) {
|
|
|
1669
1698
|
}
|
|
1670
1699
|
}
|
|
1671
1700
|
function findRouteOfCategory(routes, categoryId, market, locale) {
|
|
1672
|
-
const findRoute = market && locale ? (route2) => route2.isDefault && route2.resolvedCategory === categoryId && route2.market === market && route2.locale === locale : (route2) => route2.isDefault && route2.resolvedCategory === categoryId;
|
|
1701
|
+
const findRoute = market && locale ? ((route2) => route2.isDefault && route2.resolvedCategory === categoryId && route2.market === market && route2.locale === locale) : ((route2) => route2.isDefault && route2.resolvedCategory === categoryId);
|
|
1673
1702
|
const route = routes.find(findRoute);
|
|
1674
1703
|
return route;
|
|
1675
1704
|
}
|
|
@@ -1716,7 +1745,7 @@ function getRouteHref(segments, market, locale, markets, locales) {
|
|
|
1716
1745
|
return `${prefix}${href}`;
|
|
1717
1746
|
}
|
|
1718
1747
|
function hasMarket(item, market) {
|
|
1719
|
-
return !item.markets || item.markets.length === 0 || item.markets.includes(market.id);
|
|
1748
|
+
return !item.markets || item.markets.length === 0 || item.markets.map((x) => asEquatable(x)).includes(market.id);
|
|
1720
1749
|
}
|
|
1721
1750
|
export {
|
|
1722
1751
|
ImageStrategy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-core",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Core module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git://github.com/websolutespa/bom.git"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"lint": "eslint
|
|
16
|
+
"lint": "eslint .",
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"test-watch": "vitest",
|
|
19
19
|
"coverage:integration": "npm run test -- --coverage.enabled --coverage.provider=istanbul --coverage.all",
|
|
@@ -29,17 +29,18 @@
|
|
|
29
29
|
"peerDependencies": {},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.33",
|
|
32
|
-
"@types/react": "19.2.
|
|
33
|
-
"@
|
|
34
|
-
"@websolutespa/
|
|
35
|
-
"@websolutespa/
|
|
36
|
-
"
|
|
32
|
+
"@types/react": "19.2.18",
|
|
33
|
+
"@vitest/coverage-istanbul": "5.0.5",
|
|
34
|
+
"@websolutespa/eslint-config": "^3.1.0",
|
|
35
|
+
"@websolutespa/test": "^3.1.0",
|
|
36
|
+
"@websolutespa/tsconfig": "^3.1.0",
|
|
37
|
+
"eslint": "10.13.0",
|
|
37
38
|
"npm-run-all": "4.1.5",
|
|
38
39
|
"raw-loader": "4.0.2",
|
|
39
|
-
"react": "19.2.
|
|
40
|
-
"tsup": "
|
|
41
|
-
"typescript": "
|
|
42
|
-
"vitest": "
|
|
40
|
+
"react": "19.2.9",
|
|
41
|
+
"tsup": "9.0.0",
|
|
42
|
+
"typescript": "6.0.3",
|
|
43
|
+
"vitest": "5.0.5"
|
|
43
44
|
},
|
|
44
45
|
"publishConfig": {
|
|
45
46
|
"access": "public"
|