@putkoff/abstract-utilities 0.1.190 → 0.1.191

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,5 +1,15 @@
1
- export declare function ensureAbstractUrl(endpoint: string, slices?: string[]): string;
2
- export declare function api(endpoint: string): string;
3
- export declare function getHtmlDirectory(directory: string, filename: string): string;
4
- export declare function fetchIndexHtml(filename: string, directory?: string, base?: string): Promise<string>;
5
- export declare function fetchIndexHtmlContainer(filename: string, doc?: Document, directory?: string): Promise<void>;
1
+ import { FetchVariables } from './../imports';
2
+ /**
3
+ * Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
4
+ */
5
+ export declare function getResult<T>(obj: unknown): T;
6
+ export declare function getMethod(method?: string | null, body?: unknown): string;
7
+ export declare function getHeaders(headers?: Record<string, string>, method?: string | null, body?: unknown): Record<string, string>;
8
+ export declare function getBody(body?: unknown, method?: string | null): string | undefined;
9
+ export declare function getFetchVars(headers?: Record<string, string> | null, method?: string | null, body?: any): FetchVariables;
10
+ export declare function parseResult(res: Response): Promise<unknown>;
11
+ /**
12
+ * Intercept 401/403 and force a clean redirect to login
13
+ * without ever showing an alert.
14
+ */
15
+ export declare function checkResponse(res: Response): Response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "0.1.190",
3
+ "version": "0.1.191",
4
4
  "type": "module",
5
5
  "description": "A reusable React Login component with JWT authentication",
6
6
  "main": "dist/cjs/index.js",