@emailmaker/filemanager 0.10.93 → 0.10.95

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -54,6 +54,10 @@ export declare class DataSourceProxyBase implements FileManagerDataProviders {
54
54
  private readonly _blobFetchForceReloadOnceIds;
55
55
  /** Frontend-only guard against reads racing with delete operations. */
56
56
  private readonly _mutationRegistry;
57
+ private _getTrashPath;
58
+ private _getPathLookupCandidates;
59
+ private _folderFromResolvedPath;
60
+ private _resolveFolderByPath;
57
61
  private _findOrCreateFolderByPath;
58
62
  private getTrashFolder;
59
63
  private getTempFolder;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,7 @@ export declare class PathAwareStorageAdapter implements StorageProvider {
13
13
  constructor(_inner: StorageProvider, rootPath?: string, trashId?: string, trashPath?: string, ensureFolderTrailingSlash?: boolean);
14
14
  setController(controller: StorageProviderController): void;
15
15
  clearCache?(pathFolder?: string | null): MayBePromise<void>;
16
+ findItemByPath?(path: string): MayBePromise<FileSystemItem | undefined>;
16
17
  private _getOrGenerateId;
17
18
  pathForId(id: string, isFolder: boolean, silent?: boolean): string;
18
19
  private _updateIdMapping;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,7 @@
1
1
  import type { FileSystemItem } from '../types/storage';
2
+ import type { ChildrenQueryParams, ViewStrategyOptions } from './cacheViewTypes';
2
3
  import { FailedRequestCache } from './FailedRequestCache';
4
+ export type { ChildrenQueryParams, ViewStrategyOptions } from './cacheViewTypes';
3
5
  export interface QueryResult<T> {
4
6
  items: T[];
5
7
  total?: number;
@@ -8,15 +10,6 @@ export interface QueryResult<T> {
8
10
  limit?: number;
9
11
  [key: string]: unknown;
10
12
  }
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
13
  /** When `fileManager.cacheStrategy.ttl` is unset: success/error cache and notification dedupe fallback (30 min). */
21
14
  export declare const DEFAULT_FILE_MANAGER_CACHE_TTL_MS: number;
22
15
  /**
@@ -78,15 +71,6 @@ export declare class EntityCacheManager {
78
71
  toJSON(): any;
79
72
  static fromJSON(data: any): EntityCacheManager;
80
73
  }
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
74
  export declare class ViewCacheManager {
91
75
  private readonly views;
92
76
  private readonly strategy;
@@ -106,6 +90,8 @@ export declare class ViewCacheManager {
106
90
  private isExpired;
107
91
  private areEntitiesStale;
108
92
  private isEntityTypeCompatible;
93
+ /** Mark cached view as stale and cancel any in-flight load for this record. */
94
+ private markViewStaleForReload;
109
95
  private cleanupOldViews;
110
96
  getOrCreateChildren(parentId: string | null, params: ChildrenQueryParams, loader: (parentId: string | null, params: ChildrenQueryParams) => Promise<QueryResult<FileSystemItem>>, entitiesManager: EntityCacheManager): Promise<QueryResult<FileSystemItem>>;
111
97
  /**
@@ -117,7 +103,6 @@ export declare class ViewCacheManager {
117
103
  private updateTotalPagesForAllViews;
118
104
  private isParamsSame;
119
105
  private syncTotalsInSameViews;
120
- private canSafelyModifySortedView;
121
106
  private cascadeShiftPages;
122
107
  private cascadeShiftToNextPage;
123
108
  private tryInsertSorted;
@@ -165,6 +150,8 @@ export declare class TreeCache {
165
150
  deletedFolderIds: string[];
166
151
  };
167
152
  forceInvalidate(id: string): void;
153
+ /** Сбрасывает закэшированные листинги папки, даже если entity папки ещё нет в графе. */
154
+ invalidateListingViews(folderId: string | null | undefined): void;
168
155
  getChildrenIds(parentId: string | null): string[];
169
156
  searchByName(searchQuery: string, options?: {
170
157
  parentId?: string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { FileSystemItem } from '../types/storage';
2
+ import type { ChildrenQueryParams, ViewStrategyOptions } from './cacheViewTypes';
3
+ type SortOrder = 'asc' | 'desc';
4
+ /**
5
+ * Resolve sort field defaults for cache compare vs client-side sort callers.
6
+ * - sortBy omitted → name
7
+ * - sortOrder omitted + sortBy explicitly set → desc (matches getFiles server default)
8
+ * - both omitted → asc (legacy client-side default)
9
+ */
10
+ export declare function resolveSortParams(params?: ChildrenQueryParams): {
11
+ sortBy: string;
12
+ sortOrder: SortOrder;
13
+ };
14
+ /**
15
+ * Compare two file-system items for sorted view cache maintenance.
16
+ * Aligns with {@link DataSourceProxyBase} client-side sort and default server sort params.
17
+ */
18
+ export declare function compareFileSystemItems(a: FileSystemItem, b: FileSystemItem, params?: ChildrenQueryParams): number;
19
+ /**
20
+ * Whether an entity belongs in a cached children view with optional search filter.
21
+ */
22
+ export declare function matchesChildrenViewFilter(entity: FileSystemItem, params?: ChildrenQueryParams): boolean;
23
+ /** Default comparator for sorted view cache updates. */
24
+ export declare const defaultFileSystemItemComparator: typeof compareFileSystemItems;
25
+ /** Default search filter for cached children views. */
26
+ export declare const defaultChildrenViewFilterMatch: typeof matchesChildrenViewFilter;
27
+ /**
28
+ * Merge user cache strategy with package defaults for comparator and filterMatch.
29
+ */
30
+ export declare function resolveViewStrategyOptions(options?: ViewStrategyOptions): ViewStrategyOptions;
31
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { FileSystemItem } from '../types/storage';
2
+ export interface ChildrenQueryParams {
3
+ page?: number;
4
+ pageSize?: number | string;
5
+ sortBy?: string;
6
+ sortOrder?: string;
7
+ search?: string;
8
+ itemType?: 'file' | 'folder' | 'all';
9
+ [key: string]: unknown;
10
+ }
11
+ export interface ViewStrategyOptions {
12
+ allowSortedInsert?: boolean;
13
+ allowSearchInsert?: boolean;
14
+ invalidateOnPaginationFull?: boolean;
15
+ preloadPagesBefore?: number;
16
+ preloadPagesAfter?: number;
17
+ comparator?: (a: FileSystemItem, b: FileSystemItem, params?: ChildrenQueryParams) => number;
18
+ filterMatch?: (entity: FileSystemItem, params?: ChildrenQueryParams) => boolean;
19
+ }
@@ -0,0 +1,27 @@
1
+ import type { FileSystemItem } from '../types/storage';
2
+ /** Tree/cache sentinel id for the trash folder (matches `FolderTree` node key and `TRASH` constant). */
3
+ export declare const TRASH_FOLDER_ID: "Trash";
4
+ export type SystemFolderDefinition = {
5
+ id: string;
6
+ name?: string;
7
+ folderId?: string | null;
8
+ };
9
+ /** Normalize a logical folder path for system-folder lookup (`Trash`, `/Trash/`, `foo\\bar`). */
10
+ export declare function normalizeSystemFolderPath(path: string): string;
11
+ /**
12
+ * Lookup keys to try with {@link StorageProvider.findItemByPath} for trash system paths.
13
+ * Adds trash sentinel aliases when `requestPath` normalizes to the configured `trashPath`.
14
+ */
15
+ export declare function getTrashFolderLookupCandidates(requestPath: string, trashPath: string, trashFolderId?: string): string[];
16
+ /**
17
+ * Factory for {@link StorageProvider.findItemByPath} — maps logical paths to synthetic folders
18
+ * (backend-managed trash, etc.) without creating physical folders on the server.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * findItemByPath: createSystemFolderByPathResolver({
23
+ * Trash: { id: TRASH_FOLDER_ID, folderId: rootId },
24
+ * }),
25
+ * ```
26
+ */
27
+ export declare function createSystemFolderByPathResolver(folders: Record<string, SystemFolderDefinition>): (path: string) => FileSystemItem | undefined;
@@ -0,0 +1 @@
1
+ export {};