@putkoff/abstract-utilities 0.1.178 → 0.1.180
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/index.js +121 -109
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +120 -110
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/fetch_utils/src/fetchIt_utils.d.ts +3 -10
- package/dist/functions/fetch_utils/src/fetch_utils.d.ts +28 -0
- package/dist/functions/fetch_utils/src/index.d.ts +1 -1
- package/dist/functions/fetch_utils/src/utils.d.ts +0 -19
- package/dist/functions/string_utils/src/string_utils.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strip a leading host (http://host) from any URL-like string.
|
|
3
|
-
*/
|
|
4
|
-
export declare function stripHost(str: string): string;
|
|
5
|
-
/**
|
|
6
|
-
* Given an “endpoint” slug like "api/list", build the full URL
|
|
7
|
-
* from the BASE_API_URL entry in your JSON config.
|
|
8
|
-
*/
|
|
9
|
-
export declare function get_app_config_url(endpoint: string): Promise<any>;
|
|
10
|
-
export declare function fetchIt(url: any, body?: any, method?: any, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<any>;
|
|
11
1
|
export 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>;
|
|
12
2
|
export 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>;
|
|
13
3
|
export declare function requestPatch(url: string, body?: unknown): Promise<Response>;
|
|
14
4
|
export declare function fetchSharePatch(file: unknown, appKey?: any): Promise<void>;
|
|
5
|
+
export declare function getHtmlDirectory(directory: string, filename: string): string;
|
|
6
|
+
export declare function fetchIndexHtml(filename: string, directory?: string, base?: string): Promise<string>;
|
|
7
|
+
export declare function fetchIndexHtmlContainer(filename: string, doc?: Document, directory?: string): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FetchVariables } from './../imports';
|
|
2
|
+
export declare function api(endpoint: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Strip a leading host (http://host) from any URL-like string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stripHost(str: string): string;
|
|
7
|
+
export declare function ensureAbstractUrl(endpoint: string, slices?: string[]): string;
|
|
8
|
+
/**
|
|
9
|
+
* Given an “endpoint” slug like "api/list", build the full URL
|
|
10
|
+
* from the BASE_API_URL entry in your JSON config.
|
|
11
|
+
*/
|
|
12
|
+
export declare function get_app_config_url(endpoint: string): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getResult<T>(obj: unknown): T;
|
|
17
|
+
export declare function getMethod(method?: string | null, body?: unknown): string;
|
|
18
|
+
export declare function getHeaders(headers?: Record<string, string>, method?: string | null, body?: unknown): Record<string, string>;
|
|
19
|
+
export declare function getBody(body?: unknown, method?: string | null): string | undefined;
|
|
20
|
+
export declare function getFetchVars(headers?: Record<string, string> | null, method?: string | null, body?: any): FetchVariables;
|
|
21
|
+
export declare function parseResult(res: Response): Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Intercept 401/403 and force a clean redirect to login
|
|
24
|
+
* without ever showing an alert.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkResponse(res: Response): Response;
|
|
27
|
+
export declare function fetchIt<T>(url: any, body?: any, method?: any, headers?: Record<string, string> | null, blob?: boolean, configUrl?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<T>;
|
|
28
|
+
export declare function fetchIt(url: any, body?: any, method?: any, headers?: Record<string, string> | null, blob?: boolean, configUrl?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<Blob>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './fetchIt_utils';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './fetch_utils';
|
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import { FetchVariables } from './../imports';
|
|
2
1
|
export declare function ensureAbstractUrl(endpoint: string, slices?: string[]): string;
|
|
3
|
-
/**
|
|
4
|
-
* Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getResult<T>(obj: unknown): T;
|
|
7
2
|
export declare function api(endpoint: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Intercept 401/403 and force a clean redirect to login
|
|
10
|
-
* without ever showing an alert.
|
|
11
|
-
*/
|
|
12
|
-
export declare function checkResponse(res: Response): Response;
|
|
13
|
-
/**
|
|
14
|
-
* parseResult no longer needs to worry about JSON vs HTML redirect errors;
|
|
15
|
-
* all 401/403 have already been handled above.
|
|
16
|
-
*/
|
|
17
|
-
export declare function parseResult(res: Response): Promise<unknown>;
|
|
18
|
-
export declare function getMethod(method?: string | null, body?: unknown): string;
|
|
19
|
-
export declare function getHeaders(headers?: Record<string, string>, method?: string | null, body?: unknown): Record<string, string>;
|
|
20
|
-
export declare function getBody(body?: unknown, method?: string | null): string | undefined;
|
|
21
|
-
export declare function getFetchVars(headers?: Record<string, string> | null, method?: string | null, body?: any): FetchVariables;
|
|
22
3
|
export declare function getHtmlDirectory(directory: string, filename: string): string;
|
|
23
4
|
export declare function fetchIndexHtml(filename: string, directory?: string, base?: string): Promise<string>;
|
|
24
5
|
export declare function fetchIndexHtmlContainer(filename: string, doc?: Document, directory?: string): Promise<void>;
|
|
@@ -29,3 +29,5 @@ export declare function eatOuter(str: string, listObjects: string | string[]): s
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function eatAll(str: string, listObjects: string | string[]): string;
|
|
31
31
|
export declare function eatEnd(obj: string, endings?: string[]): string;
|
|
32
|
+
export declare function tryParse(obj: any): any;
|
|
33
|
+
export declare function create_list_string(array_obj: any): string;
|