@putkoff/abstract-utilities 0.1.234 → 0.1.236

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.
Files changed (92) hide show
  1. package/dist/cjs/index.js +100 -0
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/index.js +93 -1
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.ts +28 -1
  6. package/dist/types/functions/auth_utils/imports.d.ts +0 -0
  7. package/dist/types/functions/auth_utils/index.d.ts +0 -0
  8. package/dist/types/functions/auth_utils/src/index.d.ts +0 -0
  9. package/dist/types/functions/auth_utils/src/token_utils.d.ts +0 -0
  10. package/dist/types/functions/config_utils/imports.d.ts +0 -0
  11. package/dist/types/functions/config_utils/index.d.ts +0 -0
  12. package/dist/types/functions/config_utils/src/config_utils.d.ts +0 -0
  13. package/dist/types/functions/config_utils/src/index.d.ts +0 -0
  14. package/dist/types/functions/constants_utils/index.d.ts +0 -0
  15. package/dist/types/functions/constants_utils/src/constants.d.ts +0 -0
  16. package/dist/types/functions/constants_utils/src/index.d.ts +0 -0
  17. package/dist/types/functions/env_utils/imports.d.ts +0 -0
  18. package/dist/types/functions/env_utils/index.d.ts +0 -0
  19. package/dist/types/functions/env_utils/src/index.d.ts +0 -0
  20. package/dist/types/functions/env_utils/src/window_utils.d.ts +0 -0
  21. package/dist/types/functions/fetch_utils/imports.d.ts +0 -0
  22. package/dist/types/functions/fetch_utils/index.d.ts +0 -0
  23. package/dist/types/functions/fetch_utils/src/fetch_utils.d.ts +0 -0
  24. package/dist/types/functions/fetch_utils/src/index.d.ts +1 -0
  25. package/dist/types/functions/fetch_utils/src/url_utils.d.ts +23 -0
  26. package/dist/types/functions/fetch_utils/src/utils.d.ts +1 -0
  27. package/dist/types/functions/index.d.ts +0 -0
  28. package/dist/types/functions/math_utils/index.d.ts +0 -0
  29. package/dist/types/functions/math_utils/safe_math.d.ts +0 -0
  30. package/dist/types/functions/path_utils/imports.d.ts +0 -0
  31. package/dist/types/functions/path_utils/index.d.ts +0 -0
  32. package/dist/types/functions/path_utils/src/base_dirs.d.ts +0 -0
  33. package/dist/types/functions/path_utils/src/function_dirs.d.ts +0 -0
  34. package/dist/types/functions/path_utils/src/index.d.ts +0 -0
  35. package/dist/types/functions/path_utils/src/misc_dirs.d.ts +0 -0
  36. package/dist/types/functions/path_utils/src/path_utils.browser.d.ts +0 -0
  37. package/dist/types/functions/path_utils/src/path_utils.d.ts +2 -0
  38. package/dist/types/functions/path_utils/src/path_utils.node.d.ts +0 -0
  39. package/dist/types/functions/path_utils/src/paths.d.ts +0 -0
  40. package/dist/types/functions/path_utils/src/src_dirs.d.ts +0 -0
  41. package/dist/types/functions/read_utils/imports.d.ts +0 -0
  42. package/dist/types/functions/read_utils/index.d.ts +0 -0
  43. package/dist/types/functions/read_utils/src/index.d.ts +0 -0
  44. package/dist/types/functions/read_utils/src/read_utils.browser.d.ts +0 -0
  45. package/dist/types/functions/read_utils/src/utils.browser.d.ts +0 -0
  46. package/dist/types/functions/read_utils/src/utils.d.ts +0 -0
  47. package/dist/types/functions/rndm_utils/imports.d.ts +0 -0
  48. package/dist/types/functions/rndm_utils/index.d.ts +0 -0
  49. package/dist/types/functions/rndm_utils/src/index.d.ts +0 -0
  50. package/dist/types/functions/rndm_utils/src/utils.d.ts +0 -0
  51. package/dist/types/functions/safe_utils/imports.d.ts +0 -0
  52. package/dist/types/functions/safe_utils/index.d.ts +0 -0
  53. package/dist/types/functions/safe_utils/src/index.d.ts +0 -0
  54. package/dist/types/functions/safe_utils/src/safe_document.d.ts +0 -0
  55. package/dist/types/functions/safe_utils/src/safe_globals.d.ts +0 -0
  56. package/dist/types/functions/safe_utils/src/safe_storage.d.ts +0 -0
  57. package/dist/types/functions/safe_utils/src/safe_window.d.ts +0 -0
  58. package/dist/types/functions/string_utils/index.d.ts +0 -0
  59. package/dist/types/functions/string_utils/src/index.d.ts +0 -0
  60. package/dist/types/functions/string_utils/src/string_utils.d.ts +0 -0
  61. package/dist/types/functions/type_utils/imports.d.ts +0 -0
  62. package/dist/types/functions/type_utils/index.d.ts +0 -0
  63. package/dist/types/functions/type_utils/src/clean_utils.d.ts +0 -0
  64. package/dist/types/functions/type_utils/src/ensure_utils.d.ts +0 -0
  65. package/dist/types/functions/type_utils/src/index.d.ts +0 -0
  66. package/dist/types/functions/type_utils/src/json_utils.d.ts +0 -0
  67. package/dist/types/functions/type_utils/src/type_utils.d.ts +0 -0
  68. package/dist/types/functions/ui_utils/imports.d.ts +0 -0
  69. package/dist/types/functions/ui_utils/index.d.ts +0 -0
  70. package/dist/types/functions/ui_utils/src/button.d.ts +0 -0
  71. package/dist/types/functions/ui_utils/src/checkbox.d.ts +0 -0
  72. package/dist/types/functions/ui_utils/src/index.d.ts +0 -0
  73. package/dist/types/functions/ui_utils/src/input.d.ts +0 -0
  74. package/dist/types/functions/ui_utils/src/spinner.d.ts +0 -0
  75. package/dist/types/functions/variable_utils/imports.d.ts +0 -0
  76. package/dist/types/functions/variable_utils/index.d.ts +0 -0
  77. package/dist/types/functions/variable_utils/src/index.d.ts +0 -0
  78. package/dist/types/functions/variable_utils/src/variable_utils.d.ts +0 -0
  79. package/dist/types/index.d.ts +0 -0
  80. package/dist/types/types/index.d.ts +0 -0
  81. package/dist/types/types/src/ChangePassword.d.ts +0 -0
  82. package/dist/types/types/src/Files.d.ts +0 -0
  83. package/dist/types/types/src/index.d.ts +0 -0
  84. package/dist/types/types/src/login.d.ts +0 -0
  85. package/dist/types/types/src/logout.d.ts +0 -0
  86. package/dist/types/types/src/utils.d.ts +0 -0
  87. package/dist/types/utils/imports.d.ts +0 -0
  88. package/dist/types/utils/index.d.ts +0 -0
  89. package/dist/types/utils/src/Input.d.ts +0 -0
  90. package/dist/types/utils/src/config.d.ts +0 -0
  91. package/dist/types/utils/src/index.d.ts +0 -0
  92. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -212,6 +212,7 @@ declare function getConfigVar<T = any>(key?: any): Promise<T | undefined>;
