@putkoff/abstract-utilities 1.0.68 → 1.0.70
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/dist/cjs/index.js +14954 -131
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +15446 -130
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +34 -1
- package/dist/types/functions/index.d.ts +1 -0
- package/dist/types/functions/math_utils/bigint_utils.d.ts +8 -0
- package/dist/types/functions/math_utils/index.d.ts +1 -0
- package/dist/types/functions/size_utils/index.d.ts +1 -0
- package/dist/types/functions/size_utils/src/index.d.ts +1 -0
- package/dist/types/functions/size_utils/src/sizeUtils.d.ts +5 -0
- package/dist/types/functions/type_utils/src/index.d.ts +1 -0
- package/dist/types/functions/type_utils/src/json_utils.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -536,6 +536,15 @@ declare const MPerS_TO_MiPerH: number;
|
|
|
536
536
|
|
|
537
537
|
declare function isTimeInterval(timeObj: number, interval: number): boolean;
|
|
538
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Recursively traverse the object and convert BigInts to numbers or strings.
|
|
541
|
+
*
|
|
542
|
+
* @param {object|array} obj - The object to traverse
|
|
543
|
+
* @param {boolean} convertToNumber - Whether to convert BigInt to Number (default is true)
|
|
544
|
+
* @returns {object|array} - The transformed object
|
|
545
|
+
*/
|
|
546
|
+
declare function convertBigInts(obj: any, convertToNumber?: boolean): any;
|
|
547
|
+
|
|
539
548
|
declare function cleanText(input: any): any;
|
|
540
549
|
declare function cleanArray(obj: any): unknown[];
|
|
541
550
|
declare function getCleanArray(obj: any): unknown[];
|
|
@@ -570,6 +579,14 @@ declare function get_key_value<T extends object>(obj: T, key: string): any;
|
|
|
570
579
|
declare function get<T extends object>(obj: T | null | undefined, keys: string | string[], defaultValue?: any): any;
|
|
571
580
|
declare function findKeyValue(obj: Record<string, any>, keyToFind: string): any;
|
|
572
581
|
declare function omitKeys<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
582
|
+
/**
|
|
583
|
+
* Extracts necessary properties from the insertValue to prevent circular references.
|
|
584
|
+
*
|
|
585
|
+
* @param insertValue - The original RPC result.
|
|
586
|
+
* @returns A new object with only the required properties.
|
|
587
|
+
*/
|
|
588
|
+
declare function extractInsertData(insertValue: any): any;
|
|
589
|
+
declare function loadInnerJson(data: any): any;
|
|
573
590
|
|
|
574
591
|
declare function isType(obj: any, type: string): boolean;
|
|
575
592
|
declare function isStrInString(obj: any, string: any): boolean;
|
|
@@ -752,6 +769,16 @@ declare const confirm_type: typeof confirmType;
|
|
|
752
769
|
declare const is_media_type: typeof isMediaType;
|
|
753
770
|
declare const get_mime_type: typeof getMimeType;
|
|
754
771
|
|
|
772
|
+
declare function getIfNone<T>(obj: T | undefined | null, fallback: T): T;
|
|
773
|
+
/**
|
|
774
|
+
* Merges non-null values from multiple dictionaries.
|
|
775
|
+
*/
|
|
776
|
+
declare function mergeNotNullValues<T extends Record<string, any>>(dictA: T, dictB?: Partial<T>, dictC?: Partial<T>, dictD?: Partial<T>, dictE?: Partial<T>): T;
|
|
777
|
+
/**
|
|
778
|
+
* Converts an empty object to null.
|
|
779
|
+
*/
|
|
780
|
+
declare function emptyObjectToNull<T>(value: T): T | null;
|
|
781
|
+
|
|
755
782
|
declare function loadConfig(filePath?: string | null): Promise<AppConfig>;
|
|
756
783
|
/**
|
|
757
784
|
* getConfig(): Promise<AppConfig>
|
|
@@ -776,5 +803,11 @@ declare function processKeywords(keywords: string | string[]): string[];
|
|
|
776
803
|
*/
|
|
777
804
|
declare function get_keyword_string(keywords: any): string;
|
|
778
805
|
|
|
779
|
-
|
|
806
|
+
declare function exceedsMbLimit(limitMb: number, payloadMb: number): boolean;
|
|
807
|
+
declare function safeJsonSizeInMb(value: unknown): number;
|
|
808
|
+
declare function dataSizeInMb(data: unknown): number;
|
|
809
|
+
declare function getJsonSizeInMb(json: unknown): number;
|
|
810
|
+
declare function dataSize(data: any): number;
|
|
811
|
+
|
|
812
|
+
export { API_PREFIX, ATTOSECOND, BASE_URL, CENTISECOND, DAY, DAY_IN_S, DECISECOND, DEV_PREFIX, DIST_ALIASES, DIST_FACTORS, DOMAIN_NAME, DistanceConverter, FEET_PER_METER, FEMTOSECOND, HOUR, HOUR_IN_S, KMS_PER_METER, MEDIA_TYPES, METERS_PER_FOOT, METERS_PER_KM, METERS_PER_MILE, MICROSECOND, MILES_PER_METER, MILISECOND, MIME_TYPES, MINUTE, MIN_IN_S, MONTH, MONTH_IN_S, MPerS_TO_MiPerH, MiPerH_TO_MPerS, NANOSECOND, PI, PI2, PICOSECOND, PROD_PREFIX, PROTOCOL, SECOND, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SUB_DIR, SpeedConverter, TIME_ALIASES, TIME_FACTORS, TimeConverter, YEAR, YEAR_IN_S, ZEPTOSECOND, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, assurearray, assurelist, assurenumber, assurestring, callStorage, callWindowMethod, canonDist, canonTime, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, confirmType, confirm_type, convertBigInts, convertDistance, convertSpeed, convertTime, create_list_string, dataSize, dataSizeInMb, decodeJwt, distanceToMeters, eatAll, eatElse, eatInner, eatOuter, eatall, eatinner, eatouter, emptyObjectToNull, ends_in_quotes, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, ensurearray, ensurelist, ensurenumber, ensurestring, exceedsMbLimit, exponential, extractInsertData, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, findKeyValue, fmt, formatNumber, fromMeters, fromMps, fromSeconds, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAllFileTypes, getAllFileTypesSync, getAlphaNum, getAlphas, getBaseDir, getBasename, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfig, getConfigContent, getConfigVar, getDbConfigsPath, getDirname, getDistDir, getDocumentProp, getEnvDir, getEnvPath, getExtname, getFetchVars, getFilename, getFunctionsDir, getFunctionsUtilsDirectory, getHeaders, getHooksUtilsDirectory, getHtmlDirectory, getIfNone, getJsonSizeInMb, getLibUtilsDirectory, getMediaExts, getMediaMap, getMethod, getMimeType, getNums, getPublicDir, getResult, getSafeDocument, getSafeLocalStorage, getSafeWindow, getSchemasDirPath, getSchemasPath, getSplitext, getSrcDir, getSubstring, getWindowHost, getWindowProp, get_all_file_types, get_basename, get_dirname, get_extname, get_filename, get_full_path, get_full_url, get_key_value, get_keyword_string, get_media_exts, get_media_map, get_mime_type, get_relative_path, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, getbasename, getdirname, getextname, getfilename, getsplitext, isFiniteNum, isMediaType, isNum, isStrInString, isTimeInterval, isTokenExpired, isType, isZero, is_media_type, loadConfig, loadInnerJson, makePath, make_path, make_sanitized_path, makepath, mergeNotNullValues, metersToDistance, mpsToSpeed, normalizeUrl, omitKeys, parseResult, pathJoin, path_join, path_to_url, pathjoin, processKeywords, readJsonFile, roundPercentage, safeDivide, safeGlobalProp, safeJsonSizeInMb, safeMultiply, safeNums, safeStorage, sanitizeFilename, sanitizeString, secondsToTime, speedToMps, stripPrefixes, stripQuotes, timeToSeconds, toMeters, toSeconds, truncateString, tryEatPrefix, tryParse, urlJoin, url_to_path, urljoin, velocityFromMs, velocityToMs };
|
|
780
813
|
export type { ApiRow, AppConfig, CanonDist, CanonTime, ConvertDistance, ConvertSpeed, ConvertTime, Day, DistanceUnit, FetchVariables, FileItem, FileListResponse, Foot, Hour, InputProps, JwtPayload, Kilometer, LoginFormProps, LoginProps, LogoutButtonProps, MediaCategory, MediaMap, MediaOptions, Meter, Mile, MimeByExt, Minute, OutDist, OutDistance, OutSpeed, OutSpeedType, OutSpeeds, OutTime, OutTimeType, OutTimes, Promise$1 as Promise, Second, StartVelIn, TargetAltIn, TargetVelIn, TimeUnit, UnitConverter, UrlKey, VelocityUnit };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively traverse the object and convert BigInts to numbers or strings.
|
|
3
|
+
*
|
|
4
|
+
* @param {object|array} obj - The object to traverse
|
|
5
|
+
* @param {boolean} convertToNumber - Whether to convert BigInt to Number (default is true)
|
|
6
|
+
* @returns {object|array} - The transformed object
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertBigInts(obj: any, convertToNumber?: boolean): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sizeUtils';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function exceedsMbLimit(limitMb: number, payloadMb: number): boolean;
|
|
2
|
+
export declare function safeJsonSizeInMb(value: unknown): number;
|
|
3
|
+
export declare function dataSizeInMb(data: unknown): number;
|
|
4
|
+
export declare function getJsonSizeInMb(json: unknown): number;
|
|
5
|
+
export declare function dataSize(data: any): number;
|
|
@@ -2,3 +2,11 @@ export declare function get_key_value<T extends object>(obj: T, key: string): an
|
|
|
2
2
|
export declare function get<T extends object>(obj: T | null | undefined, keys: string | string[], defaultValue?: any): any;
|
|
3
3
|
export declare function findKeyValue(obj: Record<string, any>, keyToFind: string): any;
|
|
4
4
|
export declare function omitKeys<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
5
|
+
/**
|
|
6
|
+
* Extracts necessary properties from the insertValue to prevent circular references.
|
|
7
|
+
*
|
|
8
|
+
* @param insertValue - The original RPC result.
|
|
9
|
+
* @returns A new object with only the required properties.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractInsertData(insertValue: any): any;
|
|
12
|
+
export declare function loadInnerJson(data: any): any;
|