@putkoff/abstract-utilities 0.1.102 → 0.1.103
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/fetch_utils/src/fetchIt_utils.d.ts +1 -1
- package/dist/cjs/index.js +6 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/functions/fetch_utils/src/fetchIt_utils.d.ts +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/functions/fetch_utils/src/fetchIt_utils.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
export declare function get_app_config_url(endpoint: any): string;
|
|
11
11
|
export 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>;
|
|
12
12
|
export declare function secureFetchIt<T>(endpoint: string, body?: unknown, method?: string, headers?: Record<string, string> | null, blob?: false, noApi?: boolean, requireAuth?: boolean): Promise<T>;
|
|
13
|
-
export declare function secureFetchIt(endpoint: string, body?: unknown, method?: string, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean): Promise<Blob>;
|
|
13
|
+
export declare function secureFetchIt(endpoint: string, body?: unknown, method?: string, headers?: Record<string, string> | null, blob?: boolean, noApi?: boolean, withCredentials?: boolean, returnJson?: boolean, returnReult?: boolean): Promise<Blob>;
|
|
14
14
|
export declare function requestPatch(url: string, body?: unknown): Promise<Response>;
|
|
15
15
|
export declare function fetchSharePatch(file: unknown): Promise<void>;
|
package/dist/esm/index.js
CHANGED
|
@@ -1146,10 +1146,10 @@ function fetchIt(endpoint_1) {
|
|
|
1146
1146
|
});
|
|
1147
1147
|
}
|
|
1148
1148
|
function secureFetchIt(endpoint_1) {
|
|
1149
|
-
return __awaiter(this, arguments, void 0, function* (endpoint, body = null, method = null, customHeaders = null, blob = false, noApi = false, withCredentials = true, returnJson = true) {
|
|
1149
|
+
return __awaiter(this, arguments, void 0, function* (endpoint, body = null, method = null, customHeaders = null, blob = false, noApi = false, withCredentials = true, returnJson = true, returnReult = true) {
|
|
1150
1150
|
// strip leading slashes off the endpoint
|
|
1151
1151
|
method = method || "GET";
|
|
1152
|
-
let url = endpoint
|
|
1152
|
+
let url = endpoint;
|
|
1153
1153
|
if (!noApi) {
|
|
1154
1154
|
url = get_app_config_url(url);
|
|
1155
1155
|
}
|
|
@@ -1173,8 +1173,10 @@ function secureFetchIt(endpoint_1) {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
if (blob)
|
|
1175
1175
|
return res.blob();
|
|
1176
|
-
if (
|
|
1176
|
+
if (returnReult)
|
|
1177
1177
|
return getResult(res.json());
|
|
1178
|
+
if (returnJson)
|
|
1179
|
+
return res.json();
|
|
1178
1180
|
return res;
|
|
1179
1181
|
});
|
|
1180
1182
|
}
|
|
@@ -1385,7 +1387,7 @@ function uploadFiles(file_1) {
|
|
|
1385
1387
|
formData.append('file', file);
|
|
1386
1388
|
formData.append('subdir', subdir.trim());
|
|
1387
1389
|
try {
|
|
1388
|
-
const json = yield secureFetchIt('upload', formData, 'POST', null, false,
|
|
1390
|
+
const json = yield secureFetchIt('upload', formData, 'POST', null, false, false);
|
|
1389
1391
|
if (!json || typeof json !== 'object') {
|
|
1390
1392
|
throw new Error('Invalid response from server.');
|
|
1391
1393
|
}
|