@emailmaker/filemanager 0.10.89 → 0.10.90
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/{129.533eb7b36d92578d2ead.js → 129.1f7048a0e93daec2ca44.js} +27 -27
- package/adapters/DataSourceProxyBase.d.ts +225 -0
- package/adapters/FailedRequestCache.d.ts +20 -0
- package/adapters/MutationRegistry.d.ts +6 -0
- package/adapters/PathAwareStorageAdapter.d.ts +70 -0
- package/adapters/TreeCache.d.ts +181 -0
- package/components/FileContent/renderers/FileTableView.d.ts +1 -1
- package/components/FileModals/FileModals.d.ts +1 -1
- package/components/Tag/index.d.ts +1 -1
- package/file-manager-IconsTab-CgBriMBe.js +2 -0
- package/file-manager-ImageCodeGenerator-BoVEEDJM.js +2 -0
- package/file-manager-JsBarcode-rSv58QnO.js +2 -0
- package/file-manager-browser-Bk6AOO-_.js +2 -0
- package/file-manager-index-B3Ea-yTf.js +10 -0
- package/file-manager.css +176 -160
- package/file-manager.esm.js +1 -1
- package/file-manager.js +10499 -61577
- package/{fm-icons-tab.d9174776dd6a2cd3d05e.js → fm-icons-tab.9fb59ff579663a515590.js} +19 -21
- package/{fm-image-code-generator.078531875a31b8f35911.js → fm-image-code-generator.50fded261e49f2abdf2b.js} +46 -47
- package/helpers/urls.d.ts +1 -0
- package/hooks/core/types.d.ts +1 -1
- package/hooks/core/useFolders.d.ts +1 -1
- package/hooks/notifications/index.d.ts +1 -1
- package/hooks/notifications/useNotificationsBase.d.ts +9 -0
- package/hooks/useFolderSelectionMenu.d.ts +1 -1
- package/index.d.ts +7 -0
- package/notification.d.ts +7 -1
- package/package.json +8 -2
- package/types/storage.d.ts +411 -0
- package/types.d.ts +7 -2
- package/file-manager-IconsTab-BB0044jH.js +0 -2
- package/file-manager-ImageCodeGenerator-D7H2_EZi.js +0 -2
- package/file-manager-JsBarcode-CB7r374U.js +0 -2
- package/file-manager-browser-C6quQUxe.js +0 -2
- package/file-manager-index-D14X20BS.js +0 -62
|
@@ -887,31 +887,6 @@ exports["default"] = Barcode;
|
|
|
887
887
|
|
|
888
888
|
/***/ }),
|
|
889
889
|
|
|
890
|
-
/***/ 2689:
|
|
891
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
896
|
-
value: true
|
|
897
|
-
}));
|
|
898
|
-
exports.ITF14 = exports.ITF = undefined;
|
|
899
|
-
|
|
900
|
-
var _ITF = __webpack_require__(739);
|
|
901
|
-
|
|
902
|
-
var _ITF2 = _interopRequireDefault(_ITF);
|
|
903
|
-
|
|
904
|
-
var _ITF3 = __webpack_require__(8122);
|
|
905
|
-
|
|
906
|
-
var _ITF4 = _interopRequireDefault(_ITF3);
|
|
907
|
-
|
|
908
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
909
|
-
|
|
910
|
-
exports.ITF = _ITF2.default;
|
|
911
|
-
exports.ITF14 = _ITF4.default;
|
|
912
|
-
|
|
913
|
-
/***/ }),
|
|
914
|
-
|
|
915
890
|
/***/ 2700:
|
|
916
891
|
/***/ ((__unused_webpack_module, exports) => {
|
|
917
892
|
|
|
@@ -2086,6 +2061,31 @@ exports["default"] = CODE128AUTO;
|
|
|
2086
2061
|
|
|
2087
2062
|
/***/ }),
|
|
2088
2063
|
|
|
2064
|
+
/***/ 5070:
|
|
2065
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2070
|
+
value: true
|
|
2071
|
+
}));
|
|
2072
|
+
exports.ITF14 = exports.ITF = undefined;
|
|
2073
|
+
|
|
2074
|
+
var _ITF = __webpack_require__(739);
|
|
2075
|
+
|
|
2076
|
+
var _ITF2 = _interopRequireDefault(_ITF);
|
|
2077
|
+
|
|
2078
|
+
var _ITF3 = __webpack_require__(8122);
|
|
2079
|
+
|
|
2080
|
+
var _ITF4 = _interopRequireDefault(_ITF3);
|
|
2081
|
+
|
|
2082
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2083
|
+
|
|
2084
|
+
exports.ITF = _ITF2.default;
|
|
2085
|
+
exports.ITF14 = _ITF4.default;
|
|
2086
|
+
|
|
2087
|
+
/***/ }),
|
|
2088
|
+
|
|
2089
2089
|
/***/ 5099:
|
|
2090
2090
|
/***/ ((__unused_webpack_module, exports) => {
|
|
2091
2091
|
|
|
@@ -3804,7 +3804,7 @@ var _CODE2 = __webpack_require__(1509);
|
|
|
3804
3804
|
|
|
3805
3805
|
var _EAN_UPC = __webpack_require__(5726);
|
|
3806
3806
|
|
|
3807
|
-
var _ITF = __webpack_require__(
|
|
3807
|
+
var _ITF = __webpack_require__(5070);
|
|
3808
3808
|
|
|
3809
3809
|
var _MSI = __webpack_require__(8248);
|
|
3810
3810
|
|
|
@@ -3890,4 +3890,4 @@ exports.CODE93FullASCII = _CODE93FullASCII2.default;
|
|
|
3890
3890
|
/***/ })
|
|
3891
3891
|
|
|
3892
3892
|
}]);
|
|
3893
|
-
//# sourceMappingURL=129.
|
|
3893
|
+
//# sourceMappingURL=129.1f7048a0e93daec2ca44.js.map
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { ApiPaginationResponse, BatchResult, File, FileManagerDataProviders, Folder, SortState, UploadFileResultData, UploadFilesRequest } from '../types';
|
|
2
|
+
import type { FileSystemItem, GetFileDataOptions, StorageProvider, StorageProviderController } from '../types/storage';
|
|
3
|
+
import { ViewStrategyOptions } from './TreeCache';
|
|
4
|
+
/**
|
|
5
|
+
* DI config for {@link DataSourceProxyBase}.
|
|
6
|
+
* All fields are optional — the class works standalone with EN-only defaults.
|
|
7
|
+
*/
|
|
8
|
+
export interface DataSourceProxyConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Custom fetch implementation (e.g. with CDN proxy, auth headers, retries).
|
|
11
|
+
* Used when loading file binary data via URL.
|
|
12
|
+
* Falls back to global `fetch` when omitted.
|
|
13
|
+
*/
|
|
14
|
+
fetchWithProxy?: (url: string, init?: RequestInit) => Promise<Response>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Subset of FileManager options used by {@link DataSourceProxyBase}.
|
|
18
|
+
*/
|
|
19
|
+
export interface FileManagerProxyOptions {
|
|
20
|
+
enableTrash?: boolean;
|
|
21
|
+
enablePagination?: boolean;
|
|
22
|
+
unifiedCatalogFetch?: boolean;
|
|
23
|
+
clientSideFilter?: boolean | ((items: FileSystemItem[], search?: string) => FileSystemItem[]);
|
|
24
|
+
clientSideSorting?: boolean | ((items: FileSystemItem[], sortBy?: SortState['sortBy'], sortOrder?: SortState['sortOrder']) => FileSystemItem[]);
|
|
25
|
+
clientSidePaging?: boolean | ((items: FileSystemItem[], page?: number, limit?: number) => FileSystemItem[]);
|
|
26
|
+
cacheStrategy?: ViewStrategyOptions & {
|
|
27
|
+
ttl?: number;
|
|
28
|
+
errorTtl?: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface DataSourceProxyOptions {
|
|
32
|
+
rootId?: string;
|
|
33
|
+
trashPath?: string;
|
|
34
|
+
tempPath?: string;
|
|
35
|
+
useSoftDelete?: boolean;
|
|
36
|
+
batchOperationFallback?: boolean;
|
|
37
|
+
validateDuplicates?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Caching adapter: wraps a {@link StorageProvider} and exposes a {@link FileManagerDataProviders} interface.
|
|
41
|
+
* Handles client-side caching (TreeCache), soft-delete, pagination, and deduplication.
|
|
42
|
+
* Extend this class in a consumer app to add backend-specific logic.
|
|
43
|
+
*/
|
|
44
|
+
export declare class DataSourceProxyBase implements FileManagerDataProviders {
|
|
45
|
+
private readonly _dataProvider;
|
|
46
|
+
private readonly _options;
|
|
47
|
+
private readonly _pathOptions;
|
|
48
|
+
private readonly _cache;
|
|
49
|
+
private readonly _rootId;
|
|
50
|
+
private readonly _useSoftDelete;
|
|
51
|
+
private readonly _enableTrash;
|
|
52
|
+
private readonly _validateDuplicates;
|
|
53
|
+
/** Next `getFileData` for this normalized file id uses HTTP no-store (e.g. after overwrite). */
|
|
54
|
+
private readonly _blobFetchForceReloadOnceIds;
|
|
55
|
+
/** Frontend-only guard against reads racing with delete operations. */
|
|
56
|
+
private readonly _mutationRegistry;
|
|
57
|
+
private _findOrCreateFolderByPath;
|
|
58
|
+
private getTrashFolder;
|
|
59
|
+
private getTempFolder;
|
|
60
|
+
private readonly _config;
|
|
61
|
+
constructor(_dataProvider: StorageProvider, _options: FileManagerProxyOptions | undefined, _pathOptions: DataSourceProxyOptions, config?: DataSourceProxyConfig);
|
|
62
|
+
setController(controller: StorageProviderController): void;
|
|
63
|
+
clearCache(pathFolder?: string | null): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* After save/overwrite, the next `getFileData` for this file id will use `forceReload` (HTTP no-store).
|
|
66
|
+
*/
|
|
67
|
+
markNextFileBlobFetchBypassHttpCache(fileId: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Нормализует идентификатор с использованием текущих rootId
|
|
70
|
+
*/
|
|
71
|
+
normalizeId(id: string | null | undefined): string;
|
|
72
|
+
private _isDeletingId;
|
|
73
|
+
private _collectDeletingIds;
|
|
74
|
+
private _emptyFilesResult;
|
|
75
|
+
/**
|
|
76
|
+
* Проверяет валидность имени файла/папки
|
|
77
|
+
*/
|
|
78
|
+
private _validateName;
|
|
79
|
+
/**
|
|
80
|
+
* Проверяет, что целевая папка в кэше является папкой (если она есть в кэше)
|
|
81
|
+
* Не проверяет существование, так как отсутствие в кэше не означает отсутствие на бэкенде
|
|
82
|
+
*/
|
|
83
|
+
private _validateTargetFolderType;
|
|
84
|
+
/**
|
|
85
|
+
* Проверяет, существует ли элемент с указанным именем в целевой папке (только через кэш, без обращения к бэку)
|
|
86
|
+
*/
|
|
87
|
+
private _checkNameExistsInCache;
|
|
88
|
+
private _getUrl;
|
|
89
|
+
private _getThumbnailUrl;
|
|
90
|
+
private _mapItem;
|
|
91
|
+
/**
|
|
92
|
+
* Проверяет, является ли targetFolderId дочерней папкой sourceFolderId (циклическая ссылка)
|
|
93
|
+
*/
|
|
94
|
+
private _isAncestor;
|
|
95
|
+
getFile(folderId: string, name: string): Promise<FileSystemItem | null>;
|
|
96
|
+
/**
|
|
97
|
+
* File metadata by id: entity cache first; on miss, loads parent listing via {@link getFile} / {@link getFiles} (i.e. provider `getItems`).
|
|
98
|
+
* Only practical when ids are path-shaped and {@link StorageProvider.pathMode} is true; otherwise cache-only.
|
|
99
|
+
*/
|
|
100
|
+
getFileById(fileId: string): Promise<File | null>;
|
|
101
|
+
private _getFileByPathStyleId;
|
|
102
|
+
getFileUrl(folderId: string, name: string): Promise<string | undefined>;
|
|
103
|
+
/**
|
|
104
|
+
* Получает список файлов и папок с поддержкой пагинации, фильтрации и сортировки
|
|
105
|
+
*/
|
|
106
|
+
getFiles({ folderId, search, sortBy, sortOrder, page, limit, itemType, noFolder, }: {
|
|
107
|
+
folderId?: string | null;
|
|
108
|
+
search?: string;
|
|
109
|
+
sortBy?: SortState['sortBy'];
|
|
110
|
+
sortOrder?: SortState['sortOrder'];
|
|
111
|
+
page?: number;
|
|
112
|
+
limit?: number;
|
|
113
|
+
itemType: 'file' | 'folder' | 'all';
|
|
114
|
+
noFolder?: boolean;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
files: File[];
|
|
117
|
+
pagination: Partial<ApiPaginationResponse>;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Стандартная клиентская сортировка файлов
|
|
121
|
+
*/
|
|
122
|
+
private _defaultClientSideSort;
|
|
123
|
+
/**
|
|
124
|
+
* Получает данные файла в виде Blob
|
|
125
|
+
*/
|
|
126
|
+
getFileData(fileId: string, options?: GetFileDataOptions): Promise<Blob>;
|
|
127
|
+
getFileData(file: File, options?: GetFileDataOptions): Promise<Blob>;
|
|
128
|
+
findFileByUrl(url: string): Promise<File | null>;
|
|
129
|
+
/**
|
|
130
|
+
* Получает количество элементов в папке
|
|
131
|
+
*/
|
|
132
|
+
getChildrenCount(folderId?: string): Promise<number>;
|
|
133
|
+
private _isPathFolderNotFoundError;
|
|
134
|
+
/**
|
|
135
|
+
* Загружает файл на сервер
|
|
136
|
+
*/
|
|
137
|
+
_uploadFile(file: {
|
|
138
|
+
name: string;
|
|
139
|
+
size: number;
|
|
140
|
+
type: string;
|
|
141
|
+
folderId?: string | null;
|
|
142
|
+
data: Blob | globalThis.File;
|
|
143
|
+
}): Promise<File>;
|
|
144
|
+
uploadFiles(request: UploadFilesRequest): Promise<BatchResult<UploadFileResultData>>;
|
|
145
|
+
/**
|
|
146
|
+
* Удаляет файл (либо полностью, либо перемещает в корзину в зависимости от настроек)
|
|
147
|
+
*/
|
|
148
|
+
deleteFile(fileId: string): Promise<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Удаляет файл (либо полностью, либо перемещает в корзину в зависимости от настроек)
|
|
151
|
+
*/
|
|
152
|
+
deleteItems(itemIds: string[], options: {
|
|
153
|
+
permanent: boolean;
|
|
154
|
+
}): Promise<BatchResult<{}>>;
|
|
155
|
+
/**
|
|
156
|
+
* Полностью удаляет файлы
|
|
157
|
+
*/
|
|
158
|
+
private hardDeleteItems;
|
|
159
|
+
/**
|
|
160
|
+
* Полностью удаляет файл без возможности восстановления
|
|
161
|
+
*/
|
|
162
|
+
private hardDeleteItem;
|
|
163
|
+
/**
|
|
164
|
+
* Очищает корзину (удаляет все файлы из корзины)
|
|
165
|
+
*/
|
|
166
|
+
cleanTrash(): Promise<{
|
|
167
|
+
success: boolean;
|
|
168
|
+
deletedCount?: number;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Создает новую папку
|
|
172
|
+
*/
|
|
173
|
+
createFolder({ name, parentId, is_force_create, }: {
|
|
174
|
+
name: string;
|
|
175
|
+
parentId?: string | null;
|
|
176
|
+
is_force_create?: boolean;
|
|
177
|
+
}): Promise<Folder>;
|
|
178
|
+
/**
|
|
179
|
+
* Удаляет папку (либо полностью, либо перемещает в корзину в зависимости от настроек)
|
|
180
|
+
*/
|
|
181
|
+
deleteFolder(folderId: string): Promise<boolean>;
|
|
182
|
+
/**
|
|
183
|
+
* Переименовывает папку
|
|
184
|
+
*/
|
|
185
|
+
renameFolder(folderId: string, newName: string): Promise<Folder>;
|
|
186
|
+
/**
|
|
187
|
+
* Переименовывает файл
|
|
188
|
+
*/
|
|
189
|
+
renameFile(fileId: string, newName: string): Promise<File>;
|
|
190
|
+
/**
|
|
191
|
+
* Перемещает элемент (файл или папку)
|
|
192
|
+
*/
|
|
193
|
+
moveItem({ itemId, targetFolderId, isFolder, }: {
|
|
194
|
+
itemId: string;
|
|
195
|
+
targetFolderId: string | null;
|
|
196
|
+
isFolder: boolean;
|
|
197
|
+
}): Promise<boolean>;
|
|
198
|
+
moveItems(targetFolderId: string, itemIds: string[]): Promise<BatchResult<{}>>;
|
|
199
|
+
/**
|
|
200
|
+
* Копирует элемент (файл или папку)
|
|
201
|
+
*/
|
|
202
|
+
copyItem({ itemId, targetFolderId, }: {
|
|
203
|
+
itemId: string;
|
|
204
|
+
targetFolderId: string | null;
|
|
205
|
+
isFolder: boolean;
|
|
206
|
+
}): Promise<boolean>;
|
|
207
|
+
copyItems(targetFolderId: string, items: Array<{
|
|
208
|
+
id: string;
|
|
209
|
+
newName?: string;
|
|
210
|
+
}> | string[]): Promise<BatchResult<{}>>;
|
|
211
|
+
/**
|
|
212
|
+
* Загружает файл по URL
|
|
213
|
+
*/
|
|
214
|
+
uploadFileByUrl(data: {
|
|
215
|
+
url: string;
|
|
216
|
+
folderId?: string | null;
|
|
217
|
+
noFolder?: boolean;
|
|
218
|
+
name?: string;
|
|
219
|
+
eventSource?: 'upload' | 'uploadByUrl' | 'pixie' | 'iconStock' | 'imageStock' | 'gif';
|
|
220
|
+
}): Promise<File>;
|
|
221
|
+
/**
|
|
222
|
+
* Обновляет данные файла
|
|
223
|
+
*/
|
|
224
|
+
updateFile(fileId: string, updates: Partial<Omit<File, 'id'>>): Promise<File>;
|
|
225
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single store for short-lived cached request failures (negative cache).
|
|
3
|
+
* Used by {@link TreeCache} for children views and children counts; can be extended for other GETs.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FailedRequestCache {
|
|
6
|
+
private readonly map;
|
|
7
|
+
/** Errors from {@link ViewCacheManager.getOrCreateChildren} */
|
|
8
|
+
static childrenViewKey(pKey: string, qKey: string): string;
|
|
9
|
+
/** Errors from {@link TreeCache.getChildrenCount} */
|
|
10
|
+
static childrenCountKey(normalizedParentKey: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the cached error if still within TTL, otherwise null (entry may be removed).
|
|
13
|
+
*/
|
|
14
|
+
getFreshError(key: string, errorTtlMs: number): unknown | null;
|
|
15
|
+
setError(key: string, error: unknown): void;
|
|
16
|
+
delete(key: string): void;
|
|
17
|
+
/** All list-view errors for one parent bucket (pKey). */
|
|
18
|
+
clearChildrenViewErrorsForParent(pKey: string): void;
|
|
19
|
+
clearAll(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { FileSystemItem, StorageProvider, FileSystemItemUpdate, GetFileDataOptions, MayBePromise, StorageProviderController, BatchResult, StorageUploadFilesRequest as UploadFilesRequest, StorageSortState as SortState, StorageApiPaginationResponse as ApiPaginationResponse } from '../types/storage';
|
|
2
|
+
export declare class PathAwareStorageAdapter implements StorageProvider {
|
|
3
|
+
private readonly _inner;
|
|
4
|
+
readonly rootPath: string;
|
|
5
|
+
readonly trashId: string;
|
|
6
|
+
readonly trashPath: string;
|
|
7
|
+
readonly ensureFolderTrailingSlash: boolean;
|
|
8
|
+
private readonly _pathToId;
|
|
9
|
+
private readonly _idToPath;
|
|
10
|
+
getUrl?: (file: FileSystemItem) => MayBePromise<string>;
|
|
11
|
+
getThumbnailUrl?: (file: FileSystemItem) => MayBePromise<string>;
|
|
12
|
+
validateDuplicates?: boolean;
|
|
13
|
+
constructor(_inner: StorageProvider, rootPath?: string, trashId?: string, trashPath?: string, ensureFolderTrailingSlash?: boolean);
|
|
14
|
+
setController(controller: StorageProviderController): void;
|
|
15
|
+
clearCache?(pathFolder?: string | null): MayBePromise<void>;
|
|
16
|
+
private _getOrGenerateId;
|
|
17
|
+
pathForId(id: string, isFolder: boolean, silent?: boolean): string;
|
|
18
|
+
private _updateIdMapping;
|
|
19
|
+
getItems(options: {
|
|
20
|
+
folderId?: string;
|
|
21
|
+
search?: string;
|
|
22
|
+
sortBy?: SortState['sortBy'];
|
|
23
|
+
sortOrder?: SortState['sortOrder'];
|
|
24
|
+
page?: number;
|
|
25
|
+
limit?: number;
|
|
26
|
+
itemType: 'all' | 'file' | 'folder';
|
|
27
|
+
}): Promise<{
|
|
28
|
+
items: FileSystemItem[];
|
|
29
|
+
pagination?: Partial<ApiPaginationResponse>;
|
|
30
|
+
}>;
|
|
31
|
+
createFolder(name: string, parent?: string, is_force_create?: boolean): Promise<FileSystemItem>;
|
|
32
|
+
renameItem(item: FileSystemItem, newName: string): Promise<FileSystemItemUpdate>;
|
|
33
|
+
deleteItem(item: FileSystemItem, options: {
|
|
34
|
+
permanent: boolean;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
uploadFile(file: {
|
|
37
|
+
name: string;
|
|
38
|
+
size: number;
|
|
39
|
+
type: string;
|
|
40
|
+
folderId?: string | null;
|
|
41
|
+
data: Blob | globalThis.File;
|
|
42
|
+
thumbnail?: string;
|
|
43
|
+
dimensions?: string;
|
|
44
|
+
aspectRatio?: string;
|
|
45
|
+
extension?: string;
|
|
46
|
+
}): Promise<FileSystemItemUpdate>;
|
|
47
|
+
uploadFiles(request: UploadFilesRequest): Promise<BatchResult<FileSystemItem>>;
|
|
48
|
+
findFileByUrl(url: string, folderId?: string): Promise<FileSystemItem | undefined>;
|
|
49
|
+
uploadFileByUrl(url: string, folderId?: string | null, options?: {
|
|
50
|
+
eventSource?: 'upload' | 'uploadByUrl' | 'pixie' | 'iconStock' | 'imageStock' | 'gif';
|
|
51
|
+
}): Promise<FileSystemItem>;
|
|
52
|
+
moveItem(item: FileSystemItem, targetFolderId?: string): Promise<FileSystemItemUpdate>;
|
|
53
|
+
moveItems(items: FileSystemItem[], targetFolderId?: string): Promise<BatchResult<FileSystemItemUpdate>>;
|
|
54
|
+
copyItems(items: FileSystemItem[], targetFolderId?: string): Promise<BatchResult<FileSystemItemUpdate>>;
|
|
55
|
+
deleteItems(items: FileSystemItem[], options: {
|
|
56
|
+
permanent: boolean;
|
|
57
|
+
}): Promise<BatchResult<never>>;
|
|
58
|
+
private remapCachedFolderContents;
|
|
59
|
+
private recursivelyRemoveMappings;
|
|
60
|
+
copyItem(item: FileSystemItem, targetFolderId?: string): Promise<FileSystemItemUpdate>;
|
|
61
|
+
updateFile(file: FileSystemItem, updates: {
|
|
62
|
+
name?: string;
|
|
63
|
+
data?: Blob | string;
|
|
64
|
+
}): Promise<FileSystemItemUpdate>;
|
|
65
|
+
getFileData(file: FileSystemItem, options?: GetFileDataOptions): Promise<Blob>;
|
|
66
|
+
cleanTrash(): Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
deletedCount?: number;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { FileSystemItem } from '../types/storage';
|
|
2
|
+
import { FailedRequestCache } from './FailedRequestCache';
|
|
3
|
+
export interface QueryResult<T> {
|
|
4
|
+
items: T[];
|
|
5
|
+
total?: number;
|
|
6
|
+
totalPages?: number;
|
|
7
|
+
page?: number;
|
|
8
|
+
limit?: number;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface ChildrenQueryParams {
|
|
12
|
+
page?: number;
|
|
13
|
+
pageSize?: number | string;
|
|
14
|
+
sortBy?: string;
|
|
15
|
+
sortOrder?: string;
|
|
16
|
+
search?: string;
|
|
17
|
+
itemType?: 'file' | 'folder' | 'all';
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** When `fileManager.cacheStrategy.ttl` is unset: success/error cache and notification dedupe fallback (30 min). */
|
|
21
|
+
export declare const DEFAULT_FILE_MANAGER_CACHE_TTL_MS: number;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for {@link TreeCache}.
|
|
24
|
+
*/
|
|
25
|
+
export interface TreeCacheConfig {
|
|
26
|
+
ttl?: number;
|
|
27
|
+
errorTtl?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Predicate: which errors count as "folder not found" (for negative cache / empty result).
|
|
30
|
+
* Default: checks error.code === 'folder_not_found' | 'path_folder_not_found' | 'FolderNotFound',
|
|
31
|
+
* or error.status === 404.
|
|
32
|
+
*/
|
|
33
|
+
isFolderNotFoundError?: (err: unknown) => boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Default predicate for "folder not found" errors. Can be overridden via {@link TreeCacheConfig.isFolderNotFoundError}. */
|
|
36
|
+
export declare function defaultIsFolderNotFoundError(error: unknown): boolean;
|
|
37
|
+
export declare class EntityCacheManager {
|
|
38
|
+
private readonly entities;
|
|
39
|
+
private readonly childrenByParent;
|
|
40
|
+
private readonly maxCacheSize;
|
|
41
|
+
private now;
|
|
42
|
+
private checkCacheSize;
|
|
43
|
+
getEntity(id: string): FileSystemItem | undefined;
|
|
44
|
+
getRecord(id: string): {
|
|
45
|
+
value: FileSystemItem;
|
|
46
|
+
updatedAt: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
getFileSystemItem(id: string): FileSystemItem | undefined;
|
|
49
|
+
getFolder(id: string): FileSystemItem | undefined;
|
|
50
|
+
getChildrenIds(parentId: string | null, opts?: {
|
|
51
|
+
onlyFileSystemItems?: boolean;
|
|
52
|
+
onlyFolders?: boolean;
|
|
53
|
+
}): string[];
|
|
54
|
+
searchByUrl(url: string): FileSystemItem | null;
|
|
55
|
+
upsertEntity(entity: FileSystemItem): void;
|
|
56
|
+
updateServerChildrenCount(folderId: string | null, serverCount: number | undefined): void;
|
|
57
|
+
deleteEntityById(id: string): {
|
|
58
|
+
entity: FileSystemItem | null;
|
|
59
|
+
parentId: string | null;
|
|
60
|
+
};
|
|
61
|
+
deleteFolderRecursive(folderId: string): {
|
|
62
|
+
deletedFolderRecords: FileSystemItem[];
|
|
63
|
+
deletedFileSystemItemRecords: FileSystemItem[];
|
|
64
|
+
};
|
|
65
|
+
moveEntityById(entityId: string, targetParentId: string | null): FileSystemItem | null;
|
|
66
|
+
copyFileSystemItem(fileId: string, newId: string, targetFolderId: string | null): FileSystemItem | null;
|
|
67
|
+
copyFolderShallow(folderId: string, newId: string, targetParentId: string | null): FileSystemItem | null;
|
|
68
|
+
isEntityStale(id: string, ttlMs: number): boolean;
|
|
69
|
+
touch(id: string, at?: number): void;
|
|
70
|
+
getEntitiesByIds<T extends FileSystemItem>(ids: string[]): (T | null)[];
|
|
71
|
+
searchByName(searchQuery: string, options?: {
|
|
72
|
+
parentId?: string | null;
|
|
73
|
+
recursive?: boolean;
|
|
74
|
+
itemType?: 'file' | 'folder' | 'all';
|
|
75
|
+
caseSensitive?: boolean;
|
|
76
|
+
limit?: number;
|
|
77
|
+
}): FileSystemItem[];
|
|
78
|
+
toJSON(): any;
|
|
79
|
+
static fromJSON(data: any): EntityCacheManager;
|
|
80
|
+
}
|
|
81
|
+
export interface ViewStrategyOptions {
|
|
82
|
+
allowSortedInsert?: boolean;
|
|
83
|
+
allowSearchInsert?: boolean;
|
|
84
|
+
invalidateOnPaginationFull?: boolean;
|
|
85
|
+
preloadPagesBefore?: number;
|
|
86
|
+
preloadPagesAfter?: number;
|
|
87
|
+
comparator?: (a: FileSystemItem, b: FileSystemItem, params?: ChildrenQueryParams) => number;
|
|
88
|
+
filterMatch?: (entity: FileSystemItem, params?: ChildrenQueryParams) => boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare class ViewCacheManager {
|
|
91
|
+
private readonly views;
|
|
92
|
+
private readonly strategy;
|
|
93
|
+
private readonly ttl;
|
|
94
|
+
private readonly errorTtl;
|
|
95
|
+
private readonly entityTtl;
|
|
96
|
+
private readonly failedRequests;
|
|
97
|
+
private readonly isFolderNotFoundError;
|
|
98
|
+
private serverChildrenCountHandler?;
|
|
99
|
+
private childrenCountInvalidator?;
|
|
100
|
+
private readonly maxViewsPerParent;
|
|
101
|
+
constructor(options?: ViewStrategyOptions, ttl?: number, errorTtl?: number, entityTtl?: number, failedRequests?: FailedRequestCache, isFolderNotFoundError?: (err: unknown) => boolean);
|
|
102
|
+
setServerChildrenCountHandler(handler: (parentId: string | null, total: number | undefined, entitiesManager: EntityCacheManager) => void): void;
|
|
103
|
+
setChildrenCountInvalidator(handler: (parentId: string | null | undefined) => void): void;
|
|
104
|
+
private now;
|
|
105
|
+
private parentKey;
|
|
106
|
+
private isExpired;
|
|
107
|
+
private areEntitiesStale;
|
|
108
|
+
private isEntityTypeCompatible;
|
|
109
|
+
private cleanupOldViews;
|
|
110
|
+
getOrCreateChildren(parentId: string | null, params: ChildrenQueryParams, loader: (parentId: string | null, params: ChildrenQueryParams) => Promise<QueryResult<FileSystemItem>>, entitiesManager: EntityCacheManager): Promise<QueryResult<FileSystemItem>>;
|
|
111
|
+
/**
|
|
112
|
+
* Асинхронно предзагружает соседние страницы
|
|
113
|
+
* Проверяет loadId основного view перед применением результатов
|
|
114
|
+
*/
|
|
115
|
+
private preloadPagesAsync;
|
|
116
|
+
private removeEmptyPageIfNeeded;
|
|
117
|
+
private updateTotalPagesForAllViews;
|
|
118
|
+
private isParamsSame;
|
|
119
|
+
private syncTotalsInSameViews;
|
|
120
|
+
private canSafelyModifySortedView;
|
|
121
|
+
private cascadeShiftPages;
|
|
122
|
+
private cascadeShiftToNextPage;
|
|
123
|
+
private tryInsertSorted;
|
|
124
|
+
private updateChildrenCountForOperation;
|
|
125
|
+
private adjustChildrenCount;
|
|
126
|
+
smartInvalidateChildrenViews(parentId: string | null, entity: FileSystemItem | null, operation: 'insert' | 'delete' | 'move' | 'copy' | 'update', entitiesManager: EntityCacheManager, prevParentId?: string | null, prevEntity?: FileSystemItem | null): void;
|
|
127
|
+
private shouldInvalidateCompletely;
|
|
128
|
+
private tryReinsertEntity;
|
|
129
|
+
private handleDelete;
|
|
130
|
+
private handleInsert;
|
|
131
|
+
private handleUpdate;
|
|
132
|
+
private handleMove;
|
|
133
|
+
forceInvalidateChildrenViews(parentId: string | null): void;
|
|
134
|
+
getKnownTotal(parentId: string | null): number | undefined;
|
|
135
|
+
toJSON(): any;
|
|
136
|
+
static fromJSON(data: any, opts?: {
|
|
137
|
+
failedRequests?: FailedRequestCache;
|
|
138
|
+
ttl?: number;
|
|
139
|
+
errorTtl?: number;
|
|
140
|
+
isFolderNotFoundError?: (err: unknown) => boolean;
|
|
141
|
+
}): ViewCacheManager;
|
|
142
|
+
}
|
|
143
|
+
export declare class TreeCache {
|
|
144
|
+
private readonly entities;
|
|
145
|
+
private readonly views;
|
|
146
|
+
private readonly ttl;
|
|
147
|
+
private readonly errorTtl;
|
|
148
|
+
private readonly failedRequests;
|
|
149
|
+
private readonly isFolderNotFoundError;
|
|
150
|
+
private readonly childrenCountPromises;
|
|
151
|
+
private invalidateChildrenCountCache;
|
|
152
|
+
constructor(viewOptions?: ViewStrategyOptions, ttl?: number, errorTtl?: number, config?: TreeCacheConfig);
|
|
153
|
+
getEntity(id: string): FileSystemItem | null;
|
|
154
|
+
getFileSystemItem(id: string): FileSystemItem | null;
|
|
155
|
+
getFolder(id: string): FileSystemItem | null;
|
|
156
|
+
getOrCreateChildren(parentId: string | null, params: ChildrenQueryParams, loader: (parentId: string | null, params: ChildrenQueryParams) => Promise<QueryResult<FileSystemItem>>): Promise<QueryResult<FileSystemItem>>;
|
|
157
|
+
upsertEntity(entity: FileSystemItem): void;
|
|
158
|
+
private isAncestor;
|
|
159
|
+
moveEntity(entityId: string, targetParentId: string | null): FileSystemItem | null;
|
|
160
|
+
copyEntity(entityId: string, targetParentId: string | null, newId?: string, overrides?: Partial<FileSystemItem>): FileSystemItem | null;
|
|
161
|
+
searchByUrl(url: string): FileSystemItem | null;
|
|
162
|
+
deleteEntity(entityId: string): FileSystemItem | null;
|
|
163
|
+
deleteFolderRecursive(folderId: string): {
|
|
164
|
+
deletedFileSystemItemIds: string[];
|
|
165
|
+
deletedFolderIds: string[];
|
|
166
|
+
};
|
|
167
|
+
forceInvalidate(id: string): void;
|
|
168
|
+
getChildrenIds(parentId: string | null): string[];
|
|
169
|
+
searchByName(searchQuery: string, options?: {
|
|
170
|
+
parentId?: string | null;
|
|
171
|
+
recursive?: boolean;
|
|
172
|
+
itemType?: 'file' | 'folder' | 'all';
|
|
173
|
+
caseSensitive?: boolean;
|
|
174
|
+
limit?: number;
|
|
175
|
+
}): FileSystemItem[];
|
|
176
|
+
getChildrenCount(folderId?: string, loader?: (folderId: string) => Promise<number>): Promise<number>;
|
|
177
|
+
toJSON(): any;
|
|
178
|
+
static fromJSON(data: any, viewOptions?: ViewStrategyOptions, config?: TreeCacheConfig): TreeCache;
|
|
179
|
+
private handleServerReportedChildrenCount;
|
|
180
|
+
private checkAndResolveChildrenCountConflict;
|
|
181
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ColumnsType } from 'antd
|
|
2
|
+
import type { TableColumnsType as ColumnsType } from 'antd';
|
|
3
3
|
import type { FileListRowModel } from '../../../presentation/file-list/types';
|
|
4
4
|
interface FileTableViewProps {
|
|
5
5
|
rows: FileListRowModel[];
|