@putkoff/abstract-utilities 0.1.113 → 0.1.115
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/config_utils/imports.d.ts +1 -0
- package/dist/cjs/functions/config_utils/index.d.ts +1 -0
- package/dist/cjs/functions/config_utils/src/config_utils.d.ts +7 -0
- package/dist/cjs/functions/config_utils/src/index.d.ts +1 -0
- package/dist/cjs/functions/index.d.ts +2 -0
- package/dist/cjs/functions/read_utils/imports.d.ts +3 -0
- package/dist/cjs/functions/read_utils/index.d.ts +1 -0
- package/dist/cjs/functions/read_utils/src/index.d.ts +1 -0
- package/dist/cjs/functions/read_utils/src/read_utils.d.ts +17 -0
- package/dist/cjs/index.js +88 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/utils.d.ts +6 -0
- package/dist/esm/functions/config_utils/imports.d.ts +1 -0
- package/dist/esm/functions/config_utils/index.d.ts +1 -0
- package/dist/esm/functions/config_utils/src/config_utils.d.ts +7 -0
- package/dist/esm/functions/config_utils/src/index.d.ts +1 -0
- package/dist/esm/functions/index.d.ts +2 -0
- package/dist/esm/functions/read_utils/imports.d.ts +3 -0
- package/dist/esm/functions/read_utils/index.d.ts +1 -0
- package/dist/esm/functions/read_utils/src/index.d.ts +1 -0
- package/dist/esm/functions/read_utils/src/read_utils.d.ts +17 -0
- package/dist/esm/index.js +85 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/utils.d.ts +6 -0
- package/dist/functions/config_utils/imports.d.ts +1 -0
- package/dist/functions/config_utils/index.d.ts +1 -0
- package/dist/functions/config_utils/src/config_utils.d.ts +7 -0
- package/dist/functions/config_utils/src/index.d.ts +1 -0
- package/dist/functions/index.d.ts +2 -0
- package/dist/functions/read_utils/imports.d.ts +3 -0
- package/dist/functions/read_utils/index.d.ts +1 -0
- package/dist/functions/read_utils/src/index.d.ts +1 -0
- package/dist/functions/read_utils/src/read_utils.d.ts +17 -0
- package/dist/index.d.ts +32 -1
- package/dist/types/src/utils.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a file at `relativeOrAbsolutePath` and returns its contents as a string.
|
|
3
|
+
*/
|
|
4
|
+
export declare function readFileContents(relativeOrAbsolutePath: string): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Reads a JSON file and returns the parsed object.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readJsonFile<T = any>(relativeOrAbsolutePath: string): Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Read a file and optionally parse it as JSON (and even pluck a field).
|
|
11
|
+
*
|
|
12
|
+
* @param filePath Path to your file (relative to cwd or absolute)
|
|
13
|
+
* @param asJson If true, JSON.parse the file.
|
|
14
|
+
* If a string, JSON.parse then return parsed[string].
|
|
15
|
+
* @returns The raw string, whole parsed object, or a specific field.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reader(filePath: string, asJson?: boolean | string): Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,12 @@ interface ChangePasswordFormProps {
|
|
|
47
47
|
onCancel?: () => void;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
interface AppConfig {
|
|
51
|
+
BASE_URL: string;
|
|
52
|
+
BASE_API_URL: string;
|
|
53
|
+
FEATURE_FLAG?: boolean;
|
|
54
|
+
SOME_NUMBER?: number;
|
|
55
|
+
}
|
|
50
56
|
interface InputProps {
|
|
51
57
|
label?: any;
|
|
52
58
|
type?: any;
|
|
@@ -262,4 +268,29 @@ declare function Input({ label, trailing, ...rest }: React$1.InputHTMLAttributes
|
|
|
262
268
|
|
|
263
269
|
declare function Spinner(): react_jsx_runtime.JSX.Element;
|
|
264
270
|
|
|
265
|
-
|
|
271
|
+
/**
|
|
272
|
+
* getConfig(): load the full AppConfig
|
|
273
|
+
* getConfig(key): load just that key
|
|
274
|
+
*/
|
|
275
|
+
declare function getConfig(): Promise<AppConfig>;
|
|
276
|
+
declare function getConfig<K extends keyof AppConfig>(key: K): Promise<AppConfig[K]>;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Reads a file at `relativeOrAbsolutePath` and returns its contents as a string.
|
|
280
|
+
*/
|
|
281
|
+
declare function readFileContents(relativeOrAbsolutePath: string): Promise<string>;
|
|
282
|
+
/**
|
|
283
|
+
* Reads a JSON file and returns the parsed object.
|
|
284
|
+
*/
|
|
285
|
+
declare function readJsonFile<T = any>(relativeOrAbsolutePath: string): Promise<T>;
|
|
286
|
+
/**
|
|
287
|
+
* Read a file and optionally parse it as JSON (and even pluck a field).
|
|
288
|
+
*
|
|
289
|
+
* @param filePath Path to your file (relative to cwd or absolute)
|
|
290
|
+
* @param asJson If true, JSON.parse the file.
|
|
291
|
+
* If a string, JSON.parse then return parsed[string].
|
|
292
|
+
* @returns The raw string, whole parsed object, or a specific field.
|
|
293
|
+
*/
|
|
294
|
+
declare function reader(filePath: string, asJson?: boolean | string): Promise<any>;
|
|
295
|
+
|
|
296
|
+
export { API_PREFIX, type ApiRow, type AppConfig, BASE_URL, Button, type ChangePasswordFormProps, type ChangePasswordProps, Checkbox, DEV_PREFIX, DOMAIN_NAME, type FetchVariables, type FileItem, type FileListResponse, Input, type InputProps, type JwtPayload, type LoginFormProps, type LoginProps, type LogoutButtonProps, 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, reader, requestPatch, requireToken, sanitizeFilename, secureFetchIt, stripPrefixes, truncateString };
|