@websolutespa/bom-core 1.7.11 → 1.7.12
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 +406 -14
- package/dist/index.js +317 -255
- package/dist/index.mjs +309 -253
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ type IOverride<T, FromType, ToType> = {
|
|
|
64
64
|
*/
|
|
65
65
|
type ILetter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
66
66
|
type ILocaleId = `${ILetter}${ILetter}`;
|
|
67
|
-
type ILocalizedString = Record<ILocaleId, string
|
|
67
|
+
type ILocalizedString = Partial<Record<ILocaleId, string>>;
|
|
68
68
|
type ILocalizable = string | ILocalizedString;
|
|
69
69
|
type ILocalized<T> = IOverride<T, ILocalizable, string>;
|
|
70
70
|
|
|
@@ -226,6 +226,7 @@ type ICategory = IEntity & {
|
|
|
226
226
|
order?: number;
|
|
227
227
|
slug: ILocalizable;
|
|
228
228
|
title: ILocalizable;
|
|
229
|
+
isHidden?: boolean;
|
|
229
230
|
};
|
|
230
231
|
type ICategoryItem = ICategory & {
|
|
231
232
|
items: ICategory[];
|
|
@@ -311,7 +312,8 @@ type IMarket = IEntity & {
|
|
|
311
312
|
};
|
|
312
313
|
|
|
313
314
|
type IRoute = {
|
|
314
|
-
category: IEquatable
|
|
315
|
+
category: IEquatable;
|
|
316
|
+
resolvedCategory: IEquatable;
|
|
315
317
|
id: string;
|
|
316
318
|
isDefault?: boolean;
|
|
317
319
|
locale: string;
|
|
@@ -611,31 +613,167 @@ type ITemplate = {
|
|
|
611
613
|
collections: string[];
|
|
612
614
|
};
|
|
613
615
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
+
/**
|
|
617
|
+
* Retrieves the root category from the given list of categories.
|
|
618
|
+
* @param categories - The list of categories.
|
|
619
|
+
* @returns The root category, if found; otherwise undefined.
|
|
620
|
+
*/
|
|
616
621
|
declare function getRootCategory(categories: ICategory[]): ICategory | undefined;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
622
|
+
/**
|
|
623
|
+
* Retrieves the parent category of an item.
|
|
624
|
+
* @param categories - The array of categories.
|
|
625
|
+
* @param item - The item to find the parent category for.
|
|
626
|
+
* @returns The parent category of the item, or undefined if not found.
|
|
627
|
+
*/
|
|
628
|
+
declare function getParentCategory(categories: ICategory[], item: ICategorized): ICategory | undefined;
|
|
629
|
+
/**
|
|
630
|
+
* Retrieves the parent categories of a category with the given ID.
|
|
631
|
+
* @param categories - The list of categories.
|
|
632
|
+
* @param id - The ID of the category.
|
|
633
|
+
* @returns An array of parent categories.
|
|
634
|
+
*/
|
|
635
|
+
declare function getParentCategoriesById(categories: ICategory[], id?: string): ICategory[];
|
|
636
|
+
/**
|
|
637
|
+
* Retrieves the category segments for an ICategorized item.
|
|
638
|
+
* @param item - The item to retrieve the category segments for.
|
|
639
|
+
* @param categories - The list of categories.
|
|
640
|
+
* @returns An array of category segments.
|
|
641
|
+
*/
|
|
642
|
+
declare function getCategorySegments(categories: ICategory[], item: ICategorized): ICategory[];
|
|
643
|
+
/**
|
|
644
|
+
* Retrieves the category segments for a category.
|
|
645
|
+
* @param item - The category to retrieve the category segments for.
|
|
646
|
+
* @param categories - The list of categories.
|
|
647
|
+
* @returns An array of category segments.
|
|
648
|
+
*/
|
|
649
|
+
declare function getCategorySegmentsByCategory(categories: ICategory[], item: ICategory): ICategory[];
|
|
650
|
+
/**
|
|
651
|
+
* Retrieves the ID of a category or an object that implements IEquatable.
|
|
652
|
+
* @param value - The category or object to retrieve the ID from.
|
|
653
|
+
* @returns The ID of the category or object as a string.
|
|
654
|
+
*/
|
|
655
|
+
declare function asCategoryId(value: undefined): undefined;
|
|
656
|
+
declare function asCategoryId(value: string): string;
|
|
657
|
+
declare function asCategoryId(value: IEntity | IEquatable): string;
|
|
658
|
+
declare function asCategoryId(value: IEntity | IEquatable | undefined): string | undefined;
|
|
659
|
+
/**
|
|
660
|
+
* Finds a category in the given array of categories based on the provided item.
|
|
661
|
+
* @param categories - The array of categories to search in.
|
|
662
|
+
* @param item - The item to find in the categories array.
|
|
663
|
+
* @returns The found category, if any, or undefined.
|
|
664
|
+
*/
|
|
665
|
+
declare function findCategoryInCategories(categories: ICategory[], item: ICategory | IEquatable | undefined): ICategory | undefined;
|
|
666
|
+
/**
|
|
667
|
+
* Finds child categories based on the given item.
|
|
668
|
+
* @param categories - The array of categories to search in.
|
|
669
|
+
* @param item - The item to find child categories for.
|
|
670
|
+
* @returns An array of child categories.
|
|
671
|
+
*/
|
|
672
|
+
declare function findChildCategories(categories: ICategory[], item: ICategory | IEquatable | undefined): ICategory[];
|
|
620
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Combines multiple IClassName objects into a single string of class names.
|
|
676
|
+
* @param props - The IClassName objects to combine.
|
|
677
|
+
* @returns A string of class names.
|
|
678
|
+
*/
|
|
621
679
|
declare function getClassNames(...props: Array<IClassName>): string;
|
|
622
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Retrieves the collection description based on the given text.
|
|
683
|
+
* @param text - The input text.
|
|
684
|
+
* @returns The collection description object.
|
|
685
|
+
*/
|
|
623
686
|
declare function getCollectionDescription(text: string): ICollectionDescription;
|
|
687
|
+
/**
|
|
688
|
+
* Converts a camel case string to snake case.
|
|
689
|
+
* @param text - The input text.
|
|
690
|
+
* @returns The converted snake case string.
|
|
691
|
+
*/
|
|
624
692
|
declare function camelToSnakeCase(text: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* Checks if the given collection description is valid.
|
|
695
|
+
* @param description - The collection description object.
|
|
696
|
+
* @returns True if the collection description is valid, false otherwise.
|
|
697
|
+
*/
|
|
625
698
|
declare function isValidCollectionDescription(description: ICollectionDescription): boolean;
|
|
699
|
+
/**
|
|
700
|
+
* Checks if the given collection description is reserved.
|
|
701
|
+
* @param description - The collection description object.
|
|
702
|
+
* @returns True if the collection description is reserved, false otherwise.
|
|
703
|
+
*/
|
|
626
704
|
declare function isReservedCollectionDescription(description: ICollectionDescription): boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Converts a string to a display name by removing spaces.
|
|
707
|
+
* @param text - The input text.
|
|
708
|
+
* @returns The converted display name.
|
|
709
|
+
*/
|
|
627
710
|
declare function toDisplayName(text: string): string;
|
|
711
|
+
/**
|
|
712
|
+
* Converts a string to its plural form.
|
|
713
|
+
* @param text - The input text.
|
|
714
|
+
* @returns The plural form of the input text.
|
|
715
|
+
*/
|
|
628
716
|
declare function toPluralName(text: string): string;
|
|
717
|
+
/**
|
|
718
|
+
* Converts a string to title case.
|
|
719
|
+
* @param text - The input text.
|
|
720
|
+
* @returns The converted title case string.
|
|
721
|
+
*/
|
|
629
722
|
declare function toTitleCase(text: string): string;
|
|
723
|
+
/**
|
|
724
|
+
* Converts a string to a valid collection name by removing special characters and converting to snake case.
|
|
725
|
+
* @param text - The input text.
|
|
726
|
+
* @returns The converted valid collection name.
|
|
727
|
+
*/
|
|
630
728
|
declare function toValidCollectionName(text: string): string;
|
|
631
729
|
|
|
632
730
|
declare function consoleWarn(message: string, component?: string): void;
|
|
633
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Performs an HTTP fetch request.
|
|
734
|
+
* @param url - The URL to fetch.
|
|
735
|
+
* @param options - The fetch request options.
|
|
736
|
+
* @param serviceOptions - Additional service options.
|
|
737
|
+
* @returns A promise that resolves to the response data.
|
|
738
|
+
*/
|
|
634
739
|
declare function httpFetch(url: string, options?: FetchRequestOptions, serviceOptions?: any): Promise<any>;
|
|
740
|
+
/**
|
|
741
|
+
* Performs an HTTP GET request.
|
|
742
|
+
* @param url - The URL to fetch.
|
|
743
|
+
* @param options - The fetch request options.
|
|
744
|
+
* @returns A promise that resolves to the response data.
|
|
745
|
+
*/
|
|
635
746
|
declare function httpGet(url: string, options?: FetchRequestOptions): Promise<any>;
|
|
747
|
+
/**
|
|
748
|
+
* Performs an HTTP POST request.
|
|
749
|
+
* @param url - The URL to fetch.
|
|
750
|
+
* @param payload - The payload to send in the request body.
|
|
751
|
+
* @param options - The fetch request options.
|
|
752
|
+
* @returns A promise that resolves to the response data.
|
|
753
|
+
*/
|
|
636
754
|
declare function httpPost(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
755
|
+
/**
|
|
756
|
+
* Performs an HTTP PUT request.
|
|
757
|
+
* @param url - The URL to fetch.
|
|
758
|
+
* @param payload - The payload to send in the request body.
|
|
759
|
+
* @param options - The fetch request options.
|
|
760
|
+
* @returns A promise that resolves to the response data.
|
|
761
|
+
*/
|
|
637
762
|
declare function httpPut(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
763
|
+
/**
|
|
764
|
+
* Performs an HTTP PATCH request.
|
|
765
|
+
* @param url - The URL to fetch.
|
|
766
|
+
* @param payload - The payload to send in the request body.
|
|
767
|
+
* @param options - The fetch request options.
|
|
768
|
+
* @returns A promise that resolves to the response data.
|
|
769
|
+
*/
|
|
638
770
|
declare function httpPatch(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
771
|
+
/**
|
|
772
|
+
* Performs an HTTP DELETE request.
|
|
773
|
+
* @param url - The URL to fetch.
|
|
774
|
+
* @param options - The fetch request options.
|
|
775
|
+
* @returns A promise that resolves to the response data.
|
|
776
|
+
*/
|
|
639
777
|
declare function httpDelete(url: string, options?: FetchRequestOptions): Promise<any>;
|
|
640
778
|
|
|
641
779
|
declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
@@ -690,10 +828,43 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
|
690
828
|
|
|
691
829
|
declare const defaultLocale: string;
|
|
692
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Checks if a value is a localized string.
|
|
833
|
+
* @param value - The value to check.
|
|
834
|
+
* @returns A boolean indicating whether the value is a localized string.
|
|
835
|
+
*/
|
|
693
836
|
declare function isLocalizedString(value: any): value is ILocalizedString;
|
|
837
|
+
/**
|
|
838
|
+
* Converts a localized string object to a string based on the specified locale.
|
|
839
|
+
* @param json - The localized string object.
|
|
840
|
+
* @param locale - The locale to use.
|
|
841
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
842
|
+
* @returns The localized string.
|
|
843
|
+
*/
|
|
694
844
|
declare function localizedToString(json: ILocalizedString, locale: string, defaultLocale?: string): string;
|
|
845
|
+
/**
|
|
846
|
+
* Localizes a value based on the specified locale.
|
|
847
|
+
* @param value - The value to localize.
|
|
848
|
+
* @param locale - The locale to use.
|
|
849
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
850
|
+
* @returns The localized value as a string.
|
|
851
|
+
*/
|
|
695
852
|
declare function localize(value: ILocalizable, locale: string, defaultLocale?: string): string;
|
|
853
|
+
/**
|
|
854
|
+
* Localizes a value or an array/object of values based on the specified locale.
|
|
855
|
+
* @param value - The value or array/object of values to localize.
|
|
856
|
+
* @param locale - The locale to use.
|
|
857
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
858
|
+
* @returns The localized value or array/object of localized values.
|
|
859
|
+
*/
|
|
696
860
|
declare function localizeValue(value: any, locale: string, defaultLocale?: string): any;
|
|
861
|
+
/**
|
|
862
|
+
* Localizes an array/object of values based on the specified locale.
|
|
863
|
+
* @param item - The array/object of values to localize.
|
|
864
|
+
* @param locale - The locale to use.
|
|
865
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
866
|
+
* @returns The localized array/object of values.
|
|
867
|
+
*/
|
|
697
868
|
declare function localizeItem<T = any>(item: T, locale: string, defaultLocale?: string): T;
|
|
698
869
|
|
|
699
870
|
declare enum LoggerLevel {
|
|
@@ -716,33 +887,166 @@ declare class Logger {
|
|
|
716
887
|
|
|
717
888
|
declare const defaultMarket: string;
|
|
718
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Serializes query parameters into a query string.
|
|
892
|
+
* @param queryParams - The query parameters to serialize.
|
|
893
|
+
* @returns The serialized query string.
|
|
894
|
+
*/
|
|
719
895
|
declare function qsSerialize(queryParams?: QueryParams): string;
|
|
896
|
+
/**
|
|
897
|
+
* Serializes query parameters into a raw query string.
|
|
898
|
+
* @param queryParams - The query parameters to serialize.
|
|
899
|
+
* @returns The serialized raw query string.
|
|
900
|
+
*/
|
|
720
901
|
declare function qsSerializeRaw(queryParams?: {}): string;
|
|
902
|
+
/**
|
|
903
|
+
* Deserializes a query string into query parameters.
|
|
904
|
+
* @param query - The query string to deserialize.
|
|
905
|
+
* @param deserializedParams - The deserialized query parameters.
|
|
906
|
+
* @returns The deserialized query parameters.
|
|
907
|
+
*/
|
|
721
908
|
declare function qsDeserialize(query?: string, deserializedParams?: {}): QueryParams;
|
|
909
|
+
/**
|
|
910
|
+
* Deserializes a raw query string into parameters.
|
|
911
|
+
* @param query - The raw query string to deserialize.
|
|
912
|
+
* @param deserializedParams - The deserialized parameters.
|
|
913
|
+
* @returns The deserialized parameters.
|
|
914
|
+
*/
|
|
722
915
|
declare function qsDeserializeRaw(query?: string, deserializedParams?: {}): {};
|
|
723
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Checks if the given headers object is an instance of the Headers class.
|
|
919
|
+
* @param headers - The headers object to check.
|
|
920
|
+
* @returns True if the headers object is an instance of Headers, false otherwise.
|
|
921
|
+
*/
|
|
724
922
|
declare function isHeaders(headers?: IncomingHttpHeaders | Headers): headers is Headers;
|
|
923
|
+
/**
|
|
924
|
+
* Checks if the given headers object is an instance of IncomingHttpHeaders.
|
|
925
|
+
* @param headers - The headers object to check.
|
|
926
|
+
* @returns True if the headers object is an instance of IncomingHttpHeaders, false otherwise.
|
|
927
|
+
*/
|
|
725
928
|
declare function isIncomingHttpHeaders(headers?: IncomingHttpHeaders | Headers): headers is IncomingHttpHeaders;
|
|
929
|
+
/**
|
|
930
|
+
* Retrieves the host from the headers object.
|
|
931
|
+
* @param headers - The headers object.
|
|
932
|
+
* @returns The host value from the headers object, or null if not found.
|
|
933
|
+
*/
|
|
726
934
|
declare function getHost(headers?: IncomingHttpHeaders | Headers): string | null;
|
|
935
|
+
/**
|
|
936
|
+
* Retrieves the protocol from the headers object.
|
|
937
|
+
* @param headers - The headers object.
|
|
938
|
+
* @returns The protocol value from the headers object, or 'https' if not found.
|
|
939
|
+
*/
|
|
727
940
|
declare function getProto(headers?: IncomingHttpHeaders | Headers): string;
|
|
941
|
+
/**
|
|
942
|
+
* Retrieves the origin from the headers object.
|
|
943
|
+
* @param headers - The headers object.
|
|
944
|
+
* @returns The origin value based on the host and protocol from the headers object, or an empty string if not found.
|
|
945
|
+
*/
|
|
728
946
|
declare function getOrigin(headers?: IncomingHttpHeaders | Headers): string;
|
|
729
947
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
948
|
+
/**
|
|
949
|
+
* Represents the route strategy options.
|
|
950
|
+
*/
|
|
733
951
|
declare enum RouteStrategy {
|
|
734
952
|
Auto = "auto",
|
|
735
953
|
Default = "default",
|
|
736
954
|
Manual = "manual"
|
|
737
955
|
}
|
|
956
|
+
/**
|
|
957
|
+
* Collects routes based on the provided data.
|
|
958
|
+
*
|
|
959
|
+
* @param store - The memory store containing categorized items.
|
|
960
|
+
* @param categories - The list of categories.
|
|
961
|
+
* @param markets - The list of markets.
|
|
962
|
+
* @param locales - The list of locales.
|
|
963
|
+
* @returns An array of collected routes.
|
|
964
|
+
*/
|
|
965
|
+
declare function collectRoutes(store: IMemoryStore<ICategorized>, categories: ICategory[], markets: IMarket[], locales: ILocale[]): IRoute[];
|
|
966
|
+
/**
|
|
967
|
+
* Iterates over each market and locale combination and invokes the callback function.
|
|
968
|
+
*
|
|
969
|
+
* @param markets - The list of markets.
|
|
970
|
+
* @param locales - The list of locales.
|
|
971
|
+
* @param callback - The callback function to be invoked for each market and locale combination.
|
|
972
|
+
*/
|
|
973
|
+
declare function eachMarketLocale(markets: IMarket[], locales: ILocale[], callback: (market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]) => void): void;
|
|
974
|
+
/**
|
|
975
|
+
* Iterates over each categorized item in the store and invokes the callback function.
|
|
976
|
+
*
|
|
977
|
+
* @param store - The memory store containing categorized items.
|
|
978
|
+
* @param callback - The callback function to be invoked for each categorized item.
|
|
979
|
+
*/
|
|
980
|
+
declare function eachCategorized(store: IMemoryStore<ICategorized>, callback: (item: ICategorized, key: string) => void): void;
|
|
981
|
+
/**
|
|
982
|
+
* Finds the default route of a category by categoryId, market, and locale.
|
|
983
|
+
* @param routes - The array of routes to search.
|
|
984
|
+
* @param categoryId - The category ID to match.
|
|
985
|
+
* @param market - The market to match (optional).
|
|
986
|
+
* @param locale - The locale to match (optional).
|
|
987
|
+
* @returns The matching route, if found. Otherwise, undefined.
|
|
988
|
+
*/
|
|
989
|
+
declare function findRouteOfCategory(routes: IRoute[], categoryId: IEquatable, market?: string, locale?: string): IRoute | undefined;
|
|
990
|
+
/**
|
|
991
|
+
* Finds the routes of a category by categoryId.
|
|
992
|
+
* @param routes - The array of routes to search.
|
|
993
|
+
* @param categoryId - The category ID to filter routes by.
|
|
994
|
+
* @param isDefault - Optional. Specifies whether to filter routes by default status. Default is true.
|
|
995
|
+
* @returns An array of routes that match the specified category and default status.
|
|
996
|
+
*/
|
|
997
|
+
declare function findRoutesOfCategory(routes: IRoute[], categoryId: IEquatable, isDefault?: boolean): IRoute[];
|
|
998
|
+
/**
|
|
999
|
+
* Generates the route href based on the provided segments, market, locale, markets, and locales.
|
|
1000
|
+
*
|
|
1001
|
+
* @param segments - The segments of the route.
|
|
1002
|
+
* @param market - The market object.
|
|
1003
|
+
* @param locale - The locale object.
|
|
1004
|
+
* @param markets - The list of markets.
|
|
1005
|
+
* @param locales - The list of locales.
|
|
1006
|
+
* @returns The generated route href.
|
|
1007
|
+
*/
|
|
738
1008
|
declare function getRouteHref(segments: {
|
|
739
1009
|
slug: ILocalizable;
|
|
740
1010
|
}[], market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]): string;
|
|
741
1011
|
|
|
742
|
-
|
|
743
|
-
|
|
1012
|
+
/**
|
|
1013
|
+
* Converts a value to an `IEquatable` or `undefined`.
|
|
1014
|
+
* If the value is an `IEntity`, it extracts the `id` property.
|
|
1015
|
+
* If the `id` is a string that represents a valid number, it returns the number.
|
|
1016
|
+
* Otherwise, it returns the `id` as is.
|
|
1017
|
+
*
|
|
1018
|
+
* @param value The value to convert.
|
|
1019
|
+
* @returns The converted value as an `IEquatable` or `undefined`.
|
|
1020
|
+
*/
|
|
744
1021
|
declare function asEquatable(value: string): IEquatable;
|
|
1022
|
+
declare function asEquatable(value: number): number;
|
|
1023
|
+
/**
|
|
1024
|
+
* Converts a value to a string or `undefined`.
|
|
1025
|
+
* If the value is an `IEntity`, it extracts the `id` property.
|
|
1026
|
+
* If the `id` is defined, it returns it as a string.
|
|
1027
|
+
* Otherwise, it returns `undefined`.
|
|
1028
|
+
*
|
|
1029
|
+
* @param value The value to convert.
|
|
1030
|
+
* @returns The converted value as a string or `undefined`.
|
|
1031
|
+
*/
|
|
1032
|
+
declare function asEquatableString(value: string): string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Converts a value to a number or `undefined`.
|
|
1035
|
+
* If the value is an `IEntity`, it extracts the `id` property.
|
|
1036
|
+
* If the `id` is a string that represents a valid number, it returns the number.
|
|
1037
|
+
* Otherwise, it returns `undefined`.
|
|
1038
|
+
*
|
|
1039
|
+
* @param value The value to convert.
|
|
1040
|
+
* @returns The converted value as a number or `undefined`.
|
|
1041
|
+
*/
|
|
1042
|
+
declare function asEquatableNumber(value: number): number;
|
|
745
1043
|
|
|
1044
|
+
/**
|
|
1045
|
+
* Reorder an array of INamedEntities into an options list sorted by name.
|
|
1046
|
+
*
|
|
1047
|
+
* @param items - The array of INamedEntities to reorder.
|
|
1048
|
+
* @returns An array of sorted IOption.
|
|
1049
|
+
*/
|
|
746
1050
|
declare function asSortedOptions<T extends INamedEntity = INamedEntity>(items: T[]): IOption[];
|
|
747
1051
|
|
|
748
1052
|
/**
|
|
@@ -767,6 +1071,12 @@ declare function cloneItem<T = unknown>(item: T): T;
|
|
|
767
1071
|
|
|
768
1072
|
declare function collectFeatureTypes<T extends IEntity = IEntity>(items: T[], ...keys: string[]): Promise<IFeatureType[]>;
|
|
769
1073
|
|
|
1074
|
+
/**
|
|
1075
|
+
* Collects options from an array of items based on specified keys.
|
|
1076
|
+
* @param items The array of items to collect options from.
|
|
1077
|
+
* @param keys The keys to collect options for.
|
|
1078
|
+
* @returns A promise that resolves to an object containing the collected options.
|
|
1079
|
+
*/
|
|
770
1080
|
declare function collectOptions<T extends IEntity = IEntity>(items: T[], ...keys: string[]): Promise<Partial<Record<keyof T, IOption[]>>>;
|
|
771
1081
|
|
|
772
1082
|
/**
|
|
@@ -801,22 +1111,104 @@ type ListItem<T> = {
|
|
|
801
1111
|
*/
|
|
802
1112
|
declare function enumToList<T extends Record<string, number | string>>(enumeration: T, separatorRegex?: RegExp): ListItem<T>[];
|
|
803
1113
|
|
|
1114
|
+
/**
|
|
1115
|
+
* Checks if the given item is a number.
|
|
1116
|
+
* @param item The item to check.
|
|
1117
|
+
* @returns True if the item is a number, false otherwise.
|
|
1118
|
+
*/
|
|
804
1119
|
declare function isNumber(item: unknown): item is number;
|
|
1120
|
+
/**
|
|
1121
|
+
* Checks if the given item is a string.
|
|
1122
|
+
* @param item The item to check.
|
|
1123
|
+
* @returns True if the item is a string, false otherwise.
|
|
1124
|
+
*/
|
|
805
1125
|
declare function isString(item: unknown): item is string;
|
|
1126
|
+
/**
|
|
1127
|
+
* Checks if the given item is a valid non-empty string.
|
|
1128
|
+
* @param item The item to check.
|
|
1129
|
+
* @returns True if the item is a valid non-empty string, false otherwise.
|
|
1130
|
+
*/
|
|
806
1131
|
declare function isValidString(item: unknown): item is string;
|
|
1132
|
+
/**
|
|
1133
|
+
* Checks if the given item is an array.
|
|
1134
|
+
* @param item The item to check.
|
|
1135
|
+
* @returns True if the item is an array, false otherwise.
|
|
1136
|
+
*/
|
|
807
1137
|
declare function isArray<T = unknown>(item: unknown): item is Array<T>;
|
|
1138
|
+
/**
|
|
1139
|
+
* Checks if the given item is an object.
|
|
1140
|
+
* @param item The item to check.
|
|
1141
|
+
* @returns True if the item is an object, false otherwise.
|
|
1142
|
+
*/
|
|
808
1143
|
declare function isObject<T = Record<string, unknown>>(item: unknown): item is T;
|
|
1144
|
+
/**
|
|
1145
|
+
* Checks if the given item is a promise.
|
|
1146
|
+
* @param result The item to check.
|
|
1147
|
+
* @returns True if the item is a promise, false otherwise.
|
|
1148
|
+
*/
|
|
809
1149
|
declare function isPromise(result: unknown): result is Promise<unknown>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Checks if the given item is a non-null string.
|
|
1152
|
+
* @param item The item to check.
|
|
1153
|
+
* @returns True if the item is a non-null string, false otherwise.
|
|
1154
|
+
*/
|
|
810
1155
|
declare function isNotNullString(item: unknown): item is string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Checks if the given item is equatable.
|
|
1158
|
+
* @param item The item to check.
|
|
1159
|
+
* @returns True if the item is equatable, false otherwise.
|
|
1160
|
+
*/
|
|
811
1161
|
declare function isEquatable(item: unknown): item is IEquatable;
|
|
812
|
-
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks if the given item is an entity.
|
|
1164
|
+
* @param item The item to check.
|
|
1165
|
+
* @returns True if the item is an entity, false otherwise.
|
|
1166
|
+
*/
|
|
1167
|
+
declare function isEntity<T = IEntity>(item: unknown): item is T;
|
|
1168
|
+
/**
|
|
1169
|
+
* Checks if the given item is an unresolved relation.
|
|
1170
|
+
* @param item The item to check.
|
|
1171
|
+
* @returns True if the item is an unresolved relation, false otherwise.
|
|
1172
|
+
*/
|
|
813
1173
|
declare function isUnresolvedRelation(item: unknown): item is IPageUnresolvedRelation;
|
|
1174
|
+
/**
|
|
1175
|
+
* Checks if the given item is a relation.
|
|
1176
|
+
* @param item The item to check.
|
|
1177
|
+
* @returns True if the item is a relation, false otherwise.
|
|
1178
|
+
*/
|
|
814
1179
|
declare function isRelation(item: unknown): item is IPageRelation;
|
|
1180
|
+
/**
|
|
1181
|
+
* Checks if the given item is an undecorated menu item.
|
|
1182
|
+
* @param item The item to check.
|
|
1183
|
+
* @returns True if the item is an undecorated menu item, false otherwise.
|
|
1184
|
+
*/
|
|
815
1185
|
declare function isUndecoratedMenuItem(item: unknown): item is IUndecoratedMenuItem;
|
|
1186
|
+
/**
|
|
1187
|
+
* Checks if the given item is an undecorated navigation.
|
|
1188
|
+
* @param item The item to check.
|
|
1189
|
+
* @returns True if the item is an undecorated navigation, false otherwise.
|
|
1190
|
+
*/
|
|
816
1191
|
declare function isUndecoratedNav<T>(item: unknown): item is IUndecoratedNav<T>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Checks if the given item is an undecorated menu category.
|
|
1194
|
+
* @param item The item to check.
|
|
1195
|
+
* @returns True if the item is an undecorated menu category, false otherwise.
|
|
1196
|
+
*/
|
|
817
1197
|
declare function isUndecoratedMenuCategory(item: unknown): item is IUndecoratedMenuCategory;
|
|
1198
|
+
/**
|
|
1199
|
+
* Checks if the given item is an undecorated menu page.
|
|
1200
|
+
* @param item The item to check.
|
|
1201
|
+
* @returns True if the item is an undecorated menu page, false otherwise.
|
|
1202
|
+
*/
|
|
818
1203
|
declare function isUndecoratedMenuPage(item: unknown): item is IUndecoratedMenuPage;
|
|
819
1204
|
|
|
1205
|
+
/**
|
|
1206
|
+
* Generates a random UUID (Universally Unique Identifier) in version 4 format.
|
|
1207
|
+
*
|
|
1208
|
+
* @returns {string} The generated UUID.
|
|
1209
|
+
*/
|
|
1210
|
+
declare function uuidv4(): string;
|
|
1211
|
+
|
|
820
1212
|
declare function getIsDevelopment(): boolean;
|
|
821
1213
|
declare function getIsProduction(): boolean;
|
|
822
1214
|
declare const isDevelopment: boolean;
|
|
@@ -829,4 +1221,4 @@ declare function asServerProps(props: any): any;
|
|
|
829
1221
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
830
1222
|
declare function merge(target: any, source: any): any;
|
|
831
1223
|
|
|
832
|
-
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, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, asSortedOptions, 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,
|
|
1224
|
+
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, StaticPropsContext, User, UserRole, UserWithRoles, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asEquatableNumber, asEquatableString, asServerProps, asSortedOptions, awaitAll, camelToSnakeCase, cloneItem, collectFeatureTypes, collectOptions, collectRoutes, consoleWarn, deepMerge, defaultLocale, defaultMarket, eachCategorized, eachMarketLocale, 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 };
|