@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.
Files changed (36) hide show
  1. package/dist/cjs/functions/config_utils/imports.d.ts +1 -0
  2. package/dist/cjs/functions/config_utils/index.d.ts +1 -0
  3. package/dist/cjs/functions/config_utils/src/config_utils.d.ts +7 -0
  4. package/dist/cjs/functions/config_utils/src/index.d.ts +1 -0
  5. package/dist/cjs/functions/index.d.ts +2 -0
  6. package/dist/cjs/functions/read_utils/imports.d.ts +3 -0
  7. package/dist/cjs/functions/read_utils/index.d.ts +1 -0
  8. package/dist/cjs/functions/read_utils/src/index.d.ts +1 -0
  9. package/dist/cjs/functions/read_utils/src/read_utils.d.ts +17 -0
  10. package/dist/cjs/index.js +88 -2
  11. package/dist/cjs/index.js.map +1 -1
  12. package/dist/cjs/types/src/utils.d.ts +6 -0
  13. package/dist/esm/functions/config_utils/imports.d.ts +1 -0
  14. package/dist/esm/functions/config_utils/index.d.ts +1 -0
  15. package/dist/esm/functions/config_utils/src/config_utils.d.ts +7 -0
  16. package/dist/esm/functions/config_utils/src/index.d.ts +1 -0
  17. package/dist/esm/functions/index.d.ts +2 -0
  18. package/dist/esm/functions/read_utils/imports.d.ts +3 -0
  19. package/dist/esm/functions/read_utils/index.d.ts +1 -0
  20. package/dist/esm/functions/read_utils/src/index.d.ts +1 -0
  21. package/dist/esm/functions/read_utils/src/read_utils.d.ts +17 -0
  22. package/dist/esm/index.js +85 -3
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/types/src/utils.d.ts +6 -0
  25. package/dist/functions/config_utils/imports.d.ts +1 -0
  26. package/dist/functions/config_utils/index.d.ts +1 -0
  27. package/dist/functions/config_utils/src/config_utils.d.ts +7 -0
  28. package/dist/functions/config_utils/src/index.d.ts +1 -0
  29. package/dist/functions/index.d.ts +2 -0
  30. package/dist/functions/read_utils/imports.d.ts +3 -0
  31. package/dist/functions/read_utils/index.d.ts +1 -0
  32. package/dist/functions/read_utils/src/index.d.ts +1 -0
  33. package/dist/functions/read_utils/src/read_utils.d.ts +17 -0
  34. package/dist/index.d.ts +32 -1
  35. package/dist/types/src/utils.d.ts +6 -0
  36. 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
- export { API_PREFIX, type ApiRow, 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, 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, requestPatch, requireToken, sanitizeFilename, secureFetchIt, stripPrefixes, truncateString };
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 };
@@ -1,3 +1,9 @@
1
+ export interface AppConfig {
2
+ BASE_URL: string;
3
+ BASE_API_URL: string;
4
+ FEATURE_FLAG?: boolean;
5
+ SOME_NUMBER?: number;
6
+ }
1
7
  export interface InputProps {
2
8
  label?: any;
3
9
  type?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "type": "module",
5
5
  "description": "A reusable React Login component with JWT authentication",
6
6
  "main": "dist/cjs/index.js",