@frontegg/rest-api
Advanced tools
Comparing version 1.14.1 to 1.14.2-alpha.433815765
@@ -43,3 +43,4 @@ export declare type SortDirectionType = 'asc' | 'desc'; | ||
offset: number; | ||
format: 'csv' | 'pdf'; | ||
outputFileName: string; | ||
endpoint: 'csv' | 'pdf' | 'csv/v2'; | ||
} | ||
@@ -46,0 +47,0 @@ export interface HeaderProps { |
@@ -205,3 +205,3 @@ import { __awaiter, __generator, __assign, __rest } from 'tslib'; | ||
var sendRequest = function (opts) { return __awaiter(void 0, void 0, void 0, function () { | ||
var context, headers, url, response, errorMessage, e_1, e_2; | ||
var context, headers, url, response, errorMessage, e_1, e_2, outputFileName_1; | ||
var _a, _b, _c; | ||
@@ -263,3 +263,12 @@ return __generator(this, function (_d) { | ||
if (!(opts.responseType === 'blob')) return [3 /*break*/, 15]; | ||
return [4 /*yield*/, response.blob()]; | ||
outputFileName_1 = opts.params.outputFileName; | ||
return [4 /*yield*/, response | ||
.blob() | ||
.then(function (blob) { return URL.createObjectURL(blob); }) | ||
.then(function (url) { | ||
var tempLink = document.createElement('a'); | ||
tempLink.href = url; | ||
tempLink.setAttribute('download', outputFileName_1 || 'output'); | ||
tempLink.click(); | ||
})]; | ||
case 14: return [2 /*return*/, _d.sent()]; | ||
@@ -1156,6 +1165,6 @@ case 15: return [4 /*yield*/, response.text()]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var format, headerProps, restParams; | ||
var endpoint, headerProps, restParams; | ||
return __generator(this, function (_a) { | ||
format = params.format, headerProps = params.headerProps, restParams = __rest(params, ["format", "headerProps"]); | ||
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + format, { properties: headerProps }, restParams)]; | ||
endpoint = params.endpoint, headerProps = params.headerProps, restParams = __rest(params, ["endpoint", "headerProps"]); | ||
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + endpoint, { properties: headerProps }, restParams)]; | ||
}); | ||
@@ -1162,0 +1171,0 @@ }); |
@@ -185,3 +185,12 @@ import { __awaiter, __rest } from 'tslib'; | ||
else if (opts.responseType === 'blob') { | ||
return yield response.blob(); | ||
const { outputFileName } = opts.params; | ||
return yield response | ||
.blob() | ||
.then((blob) => URL.createObjectURL(blob)) | ||
.then((url) => { | ||
let tempLink = document.createElement('a'); | ||
tempLink.href = url; | ||
tempLink.setAttribute('download', outputFileName || 'output'); | ||
tempLink.click(); | ||
}); | ||
} | ||
@@ -900,4 +909,4 @@ else { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { format, headerProps } = params, restParams = __rest(params, ["format", "headerProps"]); | ||
return PostDownload(`${AUDITS_SERVICE_EXPORT_URL}/${format}`, { properties: headerProps }, restParams); | ||
const { endpoint, headerProps } = params, restParams = __rest(params, ["endpoint", "headerProps"]); | ||
return PostDownload(`${AUDITS_SERVICE_EXPORT_URL}/${endpoint}`, { properties: headerProps }, restParams); | ||
}); | ||
@@ -904,0 +913,0 @@ } |
19
index.js
@@ -211,3 +211,3 @@ 'use strict'; | ||
var sendRequest = function (opts) { return tslib.__awaiter(void 0, void 0, void 0, function () { | ||
var context, headers, url, response, errorMessage, e_1, e_2; | ||
var context, headers, url, response, errorMessage, e_1, e_2, outputFileName_1; | ||
var _a, _b, _c; | ||
@@ -269,3 +269,12 @@ return tslib.__generator(this, function (_d) { | ||
if (!(opts.responseType === 'blob')) return [3 /*break*/, 15]; | ||
return [4 /*yield*/, response.blob()]; | ||
outputFileName_1 = opts.params.outputFileName; | ||
return [4 /*yield*/, response | ||
.blob() | ||
.then(function (blob) { return URL.createObjectURL(blob); }) | ||
.then(function (url) { | ||
var tempLink = document.createElement('a'); | ||
tempLink.href = url; | ||
tempLink.setAttribute('download', outputFileName_1 || 'output'); | ||
tempLink.click(); | ||
})]; | ||
case 14: return [2 /*return*/, _d.sent()]; | ||
@@ -1162,6 +1171,6 @@ case 15: return [4 /*yield*/, response.text()]; | ||
return tslib.__awaiter(this, void 0, void 0, function () { | ||
var format, headerProps, restParams; | ||
var endpoint, headerProps, restParams; | ||
return tslib.__generator(this, function (_a) { | ||
format = params.format, headerProps = params.headerProps, restParams = tslib.__rest(params, ["format", "headerProps"]); | ||
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + format, { properties: headerProps }, restParams)]; | ||
endpoint = params.endpoint, headerProps = params.headerProps, restParams = tslib.__rest(params, ["endpoint", "headerProps"]); | ||
return [2 /*return*/, PostDownload(AUDITS_SERVICE_EXPORT_URL + "/" + endpoint, { properties: headerProps }, restParams)]; | ||
}); | ||
@@ -1168,0 +1177,0 @@ }); |
{ | ||
"name": "@frontegg/rest-api", | ||
"libName": "FronteggRestApi", | ||
"version": "1.14.1", | ||
"version": "1.14.2-alpha.433815765", | ||
"author": "Frontegg LTD", | ||
@@ -12,5 +12,5 @@ "module": "index.esm.js", | ||
}, | ||
"gitHead": "297ea12933c6379fbea09ece998bbf4b40e225dd", | ||
"gitHead": "5cd5e7c3c9b18364b9e393df5765ad78082ccb78", | ||
"main": "index.js", | ||
"peerDependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
381052
4893
2