@websolutespa/bom-core 4.0.0-next.1 → 4.0.0-next.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 +21 -0
- package/README.md +11 -11
- package/dist/index.d.ts +13 -12
- package/dist/index.js +20 -10
- package/package.json +23 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @websolutespa/bom-core
|
|
2
2
|
|
|
3
|
+
## 4.0.0-next.6
|
|
4
|
+
|
|
3
5
|
## 4.0.0-next.1
|
|
4
6
|
|
|
5
7
|
### Patch Changes
|
|
@@ -15,6 +17,25 @@
|
|
|
15
17
|
|
|
16
18
|
- Next: support of the bom-next app package
|
|
17
19
|
|
|
20
|
+
## 3.1.2
|
|
21
|
+
|
|
22
|
+
## 3.1.1
|
|
23
|
+
|
|
24
|
+
## 3.1.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- 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`
|
|
29
|
+
- 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
|
|
30
|
+
- payload-plugin-storage: `AZURE_STORAGE_CONTAINER_ACCESS` (`private` default since payload 3.90, `blob`, `container`) for containers created by the plugin
|
|
31
|
+
- mixer web: `images.qualities` includes `IMAGE_QUALITY` (next 16 defaults to `[75]`)
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 12b6e2f: - test: replace the jest presets with shared vitest configurations, `@websolutespa/test/vitest` (`defineNodeConfig`, `defineDomConfig`, `definePayloadConfig`); drop jest dependencies
|
|
36
|
+
- declare every imported package and script binary in the package that uses it (no more reliance on hoisting), drop unused dependencies
|
|
37
|
+
- bom-mixer-checkout: `useCart.add` no longer mutates the previous cart state
|
|
38
|
+
|
|
18
39
|
## 3.0.5
|
|
19
40
|
|
|
20
41
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @websolutespa/bom-core
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/js/%40websolutespa%2Fbom-core)
|
|
4
|
-
|
|
5
|
-
[](https://shields.io/)
|
|
6
|
-
|
|
7
|
-
Core module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
#####
|
|
1
|
+
# @websolutespa/bom-core
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40websolutespa%2Fbom-core)
|
|
4
|
+
|
|
5
|
+
[](https://shields.io/)
|
|
6
|
+
|
|
7
|
+
Core module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
##### _this library is for internal usage and not production ready_
|
package/dist/index.d.ts
CHANGED
|
@@ -60,18 +60,18 @@ type IPrettify<T> = {
|
|
|
60
60
|
[K in keyof T]: T[K];
|
|
61
61
|
} & {};
|
|
62
62
|
type IOverrideReturnValue<T, FromType, ToType> = T extends Record<string, unknown> ? IPrettify<IOverride<T, FromType, ToType>> : T;
|
|
63
|
-
type IOverrideValue<T, FromType, ToType> = T extends FromType ?
|
|
63
|
+
type IOverrideValue<T, FromType, ToType> = T extends FromType ? keyof T extends keyof FromType ? ToType : IOverrideReturnValue<T, FromType, ToType> : IOverrideReturnValue<T, FromType, ToType>;
|
|
64
64
|
type IOverride<T, FromType, ToType> = {
|
|
65
65
|
[Property in keyof T]: IOverrideValue<T[Property], FromType, ToType>;
|
|
66
66
|
};
|
|
67
67
|
type RequireAtLeastOne<T> = {
|
|
68
68
|
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
|
|
69
69
|
}[keyof T];
|
|
70
|
-
type Shift<T extends any[]> = ((...t: T) => any) extends (
|
|
70
|
+
type Shift<T extends any[]> = ((...t: T) => any) extends (first: any, ...rest: infer Rest) => any ? Rest : never;
|
|
71
71
|
type ShiftUnion<P extends PropertyKey, T extends any[]> = T extends any[] ? T[0] extends P ? Shift<T> : never : never;
|
|
72
|
-
type DeepRequiredProps<T, P extends string[]> = T extends object ?
|
|
72
|
+
type DeepRequiredProps<T, P extends string[]> = T extends object ? Omit<T, Extract<keyof T, P[0]>> & Required<{
|
|
73
73
|
[K in Extract<keyof T, P[0]>]: NonNullable<DeepRequiredProps<T[K], ShiftUnion<K, P>>>;
|
|
74
|
-
}>
|
|
74
|
+
}> : T;
|
|
75
75
|
type DeepRequired<T> = {
|
|
76
76
|
[K in keyof T]: Required<DeepRequired<T[K]>>;
|
|
77
77
|
};
|
|
@@ -997,9 +997,9 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
|
997
997
|
protected whereItems_<B extends T = T>(items: B[], where?: Where, limit?: number): B[];
|
|
998
998
|
protected sortCollection_<B extends T = T>(items: B[], sort?: string): B[];
|
|
999
999
|
protected limitCollection_<B extends T = T>(items: B[], limit?: number): B[];
|
|
1000
|
-
protected paginatedItems_<B extends T = T>(items: B[], page?: number, limit?: number):
|
|
1000
|
+
protected paginatedItems_<B extends T = T>(items: B[], page?: number, limit?: number): {
|
|
1001
1001
|
docs: B[];
|
|
1002
|
-
} & Pagination
|
|
1002
|
+
} & Pagination;
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
declare const defaultLocale: string;
|
|
@@ -1410,7 +1410,7 @@ declare function asSortedOptions<T extends INamedEntity = INamedEntity>(items: T
|
|
|
1410
1410
|
* kebab-case
|
|
1411
1411
|
* snake_case
|
|
1412
1412
|
* char*case
|
|
1413
|
-
**/
|
|
1413
|
+
**/
|
|
1414
1414
|
declare function unknownCaseToPascalCase(unknownCase: string): string;
|
|
1415
1415
|
declare function pascalCaseToCamelCase(pascalCase: string): string;
|
|
1416
1416
|
declare function pascalCaseToCharCase(pascalCase: string, char?: string): string;
|
|
@@ -1472,10 +1472,10 @@ type ListItem<T> = {
|
|
|
1472
1472
|
};
|
|
1473
1473
|
}[keyof T];
|
|
1474
1474
|
/**
|
|
1475
|
-
* Helper to produce an array of enum descriptors.
|
|
1476
|
-
* @param enumeration Enumeration object.
|
|
1477
|
-
* @param separatorRegex Regex that would catch the separator in your enum key.
|
|
1478
|
-
*/
|
|
1475
|
+
* Helper to produce an array of enum descriptors.
|
|
1476
|
+
* @param enumeration Enumeration object.
|
|
1477
|
+
* @param separatorRegex Regex that would catch the separator in your enum key.
|
|
1478
|
+
*/
|
|
1479
1479
|
declare function enumToList<T extends Record<string, number | string>>(enumeration: T, separatorRegex?: RegExp): ListItem<T>[];
|
|
1480
1480
|
|
|
1481
1481
|
/**
|
|
@@ -1600,4 +1600,5 @@ declare function asServerProps(props: any): any;
|
|
|
1600
1600
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
1601
1601
|
declare function merge(target: any, source: any): any;
|
|
1602
1602
|
|
|
1603
|
-
export {
|
|
1603
|
+
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, getMetaRobots, 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 };
|
|
1604
|
+
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
|
@@ -117,10 +117,7 @@ function pascalCaseToCamelCase(pascalCase) {
|
|
|
117
117
|
return camelCase;
|
|
118
118
|
}
|
|
119
119
|
function pascalCaseToCharCase(pascalCase, char = "-") {
|
|
120
|
-
const charCase = pascalCase.replace(
|
|
121
|
-
/([A-Z]+)/g,
|
|
122
|
-
(m, g1, index) => (index > 0 ? char : "") + m
|
|
123
|
-
).toLowerCase();
|
|
120
|
+
const charCase = pascalCase.replace(/([A-Z]+)/g, (m, g1, index) => (index > 0 ? char : "") + m).toLowerCase();
|
|
124
121
|
return charCase;
|
|
125
122
|
}
|
|
126
123
|
function pascalCaseToKebabCase(pascalCase) {
|
|
@@ -1291,7 +1288,10 @@ function isLocalizedString(value) {
|
|
|
1291
1288
|
let isLocalizedString2 = false;
|
|
1292
1289
|
if (value && !Array.isArray(value) && typeof value === "object") {
|
|
1293
1290
|
const matchKeys = Object.keys(value).reduce((p, c) => p && /^(\w{2})(-\w{2})?$/.test(c), true);
|
|
1294
|
-
const matchValues = Object.values(value).reduce(
|
|
1291
|
+
const matchValues = Object.values(value).reduce(
|
|
1292
|
+
(p, c) => p && (typeof c === "string" || !c),
|
|
1293
|
+
true
|
|
1294
|
+
);
|
|
1295
1295
|
isLocalizedString2 = Boolean(matchKeys && matchValues);
|
|
1296
1296
|
}
|
|
1297
1297
|
return isLocalizedString2;
|
|
@@ -1559,9 +1559,15 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1559
1559
|
const rootCategory = getRootCategory(categories);
|
|
1560
1560
|
const activeLocales = locales.filter((locale) => locale.isActive !== false);
|
|
1561
1561
|
const activeMarkets = markets.filter((market) => market.isActive !== false);
|
|
1562
|
-
const categoryById = new Map(
|
|
1563
|
-
|
|
1564
|
-
|
|
1562
|
+
const categoryById = new Map(
|
|
1563
|
+
categories.filter((category) => typeof category.id === "string").map((category) => [category.id, category])
|
|
1564
|
+
);
|
|
1565
|
+
const localeById = new Map(
|
|
1566
|
+
activeLocales.filter((locale) => typeof locale.id === "string").map((locale) => [locale.id, locale])
|
|
1567
|
+
);
|
|
1568
|
+
const mediaById = new Map(
|
|
1569
|
+
(medias || []).filter((media) => typeof media.id === "string").map((media) => [media.id, media])
|
|
1570
|
+
);
|
|
1565
1571
|
const marketLocales = activeMarkets.flatMap((market) => {
|
|
1566
1572
|
const localesForMarket = market.languages && market.languages.length > 0 ? market.languages.map((language) => localeById.get(String(asEntityId(language)))).filter((locale) => locale !== void 0) : activeLocales;
|
|
1567
1573
|
return localesForMarket.map((locale) => ({ market, locale }));
|
|
@@ -1588,7 +1594,9 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1588
1594
|
};
|
|
1589
1595
|
eachCategorized(store, (item, key) => {
|
|
1590
1596
|
const segments = getSegments(item);
|
|
1591
|
-
const visibleSegments = segments.filter(
|
|
1597
|
+
const visibleSegments = segments.filter(
|
|
1598
|
+
(x) => x.id !== rootCategory?.id && Boolean(x.isHidden) === false
|
|
1599
|
+
);
|
|
1592
1600
|
const visibleCategory = visibleSegments.length > 0 ? visibleSegments[visibleSegments.length - 1] : rootCategory;
|
|
1593
1601
|
if (visibleCategory) {
|
|
1594
1602
|
const slugs = visibleSegments.map((x) => ({ slug: x.slug }));
|
|
@@ -1667,7 +1675,9 @@ function collectRoutes(store, categories, markets, locales, medias) {
|
|
|
1667
1675
|
for (const route of routes) {
|
|
1668
1676
|
const targetPage = redirects.get(route.page);
|
|
1669
1677
|
if (targetPage != null) {
|
|
1670
|
-
const target = routeByPageContext.get(
|
|
1678
|
+
const target = routeByPageContext.get(
|
|
1679
|
+
JSON.stringify([targetPage, route.market, route.locale])
|
|
1680
|
+
);
|
|
1671
1681
|
if (target) {
|
|
1672
1682
|
route.publicRedirect = target.id;
|
|
1673
1683
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-core",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.6",
|
|
4
4
|
"description": "Core module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -12,34 +12,26 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git://github.com/websolutespa/bom.git"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"lint": "eslint *.ts*",
|
|
17
|
-
"test": "vitest run",
|
|
18
|
-
"test-watch": "vitest",
|
|
19
|
-
"coverage:integration": "npm run test -- --coverage.enabled --coverage.provider=istanbul --coverage.all",
|
|
20
|
-
"coverage": "run-s -c --silent coverage:*",
|
|
21
|
-
"compile": "tsup ./src/index.ts --format esm --dts --external react",
|
|
22
|
-
"prepack": "bom prepack",
|
|
23
|
-
"postpack": "bom postpack",
|
|
24
|
-
"types": "tsc --noemit"
|
|
25
|
-
},
|
|
26
15
|
"dependencies": {
|
|
27
16
|
"pluralize": "8.0.0"
|
|
28
17
|
},
|
|
29
18
|
"peerDependencies": {},
|
|
30
19
|
"devDependencies": {
|
|
20
|
+
"@types/node": "24.19.2",
|
|
31
21
|
"@types/pluralize": "0.0.33",
|
|
32
|
-
"@types/react": "19.2.
|
|
33
|
-
"@
|
|
34
|
-
"@websolutespa/
|
|
35
|
-
"@websolutespa/
|
|
36
|
-
"
|
|
22
|
+
"@types/react": "19.2.18",
|
|
23
|
+
"@vitest/coverage-istanbul": "5.0.5",
|
|
24
|
+
"@websolutespa/eslint-config": "^4.0.0-next.6",
|
|
25
|
+
"@websolutespa/test": "^4.0.0-next.6",
|
|
26
|
+
"@websolutespa/tsconfig": "^4.0.0-next.6",
|
|
37
27
|
"npm-run-all": "4.1.5",
|
|
28
|
+
"oxlint": "1.89.0",
|
|
29
|
+
"oxlint-tsgolint": "7.0.2005",
|
|
38
30
|
"raw-loader": "4.0.2",
|
|
39
|
-
"react": "19.2.
|
|
40
|
-
"tsup": "
|
|
41
|
-
"typescript": "
|
|
42
|
-
"vitest": "
|
|
31
|
+
"react": "19.2.9",
|
|
32
|
+
"tsup": "9.0.0",
|
|
33
|
+
"typescript": "6.0.3",
|
|
34
|
+
"vitest": "5.0.5"
|
|
43
35
|
},
|
|
44
36
|
"publishConfig": {
|
|
45
37
|
"access": "public"
|
|
@@ -57,5 +49,14 @@
|
|
|
57
49
|
},
|
|
58
50
|
"types": "./dist/index.d.ts",
|
|
59
51
|
"main": "./dist/index.js",
|
|
60
|
-
"module": "./dist/index.js"
|
|
52
|
+
"module": "./dist/index.js",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"lint": "oxlint --type-aware",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test-watch": "vitest",
|
|
57
|
+
"coverage:integration": "vitest run --coverage.enabled --coverage.provider=istanbul --coverage.all",
|
|
58
|
+
"coverage": "run-s -c --silent coverage:*",
|
|
59
|
+
"compile": "tsup ./src/index.ts --format esm --dts --external react",
|
|
60
|
+
"types": "tsc --noemit"
|
|
61
|
+
}
|
|
61
62
|
}
|