@putkoff/abstract-utilities 0.1.115 → 0.1.117

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.
@@ -1,17 +1,9 @@
1
1
  /**
2
2
  * Reads a file at `relativeOrAbsolutePath` and returns its contents as a string.
3
+ * In a browser this will reject immediately.
3
4
  */
4
5
  export declare function readFileContents(relativeOrAbsolutePath: string): Promise<string>;
5
6
  /**
6
7
  * Reads a JSON file and returns the parsed object.
7
8
  */
8
9
  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
@@ -53,6 +53,12 @@ interface AppConfig {
53
53
  FEATURE_FLAG?: boolean;
54
54
  SOME_NUMBER?: number;
55
55
  }
56
+ interface Promise$1<AppConfig> {
57
+ BASE_URL: string;
58
+ BASE_API_URL: string;
59
+ FEATURE_FLAG?: boolean;
60
+ SOME_NUMBER?: number;
61
+ }
56
62
  interface InputProps {
57
63
  label?: any;
58
64
  type?: any;
@@ -148,12 +154,12 @@ declare function get_window_parts(): Location | "https://abstractendeavors.com"
148
154
  *
149
155
  */
150
156
  /** Pulls base-URL from AppConfig.API_BASE_URL, strips trailing slashes */
151
- declare function get_app_config_url(endpoint: any): string;
157
+ declare function get_app_config_url(endpoint: any, appKey?: any): string;
152
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>;
153
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>;
154
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>;
155
161
  declare function requestPatch(url: string, body?: unknown): Promise<Response>;
156
- declare function fetchSharePatch(file: unknown): Promise<void>;
162
+ declare function fetchSharePatch(file: unknown, appKey?: any): Promise<void>;
157
163
 
158
164
  declare function get_dirname(filePath: string | null): string;
159
165
  declare function get_basename(filePath: string | null): string;
@@ -277,20 +283,14 @@ declare function getConfig<K extends keyof AppConfig>(key: K): Promise<AppConfig
277
283
 
278
284
  /**
279
285
  * Reads a file at `relativeOrAbsolutePath` and returns its contents as a string.
286
+ * In a browser this will reject immediately.
280
287
  */
281
288
  declare function readFileContents(relativeOrAbsolutePath: string): Promise<string>;
282
289
  /**
283
290
  * Reads a JSON file and returns the parsed object.
284
291
  */
285
292
  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
293
 
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 };
294
+ declare function loadConfig(): Promise<void>;
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, type Promise$1 as Promise, 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 };
@@ -4,6 +4,12 @@ export interface AppConfig {
4
4
  FEATURE_FLAG?: boolean;
5
5
  SOME_NUMBER?: number;
6
6
  }
7
+ export interface Promise<AppConfig> {
8
+ BASE_URL: string;
9
+ BASE_API_URL: string;
10
+ FEATURE_FLAG?: boolean;
11
+ SOME_NUMBER?: number;
12
+ }
7
13
  export interface InputProps {
8
14
  label?: any;
9
15
  type?: any;
@@ -1 +1,2 @@
1
1
  export * from "./Input";
2
+ export * from './config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "0.1.115",
3
+ "version": "0.1.117",
4
4
  "type": "module",
5
5
  "description": "A reusable React Login component with JWT authentication",
6
6
  "main": "dist/cjs/index.js",
@@ -1,3 +0,0 @@
1
- export { promises as fs } from 'fs';
2
- import path from 'path';
3
- export { path };
@@ -1,3 +0,0 @@
1
- export { promises as fs } from 'fs';
2
- import path from 'path';
3
- export { path };