@databrainhq/plugin 0.14.13 → 0.14.14

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.
@@ -79849,11 +79849,45 @@ const j8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
79849
79849
  throw new Error('Network response was not ok');
79850
79850
  }
79851
79851
 
79852
+ const clonedRes = res.clone(); // Clone the response for reading the content
79853
+
79854
+ const reader = clonedRes.body?.getReader();
79855
+
79856
+ let receivedLength = 0;
79857
+ const chunks = [];
79858
+
79859
+ if (reader) {
79860
+ while (true) {
79861
+ const { done: isDone, value } = await reader.read();
79862
+ if (isDone) {
79863
+ break;
79864
+ }
79865
+ chunks.push(value);
79866
+
79867
+ receivedLength += value.length;
79868
+ const lenghtInKb = Math.round(receivedLength / 1024);
79869
+
79870
+
79871
+ document.getElementById('progress-text').textContent = 'Download Progress: ' + lenghtInKb + ' KB';
79872
+ }
79873
+ }
79874
+ // Concatenate all the chunks into a single Uint8Array
79875
+ const chunksAll = new Uint8Array(receivedLength);
79876
+ let position = 0;
79877
+ for (const chunk of chunks) {
79878
+ chunksAll.set(chunk, position);
79879
+ position += chunk.length;
79880
+ }
79881
+ // Convert the Uint8Array to a Blob
79882
+ const blob = new Blob([chunksAll]);
79852
79883
  // Read the response body as a Blob (binary data)
79853
- const zipData = await res.blob();
79884
+ // const zipData = await res.blob();
79854
79885
 
79855
79886
  // Create a temporary URL for the Blob
79856
- const zipUrl = URL.createObjectURL(zipData);
79887
+ const zipUrl = URL.createObjectURL(blob);
79888
+
79889
+ // Create a temporary URL for the Blob
79890
+ //const zipUrl = URL.createObjectURL(zipData);
79857
79891
 
79858
79892
  // Create a link element to trigger the download
79859
79893
  const downloadLink = document.createElement('a');
@@ -79873,6 +79907,8 @@ const j8e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
79873
79907
  // Remove the link from the document
79874
79908
  document.body.removeChild(downloadLink);
79875
79909
  // Close the new tab/window
79910
+ document.getElementById('progress-text').textContent = 'Download complete';
79911
+
79876
79912
  window.close();
79877
79913
 
79878
79914
  } catch (error) {
@@ -1105,11 +1105,45 @@ echarts.use([`+b+"]);":"Unknown series "+S))}return}if(D==="tooltip"){if(h){proc
1105
1105
  throw new Error('Network response was not ok');
1106
1106
  }
1107
1107
 
1108
+ const clonedRes = res.clone(); // Clone the response for reading the content
1109
+
1110
+ const reader = clonedRes.body?.getReader();
1111
+
1112
+ let receivedLength = 0;
1113
+ const chunks = [];
1114
+
1115
+ if (reader) {
1116
+ while (true) {
1117
+ const { done: isDone, value } = await reader.read();
1118
+ if (isDone) {
1119
+ break;
1120
+ }
1121
+ chunks.push(value);
1122
+
1123
+ receivedLength += value.length;
1124
+ const lenghtInKb = Math.round(receivedLength / 1024);
1125
+
1126
+
1127
+ document.getElementById('progress-text').textContent = 'Download Progress: ' + lenghtInKb + ' KB';
1128
+ }
1129
+ }
1130
+ // Concatenate all the chunks into a single Uint8Array
1131
+ const chunksAll = new Uint8Array(receivedLength);
1132
+ let position = 0;
1133
+ for (const chunk of chunks) {
1134
+ chunksAll.set(chunk, position);
1135
+ position += chunk.length;
1136
+ }
1137
+ // Convert the Uint8Array to a Blob
1138
+ const blob = new Blob([chunksAll]);
1108
1139
  // Read the response body as a Blob (binary data)
1109
- const zipData = await res.blob();
1140
+ // const zipData = await res.blob();
1141
+
1142
+ // Create a temporary URL for the Blob
1143
+ const zipUrl = URL.createObjectURL(blob);
1110
1144
 
1111
1145
  // Create a temporary URL for the Blob
1112
- const zipUrl = URL.createObjectURL(zipData);
1146
+ //const zipUrl = URL.createObjectURL(zipData);
1113
1147
 
1114
1148
  // Create a link element to trigger the download
1115
1149
  const downloadLink = document.createElement('a');
@@ -1129,6 +1163,8 @@ echarts.use([`+b+"]);":"Unknown series "+S))}return}if(D==="tooltip"){if(h){proc
1129
1163
  // Remove the link from the document
1130
1164
  document.body.removeChild(downloadLink);
1131
1165
  // Close the new tab/window
1166
+ document.getElementById('progress-text').textContent = 'Download complete';
1167
+
1132
1168
  window.close();
1133
1169
 
1134
1170
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databrainhq/plugin",
3
- "version": "0.14.13",
3
+ "version": "0.14.14",
4
4
  "description": "Databrain app ui plugin.",
5
5
  "author": "",
6
6
  "license": "MIT",