nuxt-upload-kit 0.1.15 → 0.1.16

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.15",
4
+ "version": "0.1.16",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -190,7 +190,7 @@ export declare const useUploadKit: <TUploadResult = any>(_options?: UploadOption
190
190
  onGetRemoteFile: (fn: GetRemoteFileFn) => void;
191
191
  onUpload: (fn: UploadFn<TUploadResult>) => void;
192
192
  removeFile: (fileId: string, removeOptions?: {
193
- deleteFromStorage?: boolean;
193
+ deleteFromStorage?: "always" | "never" | "local-only";
194
194
  }) => Promise<void>;
195
195
  removeFiles: (fileIds: string[]) => ({
196
196
  source: "local";
@@ -258,10 +258,22 @@ This is deprecated. Use the 'storage' option instead:
258
258
  return addedFiles;
259
259
  };
260
260
  const removeFile = async (fileId, removeOptions) => {
261
- const { deleteFromStorage = true } = removeOptions ?? {};
261
+ const { deleteFromStorage = "always" } = removeOptions ?? {};
262
262
  const file = files.value.find((f) => f.id === fileId);
263
263
  if (!file) return;
264
- if (deleteFromStorage && file.remoteUrl) {
264
+ let shouldDelete;
265
+ switch (deleteFromStorage) {
266
+ case "always":
267
+ shouldDelete = true;
268
+ break;
269
+ case "never":
270
+ shouldDelete = false;
271
+ break;
272
+ case "local-only":
273
+ shouldDelete = file.source === "local";
274
+ break;
275
+ }
276
+ if (shouldDelete && file.remoteUrl) {
265
277
  const storagePlugin = getStoragePlugin();
266
278
  if (storagePlugin?.hooks.remove) {
267
279
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-upload-kit",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
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",