@putkoff/abstract-utilities 0.1.118 → 0.1.122

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 (259) hide show
  1. package/dist/cjs/functions/auth_utils/imports.d.ts +0 -0
  2. package/dist/cjs/functions/auth_utils/index.d.ts +0 -0
  3. package/dist/cjs/functions/auth_utils/src/index.d.ts +0 -0
  4. package/dist/cjs/functions/auth_utils/src/token_utils.d.ts +0 -0
  5. package/dist/cjs/functions/config_utils/imports.d.ts +0 -0
  6. package/dist/cjs/functions/config_utils/index.d.ts +0 -0
  7. package/dist/cjs/functions/config_utils/src/config_utils.d.ts +0 -0
  8. package/dist/cjs/functions/config_utils/src/index.d.ts +0 -0
  9. package/dist/cjs/functions/constants_utils/index.d.ts +0 -0
  10. package/dist/cjs/functions/constants_utils/src/constants.d.ts +0 -0
  11. package/dist/cjs/functions/constants_utils/src/index.d.ts +0 -0
  12. package/dist/cjs/functions/env_utils/imports.d.ts +0 -0
  13. package/dist/cjs/functions/env_utils/index.d.ts +0 -0
  14. package/dist/cjs/functions/env_utils/src/index.d.ts +0 -0
  15. package/dist/cjs/functions/env_utils/src/window_utils.d.ts +0 -0
  16. package/dist/cjs/functions/fetch_utils/imports.d.ts +1 -1
  17. package/dist/cjs/functions/fetch_utils/index.d.ts +0 -0
  18. package/dist/cjs/functions/fetch_utils/src/fetchIt_utils.d.ts +1 -1
  19. package/dist/cjs/functions/fetch_utils/src/index.d.ts +0 -0
  20. package/dist/cjs/functions/fetch_utils/src/utils.d.ts +0 -0
  21. package/dist/cjs/functions/index.d.ts +0 -0
  22. package/dist/cjs/functions/path_utils/imports.d.ts +3 -2
  23. package/dist/cjs/functions/path_utils/index.d.ts +0 -0
  24. package/dist/cjs/functions/path_utils/src/base_dirs.d.ts +0 -0
  25. package/dist/cjs/functions/path_utils/src/function_dirs.d.ts +0 -0
  26. package/dist/cjs/functions/path_utils/src/index.d.ts +0 -0
  27. package/dist/cjs/functions/path_utils/src/misc_dirs.d.ts +0 -0
  28. package/dist/cjs/functions/path_utils/src/path_utils.d.ts +0 -0
  29. package/dist/cjs/functions/path_utils/src/paths.d.ts +0 -0
  30. package/dist/cjs/functions/path_utils/src/src_dirs.d.ts +0 -0
  31. package/dist/cjs/functions/read_utils/index.d.ts +0 -0
  32. package/dist/cjs/functions/read_utils/src/index.d.ts +0 -0
  33. package/dist/cjs/functions/read_utils/src/read_utils.d.ts +0 -0
  34. package/dist/cjs/functions/rndm_utils/index.d.ts +0 -0
  35. package/dist/cjs/functions/rndm_utils/src/index.d.ts +0 -0
  36. package/dist/cjs/functions/rndm_utils/src/utils.d.ts +0 -0
  37. package/dist/cjs/functions/string_utils/index.d.ts +0 -0
  38. package/dist/cjs/functions/string_utils/src/index.d.ts +0 -0
  39. package/dist/cjs/functions/string_utils/src/string_utils.d.ts +0 -0
  40. package/dist/cjs/functions/type_utils/index.d.ts +0 -0
  41. package/dist/cjs/functions/type_utils/src/index.d.ts +0 -0
  42. package/dist/cjs/functions/type_utils/src/type_utils.d.ts +0 -0
  43. package/dist/cjs/functions/ui_utils/imports.d.ts +0 -0
  44. package/dist/cjs/functions/ui_utils/index.d.ts +0 -0
  45. package/dist/cjs/functions/ui_utils/src/button.d.ts +0 -0
  46. package/dist/cjs/functions/ui_utils/src/checkbox.d.ts +0 -0
  47. package/dist/cjs/functions/ui_utils/src/index.d.ts +0 -0
  48. package/dist/cjs/functions/ui_utils/src/input.d.ts +0 -0
  49. package/dist/cjs/functions/ui_utils/src/spinner.d.ts +0 -0
  50. package/dist/cjs/index.d.ts +0 -0
  51. package/dist/cjs/index.js +62 -52
  52. package/dist/cjs/index.js.map +1 -1
  53. package/dist/cjs/types/index.d.ts +0 -0
  54. package/dist/cjs/types/src/ChangePassword.d.ts +0 -0
  55. package/dist/cjs/types/src/Files.d.ts +0 -0
  56. package/dist/cjs/types/src/index.d.ts +0 -0
  57. package/dist/cjs/types/src/login.d.ts +0 -0
  58. package/dist/cjs/types/src/logout.d.ts +0 -0
  59. package/dist/cjs/types/src/utils.d.ts +0 -0
  60. package/dist/cjs/utils/imports.d.ts +0 -0
  61. package/dist/cjs/utils/index.d.ts +0 -0
  62. package/dist/cjs/utils/src/Input.d.ts +0 -0
  63. package/dist/cjs/utils/src/config.d.ts +0 -0
  64. package/dist/cjs/utils/src/index.d.ts +0 -0
  65. package/dist/esm/functions/auth_utils/imports.d.ts +0 -0
  66. package/dist/esm/functions/auth_utils/index.d.ts +0 -0
  67. package/dist/esm/functions/auth_utils/src/index.d.ts +0 -0
  68. package/dist/esm/functions/auth_utils/src/token_utils.d.ts +0 -0
  69. package/dist/esm/functions/config_utils/imports.d.ts +0 -0
  70. package/dist/esm/functions/config_utils/index.d.ts +0 -0
  71. package/dist/esm/functions/config_utils/src/config_utils.d.ts +0 -0
  72. package/dist/esm/functions/config_utils/src/index.d.ts +0 -0
  73. package/dist/esm/functions/constants_utils/index.d.ts +0 -0
  74. package/dist/esm/functions/constants_utils/src/constants.d.ts +0 -0
  75. package/dist/esm/functions/constants_utils/src/index.d.ts +0 -0
  76. package/dist/esm/functions/env_utils/imports.d.ts +0 -0
  77. package/dist/esm/functions/env_utils/index.d.ts +0 -0
  78. package/dist/esm/functions/env_utils/src/index.d.ts +0 -0
  79. package/dist/esm/functions/env_utils/src/window_utils.d.ts +0 -0
  80. package/dist/esm/functions/fetch_utils/imports.d.ts +1 -1
  81. package/dist/esm/functions/fetch_utils/index.d.ts +0 -0
  82. package/dist/esm/functions/fetch_utils/src/fetchIt_utils.d.ts +1 -1
  83. package/dist/esm/functions/fetch_utils/src/index.d.ts +0 -0
  84. package/dist/esm/functions/fetch_utils/src/utils.d.ts +0 -0
  85. package/dist/esm/functions/index.d.ts +0 -0
  86. package/dist/esm/functions/path_utils/imports.d.ts +3 -2
  87. package/dist/esm/functions/path_utils/index.d.ts +0 -0
  88. package/dist/esm/functions/path_utils/src/base_dirs.d.ts +0 -0
  89. package/dist/esm/functions/path_utils/src/function_dirs.d.ts +0 -0
  90. package/dist/esm/functions/path_utils/src/index.d.ts +0 -0
  91. package/dist/esm/functions/path_utils/src/misc_dirs.d.ts +0 -0
  92. package/dist/esm/functions/path_utils/src/path_utils.d.ts +0 -0
  93. package/dist/esm/functions/path_utils/src/paths.d.ts +0 -0
  94. package/dist/esm/functions/path_utils/src/src_dirs.d.ts +0 -0
  95. package/dist/esm/functions/read_utils/index.d.ts +0 -0
  96. package/dist/esm/functions/read_utils/src/index.d.ts +0 -0
  97. package/dist/esm/functions/read_utils/src/read_utils.d.ts +0 -0
  98. package/dist/esm/functions/rndm_utils/index.d.ts +0 -0
  99. package/dist/esm/functions/rndm_utils/src/index.d.ts +0 -0
  100. package/dist/esm/functions/rndm_utils/src/utils.d.ts +0 -0
  101. package/dist/esm/functions/string_utils/index.d.ts +0 -0
  102. package/dist/esm/functions/string_utils/src/index.d.ts +0 -0
  103. package/dist/esm/functions/string_utils/src/string_utils.d.ts +0 -0
  104. package/dist/esm/functions/type_utils/index.d.ts +0 -0
  105. package/dist/esm/functions/type_utils/src/index.d.ts +0 -0
  106. package/dist/esm/functions/type_utils/src/type_utils.d.ts +0 -0
  107. package/dist/esm/functions/ui_utils/imports.d.ts +0 -0
  108. package/dist/esm/functions/ui_utils/index.d.ts +0 -0
  109. package/dist/esm/functions/ui_utils/src/button.d.ts +0 -0
  110. package/dist/esm/functions/ui_utils/src/checkbox.d.ts +0 -0
  111. package/dist/esm/functions/ui_utils/src/index.d.ts +0 -0
  112. package/dist/esm/functions/ui_utils/src/input.d.ts +0 -0
  113. package/dist/esm/functions/ui_utils/src/spinner.d.ts +0 -0
  114. package/dist/esm/index.d.ts +0 -0
  115. package/dist/esm/index.js +62 -52
  116. package/dist/esm/index.js.map +1 -1
  117. package/dist/esm/types/index.d.ts +0 -0
  118. package/dist/esm/types/src/ChangePassword.d.ts +0 -0
  119. package/dist/esm/types/src/Files.d.ts +0 -0
  120. package/dist/esm/types/src/index.d.ts +0 -0
  121. package/dist/esm/types/src/login.d.ts +0 -0
  122. package/dist/esm/types/src/logout.d.ts +0 -0
  123. package/dist/esm/types/src/utils.d.ts +0 -0
  124. package/dist/esm/utils/imports.d.ts +0 -0
  125. package/dist/esm/utils/index.d.ts +0 -0
  126. package/dist/esm/utils/src/Input.d.ts +0 -0
  127. package/dist/esm/utils/src/config.d.ts +0 -0
  128. package/dist/esm/utils/src/index.d.ts +0 -0
  129. package/dist/functions/auth_utils/imports.d.ts +0 -0
  130. package/dist/functions/auth_utils/imports.js +1 -0
  131. package/dist/functions/auth_utils/index.d.ts +0 -0
  132. package/dist/functions/auth_utils/index.js +1 -0
  133. package/dist/functions/auth_utils/src/index.d.ts +0 -0
  134. package/dist/functions/auth_utils/src/index.js +1 -0
  135. package/dist/functions/auth_utils/src/token_utils.d.ts +0 -0
  136. package/dist/functions/auth_utils/src/token_utils.js +95 -0
  137. package/dist/functions/config_utils/imports.d.ts +0 -0
  138. package/dist/functions/config_utils/imports.js +1 -0
  139. package/dist/functions/config_utils/index.d.ts +0 -0
  140. package/dist/functions/config_utils/index.js +1 -0
  141. package/dist/functions/config_utils/src/config_utils.d.ts +0 -0
  142. package/dist/functions/config_utils/src/config_utils.js +33 -0
  143. package/dist/functions/config_utils/src/index.d.ts +0 -0
  144. package/dist/functions/config_utils/src/index.js +1 -0
  145. package/dist/functions/constants_utils/index.d.ts +0 -0
  146. package/dist/functions/constants_utils/index.js +1 -0
  147. package/dist/functions/constants_utils/src/constants.d.ts +0 -0
  148. package/dist/functions/constants_utils/src/constants.js +7 -0
  149. package/dist/functions/constants_utils/src/index.d.ts +0 -0
  150. package/dist/functions/constants_utils/src/index.js +1 -0
  151. package/dist/functions/env_utils/imports.d.ts +0 -0
  152. package/dist/functions/env_utils/imports.js +1 -0
  153. package/dist/functions/env_utils/index.d.ts +0 -0
  154. package/dist/functions/env_utils/index.js +1 -0
  155. package/dist/functions/env_utils/src/index.d.ts +0 -0
  156. package/dist/functions/env_utils/src/index.js +1 -0
  157. package/dist/functions/env_utils/src/window_utils.d.ts +0 -0
  158. package/dist/functions/env_utils/src/window_utils.js +47 -0
  159. package/dist/functions/fetch_utils/imports.d.ts +1 -1
  160. package/dist/functions/fetch_utils/imports.js +7 -0
  161. package/dist/functions/fetch_utils/index.d.ts +0 -0
  162. package/dist/functions/fetch_utils/index.js +1 -0
  163. package/dist/functions/fetch_utils/src/fetchIt_utils.d.ts +1 -1
  164. package/dist/functions/fetch_utils/src/fetchIt_utils.js +116 -0
  165. package/dist/functions/fetch_utils/src/index.d.ts +0 -0
  166. package/dist/functions/fetch_utils/src/index.js +1 -0
  167. package/dist/functions/fetch_utils/src/utils.d.ts +0 -0
  168. package/dist/functions/fetch_utils/src/utils.js +171 -0
  169. package/dist/functions/index.d.ts +0 -0
  170. package/dist/functions/index.js +12 -0
  171. package/dist/functions/path_utils/imports.d.ts +3 -2
  172. package/dist/functions/path_utils/imports.js +26 -0
  173. package/dist/functions/path_utils/index.d.ts +0 -0
  174. package/dist/functions/path_utils/index.js +1 -0
  175. package/dist/functions/path_utils/src/base_dirs.d.ts +0 -0
  176. package/dist/functions/path_utils/src/base_dirs.js +17 -0
  177. package/dist/functions/path_utils/src/function_dirs.d.ts +0 -0
  178. package/dist/functions/path_utils/src/function_dirs.js +42 -0
  179. package/dist/functions/path_utils/src/index.d.ts +0 -0
  180. package/dist/functions/path_utils/src/index.js +6 -0
  181. package/dist/functions/path_utils/src/misc_dirs.d.ts +0 -0
  182. package/dist/functions/path_utils/src/misc_dirs.js +15 -0
  183. package/dist/functions/path_utils/src/path_utils.d.ts +0 -0
  184. package/dist/functions/path_utils/src/path_utils.js +75 -0
  185. package/dist/functions/path_utils/src/paths.d.ts +0 -0
  186. package/dist/functions/path_utils/src/paths.js +12 -0
  187. package/dist/functions/path_utils/src/src_dirs.d.ts +0 -0
  188. package/dist/functions/path_utils/src/src_dirs.js +25 -0
  189. package/dist/functions/read_utils/imports.d.ts +0 -0
  190. package/dist/functions/read_utils/imports.js +1 -0
  191. package/dist/functions/read_utils/index.d.ts +0 -0
  192. package/dist/functions/read_utils/index.js +1 -0
  193. package/dist/functions/read_utils/src/index.d.ts +0 -0
  194. package/dist/functions/read_utils/src/index.js +1 -0
  195. package/dist/functions/read_utils/src/read_utils.d.ts +0 -0
  196. package/dist/functions/read_utils/src/read_utils.js +55 -0
  197. package/dist/functions/rndm_utils/imports.d.ts +0 -0
  198. package/dist/functions/rndm_utils/imports.js +1 -0
  199. package/dist/functions/rndm_utils/index.d.ts +0 -0
  200. package/dist/functions/rndm_utils/index.js +1 -0
  201. package/dist/functions/rndm_utils/src/index.d.ts +0 -0
  202. package/dist/functions/rndm_utils/src/index.js +1 -0
  203. package/dist/functions/rndm_utils/src/utils.d.ts +0 -0
  204. package/dist/functions/rndm_utils/src/utils.js +12 -0
  205. package/dist/functions/string_utils/index.d.ts +0 -0
  206. package/dist/functions/string_utils/index.js +1 -0
  207. package/dist/functions/string_utils/src/index.d.ts +0 -0
  208. package/dist/functions/string_utils/src/index.js +1 -0
  209. package/dist/functions/string_utils/src/string_utils.d.ts +0 -0
  210. package/dist/functions/string_utils/src/string_utils.js +113 -0
  211. package/dist/functions/type_utils/imports.d.ts +0 -0
  212. package/dist/functions/type_utils/imports.js +1 -0
  213. package/dist/functions/type_utils/index.d.ts +0 -0
  214. package/dist/functions/type_utils/index.js +1 -0
  215. package/dist/functions/type_utils/src/index.d.ts +0 -0
  216. package/dist/functions/type_utils/src/index.js +1 -0
  217. package/dist/functions/type_utils/src/type_utils.d.ts +0 -0
  218. package/dist/functions/type_utils/src/type_utils.js +4 -0
  219. package/dist/functions/ui_utils/imports.d.ts +0 -0
  220. package/dist/functions/ui_utils/imports.js +5 -0
  221. package/dist/functions/ui_utils/index.d.ts +0 -0
  222. package/dist/functions/ui_utils/index.js +1 -0
  223. package/dist/functions/ui_utils/src/button.d.ts +0 -0
  224. package/dist/functions/ui_utils/src/button.js +32 -0
  225. package/dist/functions/ui_utils/src/checkbox.d.ts +0 -0
  226. package/dist/functions/ui_utils/src/checkbox.js +16 -0
  227. package/dist/functions/ui_utils/src/index.d.ts +0 -0
  228. package/dist/functions/ui_utils/src/index.js +4 -0
  229. package/dist/functions/ui_utils/src/input.d.ts +0 -0
  230. package/dist/functions/ui_utils/src/input.js +16 -0
  231. package/dist/functions/ui_utils/src/spinner.d.ts +0 -0
  232. package/dist/functions/ui_utils/src/spinner.js +4 -0
  233. package/dist/index.d.ts +1 -1
  234. package/dist/index.js +5 -0
  235. package/dist/types/index.d.ts +0 -0
  236. package/dist/types/index.js +1 -0
  237. package/dist/types/src/ChangePassword.d.ts +0 -0
  238. package/dist/types/src/ChangePassword.js +1 -0
  239. package/dist/types/src/Files.d.ts +0 -0
  240. package/dist/types/src/Files.js +1 -0
  241. package/dist/types/src/index.d.ts +0 -0
  242. package/dist/types/src/index.js +5 -0
  243. package/dist/types/src/login.d.ts +0 -0
  244. package/dist/types/src/login.js +1 -0
  245. package/dist/types/src/logout.d.ts +0 -0
  246. package/dist/types/src/logout.js +1 -0
  247. package/dist/types/src/utils.d.ts +0 -0
  248. package/dist/types/src/utils.js +1 -0
  249. package/dist/utils/imports.d.ts +0 -0
  250. package/dist/utils/imports.js +1 -0
  251. package/dist/utils/index.d.ts +0 -0
  252. package/dist/utils/index.js +1 -0
  253. package/dist/utils/src/Input.d.ts +0 -0
  254. package/dist/utils/src/Input.js +2 -0
  255. package/dist/utils/src/config.d.ts +0 -0
  256. package/dist/utils/src/config.js +20 -0
  257. package/dist/utils/src/index.d.ts +0 -0
  258. package/dist/utils/src/index.js +2 -0
  259. package/package.json +8 -1