212
212
  * Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
213
213
  */
214
214
  declare function getResult<T>(obj: any): T;
215
+ declare const get_result: typeof getResult;
215
216
  declare function getMethod(method?: string | null, body?: unknown): string;
216
217
  declare function getHeaders(headers?: Record<string, string>, method?: string | null, body?: unknown): Record<string, string>;
217
218
  declare function getBody(body?: unknown, method?: string | null): string | undefined;
@@ -223,6 +224,30 @@ declare function parseResult(res: Response): Promise<unknown>;
223
224
  */
224
225
  declare function checkResponse(res: Response): Response;
225
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
+
226
251
  declare function get_dirname(filePath: string | null): string;
227
252
  declare function get_basename(filePath: string | null): string;
228
253
  declare function get_filename(file_path: string): string;
@@ -245,6 +270,8 @@ declare function get_splitext(filePath: string | null): {
245
270
  */
246
271
  declare function make_path(...paths: Array<string | string[]>): string;
247
272
  declare function sanitizeFilename(filename: string): string;
273
+ declare function get_relative_path(directory: string, fullPath: string): string;
274
+ declare function get_safe_path(p: string): string;
248
275
  declare function make_sanitized_path(...paths: string[]): string;
249
276
  declare function normalizeUrl(base: string, p?: string): string;
250
277
 
@@ -397,5 +424,5 @@ declare function safeDivide(...args: Array<number | string | null | undefined>):
397
424
  declare function safeMultiply(...args: Array<number | string | null | undefined>): number;
398
425
  declare function roundPercentage(x: any): number;
399
426
 
400
- 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, callStorage, callWindowMethod, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, create_list_string, currentUsername, currentUsernames, decodeJwt, eatAll, eatEnd, eatInner, eatOuter, 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_key_value, get_keyword_string, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, isLoggedIn, isNum, isStrInString, isTokenExpired, isType, make_path, make_sanitized_path, normalizeUrl, parseResult, processKeywords, readJsonFile, removeToken, requireToken, roundPercentage, safeDivide, safeGlobalProp, safeMultiply, safeNums, safeStorage, sanitizeFilename, stripPrefixes, truncateString, tryParse };
427
+ 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, callStorage, callWindowMethod, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, create_list_string, currentUsername, currentUsernames, decodeJwt, eatAll, eatEnd, eatInner, eatOuter, 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, parseResult, path_to_url, processKeywords, readJsonFile, removeToken, requireToken, roundPercentage, safeDivide, safeGlobalProp, safeMultiply, safeNums, safeStorage, sanitizeFilename, stripPrefixes, truncateString, tryParse, urlJoin, url_to_path };
401
428
  export type { ApiRow, AppConfig, ChangePasswordFormProps, ChangePasswordProps, FetchVariables, FileItem, FileListResponse, InputProps, JwtPayload, LoginFormProps, LoginProps, LogoutButtonProps, Promise$1 as Promise, UrlKey };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,2 +1,3 @@
