@putkoff/abstract-utilities 0.1.119 → 0.1.123
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/functions/path_utils/imports.d.ts +3 -2
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +12 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/functions/path_utils/imports.d.ts +3 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +13 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/auth_utils/imports.js +1 -0
- package/dist/functions/auth_utils/index.js +1 -0
- package/dist/functions/auth_utils/src/index.js +1 -0
- package/dist/functions/auth_utils/src/token_utils.js +95 -0
- package/dist/functions/config_utils/imports.js +1 -0
- package/dist/functions/config_utils/index.js +1 -0
- package/dist/functions/config_utils/src/config_utils.js +33 -0
- package/dist/functions/config_utils/src/index.js +1 -0
- package/dist/functions/constants_utils/index.js +1 -0
- package/dist/functions/constants_utils/src/constants.js +7 -0
- package/dist/functions/constants_utils/src/index.js +1 -0
- package/dist/functions/env_utils/imports.js +1 -0
- package/dist/functions/env_utils/index.js +1 -0
- package/dist/functions/env_utils/src/index.js +1 -0
- package/dist/functions/env_utils/src/window_utils.js +47 -0
- package/dist/functions/fetch_utils/imports.js +7 -0
- package/dist/functions/fetch_utils/index.js +1 -0
- package/dist/functions/fetch_utils/src/fetchIt_utils.js +116 -0
- package/dist/functions/fetch_utils/src/index.js +1 -0
- package/dist/functions/fetch_utils/src/utils.js +171 -0
- package/dist/functions/index.js +12 -0
- package/dist/functions/path_utils/imports.d.ts +3 -2
- package/dist/functions/path_utils/imports.js +26 -0
- package/dist/functions/path_utils/index.js +1 -0
- package/dist/functions/path_utils/src/base_dirs.js +17 -0
- package/dist/functions/path_utils/src/function_dirs.js +42 -0
- package/dist/functions/path_utils/src/index.js +6 -0
- package/dist/functions/path_utils/src/misc_dirs.js +15 -0
- package/dist/functions/path_utils/src/path_utils.js +75 -0
- package/dist/functions/path_utils/src/paths.js +12 -0
- package/dist/functions/path_utils/src/src_dirs.js +25 -0
- package/dist/functions/read_utils/imports.js +1 -0
- package/dist/functions/read_utils/index.js +1 -0
- package/dist/functions/read_utils/src/index.js +1 -0
- package/dist/functions/read_utils/src/read_utils.js +55 -0
- package/dist/functions/rndm_utils/imports.js +1 -0
- package/dist/functions/rndm_utils/index.js +1 -0
- package/dist/functions/rndm_utils/src/index.js +1 -0
- package/dist/functions/rndm_utils/src/utils.js +12 -0
- package/dist/functions/string_utils/index.js +1 -0
- package/dist/functions/string_utils/src/index.js +1 -0
- package/dist/functions/string_utils/src/string_utils.js +113 -0
- package/dist/functions/type_utils/imports.js +1 -0
- package/dist/functions/type_utils/index.js +1 -0
- package/dist/functions/type_utils/src/index.js +1 -0
- package/dist/functions/type_utils/src/type_utils.js +4 -0
- package/dist/functions/ui_utils/imports.js +5 -0
- package/dist/functions/ui_utils/index.js +1 -0
- package/dist/functions/ui_utils/src/button.js +32 -0
- package/dist/functions/ui_utils/src/checkbox.js +16 -0
- package/dist/functions/ui_utils/src/index.js +4 -0
- package/dist/functions/ui_utils/src/input.js +16 -0
- package/dist/functions/ui_utils/src/spinner.js +4 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +5 -0
- package/dist/types/index.js +1 -0
- package/dist/types/src/ChangePassword.js +1 -0
- package/dist/types/src/Files.js +1 -0
- package/dist/types/src/index.js +5 -0
- package/dist/types/src/login.js +1 -0
- package/dist/types/src/logout.js +1 -0
- package/dist/types/src/utils.js +1 -0
- package/dist/utils/imports.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/src/Input.js +2 -0
- package/dist/utils/src/config.js +20 -0
- package/dist/utils/src/index.js +2 -0
- package/package.json +8 -1
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* In the browser we already have a WHATWG URL constructor on window.
|
|
3
3
|
* Here we re-export it as “url” so other modules can import it.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
declare const _url: {
|
|
6
6
|
new (url: string | URL, base?: string | URL): URL;
|
|
7
7
|
prototype: URL;
|
|
8
8
|
canParse(url: string | URL, base?: string | URL): boolean;
|
|
9
9
|
createObjectURL(obj: Blob | MediaSource): string;
|
|
10
10
|
parse(url: string | URL, base?: string | URL): URL | null;
|
|
11
11
|
revokeObjectURL(url: string): void;
|
|
12
|
-
};
|
|
12
|
+
} | undefined;
|
|
13
|
+
export { _url as url };
|
|
13
14
|
/**
|
|
14
15
|
* Minimal fileURLToPath implementation for browser-side code.
|
|
15
16
|
* If you only ever need to strip off “file://” in development, this is enough.
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1017,7 +1017,7 @@ function alertit(obj = null) {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
1019
|
let _cachedConfig = null;
|
|
1020
|
-
function loadConfig
|
|
1020
|
+
function loadConfig() {
|
|
1021
1021
|
return __awaiter(this, arguments, void 0, function* (filePath = null) {
|
|
1022
1022
|
// 1. If nobody passed a custom path, we default to "config.json" (relative)
|
|
1023
1023
|
const relativePath = filePath || 'config.json';
|
|
@@ -1036,13 +1036,13 @@ function loadConfig$1() {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
function getConfig(key) {
|
|
1038
1038
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1039
|
-
const cfg = yield loadConfig
|
|
1039
|
+
const cfg = yield loadConfig();
|
|
1040
1040
|
return key ? cfg[key] : cfg;
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
1044
|
function ensureAbstractUrl(endpoint, slices = []) {
|
|
1045
|
-
slices = ['https//thedailydialectics.com', 'api'
|
|
1045
|
+
slices = slices || ['https//thedailydialectics.com', 'api'];
|
|
1046
1046
|
// 1) build a prefix string like "api/v1/"
|
|
1047
1047
|
const prefix = slices.map((s) => `${s}/`).join("");
|
|
1048
1048
|
// 2) normalize the list you’ll use for stripping
|
|
@@ -1169,14 +1169,18 @@ function getFetchVars(headers = null, method = null, body = null) {
|
|
|
1169
1169
|
function get_app_config_url(endpoint_1) {
|
|
1170
1170
|
return __awaiter(this, arguments, void 0, function* (endpoint, appKey = 'BASE_API_URL') {
|
|
1171
1171
|
const cleanEndpoint = endpoint.replace(/^\/+/, '');
|
|
1172
|
-
console.log(`cleanEndpoint == ${cleanEndpoint}`)
|
|
1173
|
-
const config = yield getConfig(
|
|
1174
|
-
console.log(`config == ${config}`)
|
|
1175
|
-
const baseUrl =
|
|
1172
|
+
//console.log(`cleanEndpoint == ${cleanEndpoint}`)
|
|
1173
|
+
const config = yield getConfig();
|
|
1174
|
+
//console.log(`config == ${config}`)
|
|
1175
|
+
const baseUrl = config;
|
|
1176
1176
|
appKey = appKey || 'BASE_API_URL';
|
|
1177
|
+
//console.log(`appKey == ${appKey}`)
|
|
1177
1178
|
const base = baseUrl[appKey]; // full AppConfig object
|
|
1178
|
-
console.log()
|
|
1179
|
+
//console.log(`base == ${base}`)
|
|
1180
|
+
if (!base)
|
|
1181
|
+
throw new Error(`Missing API URL for key "${appKey}"`);
|
|
1179
1182
|
const slices = base.split('/').filter(Boolean);
|
|
1183
|
+
//console.log(`slices == ${slices}`)
|
|
1180
1184
|
return ensureAbstractUrl(cleanEndpoint, slices);
|
|
1181
1185
|
});
|
|
1182
1186
|
}
|
|
@@ -1340,17 +1344,6 @@ function readJsonFile(relativeOrAbsolutePath) {
|
|
|
1340
1344
|
});
|
|
1341
1345
|
}
|
|
1342
1346
|
|
|
1343
|
-
function loadConfig() {
|
|
1344
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1345
|
-
const base = (process.env.BASE_API_URL || "").replace(/\/+$/, "");
|
|
1346
|
-
const url = `${base}/config.json`;
|
|
1347
|
-
const res = yield fetch(url);
|
|
1348
|
-
if (!res.ok)
|
|
1349
|
-
throw new Error(`Failed to load ${url}: ${res.status}`);
|
|
1350
|
-
yield res.json();
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
1347
|
Object.defineProperty(exports, "useCallback", {
|
|
1355
1348
|
enumerable: true,
|
|
1356
1349
|
get: function () { return react.useCallback; }
|
|
@@ -1431,7 +1424,6 @@ exports.get_window_parts = get_window_parts;
|
|
|
1431
1424
|
exports.get_window_pathname = get_window_pathname;
|
|
1432
1425
|
exports.isLoggedIn = isLoggedIn;
|
|
1433
1426
|
exports.isTokenExpired = isTokenExpired;
|
|
1434
|
-
exports.loadConfig = loadConfig;
|
|
1435
1427
|
exports.make_path = make_path;
|
|
1436
1428
|
exports.make_sanitized_path = make_sanitized_path;
|
|
1437
1429
|
exports.normalizeUrl = normalizeUrl;
|