@@ -0,0 +1,42 @@
1
+ import { make_path, get_dirname } from './path_utils';
2
+ import { getAbsDir } from './paths';
3
+ export function getFunctionsDir() {
4
+ return get_dirname(getAbsDir());
5
+ }
6
+ ;
7
+ export function geAuthsUtilsDirectory() {
8
+ return make_path(getFunctionsDir(), 'auths');
9
+ }
10
+ ;
11
+ export function geBackupsUtilsDirectory() {
12
+ return make_path(getFunctionsDir(), 'backups');
13
+ }
14
+ ;
15
+ export function geConstantsUtilsDirectory() {
16
+ return make_path(getFunctionsDir(), 'constants');
17
+ }
18
+ ;
19
+ export function geEnvUtilsDirectory() {
20
+ return make_path(getFunctionsDir(), 'env_utils');
21
+ }
22
+ ;
23
+ export function geFetchUtilsDirectory() {
24
+ return make_path(getFunctionsDir(), 'fetch_utils');
25
+ }
26
+ ;
27
+ export function geFileUtilsDirectory() {
28
+ return make_path(getFunctionsDir(), 'file_utils');
29
+ }
30
+ ;
31
+ export function gePathUtilsDirectory() {
32
+ return make_path(getFunctionsDir(), 'path_utils');
33
+ }
34
+ ;
35
+ export function geStringUtilsDirectory() {
36
+ return make_path(getFunctionsDir(), 'string_utils');
37
+ }
38
+ ;
39
+ export function geTypeUtilsDirectory() {
40
+ return make_path(getFunctionsDir(), 'type_utils');
41
+ }
42
+ ;
File without changes
@@ -0,0 +1,6 @@
1
+ export * from './path_utils';
2
+ export * from './paths';
3
+ export * from './function_dirs';
4
+ export * from './src_dirs';
5
+ export * from './base_dirs';
6
+ export * from './misc_dirs';
File without changes
@@ -0,0 +1,15 @@
1
+ import { getBaseDir, getEnvDir } from './base_dirs';
2
+ import { make_path } from './path_utils';
3
+ export function getEnvPath(string = '.env') {
4
+ return make_path(getEnvDir(), string);
5
+ }
6
+ ;
7
+ export function getDbConfigsPath() {
8
+ return make_path(getBaseDir(), 'dbConfigs');
9
+ }
10
+ export function getSchemasPath() {
11
+ return make_path(getDbConfigsPath(), 'schemas');
12
+ }
13
+ export function getSchemasDirPath(subPath) {
14
+ return make_path(getSchemasPath(), subPath);
15
+ }
File without changes
@@ -0,0 +1,75 @@
1
+ import * as path from 'path-browserify';
2
+ import { eatOuter, eatInner, ensure_list } from './../imports';
3
+ export function get_dirname(filePath) {
4
+ if (!filePath)
5
+ return '';
6
+ return path.dirname(filePath);
7
+ }
8
+ export function get_basename(filePath) {
9
+ if (!filePath)
10
+ return '';
11
+ return path.basename(filePath);
12
+ }
13
+ export function get_filename(file_path) {
14
+ const ext = path.extname(file_path);
15
+ return path.basename(file_path, ext);
16
+ }
17
+ export function get_extname(filePath) {
18
+ if (!filePath)
19
+ return '';
20
+ return path.extname(filePath);
21
+ }
22
+ export function get_splitext(filePath) {
23
+ if (!filePath)
24
+ return { filename: '', extname: '' };
25
+ const ext = path.extname(filePath);
26
+ // Get the basename without the extension
27
+ const filename = path.basename(filePath, ext);
28
+ return { filename, ext };
29
+ }
30
+ export function make_path(...segments) {
31
+ const list = ensure_list(segments);
32
+ let real_path = '';
33
+ for (let i = 0; i < list.length; i++) {
34
+ let segment = list[i]; // renamed, no shadowing
35
+ if (i === 0) {
36
+ real_path = segment;
37
+ }
38
+ else {
39
+ segment = eatInner(segment, ['/']);
40
+ real_path = eatOuter(real_path, ['/']);
41
+ real_path = `${real_path}/${segment}`;
42
+ }
43
+ }
44
+ return real_path || '';
45
+ }
46
+ export function sanitizeFilename(filename) {
47
+ return filename
48
+ .toLowerCase()
49
+ .replace(/\s+|-/g, '-') // Replace spaces and hyphens with single hyphen
50
+ .replace(/_/g, '-') // Replace underscores with hyphens
51
+ .replace(/[^a-z0-9-.]/g, '') // Remove all non-alphanumeric chars except hyphen and dot
52
+ .replace(/-+/g, '-') // Collapse multiple hyphens into one
53
+ .replace(/^-|-$/, ''); // Remove leading/trailing hyphens
54
+ }
55
+ export function make_sanitized_path(...paths) {
56
+ let real_path = '';
57
+ for (let i = 0; i < paths.length; i++) {
58
+ const sanitized = sanitizeFilename(eatInner(paths[i], ['/']));
59
+ if (i === 0) {
60
+ real_path = sanitized;
61
+ }
62
+ else if (sanitized) { // Only append if there's a non-empty segment
63
+ real_path = `${real_path}/${sanitized}`;
64
+ }
65
+ }
66
+ return real_path || '';
67
+ }
68
+ export function normalizeUrl(base, p) {
69
+ if (!p)
70
+ return base;
71
+ const cleanBase = base.replace(/\/+$/, ''); // regex literal
72
+ const cleanPath = p.replace(/^\/+/, '');
73
+ // collapse multiple “//” into one, but keep the “://” after protocol
74
+ return `${cleanBase}/${cleanPath}`.replace(/([^:])\/{2,}/g, '$1/');
75
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ import { getAbsolutePath } from './../imports';
2
+ import { get_dirname, make_path } from './path_utils';
3
+ /**
4
+ * Returns the absolute path of the current file.
5
+ */
6
+ export function getAbsDir() {
7
+ return get_dirname(getAbsolutePath());
8
+ }
9
+ ;
10
+ export function getAbsPath(subPath) {
11
+ return make_path(getAbsDir(), subPath);
12
+ }
File without changes
@@ -0,0 +1,25 @@
1
+ import { make_path, get_dirname } from './path_utils';
2
+ import { getFunctionsDir } from './function_dirs';
3
+ export function getSrcDir() {
4
+ return get_dirname(getFunctionsDir());
5
+ }
6
+ ;
7
+ export function geStaticDirectory() {
8
+ return make_path(getSrcDir(), 'static');
9
+ }
10
+ ;
11
+ export function getLibUtilsDirectory() {
12
+ return make_path(getSrcDir(), 'lib');
13
+ }
14
+ export function getHooksUtilsDirectory() {
15
+ return make_path(getSrcDir(), 'hooks');
16
+ }
17
+ ;
18
+ export function getFunctionsUtilsDirectory() {
19
+ return make_path(getSrcDir(), 'functions');
20
+ }
21
+ ;
22
+ export function getComponentsUtilsDirectory() {
23
+ return make_path(getSrcDir(), 'components');
24
+ }
25
+ ;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1 @@
1
+ export * from './read_utils';
File without changes
@@ -0,0 +1,55 @@
1
+ // src/read_utils.ts
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ /**
12
+ * Attempt to load the Node-only modules.
13
+ * Returns { fs: null, path: null } in the browser.
14
+ */
15
+ function tryNodeModules() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ try {
18
+ const fsMod = yield import('fs');
19
+ const pathMod = yield import('path');
20
+ return {
21
+ fs: fsMod.promises, // keep the `promises` API
22
+ path: pathMod
23
+ };
24
+ }
25
+ catch (_a) {
26
+ return { fs: null, path: null };
27
+ }
28
+ });
29
+ }
30
+ /**
31
+ * Reads a file at `relativeOrAbsolutePath` and returns its contents as a string.
32
+ * In a browser this will reject immediately.
33
+ */
34
+ export function readFileContents(relativeOrAbsolutePath) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const { fs, path } = yield tryNodeModules();
37
+ if (!fs || !path) {
38
+ throw new Error('readFileContents can only be used in Node.js');
39
+ }
40
+ // resolve absolute
41
+ const filePath = path.isAbsolute(relativeOrAbsolutePath)
42
+ ? relativeOrAbsolutePath
43
+ : path.resolve(__dirname, relativeOrAbsolutePath);
44
+ return fs.readFile(filePath, 'utf8');
45
+ });
46
+ }
47
+ /**
48
+ * Reads a JSON file and returns the parsed object.
49
+ */
50
+ export function readJsonFile(relativeOrAbsolutePath) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const text = yield readFileContents(relativeOrAbsolutePath);
53
+ return JSON.parse(text);
54
+ });
55
+ }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1 @@
1
+ export * from './utils';
File without changes
@@ -0,0 +1,12 @@
1
+ // src/functions/rndm_utils/utils.ts
2
+ export function alertit(obj = null) {
3
+ let msg;
4
+ try {
5
+ msg = JSON.stringify(obj);
6
+ }
7
+ catch (_a) {
8
+ // If JSON.stringify fails (circular refs, etc.), fall back to a simple string
9
+ msg = String(obj);
10
+ }
11
+ alert(msg);
12
+ }
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1 @@
1
+ export * from './string_utils';
File without changes
@@ -0,0 +1,113 @@
1
+ export function getSubstring(obj, maxLength = null, minLength = null) {
2
+ const objLength = obj.length;
3
+ const effectiveMaxLength = maxLength !== null && maxLength !== void 0 ? maxLength : objLength; // Use nullish coalescing for clarity
4
+ const effectiveMinLength = minLength !== null && minLength !== void 0 ? minLength : 0;
5
+ // Ensure bounds are valid
6
+ const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
7
+ const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
8
+ // If minLength exceeds maxLength, return empty string or adjust logic as needed
9
+ if (clampedMinLength >= clampedMaxLength) {
10
+ return '';
11
+ }
12
+ return obj.substring(clampedMinLength, clampedMaxLength);
13
+ }
14
+ export function truncateString(obj, maxLength = 20) {
15
+ const objLength = obj.length;
16
+ if (objLength > maxLength && maxLength) {
17
+ obj = getSubstring(obj, maxLength) + '...';
18
+ }
19
+ return obj;
20
+ }
21
+ /**
22
+ * Remove *every* occurrence of any prefix in `bases` from the *beginning*
23
+ * of `str`, looping until no prefix matches.
24
+ *
25
+ * @example
26
+ * stripPrefixes('/site/site/docs', ['/site', '/static']);
27
+ * // → '/docs'
28
+ */
29
+ export function stripPrefixes(str, bases = []) {
30
+ // normalise to a non-empty array of strings
31
+ const prefixes = (Array.isArray(bases) ? bases : [bases])
32
+ .filter(Boolean)
33
+ // longest first ⇒ '/site/files' is checked before '/site'
34
+ .sort((a, b) => b.length - a.length);
35
+ let changed = true;
36
+ while (changed) {
37
+ changed = false;
38
+ for (const prefix of prefixes) {
39
+ if (str.startsWith(prefix)) {
40
+ str = str.slice(prefix.length);
41
+ changed = true; // start the loop again
42
+ break; // restart prefix scan from the longest one
43
+ }
44
+ }
45
+ }
46
+ return str;
47
+ }
48
+ /**
49
+ * Removes characters from the beginning of the string
50
+ * if they are found in the list of characters.
51
+ *
52
+ * @param str - The input string.
53
+ * @param listObjects - A string or an array of characters to remove.
54
+ * @returns The modified string.
55
+ */
56
+ export function eatInner(str, listObjects) {
57
+ if (!Array.isArray(listObjects)) {
58
+ listObjects = [listObjects];
59
+ }
60
+ // Ensure str is a string
61
+ str = String(str);
62
+ // Remove characters from the beginning while they are in listObjects
63
+ while (str.length > 0 && listObjects.includes(str[0])) {
64
+ str = str.slice(1);
65
+ }
66
+ return str;
67
+ }
68
+ /**
69
+ * Removes characters from the end of the string
70
+ * if they are found in the list of characters.
71
+ *
72
+ * @param str - The input string.
73
+ * @param listObjects - A string or an array of characters to remove.
74
+ * @returns The modified string.
75
+ */
76
+ export function eatOuter(str, listObjects) {
77
+ if (!Array.isArray(listObjects)) {
78
+ listObjects = [listObjects];
79
+ }
80
+ // Ensure str is a string
81
+ str = String(str);
82
+ // Remove characters from the end while they are in listObjects
83
+ while (str.length > 0 && listObjects.includes(str[str.length - 1])) {
84
+ str = str.slice(0, -1);
85
+ }
86
+ return str;
87
+ }
88
+ /**
89
+ * Removes characters from both the beginning and the end of the string
90
+ * if they are found in the list of characters.
91
+ *
92
+ * @param str - The input string.
93
+ * @param listObjects - A string or an array of characters to remove.
94
+ * @returns The modified string.
95
+ */
96
+ export function eatAll(str, listObjects) {
97
+ return eatOuter(eatInner(str, listObjects), listObjects);
98
+ }
99
+ export function eatEnd(obj, endings = ['/']) {
100
+ let result = obj;
101
+ let modified = true;
102
+ while (modified) {
103
+ modified = false;
104
+ for (const ending of endings) {
105
+ if (result.endsWith(ending)) {
106
+ result = result.slice(0, -ending.length);
107
+ modified = true;
108
+ break;
109
+ }
110
+ }
111
+ }
112
+ return result;
113
+ }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1 @@
1
+ export * from './type_utils';
File without changes
@@ -0,0 +1,4 @@
1
+ export function ensure_list(obj) {
2
+ const objArray = Array.isArray(obj) ? obj : [obj];
3
+ return objArray;
4
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ //src/components/UI/UI.tsx
2
+ import React from 'react';
3
+ export const { useState, useEffect, useCallback } = React;
4
+ export { fetchIt } from './../fetch_utils';
5
+ export { currentUsername, isTokenExpired, getToken } from './../auth_utils';
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1,32 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export function Button(_a) {
14
+ var { children, color = 'gray', variant = 'default', className = '' } = _a, rest = __rest(_a, ["children", "color", "variant", "className"]);
15
+ const base = 'rounded px-3 py-1 text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors duration-150';
16
+ const variantStyles = {
17
+ default: '',
18
+ icon: 'p-1 bg-transparent hover:bg-gray-100',
19
+ primary: 'text-white',
20
+ secondary: '',
21
+ };
22
+ const palette = {
23
+ gray: variant === 'primary'
24
+ ? 'bg-gray-600 hover:bg-gray-700 focus:ring-gray-500'
25
+ : 'bg-gray-200 hover:bg-gray-300 focus:ring-gray-400',
26
+ green: 'bg-green-600 text-white hover:bg-green-700 focus:ring-green-500',
27
+ blue: variant === 'primary'
28
+ ? 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500'
29
+ : 'bg-blue-200 hover:bg-blue-300 focus:ring-blue-400',
30
+ };
31
+ return (_jsx("button", Object.assign({ className: `${base} ${variantStyles[variant]} ${palette[color]} ${className}` }, rest, { children: children })));
32
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export function Checkbox(_a) {
14
+ var { label } = _a, rest = __rest(_a, ["label"]);
15
+ return (_jsxs("label", { className: 'flex items-center gap-2 mb-4', children: [_jsx("input", Object.assign({ type: 'checkbox' }, rest)), _jsx("span", { children: label })] }));
16
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ export * from './button';
2
+ export * from './checkbox';
3
+ export * from './input';
4
+ export * from './spinner';
File without changes
@@ -0,0 +1,16 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export function Input(_a) {
14
+ var { label, trailing } = _a, rest = __rest(_a, ["label", "trailing"]);
15
+ return (_jsxs("label", { className: 'mb-4 block', children: [_jsx("span", { className: 'block text-sm font-medium mb-1', children: label }), _jsxs("div", { className: 'flex gap-2', children: [_jsx("input", Object.assign({ className: 'flex-1 rounded border px-2 py-1 disabled:bg-gray-100' }, rest)), trailing] })] }));
16
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function Spinner() {
3
+ return (_jsx("p", { className: 'animate-pulse', children: "Loading\u2026" }));
4
+ }
package/dist/index.d.ts CHANGED
@@ -154,7 +154,7 @@ declare function get_window_parts(): Location | "https://abstractendeavors.com"
154
154
  *
155
155
  */
156
156
  /** Pulls base-URL from AppConfig.API_BASE_URL, strips trailing slashes */
157
- declare function get_app_config_url(endpoint: any, appKey?: any): Promise<string>;
157
+ declare function get_app_config_url(endpoint: string, appKey?: any): Promise<string>;
158
158
  declare function fetchIt(endpoint: string, body?: unknown, method?: string | null, headers?: Record<string, string> | null, blob?: boolean | null, no_api?: boolean, requireAuth?: boolean): Promise<unknown>;
159
159
  declare function secureFetchIt<T>(endpoint: any, body?: any, method?: any, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<T>;
160
160
  declare function secureFetchIt(endpoint: any, body?: any, method?: any, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<Blob>;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from './functions';
2
+ export * from './types';
3
+ export { loadConfig } from './utils';
4
+ import { get_app_config_url } from './functions';
5
+ console.log(get_app_config_url('api'));
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,5 @@
1
+ export * from './Files';
2
+ export * from './ChangePassword';
3
+ export * from './utils';
4
+ export * from './logout';
5
+ export * from './login';
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1 @@
1
+ export * from './src';
File without changes