impaktapps-ui-builder 1.0.180 → 1.0.181
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/impaktapps-ui-builder.es.js +66 -4
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +5 -5
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/interface.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +2 -0
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +1 -0
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +78 -0
- package/src/impaktapps-ui-builder/runtime/services/events.ts +6 -3
- package/src/impaktapps-ui-builder/runtime/services/interface.ts +1 -0
- package/src/impaktapps-ui-builder/runtime/services/service.ts +5 -3
|
@@ -9521,6 +9521,7 @@ const EventSchema = {
|
|
|
9521
9521
|
oneOf: [
|
|
9522
9522
|
{ title: "RankProvider", const: "RankProvider" },
|
|
9523
9523
|
{ title: "Download File", const: "downloadFile" },
|
|
9524
|
+
{ title: "Download File Stream", const: "downloadFileStream" },
|
|
9524
9525
|
{ title: "downloadFileFromUrl", const: "downloadFileFromUrl" }
|
|
9525
9526
|
]
|
|
9526
9527
|
},
|
|
@@ -10502,6 +10503,62 @@ const downloadFileFromUrl = (response, service2) => {
|
|
|
10502
10503
|
link.click();
|
|
10503
10504
|
link.parentNode.removeChild(link);
|
|
10504
10505
|
};
|
|
10506
|
+
const downloadFileStream = async (params2) => {
|
|
10507
|
+
try {
|
|
10508
|
+
let response;
|
|
10509
|
+
if (params2.method === "GET") {
|
|
10510
|
+
response = await params2.fetchservice.getStream(
|
|
10511
|
+
params2.url,
|
|
10512
|
+
params2.config
|
|
10513
|
+
);
|
|
10514
|
+
} else if (params2.method === "POST") {
|
|
10515
|
+
response = await params2.fetchservice.postStream(
|
|
10516
|
+
params2.url,
|
|
10517
|
+
params2.body,
|
|
10518
|
+
params2.config
|
|
10519
|
+
);
|
|
10520
|
+
} else {
|
|
10521
|
+
throw new Error(
|
|
10522
|
+
`Unsupported HTTP method: ${params2.method}. Only GET and POST are supported.`
|
|
10523
|
+
);
|
|
10524
|
+
}
|
|
10525
|
+
if (!response.ok) {
|
|
10526
|
+
throw new Error("Download failed");
|
|
10527
|
+
}
|
|
10528
|
+
const fileName = response.headers.get("filename") || "downloaded_file";
|
|
10529
|
+
const extension = fileName.includes(".") ? fileName.substring(fileName.lastIndexOf(".")) : "";
|
|
10530
|
+
const reader = response.body.getReader();
|
|
10531
|
+
const fileHandle = await window.showSaveFilePicker({
|
|
10532
|
+
suggestedName: fileName,
|
|
10533
|
+
types: extension ? [
|
|
10534
|
+
{
|
|
10535
|
+
description: "File",
|
|
10536
|
+
accept: {
|
|
10537
|
+
"application/octet-stream": [extension]
|
|
10538
|
+
}
|
|
10539
|
+
}
|
|
10540
|
+
] : void 0
|
|
10541
|
+
});
|
|
10542
|
+
const writable = await fileHandle.createWritable();
|
|
10543
|
+
while (true) {
|
|
10544
|
+
const { done, value } = await reader.read();
|
|
10545
|
+
if (done)
|
|
10546
|
+
break;
|
|
10547
|
+
await writable.write(value);
|
|
10548
|
+
}
|
|
10549
|
+
await writable.close();
|
|
10550
|
+
params2.store.setNotify({
|
|
10551
|
+
SuccessMessage: "File Downloaded Successfully",
|
|
10552
|
+
Success: true
|
|
10553
|
+
});
|
|
10554
|
+
} catch (e) {
|
|
10555
|
+
params2.store.setNotify({
|
|
10556
|
+
FailMessage: "File Download Failed",
|
|
10557
|
+
Fail: true
|
|
10558
|
+
});
|
|
10559
|
+
console.error(e);
|
|
10560
|
+
}
|
|
10561
|
+
};
|
|
10505
10562
|
const executeEvents = (params2) => {
|
|
10506
10563
|
var _a, _b, _c;
|
|
10507
10564
|
let nextEvent = [];
|
|
@@ -10623,10 +10680,13 @@ function executeInBuiltFunctionHandler(params) {
|
|
|
10623
10680
|
let parameter = {};
|
|
10624
10681
|
if (params.config.funcParametersCode) {
|
|
10625
10682
|
const makeFunc = eval(params.config.funcParametersCode);
|
|
10626
|
-
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
10627
|
-
params.serviceHolder[params.config.inBuiltFunctionType](
|
|
10683
|
+
parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.fetchservice);
|
|
10684
|
+
params.serviceHolder[params.config.inBuiltFunctionType](
|
|
10685
|
+
parameter,
|
|
10686
|
+
params.service
|
|
10687
|
+
);
|
|
10628
10688
|
} else {
|
|
10629
|
-
params.serviceHolder[params.config.inBuiltFunctionType](params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
|
|
10689
|
+
params.serviceHolder[params.config.inBuiltFunctionType](params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.fetchservice);
|
|
10630
10690
|
}
|
|
10631
10691
|
}
|
|
10632
10692
|
function executeCustomHandler(params) {
|
|
@@ -10830,7 +10890,8 @@ var service = (funcParams) => {
|
|
|
10830
10890
|
dynamicData: funcParams.dynamicData,
|
|
10831
10891
|
userValue: funcParams.userValue,
|
|
10832
10892
|
service: funcParams.service,
|
|
10833
|
-
|
|
10893
|
+
fetchservice: funcParams.fetchservice,
|
|
10894
|
+
serviceHolder: { downloadFile: downloadFile$1, download: downloadFileFromUrl, downloadFileStream, ...funcParams.functionsProvider },
|
|
10834
10895
|
eventGroups,
|
|
10835
10896
|
functionsProvider: funcParams.functionsProvider,
|
|
10836
10897
|
formDataHolder
|
|
@@ -11092,6 +11153,7 @@ var service = (funcParams) => {
|
|
|
11092
11153
|
},
|
|
11093
11154
|
downloadFile: downloadFile$1,
|
|
11094
11155
|
downloadFileFromUrl,
|
|
11156
|
+
downloadFileStream,
|
|
11095
11157
|
...funcParams.functionsProvider
|
|
11096
11158
|
};
|
|
11097
11159
|
};
|