@putkoff/abstract-utilities 0.1.235 → 0.1.238
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 +167 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +155 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +45 -1
- package/dist/types/functions/fetch_utils/src/index.d.ts +1 -0
- package/dist/types/functions/index.d.ts +1 -0
- package/dist/types/functions/url_utils/index.d.ts +1 -0
- package/dist/types/functions/url_utils/uri_utils.d.ts +19 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -224,6 +224,30 @@ declare function parseResult(res: Response): Promise<unknown>;
|
|
|
224
224
|
*/
|
|
225
225
|
declare function checkResponse(res: Response): Response;
|
|
226
226
|
|
|
227
|
+
declare function urlJoin(...parts: (string | undefined | null)[]): string;
|
|
228
|
+
/**
|
|
229
|
+
* Returns a full URL.
|
|
230
|
+
* If partial_url is already absolute (starts with http), it is returned as is.
|
|
231
|
+
* Otherwise, it is combined with the base URL.
|
|
232
|
+
*/
|
|
233
|
+
declare function get_full_url(partial_url: any, domain?: any): string;
|
|
234
|
+
/**
|
|
235
|
+
* Returns a full file system path.
|
|
236
|
+
* If partial_path is already absolute, it is returned as is.
|
|
237
|
+
* Otherwise, it is joined with the base directory.
|
|
238
|
+
*/
|
|
239
|
+
declare function get_full_path(partial_path: any, parent_dir?: any): string;
|
|
240
|
+
/**
|
|
241
|
+
* Converts a local file system path into its corresponding URL.
|
|
242
|
+
* It checks against the known directories in all_paths and replaces the matching base.
|
|
243
|
+
*/
|
|
244
|
+
declare function path_to_url(filePath: string, all_paths: any): string | null;
|
|
245
|
+
/**
|
|
246
|
+
* Converts a URL into its corresponding local file system path.
|
|
247
|
+
* It checks against the known URL prefixes in all_paths and replaces the matching base.
|
|
248
|
+
*/
|
|
249
|
+
declare function url_to_path(urlStr: string, all_paths: any): string | null;
|
|
250
|
+
|
|
227
251
|
declare function get_dirname(filePath: string | null): string;
|
|
228
252
|
declare function get_basename(filePath: string | null): string;
|
|
229
253
|
declare function get_filename(file_path: string): string;
|
|
@@ -400,5 +424,25 @@ declare function safeDivide(...args: Array<number | string | null | undefined>):
|
|
|
400
424
|
declare function safeMultiply(...args: Array<number | string | null | undefined>): number;
|
|
401
425
|
declare function roundPercentage(x: any): number;
|
|
402
426
|
|
|
403
|
-
|
|
427
|
+
/** Encode a single query value/key safely */
|
|
428
|
+
declare const encode: (v: unknown) => string;
|
|
429
|
+
/** Decode a single query value/key safely (never throws) */
|
|
430
|
+
declare const decodeSafe: (v: string | null | undefined) => string;
|
|
431
|
+
/** Decode strings that might be double-encoded (up to 2 passes) */
|
|
432
|
+
declare const decodeMaybeDouble: (v: string) => string;
|
|
433
|
+
/** Convert + to spaces (legacy www-form behavior) then decode */
|
|
434
|
+
declare const decodeFormComponent: (v: string) => string;
|
|
435
|
+
/** Build a URL with query params (skips null/undefined) */
|
|
436
|
+
declare const buildUrl: (base: string, params?: Record<string, unknown>) => string;
|
|
437
|
+
/** Parse a query string into an object (first value wins; arrays if repeat=true) */
|
|
438
|
+
declare const parseQuery: (qs: string, opts?: {
|
|
439
|
+
repeat?: boolean;
|
|
440
|
+
form?: boolean;
|
|
441
|
+
}) => Record<string, any>;
|
|
442
|
+
/** Quick helper: percent-encode whole strings for placement in URLs */
|
|
443
|
+
declare const encodeTextForUrl: (text: string) => string;
|
|
444
|
+
/** Quick helper: decode long blobs coming from share-intents/UTMs */
|
|
445
|
+
declare const decodeShareBlob: (blob: string) => string;
|
|
446
|
+
|
|
447
|
+
export { API_PREFIX, BASE_URL, Button, Checkbox, DEV_PREFIX, DOMAIN_NAME, Input, PROD_PREFIX, PROTOCOL, SUB_DIR, Spinner, alertIt, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, buildUrl, callStorage, callWindowMethod, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, create_list_string, currentUsername, currentUsernames, decodeFormComponent, decodeJwt, decodeMaybeDouble, decodeSafe, decodeShareBlob, eatAll, eatEnd, eatInner, eatOuter, encode, encodeTextForUrl, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, formatNumber, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAlphaNum, getAlphas, getAuthorizationHeader, getBaseDir, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfigContent, getConfigJson, getConfigVar, getDbConfigsPath, getDistDir, getDocumentProp, getEnvDir, getEnvPath, getFetchVars, getFunctionsDir, getFunctionsUtilsDirectory, getHeaders, getHooksUtilsDirectory, getHtmlDirectory, getLibUtilsDirectory, getMethod, getNums, getPublicDir, getResult, getSafeDocument, getSafeLocalStorage, getSafeWindow, getSchemasDirPath, getSchemasPath, getSrcDir, getSubstring, getToken, getWindowHost, getWindowProp, get_basename, get_dirname, get_extname, get_filename, get_full_path, get_full_url, get_key_value, get_keyword_string, get_relative_path, get_result, get_safe_path, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, isLoggedIn, isNum, isStrInString, isTokenExpired, isType, make_path, make_sanitized_path, normalizeUrl, parseQuery, parseResult, path_to_url, processKeywords, readJsonFile, removeToken, requireToken, roundPercentage, safeDivide, safeGlobalProp, safeMultiply, safeNums, safeStorage, sanitizeFilename, stripPrefixes, truncateString, tryParse, urlJoin, url_to_path };
|
|
404
448
|
export type { ApiRow, AppConfig, ChangePasswordFormProps, ChangePasswordProps, FetchVariables, FileItem, FileListResponse, InputProps, JwtPayload, LoginFormProps, LoginProps, LogoutButtonProps, Promise$1 as Promise, UrlKey };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './uri_utils';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Encode a single query value/key safely */
|
|
2
|
+
export declare const encode: (v: unknown) => string;
|
|
3
|
+
/** Decode a single query value/key safely (never throws) */
|
|
4
|
+
export declare const decodeSafe: (v: string | null | undefined) => string;
|
|
5
|
+
/** Decode strings that might be double-encoded (up to 2 passes) */
|
|
6
|
+
export declare const decodeMaybeDouble: (v: string) => string;
|
|
7
|
+
/** Convert + to spaces (legacy www-form behavior) then decode */
|
|
8
|
+
export declare const decodeFormComponent: (v: string) => string;
|
|
9
|
+
/** Build a URL with query params (skips null/undefined) */
|
|
10
|
+
export declare const buildUrl: (base: string, params?: Record<string, unknown>) => string;
|
|
11
|
+
/** Parse a query string into an object (first value wins; arrays if repeat=true) */
|
|
12
|
+
export declare const parseQuery: (qs: string, opts?: {
|
|
13
|
+
repeat?: boolean;
|
|
14
|
+
form?: boolean;
|
|
15
|
+
}) => Record<string, any>;
|
|
16
|
+
/** Quick helper: percent-encode whole strings for placement in URLs */
|
|
17
|
+
export declare const encodeTextForUrl: (text: string) => string;
|
|
18
|
+
/** Quick helper: decode long blobs coming from share-intents/UTMs */
|
|
19
|
+
export declare const decodeShareBlob: (blob: string) => string;
|
package/package.json
CHANGED