nuxt-upload-kit 0.1.12 → 0.1.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.
- package/dist/module.json +1 -1
- package/dist/runtime/composables/useUploadKit/index.js +3 -1
- package/dist/runtime/composables/useUploadKit/plugins/storage/aws-s3.d.ts +2 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/aws-s3.js +7 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/azure-datalake.d.ts +2 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/azure-datalake.js +10 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/cloudflare-r2.d.ts +2 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/cloudflare-r2.js +7 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/firebase-storage.d.ts +2 -2
- package/dist/runtime/composables/useUploadKit/plugins/storage/firebase-storage.js +11 -2
- package/dist/runtime/composables/useUploadKit/types.d.ts +10 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -201,8 +201,10 @@ This is deprecated. Use the 'storage' option instead:
|
|
|
201
201
|
remoteUrl: remoteFileData.remoteUrl,
|
|
202
202
|
preview: remoteFileData.preview || file.preview || remoteFileData.remoteUrl,
|
|
203
203
|
// Use preview from storage, passed-in value, or fallback to remoteUrl
|
|
204
|
-
source: "storage"
|
|
204
|
+
source: "storage",
|
|
205
205
|
// File loaded from remote storage
|
|
206
|
+
// Set uploadResult for consistency with newly uploaded files
|
|
207
|
+
uploadResult: remoteFileData.uploadResult
|
|
206
208
|
};
|
|
207
209
|
return existingFile;
|
|
208
210
|
})
|
|
@@ -52,9 +52,9 @@ export interface AWSS3UploadResult {
|
|
|
52
52
|
*/
|
|
53
53
|
url: string;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Identifier to pass to getRemoteFile for retrieval
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
storageKey: string;
|
|
58
58
|
/**
|
|
59
59
|
* ETag of the uploaded object (from response headers)
|
|
60
60
|
*/
|
|
@@ -42,7 +42,7 @@ export const PluginAWSS3 = defineStorageAdapter((options) => {
|
|
|
42
42
|
const etag = await uploadWithProgress(uploadUrl, file.data, file.mimeType, context.onProgress);
|
|
43
43
|
return {
|
|
44
44
|
url: publicUrl,
|
|
45
|
-
|
|
45
|
+
storageKey: file.id,
|
|
46
46
|
etag
|
|
47
47
|
};
|
|
48
48
|
}, `Upload file "${file.name}"`);
|
|
@@ -63,7 +63,12 @@ export const PluginAWSS3 = defineStorageAdapter((options) => {
|
|
|
63
63
|
return {
|
|
64
64
|
size: Number.parseInt(response.headers.get("content-length") || "0", 10),
|
|
65
65
|
mimeType: response.headers.get("content-type") || "application/octet-stream",
|
|
66
|
-
remoteUrl: downloadUrl
|
|
66
|
+
remoteUrl: downloadUrl,
|
|
67
|
+
// Include uploadResult for consistency with newly uploaded files
|
|
68
|
+
uploadResult: {
|
|
69
|
+
url: downloadUrl,
|
|
70
|
+
storageKey: fileId
|
|
71
|
+
}
|
|
67
72
|
};
|
|
68
73
|
}, `Get remote file "${fileId}"`);
|
|
69
74
|
},
|
|
@@ -48,8 +48,8 @@ export interface AzureUploadResult {
|
|
|
48
48
|
*/
|
|
49
49
|
url: string;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Identifier to pass to getRemoteFile for retrieval
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
storageKey: string;
|
|
54
54
|
}
|
|
55
55
|
export declare const PluginAzureDataLake: (options: AzureDataLakeOptions) => import("../../types.js").StoragePlugin<AzureUploadResult, Record<string, never>>;
|
|
@@ -105,7 +105,9 @@ export const PluginAzureDataLake = defineStorageAdapter((options) => {
|
|
|
105
105
|
});
|
|
106
106
|
return {
|
|
107
107
|
url: fileClient.url,
|
|
108
|
-
|
|
108
|
+
// Return just the file ID (filename), not the full path from container root
|
|
109
|
+
// This ensures the storageKey can be used directly with getRemoteFile
|
|
110
|
+
storageKey: file.id
|
|
109
111
|
};
|
|
110
112
|
}, `Upload file "${file.name}"`);
|
|
111
113
|
},
|
|
@@ -119,7 +121,13 @@ export const PluginAzureDataLake = defineStorageAdapter((options) => {
|
|
|
119
121
|
return {
|
|
120
122
|
size: properties.contentLength || 0,
|
|
121
123
|
mimeType: properties.contentType || "application/octet-stream",
|
|
122
|
-
remoteUrl: fileClient.url
|
|
124
|
+
remoteUrl: fileClient.url,
|
|
125
|
+
// Include uploadResult for consistency with newly uploaded files
|
|
126
|
+
uploadResult: {
|
|
127
|
+
url: fileClient.url,
|
|
128
|
+
// Return the fileId as passed in, not the full path from container root
|
|
129
|
+
storageKey: fileId
|
|
130
|
+
}
|
|
123
131
|
};
|
|
124
132
|
}, `Get remote file "${fileId}"`);
|
|
125
133
|
},
|
|
@@ -52,9 +52,9 @@ export interface CloudflareR2UploadResult {
|
|
|
52
52
|
*/
|
|
53
53
|
url: string;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Identifier to pass to getRemoteFile for retrieval
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
storageKey: string;
|
|
58
58
|
/**
|
|
59
59
|
* ETag of the uploaded object (from response headers)
|
|
60
60
|
*/
|
|
@@ -42,7 +42,7 @@ export const PluginCloudflareR2 = defineStorageAdapter((options) => {
|
|
|
42
42
|
const etag = await uploadWithProgress(uploadUrl, file.data, file.mimeType, context.onProgress);
|
|
43
43
|
return {
|
|
44
44
|
url: publicUrl,
|
|
45
|
-
|
|
45
|
+
storageKey: file.id,
|
|
46
46
|
etag
|
|
47
47
|
};
|
|
48
48
|
}, `Upload file "${file.name}"`);
|
|
@@ -63,7 +63,12 @@ export const PluginCloudflareR2 = defineStorageAdapter((options) => {
|
|
|
63
63
|
return {
|
|
64
64
|
size: Number.parseInt(response.headers.get("content-length") || "0", 10),
|
|
65
65
|
mimeType: response.headers.get("content-type") || "application/octet-stream",
|
|
66
|
-
remoteUrl: downloadUrl
|
|
66
|
+
remoteUrl: downloadUrl,
|
|
67
|
+
// Include uploadResult for consistency with newly uploaded files
|
|
68
|
+
uploadResult: {
|
|
69
|
+
url: downloadUrl,
|
|
70
|
+
storageKey: fileId
|
|
71
|
+
}
|
|
67
72
|
};
|
|
68
73
|
}, `Get remote file "${fileId}"`);
|
|
69
74
|
},
|
|
@@ -52,9 +52,9 @@ export interface FirebaseStorageUploadResult {
|
|
|
52
52
|
*/
|
|
53
53
|
url: string;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Identifier to pass to getRemoteFile for retrieval
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
storageKey: string;
|
|
58
58
|
/**
|
|
59
59
|
* Storage bucket name
|
|
60
60
|
*/
|
|
@@ -67,7 +67,8 @@ export const PluginFirebaseStorage = defineStorageAdapter((options) => {
|
|
|
67
67
|
const uploadMetadata = uploadTask.snapshot.metadata;
|
|
68
68
|
resolve({
|
|
69
69
|
url: downloadURL,
|
|
70
|
-
fullPath
|
|
70
|
+
// Use fileId (not fullPath) to ensure storageKey can be used with getRemoteFile
|
|
71
|
+
storageKey: fileId,
|
|
71
72
|
bucket: uploadMetadata.bucket,
|
|
72
73
|
generation: uploadMetadata.generation,
|
|
73
74
|
md5Hash: uploadMetadata.md5Hash
|
|
@@ -104,7 +105,15 @@ export const PluginFirebaseStorage = defineStorageAdapter((options) => {
|
|
|
104
105
|
return {
|
|
105
106
|
size: metadata.size,
|
|
106
107
|
mimeType: metadata.contentType || "application/octet-stream",
|
|
107
|
-
remoteUrl: downloadURL
|
|
108
|
+
remoteUrl: downloadURL,
|
|
109
|
+
// Include uploadResult for consistency with newly uploaded files
|
|
110
|
+
uploadResult: {
|
|
111
|
+
url: downloadURL,
|
|
112
|
+
storageKey: fileId,
|
|
113
|
+
bucket: metadata.bucket,
|
|
114
|
+
generation: metadata.generation,
|
|
115
|
+
md5Hash: metadata.md5Hash
|
|
116
|
+
}
|
|
108
117
|
};
|
|
109
118
|
}, `Get remote file "${fileId}"`);
|
|
110
119
|
},
|
|
@@ -330,7 +330,10 @@ export type SetupHook<TPluginEvents extends Record<string, any> = Record<string,
|
|
|
330
330
|
export type UploadHook<TUploadResult = any, TPluginEvents extends Record<string, any> = Record<string, never>> = (file: UploadFile<TUploadResult>, context: PluginContext<TPluginEvents> & {
|
|
331
331
|
onProgress: (progress: number) => void;
|
|
332
332
|
}) => Promise<TUploadResult & {
|
|
333
|
+
/** Public URL to access the uploaded file */
|
|
333
334
|
url: string;
|
|
335
|
+
/** Identifier to pass to getRemoteFile for retrieval */
|
|
336
|
+
storageKey: string;
|
|
334
337
|
}>;
|
|
335
338
|
export type GetRemoteFileHook<TPluginEvents extends Record<string, any> = Record<string, never>> = (fileId: string, context: PluginContext<TPluginEvents>) => Promise<MinimumRemoteFileAttributes>;
|
|
336
339
|
export type RemoveHook<TPluginEvents extends Record<string, any> = Record<string, never>> = (file: UploadFile, context: PluginContext<TPluginEvents>) => Promise<void>;
|
|
@@ -509,10 +512,16 @@ export type Processor = (file: UploadFile) => Promise<File | Blob>;
|
|
|
509
512
|
export interface UploadBlob {
|
|
510
513
|
blobPath: string;
|
|
511
514
|
}
|
|
512
|
-
type MinimumRemoteFileAttributes = {
|
|
515
|
+
export type MinimumRemoteFileAttributes<TUploadResult = any> = {
|
|
513
516
|
size: number;
|
|
514
517
|
mimeType: string;
|
|
515
518
|
remoteUrl: string;
|
|
516
519
|
preview?: string;
|
|
520
|
+
/**
|
|
521
|
+
* Optional upload result from storage plugin.
|
|
522
|
+
* When provided, this will be set on initialized files for consistency
|
|
523
|
+
* with newly uploaded files, eliminating the need for special handling.
|
|
524
|
+
*/
|
|
525
|
+
uploadResult?: TUploadResult;
|
|
517
526
|
};
|
|
518
527
|
export {};
|
package/package.json
CHANGED