@websolutespa/bom-core 1.7.6 → 1.7.8
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 +13 -0
- package/dist/index.d.ts +78 -12
- package/dist/index.js +48 -1
- package/dist/index.mjs +44 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @websolutespa/bom-core
|
|
2
2
|
|
|
3
|
+
## 1.7.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixing: downgrading eslint to v8.56.0
|
|
8
|
+
|
|
9
|
+
## 1.7.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Modified: Media resolveMediaType
|
|
14
|
+
- Added: isMediaImage, isMediaVideo, isMediaJson, isMediaPdf
|
|
15
|
+
|
|
3
16
|
## 1.7.6
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -102,11 +102,25 @@ type IEndUser = UserWithRoles & {
|
|
|
102
102
|
|
|
103
103
|
type IAction = Record<string, unknown> & {
|
|
104
104
|
id: string;
|
|
105
|
+
collection: string;
|
|
105
106
|
consentPreferences: IConsentPreference[];
|
|
107
|
+
consentsRevoked?: boolean;
|
|
108
|
+
consentsRevokedDate?: string | Date;
|
|
106
109
|
endUser: IEndUser;
|
|
107
110
|
loggedEndUser?: IEndUser;
|
|
108
111
|
email?: string;
|
|
109
112
|
password?: string;
|
|
113
|
+
createdAt?: string;
|
|
114
|
+
updatedAt?: string;
|
|
115
|
+
};
|
|
116
|
+
type IActionEmailData = {
|
|
117
|
+
id?: string;
|
|
118
|
+
from?: string;
|
|
119
|
+
to?: string;
|
|
120
|
+
cc?: string;
|
|
121
|
+
bcc?: string;
|
|
122
|
+
subject: string;
|
|
123
|
+
html: string;
|
|
110
124
|
};
|
|
111
125
|
|
|
112
126
|
type IAnchor = {
|
|
@@ -148,21 +162,58 @@ type IFeatureType = {
|
|
|
148
162
|
features?: IFeature[];
|
|
149
163
|
};
|
|
150
164
|
|
|
151
|
-
type IMediaType = 'image' | 'video' | string;
|
|
152
|
-
type
|
|
153
|
-
id
|
|
154
|
-
abstract?: string;
|
|
165
|
+
type IMediaType = 'image' | 'video' | 'json' | 'pdf' | string;
|
|
166
|
+
type IMediaInfo = {
|
|
167
|
+
id: string;
|
|
155
168
|
alt?: string;
|
|
156
|
-
|
|
157
|
-
mimeType
|
|
158
|
-
|
|
169
|
+
filename: string;
|
|
170
|
+
mimeType: string;
|
|
171
|
+
filesize: number;
|
|
172
|
+
createdAt: Date | string;
|
|
173
|
+
updatedAt?: Date | string;
|
|
174
|
+
url: string;
|
|
175
|
+
};
|
|
176
|
+
type IMedia = Record<string, unknown> & Partial<IMediaInfo> & {
|
|
159
177
|
title?: string;
|
|
178
|
+
abstract?: string;
|
|
160
179
|
type: IMediaType;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
src: string;
|
|
181
|
+
media?: IMedia;
|
|
182
|
+
width?: string | number;
|
|
183
|
+
height?: string | number;
|
|
164
184
|
};
|
|
165
|
-
|
|
185
|
+
type IMediaImage = Omit<IMedia, 'type'> & {
|
|
186
|
+
type: 'image';
|
|
187
|
+
};
|
|
188
|
+
type IMediaVideo = Omit<IMedia, 'type'> & {
|
|
189
|
+
type: 'video';
|
|
190
|
+
};
|
|
191
|
+
type IMediaJson = Omit<IMedia, 'type'> & {
|
|
192
|
+
type: 'json';
|
|
193
|
+
};
|
|
194
|
+
type IMediaPdf = Omit<IMedia, 'type'> & {
|
|
195
|
+
type: 'pdf';
|
|
196
|
+
};
|
|
197
|
+
declare function resolveMediaType(media: {
|
|
198
|
+
type?: string;
|
|
199
|
+
mimeType?: string;
|
|
200
|
+
}): IMediaType;
|
|
201
|
+
declare function isMediaImage(media: {
|
|
202
|
+
type?: string;
|
|
203
|
+
mimeType?: string;
|
|
204
|
+
}): media is IMediaImage;
|
|
205
|
+
declare function isMediaVideo(media: {
|
|
206
|
+
type?: string;
|
|
207
|
+
mimeType?: string;
|
|
208
|
+
}): media is IMediaVideo;
|
|
209
|
+
declare function isMediaJson(media: {
|
|
210
|
+
type?: string;
|
|
211
|
+
mimeType?: string;
|
|
212
|
+
}): media is IMediaJson;
|
|
213
|
+
declare function isMediaPdf(media: {
|
|
214
|
+
type?: string;
|
|
215
|
+
mimeType?: string;
|
|
216
|
+
}): media is IMediaPdf;
|
|
166
217
|
|
|
167
218
|
type IMeta = {
|
|
168
219
|
title?: string;
|
|
@@ -204,6 +255,21 @@ type IClassNameValue = string | boolean | number | null | undefined;
|
|
|
204
255
|
type IClassNameCollection = Record<string, IClassNameValue>;
|
|
205
256
|
type IClassName = IClassNameCollection | IClassNameValue;
|
|
206
257
|
|
|
258
|
+
type IEmailConfig = IEntity & {
|
|
259
|
+
id: string;
|
|
260
|
+
subject: string;
|
|
261
|
+
fromAddress: string;
|
|
262
|
+
to: [{
|
|
263
|
+
address: string;
|
|
264
|
+
}];
|
|
265
|
+
cc: [{
|
|
266
|
+
address: string;
|
|
267
|
+
}];
|
|
268
|
+
bcc: [{
|
|
269
|
+
address: string;
|
|
270
|
+
}];
|
|
271
|
+
};
|
|
272
|
+
|
|
207
273
|
type FetchRequestOptions = {
|
|
208
274
|
method?: string;
|
|
209
275
|
headers?: {
|
|
@@ -738,4 +804,4 @@ declare function asServerProps(props: any): any;
|
|
|
738
804
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
739
805
|
declare function merge(target: any, source: any): any;
|
|
740
806
|
|
|
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 };
|
|
807
|
+
export { DeepPartial, Dynamic, FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, IAction, IActionEmailData, IAnchor, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IComponent, IConfig, IConsentPreference, IContextBaseParams, IContextParams, IDecoratedNav, IEmailConfig, IEndUser, IEntity, IEquatable, IFeature, IFeatureType, ILabel, ILayout, ILegalNotice, ILetter, ILocale, ILocaleId, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaImage, IMediaInfo, IMediaJson, IMediaPdf, IMediaType, IMediaVideo, 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, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, 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
|
@@ -79,6 +79,10 @@ __export(src_exports, {
|
|
|
79
79
|
isHeaders: () => isHeaders,
|
|
80
80
|
isIncomingHttpHeaders: () => isIncomingHttpHeaders,
|
|
81
81
|
isLocalizedString: () => isLocalizedString,
|
|
82
|
+
isMediaImage: () => isMediaImage,
|
|
83
|
+
isMediaJson: () => isMediaJson,
|
|
84
|
+
isMediaPdf: () => isMediaPdf,
|
|
85
|
+
isMediaVideo: () => isMediaVideo,
|
|
82
86
|
isMenuHref: () => isMenuHref,
|
|
83
87
|
isNotNullString: () => isNotNullString,
|
|
84
88
|
isObject: () => isObject,
|
|
@@ -1214,7 +1218,46 @@ function textToSlug(title) {
|
|
|
1214
1218
|
|
|
1215
1219
|
// src/types/media.ts
|
|
1216
1220
|
function resolveMediaType(media) {
|
|
1217
|
-
|
|
1221
|
+
if (typeof media.type === "string" && media.type.length > 0) {
|
|
1222
|
+
return media.type;
|
|
1223
|
+
}
|
|
1224
|
+
if (typeof media.mimeType === "string" && media.mimeType.length > 0) {
|
|
1225
|
+
const mime = media.mimeType.split("/");
|
|
1226
|
+
return mime[0] === "application" ? mime[1] : mime[0];
|
|
1227
|
+
}
|
|
1228
|
+
return "unknown";
|
|
1229
|
+
}
|
|
1230
|
+
function isMediaImage(media) {
|
|
1231
|
+
const type = resolveMediaType(media);
|
|
1232
|
+
if (type === "image") {
|
|
1233
|
+
media.type = type;
|
|
1234
|
+
return true;
|
|
1235
|
+
}
|
|
1236
|
+
return false;
|
|
1237
|
+
}
|
|
1238
|
+
function isMediaVideo(media) {
|
|
1239
|
+
const type = resolveMediaType(media);
|
|
1240
|
+
if (type === "video") {
|
|
1241
|
+
media.type = type;
|
|
1242
|
+
return true;
|
|
1243
|
+
}
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
1246
|
+
function isMediaJson(media) {
|
|
1247
|
+
const type = resolveMediaType(media);
|
|
1248
|
+
if (type === "json") {
|
|
1249
|
+
media.type = type;
|
|
1250
|
+
return true;
|
|
1251
|
+
}
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
function isMediaPdf(media) {
|
|
1255
|
+
const type = resolveMediaType(media);
|
|
1256
|
+
if (type === "pdf") {
|
|
1257
|
+
media.type = type;
|
|
1258
|
+
return true;
|
|
1259
|
+
}
|
|
1260
|
+
return false;
|
|
1218
1261
|
}
|
|
1219
1262
|
|
|
1220
1263
|
// src/types/menu.ts
|
|
@@ -1291,6 +1334,10 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
|
|
|
1291
1334
|
isHeaders,
|
|
1292
1335
|
isIncomingHttpHeaders,
|
|
1293
1336
|
isLocalizedString,
|
|
1337
|
+
isMediaImage,
|
|
1338
|
+
isMediaJson,
|
|
1339
|
+
isMediaPdf,
|
|
1340
|
+
isMediaVideo,
|
|
1294
1341
|
isMenuHref,
|
|
1295
1342
|
isNotNullString,
|
|
1296
1343
|
isObject,
|
package/dist/index.mjs
CHANGED
|
@@ -1090,7 +1090,46 @@ function textToSlug(title) {
|
|
|
1090
1090
|
|
|
1091
1091
|
// src/types/media.ts
|
|
1092
1092
|
function resolveMediaType(media) {
|
|
1093
|
-
|
|
1093
|
+
if (typeof media.type === "string" && media.type.length > 0) {
|
|
1094
|
+
return media.type;
|
|
1095
|
+
}
|
|
1096
|
+
if (typeof media.mimeType === "string" && media.mimeType.length > 0) {
|
|
1097
|
+
const mime = media.mimeType.split("/");
|
|
1098
|
+
return mime[0] === "application" ? mime[1] : mime[0];
|
|
1099
|
+
}
|
|
1100
|
+
return "unknown";
|
|
1101
|
+
}
|
|
1102
|
+
function isMediaImage(media) {
|
|
1103
|
+
const type = resolveMediaType(media);
|
|
1104
|
+
if (type === "image") {
|
|
1105
|
+
media.type = type;
|
|
1106
|
+
return true;
|
|
1107
|
+
}
|
|
1108
|
+
return false;
|
|
1109
|
+
}
|
|
1110
|
+
function isMediaVideo(media) {
|
|
1111
|
+
const type = resolveMediaType(media);
|
|
1112
|
+
if (type === "video") {
|
|
1113
|
+
media.type = type;
|
|
1114
|
+
return true;
|
|
1115
|
+
}
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
function isMediaJson(media) {
|
|
1119
|
+
const type = resolveMediaType(media);
|
|
1120
|
+
if (type === "json") {
|
|
1121
|
+
media.type = type;
|
|
1122
|
+
return true;
|
|
1123
|
+
}
|
|
1124
|
+
return false;
|
|
1125
|
+
}
|
|
1126
|
+
function isMediaPdf(media) {
|
|
1127
|
+
const type = resolveMediaType(media);
|
|
1128
|
+
if (type === "pdf") {
|
|
1129
|
+
media.type = type;
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
return false;
|
|
1094
1133
|
}
|
|
1095
1134
|
|
|
1096
1135
|
// src/types/menu.ts
|
|
@@ -1166,6 +1205,10 @@ export {
|
|
|
1166
1205
|
isHeaders,
|
|
1167
1206
|
isIncomingHttpHeaders,
|
|
1168
1207
|
isLocalizedString,
|
|
1208
|
+
isMediaImage,
|
|
1209
|
+
isMediaJson,
|
|
1210
|
+
isMediaPdf,
|
|
1211
|
+
isMediaVideo,
|
|
1169
1212
|
isMenuHref,
|
|
1170
1213
|
isNotNullString,
|
|
1171
1214
|
isObject,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"description": "Core module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@websolutespa/bom-cli": "*",
|
|
33
33
|
"@websolutespa/test": "*",
|
|
34
34
|
"@websolutespa/tsconfig": "*",
|
|
35
|
-
"eslint": "^
|
|
35
|
+
"eslint": "^8.56.0",
|
|
36
36
|
"eslint-config-websolute": "*",
|
|
37
37
|
"npm-run-all": "^4.1.5",
|
|
38
38
|
"raw-loader": "^4.0.2",
|