nuxt-upload-kit 0.1.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-upload-kit",
3
3
  "configKey": "uploadKit",
4
- "version": "0.1.13",
4
+ "version": "0.1.14",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -52,9 +52,9 @@ export interface AWSS3UploadResult {
52
52
  */
53
53
  url: string;
54
54
  /**
55
- * S3 object key (file ID used for upload)
55
+ * Identifier to pass to getRemoteFile for retrieval
56
56
  */
57
- key: string;
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
- key: file.id,
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
- * File name/path in the storage
51
+ * Identifier to pass to getRemoteFile for retrieval
52
52
  */
53
- blobPath: string;
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
- blobPath: fileClient.name
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
  },
@@ -123,7 +125,8 @@ export const PluginAzureDataLake = defineStorageAdapter((options) => {
123
125
  // Include uploadResult for consistency with newly uploaded files
124
126
  uploadResult: {
125
127
  url: fileClient.url,
126
- blobPath: fileClient.name
128
+ // Return the fileId as passed in, not the full path from container root
129
+ storageKey: fileId
127
130
  }
128
131
  };
129
132
  }, `Get remote file "${fileId}"`);
@@ -52,9 +52,9 @@ export interface CloudflareR2UploadResult {
52
52
  */
53
53
  url: string;
54
54
  /**
55
- * R2 object key (file ID used for upload)
55
+ * Identifier to pass to getRemoteFile for retrieval
56
56
  */
57
- key: string;
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
- key: file.id,
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
- * Full path in Firebase Storage
55
+ * Identifier to pass to getRemoteFile for retrieval
56
56
  */
57
- fullPath: string;
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: uploadMetadata.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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-upload-kit",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "A powerful, plugin-based file upload manager for Nuxt applications",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/genu/nuxt-upload-kit.git",