@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
package/dist/esm/index.js
CHANGED
|
@@ -1014,7 +1014,7 @@ function alertit(obj = null) {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
|
|
1016
1016
|
let _cachedConfig = null;
|
|
1017
|
-
function loadConfig
|
|
1017
|
+
function loadConfig() {
|
|
1018
1018
|
return __awaiter(this, arguments, void 0, function* (filePath = null) {
|
|
1019
1019
|
// 1. If nobody passed a custom path, we default to "config.json" (relative)
|
|
1020
1020
|
const relativePath = filePath || 'config.json';
|
|
@@ -1033,13 +1033,13 @@ function loadConfig$1() {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
function getConfig(key) {
|
|
1035
1035
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1036
|
-
const cfg = yield loadConfig
|
|
1036
|
+
const cfg = yield loadConfig();
|
|
1037
1037
|
return key ? cfg[key] : cfg;
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
1041
|
function ensureAbstractUrl(endpoint, slices = []) {
|
|
1042
|
-
slices = ['https//thedailydialectics.com', 'api'
|
|
1042
|
+
slices = slices || ['https//thedailydialectics.com', 'api'];
|
|
1043
1043
|
// 1) build a prefix string like "api/v1/"
|
|
1044
1044
|
const prefix = slices.map((s) => `${s}/`).join("");
|
|
1045
1045
|
// 2) normalize the list you’ll use for stripping
|
|
@@ -1166,14 +1166,18 @@ function getFetchVars(headers = null, method = null, body = null) {
|
|
|
1166
1166
|
function get_app_config_url(endpoint_1) {
|
|
1167
1167
|
return __awaiter(this, arguments, void 0, function* (endpoint, appKey = 'BASE_API_URL') {
|
|
1168
1168
|
const cleanEndpoint = endpoint.replace(/^\/+/, '');
|
|
1169
|
-
console.log(`cleanEndpoint == ${cleanEndpoint}`)
|
|
1170
|
-
const config = yield getConfig(
|
|
1171
|
-
console.log(`config == ${config}`)
|
|
1172
|
-
const baseUrl =
|
|
1169
|
+
//console.log(`cleanEndpoint == ${cleanEndpoint}`)
|
|
1170
|
+
const config = yield getConfig();
|
|
1171
|
+
//console.log(`config == ${config}`)
|
|
1172
|
+
const baseUrl = config;
|
|
1173
1173
|
appKey = appKey || 'BASE_API_URL';
|
|
1174
|
+
//console.log(`appKey == ${appKey}`)
|
|
1174
1175
|
const base = baseUrl[appKey]; // full AppConfig object
|
|
1175
|
-
console.log()
|
|
1176
|
+
//console.log(`base == ${base}`)
|
|
1177
|
+
if (!base)
|
|
1178
|
+
throw new Error(`Missing API URL for key "${appKey}"`);
|
|
1176
1179
|
const slices = base.split('/').filter(Boolean);
|
|
1180
|
+
//console.log(`slices == ${slices}`)
|
|
1177
1181
|
return ensureAbstractUrl(cleanEndpoint, slices);
|
|
1178
1182
|
});
|
|
1179
1183
|
}
|
|
@@ -1337,16 +1341,5 @@ function readJsonFile(relativeOrAbsolutePath) {
|
|
|
1337
1341
|
});
|
|
1338
1342
|
}
|
|
1339
1343
|
|
|
1340
|
-
|
|
1341
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1342
|
-
const base = (process.env.BASE_API_URL || "").replace(/\/+$/, "");
|
|
1343
|
-
const url = `${base}/config.json`;
|
|
1344
|
-
const res = yield fetch(url);
|
|
1345
|
-
if (!res.ok)
|
|
1346
|
-
throw new Error(`Failed to load ${url}: ${res.status}`);
|
|
1347
|
-
yield res.json();
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
export { API_PREFIX, BASE_URL, Button, Checkbox, DEV_PREFIX, DOMAIN_NAME, Input, PROD_PREFIX, PROTOCOL, SUB_DIR, Spinner, alertit, currentUsername, currentUsernames, decodeJwt, eatAll, eatEnd, eatInner, eatOuter, ensure_list, fetchIt, fetchSharePatch, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, getAbsDir, getAbsPath, getAuthorizationHeader, getBaseDir, getComponentsUtilsDirectory, getConfig, getDbConfigsPath, getDistDir, getEnvDir, getEnvPath, getFunctionsDir, getFunctionsUtilsDirectory, getHooksUtilsDirectory, getLibUtilsDirectory, getPublicDir, getSchemasDirPath, getSchemasPath, getSrcDir, getSubstring, getToken, get_app_config_url, get_basename, get_dirname, get_extname, get_filename, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, isLoggedIn, isTokenExpired, loadConfig, make_path, make_sanitized_path, normalizeUrl, readFileContents, readJsonFile, requestPatch, requireToken, sanitizeFilename, secureFetchIt, stripPrefixes, truncateString };
|
|
1344
|
+
export { API_PREFIX, BASE_URL, Button, Checkbox, DEV_PREFIX, DOMAIN_NAME, Input, PROD_PREFIX, PROTOCOL, SUB_DIR, Spinner, alertit, currentUsername, currentUsernames, decodeJwt, eatAll, eatEnd, eatInner, eatOuter, ensure_list, fetchIt, fetchSharePatch, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, getAbsDir, getAbsPath, getAuthorizationHeader, getBaseDir, getComponentsUtilsDirectory, getConfig, getDbConfigsPath, getDistDir, getEnvDir, getEnvPath, getFunctionsDir, getFunctionsUtilsDirectory, getHooksUtilsDirectory, getLibUtilsDirectory, getPublicDir, getSchemasDirPath, getSchemasPath, getSrcDir, getSubstring, getToken, get_app_config_url, get_basename, get_dirname, get_extname, get_filename, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, isLoggedIn, isTokenExpired, make_path, make_sanitized_path, normalizeUrl, readFileContents, readJsonFile, requestPatch, requireToken, sanitizeFilename, secureFetchIt, stripPrefixes, truncateString };
|
|
1352
1345
|
//# sourceMappingURL=index.js.map
|