@sparkvault/sdk-js 1.24.6 → 1.25.0
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/index.d.ts +11 -0
- package/dist/sparkvault.cjs.js +13 -8
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +13 -8
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/api.d.ts +1 -1
- package/dist/vaults/upload/types.d.ts +11 -0
- package/package.json +1 -1
package/dist/sparkvault.esm.js
CHANGED
|
@@ -6778,15 +6778,20 @@ class UploadApi extends SparkVaultApi {
|
|
|
6778
6778
|
/**
|
|
6779
6779
|
* Initiate an upload to get Forge URL and ingot ID.
|
|
6780
6780
|
*/
|
|
6781
|
-
async initiateUpload(vaultId, filename, sizeBytes, contentType) {
|
|
6781
|
+
async initiateUpload(vaultId, filename, sizeBytes, contentType, token, folder) {
|
|
6782
6782
|
const url = `${this.config.apiBaseUrl}/v1/files/in/${vaultId}/upload`;
|
|
6783
|
+
const body = {
|
|
6784
|
+
filename,
|
|
6785
|
+
size_bytes: sizeBytes,
|
|
6786
|
+
content_type: contentType,
|
|
6787
|
+
};
|
|
6788
|
+
if (folder) {
|
|
6789
|
+
body.folder_path = folder;
|
|
6790
|
+
}
|
|
6783
6791
|
const response = await this.request(url, {
|
|
6784
6792
|
method: 'POST',
|
|
6785
|
-
body: JSON.stringify(
|
|
6786
|
-
|
|
6787
|
-
size_bytes: sizeBytes,
|
|
6788
|
-
content_type: contentType,
|
|
6789
|
-
}),
|
|
6793
|
+
body: JSON.stringify(body),
|
|
6794
|
+
headers: token ? { 'X-Vault-Access-Token': token } : undefined,
|
|
6790
6795
|
});
|
|
6791
6796
|
if (!isInitiateUploadResponse(response.data)) {
|
|
6792
6797
|
throw new UploadApiError('Invalid initiate upload response from server', 'invalid_response', response.status);
|
|
@@ -9113,7 +9118,7 @@ class UploadRenderer {
|
|
|
9113
9118
|
div.className = 'svu-error-view';
|
|
9114
9119
|
div.innerHTML = `
|
|
9115
9120
|
<div class="svu-error-icon">
|
|
9116
|
-
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
9121
|
+
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
9117
9122
|
<circle cx="12" cy="12" r="10"/>
|
|
9118
9123
|
<path d="M12 8v4M12 16h.01"/>
|
|
9119
9124
|
</svg>
|
|
@@ -9195,7 +9200,7 @@ class UploadRenderer {
|
|
|
9195
9200
|
const requestId = generateRequestId();
|
|
9196
9201
|
try {
|
|
9197
9202
|
// Initiate upload
|
|
9198
|
-
const { forgeUrl, ingotId } = await this.api.initiateUpload(config.vaultId, file.name, file.size, file.type || 'application/octet-stream');
|
|
9203
|
+
const { forgeUrl, ingotId } = await this.api.initiateUpload(config.vaultId, file.name, file.size, file.type || 'application/octet-stream', this.options.token, this.options.folder);
|
|
9199
9204
|
// Show uploading state
|
|
9200
9205
|
this.setState({
|
|
9201
9206
|
view: 'uploading',
|