@unciatech/file-manager 0.0.21 → 0.0.26
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/README.md +6 -11
- package/dist/cli.cjs +325 -0
- package/dist/cli.js +140 -22
- package/dist/index.cjs +7837 -0
- package/dist/{index.d.mts → index.d.cts} +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7708 -18
- package/dist/{file-manager-4KJI2OA3.d.mts → mock-provider-nCBvw7nl.d.cts} +57 -1
- package/dist/{file-manager-4KJI2OA3.d.ts → mock-provider-nCBvw7nl.d.ts} +57 -1
- package/dist/mock.cjs +1395 -0
- package/dist/mock.d.cts +1 -0
- package/dist/mock.d.ts +1 -38
- package/dist/mock.js +1361 -2
- package/package.json +41 -21
- package/dist/chunk-4DQRTTKI.mjs +0 -18
- package/dist/chunk-S4HRPNKF.js +0 -18
- package/dist/cli.mjs +0 -184
- package/dist/index.mjs +0 -99
- package/dist/mock.d.mts +0 -38
- package/dist/mock.mjs +0 -2
- /package/dist/{cli.d.mts → cli.d.cts} +0 -0
|
@@ -39,6 +39,7 @@ declare const MODE: {
|
|
|
39
39
|
readonly PAGE: "page";
|
|
40
40
|
readonly MODAL: "modal";
|
|
41
41
|
};
|
|
42
|
+
declare const MODES: ("page" | "modal")[];
|
|
42
43
|
type Mode = (typeof MODE)[keyof typeof MODE];
|
|
43
44
|
declare const FILE_TYPE: {
|
|
44
45
|
readonly IMAGE: "images";
|
|
@@ -46,16 +47,19 @@ declare const FILE_TYPE: {
|
|
|
46
47
|
readonly AUDIO: "audios";
|
|
47
48
|
readonly FILE: "files";
|
|
48
49
|
};
|
|
50
|
+
declare const FILE_TYPES: ("images" | "videos" | "audios" | "files")[];
|
|
49
51
|
type FileType = (typeof FILE_TYPE)[keyof typeof FILE_TYPE];
|
|
50
52
|
declare const SELECTION_MODE: {
|
|
51
53
|
readonly SINGLE: "single";
|
|
52
54
|
readonly MULTIPLE: "multiple";
|
|
53
55
|
};
|
|
56
|
+
declare const SELECTION_MODES: ("single" | "multiple")[];
|
|
54
57
|
type SelectionMode = (typeof SELECTION_MODE)[keyof typeof SELECTION_MODE];
|
|
55
58
|
declare const VIEW_MODE: {
|
|
56
59
|
readonly GRID: "grid";
|
|
57
60
|
readonly LIST: "list";
|
|
58
61
|
};
|
|
62
|
+
declare const VIEW_MODES: ("grid" | "list")[];
|
|
59
63
|
type ViewMode = (typeof VIEW_MODE)[keyof typeof VIEW_MODE];
|
|
60
64
|
declare const VIDEO_SOURCE: {
|
|
61
65
|
readonly LOCAL: "local";
|
|
@@ -63,6 +67,7 @@ declare const VIDEO_SOURCE: {
|
|
|
63
67
|
readonly YOUTUBE: "youtube";
|
|
64
68
|
readonly VIMEO: "vimeo";
|
|
65
69
|
};
|
|
70
|
+
declare const VIDEO_SOURCES: ("local" | "remote" | "youtube" | "vimeo")[];
|
|
66
71
|
type VideoSource = (typeof VIDEO_SOURCE)[keyof typeof VIDEO_SOURCE];
|
|
67
72
|
interface MetaDataType {
|
|
68
73
|
/** Video or Audio duration in seconds. */
|
|
@@ -151,6 +156,11 @@ interface FileMetaData {
|
|
|
151
156
|
/** Categorization tags for sorting and discovery. */
|
|
152
157
|
tags?: string[];
|
|
153
158
|
}
|
|
159
|
+
interface Tag {
|
|
160
|
+
id: EntityId;
|
|
161
|
+
name: string;
|
|
162
|
+
color?: string;
|
|
163
|
+
}
|
|
154
164
|
interface PaginationInfo {
|
|
155
165
|
currentPage: number;
|
|
156
166
|
totalPages: number;
|
|
@@ -190,5 +200,51 @@ interface FileManagerRootProps {
|
|
|
190
200
|
maxUploadFiles?: number;
|
|
191
201
|
maxUploadSize?: number;
|
|
192
202
|
}
|
|
203
|
+
interface FileStateOptions {
|
|
204
|
+
mode: Mode;
|
|
205
|
+
selectionMode: SelectionMode;
|
|
206
|
+
initialFolderId: FolderId;
|
|
207
|
+
acceptedFileTypesForModal?: FileType[];
|
|
208
|
+
allowedFileTypes?: FileType[];
|
|
209
|
+
provider: IFileManagerProvider;
|
|
210
|
+
basePath?: string;
|
|
211
|
+
onFilesSelected?: (files: FileMetaData[]) => void;
|
|
212
|
+
onClose?: () => void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare class MockProvider implements IFileManagerProvider {
|
|
216
|
+
getFolder(folderId: FolderId): Promise<Folder | null>;
|
|
217
|
+
getFolders(folderId: FolderId, page?: number, limit?: number, query?: string): Promise<{
|
|
218
|
+
folders: Folder[];
|
|
219
|
+
pagination: PaginationInfo;
|
|
220
|
+
}>;
|
|
221
|
+
getTags(): Promise<string[]>;
|
|
222
|
+
getFiles(folderId: FolderId, fileTypes?: FileType[], page?: number, limit?: number, query?: string): Promise<{
|
|
223
|
+
files: FileMetaData[];
|
|
224
|
+
pagination: PaginationInfo;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Get files and folders separately (folders always come first)
|
|
228
|
+
* Folders are not paginated (all folders in current directory are returned)
|
|
229
|
+
* Files are paginated after folders
|
|
230
|
+
*/
|
|
231
|
+
getItems(folderId: FolderId, fileTypes?: FileType[], page?: number, limit?: number, query?: string): Promise<{
|
|
232
|
+
folders: Folder[];
|
|
233
|
+
files: FileMetaData[];
|
|
234
|
+
pagination: PaginationInfo;
|
|
235
|
+
}>;
|
|
236
|
+
createFolder(name: string, parentId?: FolderId): Promise<Folder>;
|
|
237
|
+
private getMetaDataType;
|
|
238
|
+
private getFileType;
|
|
239
|
+
uploadFiles(files: FileUploadInput[], folderId?: FolderId): Promise<FileMetaData[]>;
|
|
240
|
+
renameFolder(folderId: EntityId, newName: string): Promise<Folder>;
|
|
241
|
+
updateFileMetaData(fileId: EntityId, updates: Partial<FileMetaData>): Promise<FileMetaData>;
|
|
242
|
+
deleteFiles(fileIds: EntityId[]): Promise<void>;
|
|
243
|
+
deleteFolders(folderIds: EntityId[]): Promise<void>;
|
|
244
|
+
findFiles(searchQuery: string): Promise<FileMetaData[]>;
|
|
245
|
+
findFolders(searchQuery: string): Promise<Folder[]>;
|
|
246
|
+
moveFiles(fileIds: EntityId[], newFolderId: FolderId): Promise<FileMetaData[]>;
|
|
247
|
+
moveFolders(folderIds: FolderId[], newParentId: FolderId): Promise<Folder[]>;
|
|
248
|
+
}
|
|
193
249
|
|
|
194
|
-
export type
|
|
250
|
+
export { type EntityId as E, type FileManagerPageProps as F, type IFileManagerProvider as I, type Mode as M, type PaginationInfo as P, type SelectionMode as S, type Tag as T, VIDEO_SOURCE as V, type FileManagerModalProps as a, type FileManagerRootProps as b, type FileMetaData as c, type Folder as d, type FileType as e, type FileUploadInput as f, type FolderId as g, FILE_TYPE as h, FILE_TYPES as i, type FileStateOptions as j, type FormatDetails as k, MODE as l, MODES as m, type MetaDataType as n, MockProvider as o, SELECTION_MODE as p, SELECTION_MODES as q, VIDEO_SOURCES as r, VIEW_MODE as s, VIEW_MODES as t, type VideoSource as u, type ViewMode as v };
|
|
@@ -39,6 +39,7 @@ declare const MODE: {
|
|
|
39
39
|
readonly PAGE: "page";
|
|
40
40
|
readonly MODAL: "modal";
|
|
41
41
|
};
|
|
42
|
+
declare const MODES: ("page" | "modal")[];
|
|
42
43
|
type Mode = (typeof MODE)[keyof typeof MODE];
|
|
43
44
|
declare const FILE_TYPE: {
|
|
44
45
|
readonly IMAGE: "images";
|
|
@@ -46,16 +47,19 @@ declare const FILE_TYPE: {
|
|
|
46
47
|
readonly AUDIO: "audios";
|
|
47
48
|
readonly FILE: "files";
|
|
48
49
|
};
|
|
50
|
+
declare const FILE_TYPES: ("images" | "videos" | "audios" | "files")[];
|
|
49
51
|
type FileType = (typeof FILE_TYPE)[keyof typeof FILE_TYPE];
|
|
50
52
|
declare const SELECTION_MODE: {
|
|
51
53
|
readonly SINGLE: "single";
|
|
52
54
|
readonly MULTIPLE: "multiple";
|
|
53
55
|
};
|
|
56
|
+
declare const SELECTION_MODES: ("single" | "multiple")[];
|
|
54
57
|
type SelectionMode = (typeof SELECTION_MODE)[keyof typeof SELECTION_MODE];
|
|
55
58
|
declare const VIEW_MODE: {
|
|
56
59
|
readonly GRID: "grid";
|
|
57
60
|
readonly LIST: "list";
|
|
58
61
|
};
|
|
62
|
+
declare const VIEW_MODES: ("grid" | "list")[];
|
|
59
63
|
type ViewMode = (typeof VIEW_MODE)[keyof typeof VIEW_MODE];
|
|
60
64
|
declare const VIDEO_SOURCE: {
|
|
61
65
|
readonly LOCAL: "local";
|
|
@@ -63,6 +67,7 @@ declare const VIDEO_SOURCE: {
|
|
|
63
67
|
readonly YOUTUBE: "youtube";
|
|
64
68
|
readonly VIMEO: "vimeo";
|
|
65
69
|
};
|
|
70
|
+
declare const VIDEO_SOURCES: ("local" | "remote" | "youtube" | "vimeo")[];
|
|
66
71
|
type VideoSource = (typeof VIDEO_SOURCE)[keyof typeof VIDEO_SOURCE];
|
|
67
72
|
interface MetaDataType {
|
|
68
73
|
/** Video or Audio duration in seconds. */
|
|
@@ -151,6 +156,11 @@ interface FileMetaData {
|
|
|
151
156
|
/** Categorization tags for sorting and discovery. */
|
|
152
157
|
tags?: string[];
|
|
153
158
|
}
|
|
159
|
+
interface Tag {
|
|
160
|
+
id: EntityId;
|
|
161
|
+
name: string;
|
|
162
|
+
color?: string;
|
|
163
|
+
}
|
|
154
164
|
interface PaginationInfo {
|
|
155
165
|
currentPage: number;
|
|
156
166
|
totalPages: number;
|
|
@@ -190,5 +200,51 @@ interface FileManagerRootProps {
|
|
|
190
200
|
maxUploadFiles?: number;
|
|
191
201
|
maxUploadSize?: number;
|
|
192
202
|
}
|
|
203
|
+
interface FileStateOptions {
|
|
204
|
+
mode: Mode;
|
|
205
|
+
selectionMode: SelectionMode;
|
|
206
|
+
initialFolderId: FolderId;
|
|
207
|
+
acceptedFileTypesForModal?: FileType[];
|
|
208
|
+
allowedFileTypes?: FileType[];
|
|
209
|
+
provider: IFileManagerProvider;
|
|
210
|
+
basePath?: string;
|
|
211
|
+
onFilesSelected?: (files: FileMetaData[]) => void;
|
|
212
|
+
onClose?: () => void;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare class MockProvider implements IFileManagerProvider {
|
|
216
|
+
getFolder(folderId: FolderId): Promise<Folder | null>;
|
|
217
|
+
getFolders(folderId: FolderId, page?: number, limit?: number, query?: string): Promise<{
|
|
218
|
+
folders: Folder[];
|
|
219
|
+
pagination: PaginationInfo;
|
|
220
|
+
}>;
|
|
221
|
+
getTags(): Promise<string[]>;
|
|
222
|
+
getFiles(folderId: FolderId, fileTypes?: FileType[], page?: number, limit?: number, query?: string): Promise<{
|
|
223
|
+
files: FileMetaData[];
|
|
224
|
+
pagination: PaginationInfo;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Get files and folders separately (folders always come first)
|
|
228
|
+
* Folders are not paginated (all folders in current directory are returned)
|
|
229
|
+
* Files are paginated after folders
|
|
230
|
+
*/
|
|
231
|
+
getItems(folderId: FolderId, fileTypes?: FileType[], page?: number, limit?: number, query?: string): Promise<{
|
|
232
|
+
folders: Folder[];
|
|
233
|
+
files: FileMetaData[];
|
|
234
|
+
pagination: PaginationInfo;
|
|
235
|
+
}>;
|
|
236
|
+
createFolder(name: string, parentId?: FolderId): Promise<Folder>;
|
|
237
|
+
private getMetaDataType;
|
|
238
|
+
private getFileType;
|
|
239
|
+
uploadFiles(files: FileUploadInput[], folderId?: FolderId): Promise<FileMetaData[]>;
|
|
240
|
+
renameFolder(folderId: EntityId, newName: string): Promise<Folder>;
|
|
241
|
+
updateFileMetaData(fileId: EntityId, updates: Partial<FileMetaData>): Promise<FileMetaData>;
|
|
242
|
+
deleteFiles(fileIds: EntityId[]): Promise<void>;
|
|
243
|
+
deleteFolders(folderIds: EntityId[]): Promise<void>;
|
|
244
|
+
findFiles(searchQuery: string): Promise<FileMetaData[]>;
|
|
245
|
+
findFolders(searchQuery: string): Promise<Folder[]>;
|
|
246
|
+
moveFiles(fileIds: EntityId[], newFolderId: FolderId): Promise<FileMetaData[]>;
|
|
247
|
+
moveFolders(folderIds: FolderId[], newParentId: FolderId): Promise<Folder[]>;
|
|
248
|
+
}
|
|
193
249
|
|
|
194
|
-
export type
|
|
250
|
+
export { type EntityId as E, type FileManagerPageProps as F, type IFileManagerProvider as I, type Mode as M, type PaginationInfo as P, type SelectionMode as S, type Tag as T, VIDEO_SOURCE as V, type FileManagerModalProps as a, type FileManagerRootProps as b, type FileMetaData as c, type Folder as d, type FileType as e, type FileUploadInput as f, type FolderId as g, FILE_TYPE as h, FILE_TYPES as i, type FileStateOptions as j, type FormatDetails as k, MODE as l, MODES as m, type MetaDataType as n, MockProvider as o, SELECTION_MODE as p, SELECTION_MODES as q, VIDEO_SOURCES as r, VIEW_MODE as s, VIEW_MODES as t, type VideoSource as u, type ViewMode as v };
|