@websolutespa/bom-core 1.8.4 → 1.8.5
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 +6 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +14 -8
- package/dist/index.mjs +12 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
|
|
|
2
2
|
import { ParsedUrlQuery } from 'querystring';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
+
declare function base64ToString(text: string): string;
|
|
6
|
+
declare function stringToBase64(text: string): string;
|
|
7
|
+
|
|
5
8
|
type Json = string | number | boolean | null | Json[] | {
|
|
6
9
|
[key: string]: Json;
|
|
7
10
|
};
|
|
@@ -1300,4 +1303,4 @@ declare function asServerProps(props: any): any;
|
|
|
1300
1303
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
1301
1304
|
declare function merge(target: any, source: any): any;
|
|
1302
1305
|
|
|
1303
|
-
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, IImageResize, 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, 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, ImageStrategy, Json, JsonService, LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RequireAtLeastOne, RouteStrategy, SchemaType, ServerSidePropsContext, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, encryptImageToken, enumToList, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuHref, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
|
|
1306
|
+
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, IImageResize, 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, 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, ImageStrategy, Json, JsonService, LiteralUnion, Logger, LoggerLevel, MenuCategoryStrategy, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, Primitive, QueryParams, RedirectReason, RequireAtLeastOne, RouteStrategy, SchemaType, ServerSidePropsContext, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, arrayShuffle, asCategoryId, asEntityId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, base64ToString, camelToSnakeCase, cloneItem, collectFeatureTypes, collectFeatureTypes__, collectOptions, collectRoutes, consoleWarn, decryptImageResize, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, encryptImageToken, enumToList, findCategoryInCategories, findChildCategories, findRouteOfCategory, findRoutesOfCategory, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getHost, getIsDevelopment, getIsProduction, getOrigin, getParentCategoriesById, getParentCategory, getProto, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isArray, isBrowser, isDevelopment, isEntity, isEquatable, isHeaders, isIncomingHttpHeaders, isLocalizedString, isMediaImage, isMediaJson, isMediaPdf, isMediaVideo, isMenuHref, isNotNullString, isNumber, isObject, isProduction, isPromise, isRelation, isReservedCollectionDescription, isStage, isString, isUndecoratedMenuCategory, isUndecoratedMenuItem, isUndecoratedMenuPage, isUndecoratedNav, isUnresolvedRelation, isValidCollectionDescription, isValidString, localize, localizeItem, localizeValue, localizedToString, merge, pascalCaseToCamelCase, pascalCaseToCharCase, pascalCaseToKebabCase, pascalCaseToSnakeCase, qsDeserialize, qsDeserializeRaw, qsSerialize, qsSerializeRaw, resolveMediaType, stringToBase64, toCamelCase, toCharCase, toDisplayName, toFindParams, toKebabCase, toPascalCase, toPluralName, toSnakeCase, toTitleCase, toValidCollectionName, unknownCaseToPascalCase, uuidv4, withSchema };
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
asServerProps: () => asServerProps,
|
|
47
47
|
asSortedOptions: () => asSortedOptions,
|
|
48
48
|
awaitAll: () => awaitAll,
|
|
49
|
+
base64ToString: () => base64ToString,
|
|
49
50
|
camelToSnakeCase: () => camelToSnakeCase,
|
|
50
51
|
cloneItem: () => cloneItem,
|
|
51
52
|
collectFeatureTypes: () => collectFeatureTypes,
|
|
@@ -128,6 +129,7 @@ __export(src_exports, {
|
|
|
128
129
|
qsSerialize: () => qsSerialize,
|
|
129
130
|
qsSerializeRaw: () => qsSerializeRaw,
|
|
130
131
|
resolveMediaType: () => resolveMediaType,
|
|
132
|
+
stringToBase64: () => stringToBase64,
|
|
131
133
|
toCamelCase: () => toCamelCase,
|
|
132
134
|
toCharCase: () => toCharCase,
|
|
133
135
|
toDisplayName: () => toDisplayName,
|
|
@@ -489,6 +491,14 @@ function merge(target, source) {
|
|
|
489
491
|
return target;
|
|
490
492
|
}
|
|
491
493
|
|
|
494
|
+
// src/base64/base64.ts
|
|
495
|
+
function base64ToString(text) {
|
|
496
|
+
return isBrowser ? window.atob(text) : Buffer.from(text, "base64").toString();
|
|
497
|
+
}
|
|
498
|
+
function stringToBase64(text) {
|
|
499
|
+
return isBrowser ? window.btoa(text) : Buffer.from(text).toString("base64");
|
|
500
|
+
}
|
|
501
|
+
|
|
492
502
|
// src/category/category.ts
|
|
493
503
|
var ROOT_CATEGORY = process.env.ROOT_CATEGORY || "";
|
|
494
504
|
function getRootCategory(categories) {
|
|
@@ -717,12 +727,6 @@ async function httpDelete(url, options = {}) {
|
|
|
717
727
|
function getSecret() {
|
|
718
728
|
return process.env.IMAGE_SECRET || "The sun sets over the calm ocean";
|
|
719
729
|
}
|
|
720
|
-
function base64ToString_(text) {
|
|
721
|
-
return isBrowser ? window.atob(text) : Buffer.from(text, "base64").toString();
|
|
722
|
-
}
|
|
723
|
-
function stringToBase64_(text) {
|
|
724
|
-
return isBrowser ? window.btoa(text) : Buffer.from(text).toString("base64");
|
|
725
|
-
}
|
|
726
730
|
function textToArrayBuffer_(text) {
|
|
727
731
|
const encoder = new TextEncoder();
|
|
728
732
|
const arrayBuffer = encoder.encode(text);
|
|
@@ -744,11 +748,11 @@ function xor_(text, secret) {
|
|
|
744
748
|
}
|
|
745
749
|
function encrypt_(text, secret) {
|
|
746
750
|
const encrypted = xor_(text, secret);
|
|
747
|
-
const base64 =
|
|
751
|
+
const base64 = stringToBase64(encrypted);
|
|
748
752
|
return base64;
|
|
749
753
|
}
|
|
750
754
|
function decrypt_(base64, secret) {
|
|
751
|
-
const text =
|
|
755
|
+
const text = base64ToString(base64);
|
|
752
756
|
const decrypted = xor_(text, secret);
|
|
753
757
|
return decrypted;
|
|
754
758
|
}
|
|
@@ -1604,6 +1608,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
|
|
|
1604
1608
|
asServerProps,
|
|
1605
1609
|
asSortedOptions,
|
|
1606
1610
|
awaitAll,
|
|
1611
|
+
base64ToString,
|
|
1607
1612
|
camelToSnakeCase,
|
|
1608
1613
|
cloneItem,
|
|
1609
1614
|
collectFeatureTypes,
|
|
@@ -1686,6 +1691,7 @@ var RedirectReason = /* @__PURE__ */ ((RedirectReason2) => {
|
|
|
1686
1691
|
qsSerialize,
|
|
1687
1692
|
qsSerializeRaw,
|
|
1688
1693
|
resolveMediaType,
|
|
1694
|
+
stringToBase64,
|
|
1689
1695
|
toCamelCase,
|
|
1690
1696
|
toCharCase,
|
|
1691
1697
|
toDisplayName,
|
package/dist/index.mjs
CHANGED
|
@@ -343,6 +343,14 @@ function merge(target, source) {
|
|
|
343
343
|
return target;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
// src/base64/base64.ts
|
|
347
|
+
function base64ToString(text) {
|
|
348
|
+
return isBrowser ? window.atob(text) : Buffer.from(text, "base64").toString();
|
|
349
|
+
}
|
|
350
|
+
function stringToBase64(text) {
|
|
351
|
+
return isBrowser ? window.btoa(text) : Buffer.from(text).toString("base64");
|
|
352
|
+
}
|
|
353
|
+
|
|
346
354
|
// src/category/category.ts
|
|
347
355
|
var ROOT_CATEGORY = process.env.ROOT_CATEGORY || "";
|
|
348
356
|
function getRootCategory(categories) {
|
|
@@ -571,12 +579,6 @@ async function httpDelete(url, options = {}) {
|
|
|
571
579
|
function getSecret() {
|
|
572
580
|
return process.env.IMAGE_SECRET || "The sun sets over the calm ocean";
|
|
573
581
|
}
|
|
574
|
-
function base64ToString_(text) {
|
|
575
|
-
return isBrowser ? window.atob(text) : Buffer.from(text, "base64").toString();
|
|
576
|
-
}
|
|
577
|
-
function stringToBase64_(text) {
|
|
578
|
-
return isBrowser ? window.btoa(text) : Buffer.from(text).toString("base64");
|
|
579
|
-
}
|
|
580
582
|
function textToArrayBuffer_(text) {
|
|
581
583
|
const encoder = new TextEncoder();
|
|
582
584
|
const arrayBuffer = encoder.encode(text);
|
|
@@ -598,11 +600,11 @@ function xor_(text, secret) {
|
|
|
598
600
|
}
|
|
599
601
|
function encrypt_(text, secret) {
|
|
600
602
|
const encrypted = xor_(text, secret);
|
|
601
|
-
const base64 =
|
|
603
|
+
const base64 = stringToBase64(encrypted);
|
|
602
604
|
return base64;
|
|
603
605
|
}
|
|
604
606
|
function decrypt_(base64, secret) {
|
|
605
|
-
const text =
|
|
607
|
+
const text = base64ToString(base64);
|
|
606
608
|
const decrypted = xor_(text, secret);
|
|
607
609
|
return decrypted;
|
|
608
610
|
}
|
|
@@ -1457,6 +1459,7 @@ export {
|
|
|
1457
1459
|
asServerProps,
|
|
1458
1460
|
asSortedOptions,
|
|
1459
1461
|
awaitAll,
|
|
1462
|
+
base64ToString,
|
|
1460
1463
|
camelToSnakeCase,
|
|
1461
1464
|
cloneItem,
|
|
1462
1465
|
collectFeatureTypes,
|
|
@@ -1539,6 +1542,7 @@ export {
|
|
|
1539
1542
|
qsSerialize,
|
|
1540
1543
|
qsSerializeRaw,
|
|
1541
1544
|
resolveMediaType,
|
|
1545
|
+
stringToBase64,
|
|
1542
1546
|
toCamelCase,
|
|
1543
1547
|
toCharCase,
|
|
1544
1548
|
toDisplayName,
|