@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/cjs/index.js
CHANGED
|
@@ -1149,10 +1149,10 @@ function fetchIt(endpoint_1) {
|
|
|
1149
1149
|
});
|
|
1150
1150
|
}
|
|
1151
1151
|
function secureFetchIt(endpoint_1) {
|
|
1152
|
-
return __awaiter(this, arguments, void 0, function* (endpoint, body = null, method = null, customHeaders = null, blob = false, noApi = false, withCredentials = true, returnJson = true) {
|
|
1152
|
+
return __awaiter(this, arguments, void 0, function* (endpoint, body = null, method = null, customHeaders = null, blob = false, noApi = false, withCredentials = true, returnJson = true, returnReult = true) {
|
|
1153
1153
|
// strip leading slashes off the endpoint
|
|
1154
1154
|
method = method || "GET";
|
|
1155
|
-
let url = endpoint
|
|
1155
|
+
let url = endpoint;
|
|
1156
1156
|
if (!noApi) {
|
|
1157
1157
|
url = get_app_config_url(url);
|
|
1158
1158
|
}
|
|
@@ -1176,8 +1176,10 @@ function secureFetchIt(endpoint_1) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
if (blob)
|
|
1178
1178
|
return res.blob();
|
|
1179
|
-
if (
|
|
1179
|
+
if (returnReult)
|
|
1180
1180
|
return getResult(res.json());
|
|
1181
|
+
if (returnJson)
|
|
1182
|
+
return res.json();
|
|
1181
1183
|
return res;
|
|
1182
1184
|
});
|
|
1183
1185
|
}
|
|
@@ -1388,7 +1390,7 @@ function uploadFiles(file_1) {
|
|
|
1388
1390
|
formData.append('file', file);
|
|
1389
1391
|
formData.append('subdir', subdir.trim());
|
|
1390
1392
|
try {
|
|
1391
|
-
const json = yield secureFetchIt('upload', formData, 'POST', null, false,
|
|
1393
|
+
const json = yield secureFetchIt('upload', formData, 'POST', null, false, false);
|
|
1392
1394
|
if (!json || typeof json !== 'object') {
|
|
1393
1395
|
throw new Error('Invalid response from server.');
|
|
1394
1396
|
}
|