vuefinder 4.1.0 → 4.1.2
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/types/ServiceContainer.d.ts +3 -0
- package/dist/types/adapters/Adapter.d.ts +106 -0
- package/dist/types/adapters/AdapterManager.d.ts +161 -0
- package/dist/types/adapters/ArrayDriver.d.ts +86 -0
- package/dist/types/adapters/IndexedDBDriver.d.ts +71 -0
- package/dist/types/adapters/RemoteDriver.d.ts +75 -0
- package/dist/types/adapters/index.d.ts +57 -0
- package/dist/types/adapters/types.d.ts +239 -0
- package/dist/types/components/ActionMessage.vue.d.ts +16 -0
- package/dist/types/components/Breadcrumb.vue.d.ts +3 -0
- package/dist/types/components/ContextMenu.vue.d.ts +3 -0
- package/dist/types/components/DragItem.vue.d.ts +6 -0
- package/dist/types/components/Explorer.vue.d.ts +30 -0
- package/dist/types/components/ExplorerHeader.vue.d.ts +3 -0
- package/dist/types/components/FileItem.vue.d.ts +49 -0
- package/dist/types/components/FileRow.vue.d.ts +44 -0
- package/dist/types/components/FolderIndicator.vue.d.ts +10 -0
- package/dist/types/components/FolderLoaderIndicator.vue.d.ts +15 -0
- package/dist/types/components/ItemIcon.vue.d.ts +25 -0
- package/dist/types/components/MenuBar.vue.d.ts +3 -0
- package/dist/types/components/Message.vue.d.ts +20 -0
- package/dist/types/components/SortIcon.vue.d.ts +6 -0
- package/dist/types/components/Statusbar.vue.d.ts +17 -0
- package/dist/types/components/Toolbar.vue.d.ts +3 -0
- package/dist/types/components/TreeStorageItem.vue.d.ts +6 -0
- package/dist/types/components/TreeSubfolderList.vue.d.ts +7 -0
- package/dist/types/components/TreeView.vue.d.ts +3 -0
- package/dist/types/components/VueFinderProvider.vue.d.ts +31 -0
- package/dist/types/components/VueFinderView.vue.d.ts +48 -0
- package/dist/types/components/modals/ModalAbout.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalArchive.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalCopy.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalDelete.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalHeader.vue.d.ts +7 -0
- package/dist/types/components/modals/ModalLayout.vue.d.ts +19 -0
- package/dist/types/components/modals/ModalMessage.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalMove.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalNewFile.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalNewFolder.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalPreview.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalRename.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalSearch.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalSettings.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalShortcuts.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalTransfer.vue.d.ts +6 -0
- package/dist/types/components/modals/ModalTreeFolderItem.vue.d.ts +20 -0
- package/dist/types/components/modals/ModalTreeSelector.vue.d.ts +15 -0
- package/dist/types/components/modals/ModalUnarchive.vue.d.ts +3 -0
- package/dist/types/components/modals/ModalUpload.vue.d.ts +3 -0
- package/dist/types/components/previews/Audio.vue.d.ts +7 -0
- package/dist/types/components/previews/Default.vue.d.ts +7 -0
- package/dist/types/components/previews/Image.vue.d.ts +8 -0
- package/dist/types/components/previews/Pdf.vue.d.ts +7 -0
- package/dist/types/components/previews/Text.vue.d.ts +7 -0
- package/dist/types/components/previews/Video.vue.d.ts +7 -0
- package/dist/types/components/search/SearchInput.vue.d.ts +16 -0
- package/dist/types/components/search/SearchOptionsDropdown.vue.d.ts +23 -0
- package/dist/types/components/search/SearchResultItem.vue.d.ts +30 -0
- package/dist/types/components/search/SearchResultsList.vue.d.ts +36 -0
- package/dist/types/composables/useApp.d.ts +20 -0
- package/dist/types/composables/useDebouncedRef.d.ts +2 -0
- package/dist/types/composables/useDragNDrop.d.ts +17 -0
- package/dist/types/composables/useExternalDragDrop.d.ts +67 -0
- package/dist/types/composables/useFeature.d.ts +9 -0
- package/dist/types/composables/useHotkeyActions.d.ts +1 -0
- package/dist/types/composables/useI18n.d.ts +20 -0
- package/dist/types/composables/useItemEvents.d.ts +14 -0
- package/dist/types/composables/useItemFilters.d.ts +11 -0
- package/dist/types/composables/useItemOperations.d.ts +8 -0
- package/dist/types/composables/useLazyLoad.d.ts +26 -0
- package/dist/types/composables/useModal.d.ts +10 -0
- package/dist/types/composables/useScrollSetup.d.ts +47 -0
- package/dist/types/composables/useSelection.d.ts +23 -0
- package/dist/types/composables/useStorage.d.ts +6 -0
- package/dist/types/composables/useTheme.d.ts +13 -0
- package/dist/types/composables/useUpload.d.ts +42 -0
- package/dist/types/composables/useVirtualColumns.d.ts +31 -0
- package/dist/types/composables/useVueFinder.d.ts +2 -0
- package/dist/types/features.d.ts +6 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/stores/config.d.ts +80 -0
- package/dist/types/stores/files.d.ts +83 -0
- package/dist/types/stores/i18n.d.ts +2 -0
- package/dist/types/stores/theme.d.ts +6 -0
- package/dist/types/types.d.ts +125 -0
- package/dist/types/utils/clipboard.d.ts +21 -0
- package/dist/types/utils/contextmenu.d.ts +34 -0
- package/dist/types/utils/datetimestring.d.ts +1 -0
- package/dist/types/utils/debounce.d.ts +1 -0
- package/dist/types/utils/errorHandler.d.ts +14 -0
- package/dist/types/utils/filesize.d.ts +16 -0
- package/dist/types/utils/notify.d.ts +22 -0
- package/dist/types/utils/path.d.ts +3 -0
- package/dist/types/utils/scanFiles.d.ts +5 -0
- package/dist/types/utils/titleShorten.d.ts +1 -0
- package/dist/types/utils/upsert.d.ts +5 -0
- package/dist/vuefinder.css +1 -1
- package/dist/vuefinder.js +3485 -3558
- package/package.json +6 -6
- package/dist/features.js +0 -43
- package/dist/index.d.ts +0 -203
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Driver, DeleteResult, FileOperationResult, FileContentResult, DeleteParams, ArchiveParams, SaveParams, RenameParams, TransferParams } from './types';
|
|
2
|
+
import type { DirEntry, FsData } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Base abstract adapter class that provides common functionality
|
|
5
|
+
* for all adapter implementations
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BaseAdapter implements Driver {
|
|
8
|
+
/**
|
|
9
|
+
* Validate that required parameters are provided
|
|
10
|
+
*/
|
|
11
|
+
protected validateParam(param: unknown, name: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a file path is provided
|
|
14
|
+
*/
|
|
15
|
+
protected validatePath(path: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Extract storage and path from a combined path string
|
|
18
|
+
* Format: "storage://path" or just "path"
|
|
19
|
+
*/
|
|
20
|
+
protected parsePath(inputPath?: string): {
|
|
21
|
+
storage?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Combine storage and path into a single path string
|
|
26
|
+
*/
|
|
27
|
+
protected combinePath(storage?: string, path?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* List files and folders at a given path
|
|
30
|
+
*/
|
|
31
|
+
abstract list(params?: {
|
|
32
|
+
path?: string;
|
|
33
|
+
}): Promise<FsData>;
|
|
34
|
+
/**
|
|
35
|
+
* Delete files/folders
|
|
36
|
+
*/
|
|
37
|
+
abstract delete(params: DeleteParams): Promise<DeleteResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Rename a file or folder
|
|
40
|
+
*/
|
|
41
|
+
abstract rename(params: RenameParams): Promise<FileOperationResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Copy files/folders to a destination
|
|
44
|
+
*/
|
|
45
|
+
abstract copy(params: TransferParams): Promise<FileOperationResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Move files/folders to a destination
|
|
48
|
+
*/
|
|
49
|
+
abstract move(params: TransferParams): Promise<FileOperationResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a zip archive from files/folders
|
|
52
|
+
*/
|
|
53
|
+
abstract archive(params: ArchiveParams): Promise<FileOperationResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Extract files from a zip archive
|
|
56
|
+
*/
|
|
57
|
+
abstract unarchive(params: {
|
|
58
|
+
item: string;
|
|
59
|
+
path: string;
|
|
60
|
+
}): Promise<FileOperationResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new file
|
|
63
|
+
*/
|
|
64
|
+
abstract createFile(params: {
|
|
65
|
+
path: string;
|
|
66
|
+
name: string;
|
|
67
|
+
}): Promise<FileOperationResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a new folder
|
|
70
|
+
*/
|
|
71
|
+
abstract createFolder(params: {
|
|
72
|
+
path: string;
|
|
73
|
+
name: string;
|
|
74
|
+
}): Promise<FileOperationResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Get preview URL for a file
|
|
77
|
+
*/
|
|
78
|
+
abstract getPreviewUrl(params: {
|
|
79
|
+
path: string;
|
|
80
|
+
}): string;
|
|
81
|
+
/**
|
|
82
|
+
* Get file content
|
|
83
|
+
*/
|
|
84
|
+
abstract getContent(params: {
|
|
85
|
+
path: string;
|
|
86
|
+
}): Promise<FileContentResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Get download URL for a file
|
|
89
|
+
*/
|
|
90
|
+
abstract getDownloadUrl(params: {
|
|
91
|
+
path: string;
|
|
92
|
+
}): string;
|
|
93
|
+
/**
|
|
94
|
+
* Search files
|
|
95
|
+
*/
|
|
96
|
+
abstract search(params: {
|
|
97
|
+
path?: string;
|
|
98
|
+
filter: string;
|
|
99
|
+
deep?: boolean;
|
|
100
|
+
size?: 'all' | 'small' | 'medium' | 'large';
|
|
101
|
+
}): Promise<DirEntry[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Save content to file
|
|
104
|
+
*/
|
|
105
|
+
abstract save(params: SaveParams): Promise<string>;
|
|
106
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import type { Driver, DeleteResult, FileOperationResult, FileContentResult, DeleteParams, ArchiveParams, SaveParams, RenameParams, TransferParams } from './types';
|
|
3
|
+
import type { FsData } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for AdapterManager
|
|
6
|
+
*/
|
|
7
|
+
export interface AdapterManagerConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Query client for TanStack Query
|
|
10
|
+
* If not provided, a default one will be created
|
|
11
|
+
*/
|
|
12
|
+
queryClient?: QueryClient;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to enable refetching on window focus
|
|
15
|
+
*/
|
|
16
|
+
refetchOnWindowFocus?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Default stale time for queries (in milliseconds)
|
|
19
|
+
*/
|
|
20
|
+
staleTime?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Default cache time for queries (in milliseconds)
|
|
23
|
+
*/
|
|
24
|
+
cacheTime?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to retry failed requests
|
|
27
|
+
*/
|
|
28
|
+
retry?: boolean | number;
|
|
29
|
+
/**
|
|
30
|
+
* Callback to update state when data is fetched
|
|
31
|
+
* This allows the adapter to trigger state updates without being coupled to VueFinder
|
|
32
|
+
*/
|
|
33
|
+
onBeforeOpen?: () => void;
|
|
34
|
+
onAfterOpen?: (data: FsData) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Keys for query and mutation caching
|
|
38
|
+
*/
|
|
39
|
+
export declare const QueryKeys: {
|
|
40
|
+
list: (path?: string) => readonly ["adapter", "list", string | undefined];
|
|
41
|
+
search: (path?: string, filter?: string, deep?: boolean, size?: string) => readonly ["adapter", "search", string | undefined, string | undefined, boolean | undefined, string | undefined];
|
|
42
|
+
delete: (paths?: string[]) => readonly ["adapter", "delete", string[] | undefined];
|
|
43
|
+
rename: () => readonly ["adapter", "rename"];
|
|
44
|
+
copy: () => readonly ["adapter", "copy"];
|
|
45
|
+
move: () => readonly ["adapter", "move"];
|
|
46
|
+
archive: () => readonly ["adapter", "archive"];
|
|
47
|
+
unarchive: () => readonly ["adapter", "unarchive"];
|
|
48
|
+
createFile: () => readonly ["adapter", "createFile"];
|
|
49
|
+
createFolder: () => readonly ["adapter", "createFolder"];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* AdapterManager wraps a Driver with TanStack Query for enhanced functionality
|
|
53
|
+
* including caching, optimistic updates, and error handling.
|
|
54
|
+
*/
|
|
55
|
+
export declare class AdapterManager {
|
|
56
|
+
private driver;
|
|
57
|
+
private queryClient;
|
|
58
|
+
private config;
|
|
59
|
+
private onBeforeOpen?;
|
|
60
|
+
private onAfterOpen?;
|
|
61
|
+
constructor(adapter: Driver, config?: Partial<AdapterManagerConfig>);
|
|
62
|
+
/**
|
|
63
|
+
* Get the underlying driver instance
|
|
64
|
+
*/
|
|
65
|
+
getDriver(): Driver;
|
|
66
|
+
/**
|
|
67
|
+
* Get the query client instance
|
|
68
|
+
*/
|
|
69
|
+
getQueryClient(): QueryClient;
|
|
70
|
+
/**
|
|
71
|
+
* List files with caching and automatic refetching
|
|
72
|
+
*/
|
|
73
|
+
list(path?: string): Promise<FsData>;
|
|
74
|
+
/**
|
|
75
|
+
* Open a path and optionally update state
|
|
76
|
+
* @param path
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
open(path?: string): Promise<FsData>;
|
|
80
|
+
/**
|
|
81
|
+
* Delete files with optimistic updates
|
|
82
|
+
*/
|
|
83
|
+
delete(params: DeleteParams): Promise<DeleteResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Rename a file or folder
|
|
86
|
+
*/
|
|
87
|
+
rename(params: RenameParams): Promise<FileOperationResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Copy files to a destination
|
|
90
|
+
*/
|
|
91
|
+
copy(params: TransferParams): Promise<FileOperationResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Move files to a destination
|
|
94
|
+
*/
|
|
95
|
+
move(params: TransferParams): Promise<FileOperationResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Create a zip archive
|
|
98
|
+
*/
|
|
99
|
+
archive(params: ArchiveParams): Promise<FileOperationResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Extract files from a zip archive
|
|
102
|
+
*/
|
|
103
|
+
unarchive(params: {
|
|
104
|
+
item: string;
|
|
105
|
+
path: string;
|
|
106
|
+
}): Promise<FileOperationResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new file
|
|
109
|
+
*/
|
|
110
|
+
createFile(params: {
|
|
111
|
+
path: string;
|
|
112
|
+
name: string;
|
|
113
|
+
}): Promise<FileOperationResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Create a new folder
|
|
116
|
+
*/
|
|
117
|
+
createFolder(params: {
|
|
118
|
+
path: string;
|
|
119
|
+
name: string;
|
|
120
|
+
}): Promise<FileOperationResult>;
|
|
121
|
+
/**
|
|
122
|
+
* Get file content (cached)
|
|
123
|
+
*/
|
|
124
|
+
getContent(params: {
|
|
125
|
+
path: string;
|
|
126
|
+
}): Promise<FileContentResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Get preview URL
|
|
129
|
+
*/
|
|
130
|
+
getPreviewUrl(params: {
|
|
131
|
+
path: string;
|
|
132
|
+
}): string;
|
|
133
|
+
/**
|
|
134
|
+
* Get download URL
|
|
135
|
+
*/
|
|
136
|
+
getDownloadUrl(params: {
|
|
137
|
+
path: string;
|
|
138
|
+
}): string;
|
|
139
|
+
/**
|
|
140
|
+
* Search files (cached per path+filter)
|
|
141
|
+
*/
|
|
142
|
+
search(params: {
|
|
143
|
+
path?: string;
|
|
144
|
+
filter: string;
|
|
145
|
+
deep?: boolean;
|
|
146
|
+
size?: 'all' | 'small' | 'medium' | 'large';
|
|
147
|
+
}): Promise<import('../types').DirEntry[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Save content to file (and invalidate list cache)
|
|
150
|
+
*/
|
|
151
|
+
save(params: SaveParams): Promise<string>;
|
|
152
|
+
/**
|
|
153
|
+
* Invalidate all list queries
|
|
154
|
+
*/
|
|
155
|
+
private invalidateListQueries;
|
|
156
|
+
invalidateListQuery(path?: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Clear all cached queries
|
|
159
|
+
*/
|
|
160
|
+
clearCache(): void;
|
|
161
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BaseAdapter } from './Adapter';
|
|
2
|
+
import type { DeleteParams, DeleteResult, FileOperationResult, FileContentResult, ArchiveParams, SaveParams, RenameParams, TransferParams } from './types';
|
|
3
|
+
import type { DirEntry, FsData } from '../types';
|
|
4
|
+
type FilesSource = {
|
|
5
|
+
value: DirEntry[];
|
|
6
|
+
} | DirEntry[];
|
|
7
|
+
export interface ArrayDriverConfig {
|
|
8
|
+
files: FilesSource;
|
|
9
|
+
storage?: string;
|
|
10
|
+
storages?: string[];
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
contentStore?: Map<string, string | ArrayBuffer>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ArrayDriver extends BaseAdapter {
|
|
15
|
+
private filesSource;
|
|
16
|
+
private defaultStorage;
|
|
17
|
+
private storages;
|
|
18
|
+
private storagesSet;
|
|
19
|
+
private readOnly;
|
|
20
|
+
private contentStore;
|
|
21
|
+
constructor(config: ArrayDriverConfig);
|
|
22
|
+
private get files();
|
|
23
|
+
private set files(value);
|
|
24
|
+
private ensureWritable;
|
|
25
|
+
private ensureStorageSupported;
|
|
26
|
+
private combine;
|
|
27
|
+
private split;
|
|
28
|
+
private normalizePath;
|
|
29
|
+
private parent;
|
|
30
|
+
private join;
|
|
31
|
+
private getExtension;
|
|
32
|
+
private cloneEntry;
|
|
33
|
+
private findByPath;
|
|
34
|
+
private listChildren;
|
|
35
|
+
private replaceAll;
|
|
36
|
+
private upsert;
|
|
37
|
+
private removeExact;
|
|
38
|
+
private removeTree;
|
|
39
|
+
private isInTree;
|
|
40
|
+
private getTree;
|
|
41
|
+
private uniqueName;
|
|
42
|
+
private topLevelSources;
|
|
43
|
+
private makeDirEntry;
|
|
44
|
+
private makeFileEntry;
|
|
45
|
+
private resultForDir;
|
|
46
|
+
list(params?: {
|
|
47
|
+
path?: string;
|
|
48
|
+
}): Promise<FsData>;
|
|
49
|
+
delete(params: DeleteParams): Promise<DeleteResult>;
|
|
50
|
+
rename(params: RenameParams): Promise<FileOperationResult>;
|
|
51
|
+
copy(params: TransferParams): Promise<FileOperationResult>;
|
|
52
|
+
move(params: TransferParams): Promise<FileOperationResult>;
|
|
53
|
+
archive(params: ArchiveParams): Promise<FileOperationResult>;
|
|
54
|
+
unarchive(params: {
|
|
55
|
+
item: string;
|
|
56
|
+
path: string;
|
|
57
|
+
}): Promise<FileOperationResult>;
|
|
58
|
+
createFile(params: {
|
|
59
|
+
path: string;
|
|
60
|
+
name: string;
|
|
61
|
+
}): Promise<FileOperationResult>;
|
|
62
|
+
createFolder(params: {
|
|
63
|
+
path: string;
|
|
64
|
+
name: string;
|
|
65
|
+
}): Promise<FileOperationResult>;
|
|
66
|
+
getPreviewUrl(_params: {
|
|
67
|
+
path: string;
|
|
68
|
+
}): string;
|
|
69
|
+
getContent(params: {
|
|
70
|
+
path: string;
|
|
71
|
+
}): Promise<FileContentResult>;
|
|
72
|
+
getDownloadUrl(_params: {
|
|
73
|
+
path: string;
|
|
74
|
+
}): string;
|
|
75
|
+
search(params: {
|
|
76
|
+
path?: string;
|
|
77
|
+
filter: string;
|
|
78
|
+
deep?: boolean;
|
|
79
|
+
size?: 'all' | 'small' | 'medium' | 'large';
|
|
80
|
+
}): Promise<DirEntry[]>;
|
|
81
|
+
save(params: SaveParams): Promise<string>;
|
|
82
|
+
configureUploader?(uppy: any, context: {
|
|
83
|
+
getTargetPath: () => string;
|
|
84
|
+
}): void;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { BaseAdapter } from './Adapter';
|
|
2
|
+
import type { DeleteParams, DeleteResult, FileOperationResult, FileContentResult, ArchiveParams, SaveParams, RenameParams, TransferParams, UploaderContext } from './types';
|
|
3
|
+
import type { DirEntry, FsData } from '../types';
|
|
4
|
+
export interface IndexedDBDriverConfig {
|
|
5
|
+
dbName?: string;
|
|
6
|
+
storage?: string;
|
|
7
|
+
storages?: string[];
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
version?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class IndexedDBDriver extends BaseAdapter {
|
|
12
|
+
private dbName;
|
|
13
|
+
private defaultStorage;
|
|
14
|
+
private storages;
|
|
15
|
+
private storagesSet;
|
|
16
|
+
private readOnly;
|
|
17
|
+
private version;
|
|
18
|
+
private db;
|
|
19
|
+
private dbPromise;
|
|
20
|
+
private entries;
|
|
21
|
+
private contentStore;
|
|
22
|
+
private driver;
|
|
23
|
+
private readyPromise;
|
|
24
|
+
constructor(config?: IndexedDBDriverConfig);
|
|
25
|
+
private isManagedStorage;
|
|
26
|
+
private isManagedPath;
|
|
27
|
+
private initDB;
|
|
28
|
+
private getDB;
|
|
29
|
+
private requestToPromise;
|
|
30
|
+
private waitTransaction;
|
|
31
|
+
private loadSnapshotFromDB;
|
|
32
|
+
private persistSnapshot;
|
|
33
|
+
private ensureReady;
|
|
34
|
+
list(params?: {
|
|
35
|
+
path?: string;
|
|
36
|
+
}): Promise<FsData>;
|
|
37
|
+
delete(params: DeleteParams): Promise<DeleteResult>;
|
|
38
|
+
rename(params: RenameParams): Promise<FileOperationResult>;
|
|
39
|
+
copy(params: TransferParams): Promise<FileOperationResult>;
|
|
40
|
+
move(params: TransferParams): Promise<FileOperationResult>;
|
|
41
|
+
archive(params: ArchiveParams): Promise<FileOperationResult>;
|
|
42
|
+
unarchive(params: {
|
|
43
|
+
item: string;
|
|
44
|
+
path: string;
|
|
45
|
+
}): Promise<FileOperationResult>;
|
|
46
|
+
createFile(params: {
|
|
47
|
+
path: string;
|
|
48
|
+
name: string;
|
|
49
|
+
}): Promise<FileOperationResult>;
|
|
50
|
+
createFolder(params: {
|
|
51
|
+
path: string;
|
|
52
|
+
name: string;
|
|
53
|
+
}): Promise<FileOperationResult>;
|
|
54
|
+
getPreviewUrl(params: {
|
|
55
|
+
path: string;
|
|
56
|
+
}): string;
|
|
57
|
+
getContent(params: {
|
|
58
|
+
path: string;
|
|
59
|
+
}): Promise<FileContentResult>;
|
|
60
|
+
getDownloadUrl(params: {
|
|
61
|
+
path: string;
|
|
62
|
+
}): string;
|
|
63
|
+
search(params: {
|
|
64
|
+
path?: string;
|
|
65
|
+
filter: string;
|
|
66
|
+
deep?: boolean;
|
|
67
|
+
size?: 'all' | 'small' | 'medium' | 'large';
|
|
68
|
+
}): Promise<DirEntry[]>;
|
|
69
|
+
save(params: SaveParams): Promise<string>;
|
|
70
|
+
configureUploader?(uppy: any, context: UploaderContext): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BaseAdapter } from './Adapter';
|
|
2
|
+
import type { RemoteDriverConfig, FsData, DeleteResult, FileOperationResult, FileContentResult, DeleteParams, ArchiveParams, SaveParams, UploaderContext } from './types';
|
|
3
|
+
import type Uppy from '@uppy/core';
|
|
4
|
+
/**
|
|
5
|
+
* Remote driver for handling file operations via HTTP requests
|
|
6
|
+
* This driver makes API calls to backend endpoints
|
|
7
|
+
*/
|
|
8
|
+
export declare class RemoteDriver extends BaseAdapter {
|
|
9
|
+
private config;
|
|
10
|
+
/**
|
|
11
|
+
* Default URL endpoints
|
|
12
|
+
*/
|
|
13
|
+
private static readonly DEFAULT_URLS;
|
|
14
|
+
constructor(config: RemoteDriverConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Set or update the base URL for API requests
|
|
17
|
+
*/
|
|
18
|
+
setBaseURL(baseURL?: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Set or update the authentication token
|
|
21
|
+
* Pass undefined to remove the token
|
|
22
|
+
*/
|
|
23
|
+
setToken(token?: string): void;
|
|
24
|
+
configureUploader(uppy: Uppy, context: UploaderContext): void;
|
|
25
|
+
private getHeaders;
|
|
26
|
+
private request;
|
|
27
|
+
list(params?: {
|
|
28
|
+
path?: string;
|
|
29
|
+
}): Promise<FsData>;
|
|
30
|
+
delete(params: DeleteParams): Promise<DeleteResult>;
|
|
31
|
+
rename(params: {
|
|
32
|
+
path: string;
|
|
33
|
+
item: string;
|
|
34
|
+
name: string;
|
|
35
|
+
}): Promise<FileOperationResult>;
|
|
36
|
+
copy(params: {
|
|
37
|
+
path?: string;
|
|
38
|
+
sources: string[];
|
|
39
|
+
destination: string;
|
|
40
|
+
}): Promise<FileOperationResult>;
|
|
41
|
+
move(params: {
|
|
42
|
+
path?: string;
|
|
43
|
+
sources: string[];
|
|
44
|
+
destination: string;
|
|
45
|
+
}): Promise<FileOperationResult>;
|
|
46
|
+
archive(params: ArchiveParams): Promise<FileOperationResult>;
|
|
47
|
+
unarchive(params: {
|
|
48
|
+
item: string;
|
|
49
|
+
path: string;
|
|
50
|
+
}): Promise<FileOperationResult>;
|
|
51
|
+
createFile(params: {
|
|
52
|
+
path: string;
|
|
53
|
+
name: string;
|
|
54
|
+
}): Promise<FileOperationResult>;
|
|
55
|
+
createFolder(params: {
|
|
56
|
+
path: string;
|
|
57
|
+
name: string;
|
|
58
|
+
}): Promise<FileOperationResult>;
|
|
59
|
+
getPreviewUrl(params: {
|
|
60
|
+
path: string;
|
|
61
|
+
}): string;
|
|
62
|
+
getContent(params: {
|
|
63
|
+
path: string;
|
|
64
|
+
}): Promise<FileContentResult>;
|
|
65
|
+
getDownloadUrl(params: {
|
|
66
|
+
path: string;
|
|
67
|
+
}): string;
|
|
68
|
+
search(params: {
|
|
69
|
+
path?: string;
|
|
70
|
+
filter: string;
|
|
71
|
+
deep?: boolean;
|
|
72
|
+
size?: 'all' | 'small' | 'medium' | 'large';
|
|
73
|
+
}): Promise<import('../types').DirEntry[]>;
|
|
74
|
+
save(params: SaveParams): Promise<string>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VueFinder Adapters
|
|
3
|
+
*
|
|
4
|
+
* This module provides adapter classes for handling file operations
|
|
5
|
+
* in different environments (local and cloud).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Using RemoteDriver
|
|
9
|
+
* import { RemoteDriver } from '@vuefinder/adapters';
|
|
10
|
+
*
|
|
11
|
+
* const adapter = new RemoteDriver({
|
|
12
|
+
* baseURL: '/api/cloud',
|
|
13
|
+
* token: 'XYZ',
|
|
14
|
+
* url: {
|
|
15
|
+
* list: '/api/files',
|
|
16
|
+
* upload: '/api/files/upload',
|
|
17
|
+
* delete: '/api/files/delete',
|
|
18
|
+
* rename: '/api/files/rename',
|
|
19
|
+
* archive: '/api/files/archive',
|
|
20
|
+
* unarchive: '/api/files/unarchive',
|
|
21
|
+
* createFile: '/api/files/create-file',
|
|
22
|
+
* createFolder: '/api/files/create-folder',
|
|
23
|
+
* preview: '/api/files/preview',
|
|
24
|
+
* download: '/api/files/download'
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Using ArrayDriver (in-memory)
|
|
30
|
+
* import { ArrayDriver } from '@vuefinder/adapters';
|
|
31
|
+
*
|
|
32
|
+
* const adapter = new ArrayDriver({
|
|
33
|
+
* files: filesArray,
|
|
34
|
+
* storage: 'memory'
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Creating a custom adapter
|
|
39
|
+
* import { BaseAdapter } from '@vuefinder/adapters';
|
|
40
|
+
*
|
|
41
|
+
* class MyCustomAdapter extends BaseAdapter {
|
|
42
|
+
* async list(params) {
|
|
43
|
+
* // Your custom implementation
|
|
44
|
+
* }
|
|
45
|
+
* // ... implement other required methods
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
export { BaseAdapter } from './Adapter';
|
|
49
|
+
export { ArrayDriver } from './ArrayDriver';
|
|
50
|
+
export type { ArrayDriverConfig } from './ArrayDriver';
|
|
51
|
+
export { RemoteDriver } from './RemoteDriver';
|
|
52
|
+
export { IndexedDBDriver } from './IndexedDBDriver';
|
|
53
|
+
export type { IndexedDBDriverConfig } from './IndexedDBDriver';
|
|
54
|
+
export { AdapterManager, QueryKeys } from './AdapterManager';
|
|
55
|
+
export type { AdapterManagerConfig } from './AdapterManager';
|
|
56
|
+
export { parseBackendError } from './types';
|
|
57
|
+
export type { Driver, RemoteDriverConfig, RemoteDriverUrls, DeleteResult, FileOperationResult, FileContentResult, ListParams, DeleteParams, RenameParams, TransferParams, ArchiveParams, AdapterError, FsData, } from './types';
|