1
1
  export * from './fetch_utils';
2
2
  export * from './utils';
3
+ export * from './url_utils';
@@ -0,0 +1,23 @@
1
+ export declare function urlJoin(...parts: (string | undefined | null)[]): string;
2
+ /**
3
+ * Returns a full URL.
4
+ * If partial_url is already absolute (starts with http), it is returned as is.
5
+ * Otherwise, it is combined with the base URL.
6
+ */
7
+ export declare function get_full_url(partial_url: any, domain?: any): string;
8
+ /**
9
+ * Returns a full file system path.
10
+ * If partial_path is already absolute, it is returned as is.
11
+ * Otherwise, it is joined with the base directory.
12
+ */
13
+ export declare function get_full_path(partial_path: any, parent_dir?: any): string;
14
+ /**
15
+ * Converts a local file system path into its corresponding URL.
16
+ * It checks against the known directories in all_paths and replaces the matching base.
17
+ */
18
+ export declare function path_to_url(filePath: string, all_paths: any): string | null;
19
+ /**
20
+ * Converts a URL into its corresponding local file system path.
21
+ * It checks against the known URL prefixes in all_paths and replaces the matching base.
22
+ */
23
+ export declare function url_to_path(urlStr: string, all_paths: any): string | null;
@@ -3,6 +3,7 @@ import { FetchVariables } from './../imports';
3
3
  * Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
4
4
  */
5
5
  export declare function getResult<T>(obj: any): T;
6
+ export declare const get_result: typeof getResult;
6
7
  export declare function getMethod(method?: string | null, body?: unknown): string;
7
8
  export declare function getHeaders(headers?: Record<string, string>, method?: string | null, body?: unknown): Record<string, string>;
8
9
  export declare function getBody(body?: unknown, method?: string | null): string | undefined;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -20,5 +20,7 @@ export declare function get_splitext(filePath: string | null): {
20
20
  */
21
21
  export declare function make_path(...paths: Array<string | string[]>): string;
22
22
  export declare function sanitizeFilename(filename: string): string;
23
+ export declare function get_relative_path(directory: string, fullPath: string): string;
24
+ export declare function get_safe_path(p: string): string;
23
25
  export declare function make_sanitized_path(...paths: string[]): string;
24
26
  export declare function normalizeUrl(base: string, p?: string): string;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "0.1.234",
3
+ "version": "0.1.236",
4
4
  "description": "Reusable abstract utility functions and components for both Node and React.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",