@epam/ai-dial-chat-hooks 1.2.0-dev.170 → 1.2.0-dev.173
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/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog.d.ts +2 -0
- package/file-manager.d.ts +23 -17
- package/files/dial-file-manager-mapping.util.js +1 -1
- package/files/dial-file-manager.types.js +2 -2
- package/files/useDialFileManager/useDialFileManager.js +130 -128
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/index.d.ts +25 -17
- package/package.json +17 -17
|
@@ -23,6 +23,9 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
23
23
|
}), n.reasoningEfforts?.length && r.push({
|
|
24
24
|
label: "Reasoning efforts",
|
|
25
25
|
value: n.reasoningEfforts.join(" · ")
|
|
26
|
+
}), n.hasSkills != null && r.push({
|
|
27
|
+
label: "Skills",
|
|
28
|
+
value: n.hasSkills
|
|
26
29
|
}), r.length > 0 && t.push({
|
|
27
30
|
title: "Capabilities",
|
|
28
31
|
specs: r
|
|
@@ -147,6 +150,9 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
147
150
|
}), n.hasConfiguration != null && r.push({
|
|
148
151
|
label: "Configuration schema",
|
|
149
152
|
value: n.hasConfiguration
|
|
153
|
+
}), n.hasSkills != null && r.push({
|
|
154
|
+
label: "Skills",
|
|
155
|
+
value: n.hasSkills
|
|
150
156
|
}), r.length > 0 && t.push({
|
|
151
157
|
title: "Capabilities",
|
|
152
158
|
specs: r
|
|
@@ -252,6 +258,7 @@ var s = (e) => e >= 1e6 ? `${e / 1e6}M tokens` : e >= 1e3 ? `${e / 1e3}K tokens`
|
|
|
252
258
|
hasConfiguration: e.hasConfigurationSchema,
|
|
253
259
|
hasChatCompletion: e.chatCompletion,
|
|
254
260
|
hasResponsesApi: e.responsesApi,
|
|
261
|
+
hasSkills: e.skillsSupported,
|
|
255
262
|
reasoningEfforts: e.reasoningEfforts
|
|
256
263
|
};
|
|
257
264
|
}, T = (e) => {
|
package/catalog.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare interface AgentCapabilities {
|
|
|
50
50
|
hasConfiguration?: boolean;
|
|
51
51
|
hasChatCompletion?: boolean;
|
|
52
52
|
hasResponsesApi?: boolean;
|
|
53
|
+
hasSkills?: boolean;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/** Input-attachment configuration for an agent (application) deployment. */
|
|
@@ -575,6 +576,7 @@ export declare interface ModelCapabilities {
|
|
|
575
576
|
hasResume?: boolean;
|
|
576
577
|
hasChatCompletion?: boolean;
|
|
577
578
|
hasResponsesApi?: boolean;
|
|
579
|
+
hasSkills?: boolean;
|
|
578
580
|
reasoningEfforts?: string[];
|
|
579
581
|
}
|
|
580
582
|
|
package/file-manager.d.ts
CHANGED
|
@@ -365,8 +365,6 @@ export declare type FileNameValidationError = {
|
|
|
365
365
|
} | {
|
|
366
366
|
reason: FileNameValidationErrorReason.DuplicateName;
|
|
367
367
|
existingName: string;
|
|
368
|
-
} | {
|
|
369
|
-
reason: FileNameValidationErrorReason.LeadingDot;
|
|
370
368
|
};
|
|
371
369
|
|
|
372
370
|
/**
|
|
@@ -379,8 +377,7 @@ export declare enum FileNameValidationErrorReason {
|
|
|
379
377
|
ForbiddenSymbols = "forbiddenSymbols",
|
|
380
378
|
ReservedName = "reservedName",
|
|
381
379
|
TooLong = "tooLong",
|
|
382
|
-
DuplicateName = "duplicateName"
|
|
383
|
-
LeadingDot = "leadingDot"
|
|
380
|
+
DuplicateName = "duplicateName"
|
|
384
381
|
}
|
|
385
382
|
|
|
386
383
|
/**
|
|
@@ -397,7 +394,10 @@ export declare enum FileOperationKind {
|
|
|
397
394
|
FileCopied = "fileCopied",
|
|
398
395
|
FilesCopied = "filesCopied",
|
|
399
396
|
FileMoved = "fileMoved",
|
|
400
|
-
FilesMoved = "filesMoved"
|
|
397
|
+
FilesMoved = "filesMoved",
|
|
398
|
+
/** A copy whose every item landed in its own source folder (Duplicate). */
|
|
399
|
+
FileDuplicated = "fileDuplicated",
|
|
400
|
+
FilesDuplicated = "filesDuplicated"
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
/**
|
|
@@ -412,13 +412,15 @@ export declare interface FileOperationSuccessEvent {
|
|
|
412
412
|
name?: string;
|
|
413
413
|
/** Number of items the operation covered, when applicable. */
|
|
414
414
|
count?: number;
|
|
415
|
-
/**
|
|
415
|
+
/**
|
|
416
|
+
* Destination folder as a slash-joined virtual path starting at the root
|
|
417
|
+
* label (e.g. `My files/reports`), for copy/move/duplicate operations.
|
|
418
|
+
*/
|
|
416
419
|
destinationFolderName?: string;
|
|
417
420
|
/**
|
|
418
|
-
* Whether the affected item is a folder rather than a file.
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* "File renamed").
|
|
421
|
+
* Whether the affected item is a folder rather than a file. Set for rename,
|
|
422
|
+
* copy, move, and duplicate events; on a multi-item event it describes the
|
|
423
|
+
* first successfully affected item (the one `name` refers to).
|
|
422
424
|
*/
|
|
423
425
|
isFolder?: boolean;
|
|
424
426
|
}
|
|
@@ -662,7 +664,7 @@ export declare const splitFileNameExtension: (fileName: string) => {
|
|
|
662
664
|
|
|
663
665
|
export declare const trimFileNameToByteLimit: (name: string, limit?: number) => string;
|
|
664
666
|
|
|
665
|
-
export declare const updateEntry: (prev: FileUploadBatchState | null,
|
|
667
|
+
export declare const updateEntry: (prev: FileUploadBatchState | null, id: string, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
|
|
666
668
|
|
|
667
669
|
/** Max number of files uploaded concurrently within a single upload batch. */
|
|
668
670
|
export declare const UPLOAD_CONCURRENCY = 3;
|
|
@@ -857,7 +859,9 @@ export declare interface UseDialFileManagerResult {
|
|
|
857
859
|
uploadBatchState: FileUploadBatchState | null;
|
|
858
860
|
/** Upload: abort all in-flight and queued uploads. */
|
|
859
861
|
cancelUpload: () => void;
|
|
860
|
-
/** Upload:
|
|
862
|
+
/** Upload: abort one queued or in-flight upload by its entry id. */
|
|
863
|
+
cancelUploadFile: (id: string) => void;
|
|
864
|
+
/** Upload: empty the upload queue. */
|
|
861
865
|
clearUploadBatch: () => void;
|
|
862
866
|
/** Folder creation: called when user confirms a new folder name. */
|
|
863
867
|
onCreateFolder: (file: DialUploadFileItem, folderPath: string, fileId: string) => Promise<void>;
|
|
@@ -924,7 +928,7 @@ export declare interface UseDialFileManagerResult {
|
|
|
924
928
|
/**
|
|
925
929
|
* True while any mutating file-manager operation is in flight: the OR of
|
|
926
930
|
* `isCreatingFolder`, `isDownloading`, `isDeleting`, `isRenaming`, `isCopying`,
|
|
927
|
-
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and
|
|
931
|
+
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and any upload still queued or running.
|
|
928
932
|
*
|
|
929
933
|
* Deliberately excludes three flags, each already fully contained by its own
|
|
930
934
|
* scoped loading UI:
|
|
@@ -1070,10 +1074,11 @@ export declare interface UseDialFileSharingResult {
|
|
|
1070
1074
|
|
|
1071
1075
|
/**
|
|
1072
1076
|
* Manages upload batches (single-file and ZIP-archive extraction), including
|
|
1073
|
-
* concurrency-limited progress tracking and abort.
|
|
1074
|
-
*
|
|
1075
|
-
* `
|
|
1076
|
-
* cache
|
|
1077
|
+
* concurrency-limited progress tracking and per-file abort. A batch started
|
|
1078
|
+
* while another is on screen is appended to it, and settled entries stay in
|
|
1079
|
+
* `uploadBatchState` until `clearUploadBatch`. Invalidates the shared listing
|
|
1080
|
+
* cache for the destination folder through `invalidateFolders`/`bumpRetry`
|
|
1081
|
+
* after a batch settles — it never holds its own copy of the cache.
|
|
1077
1082
|
*/
|
|
1078
1083
|
export declare const useDialFileUploadBatch: ({ filesApi, bucket, rootLabel, activeTab, cache, sharedRootMetaRef, invalidateFolders, bumpRetry, onNotification, }: UseDialFileUploadBatchOptions) => UseDialFileUploadBatchResult;
|
|
1079
1084
|
|
|
@@ -1106,6 +1111,7 @@ export declare interface UseDialFileUploadBatchResult {
|
|
|
1106
1111
|
onValidateUpload: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => Promise<FileUploadValidationResult>;
|
|
1107
1112
|
uploadBatchState: FileUploadBatchState | null;
|
|
1108
1113
|
cancelUpload: () => void;
|
|
1114
|
+
cancelUploadFile: (id: string) => void;
|
|
1109
1115
|
clearUploadBatch: () => void;
|
|
1110
1116
|
}
|
|
1111
1117
|
|
|
@@ -50,7 +50,7 @@ var o = (t) => {
|
|
|
50
50
|
return o.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || o.push(s), a.set(t, o), a;
|
|
51
51
|
}, u = (e, t, n) => {
|
|
52
52
|
if (!e) return e;
|
|
53
|
-
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e
|
|
53
|
+
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e) => e.id === t ? {
|
|
54
54
|
...e,
|
|
55
55
|
...r
|
|
56
56
|
} : e);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
3
|
return e.FolderLoadFailed = "folderLoadFailed", e.MetadataLoadFailed = "metadataLoadFailed", e.FolderCreateFailed = "folderCreateFailed", e.DownloadFileFailed = "downloadFileFailed", e.DownloadFilesFailed = "downloadFilesFailed", e.FilesDeleted = "filesDeleted", e.FilesDeletePartiallyFailed = "filesDeletePartiallyFailed", e.DeleteFailed = "deleteFailed", e.RenameFailed = "renameFailed", e.RenamePartiallyFailed = "renamePartiallyFailed", e.MoveFailed = "moveFailed", e.MovePartiallyFailed = "movePartiallyFailed", e.CopyFailed = "copyFailed", e.CopyPartiallyFailed = "copyPartiallyFailed", e.UnshareFailed = "unshareFailed", e.RemoveAccessFailed = "removeAccessFailed", e.UploadFailed = "uploadFailed", e.UploadCompleted = "uploadCompleted", e.UploadArchiveFailed = "uploadArchiveFailed", e.UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed", e.UploadArchiveRequestFailed = "uploadArchiveRequestFailed", e;
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
|
-
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e
|
|
5
|
+
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e;
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e;
|
|
7
|
+
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e.FileDuplicated = "fileDuplicated", e.FilesDuplicated = "filesDuplicated", e;
|
|
8
8
|
}({});
|
|
9
9
|
//#endregion
|
|
10
10
|
export { e as FileManagerNotificationReason, t as FileNameValidationErrorReason, n as FileOperationKind };
|
|
@@ -6,141 +6,143 @@ import { useDialFileMetadata as u } from "../useDialFileMetadata/useDialFileMeta
|
|
|
6
6
|
import { useDialFileMutations as d } from "../useDialFileMutations/useDialFileMutations.js";
|
|
7
7
|
import { useDialFileSharing as f } from "../useDialFileSharing/useDialFileSharing.js";
|
|
8
8
|
import { useDialFileUploadBatch as p } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { isUploadInProgress as m } from "@epam/ai-dial-chat-shared";
|
|
10
|
+
import { useCallback as h, useMemo as g } from "react";
|
|
11
|
+
import { DialFileManagerActions as _, DialFileManagerTabs as v } from "@epam/ai-dial-react-file-manager";
|
|
11
12
|
//#region src/files/useDialFileManager/useDialFileManager.ts
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
filesApi:
|
|
15
|
-
bucket:
|
|
16
|
-
rootLabel:
|
|
17
|
-
activeTab:
|
|
18
|
-
onNotification:
|
|
19
|
-
}),
|
|
20
|
-
filesApi:
|
|
21
|
-
bucket:
|
|
22
|
-
rootLabel:
|
|
23
|
-
activeTab:
|
|
24
|
-
cache:
|
|
25
|
-
sharedRootMetaRef:
|
|
26
|
-
invalidateFolders:
|
|
27
|
-
bumpRetry:
|
|
28
|
-
onNotification:
|
|
29
|
-
}),
|
|
30
|
-
filesApi:
|
|
31
|
-
bucket:
|
|
32
|
-
rootLabel:
|
|
33
|
-
activeTab:
|
|
34
|
-
folderPath:
|
|
35
|
-
currentFolder:
|
|
36
|
-
sharedRootMetaRef:
|
|
37
|
-
listingPermissionsCache:
|
|
38
|
-
invalidateFolders:
|
|
39
|
-
bumpRetry:
|
|
40
|
-
mergeCreatedFolder:
|
|
41
|
-
setFolderPath:
|
|
42
|
-
onNotification:
|
|
43
|
-
onOperationSuccess:
|
|
44
|
-
downloadDestination:
|
|
45
|
-
forbiddenSymbolsRegExp:
|
|
46
|
-
}),
|
|
47
|
-
filesApi:
|
|
48
|
-
bucket:
|
|
49
|
-
rootLabel:
|
|
50
|
-
bumpRetry:
|
|
51
|
-
onNotification:
|
|
52
|
-
}),
|
|
53
|
-
filesApi:
|
|
54
|
-
bucket:
|
|
55
|
-
rootLabel:
|
|
56
|
-
onNotification:
|
|
57
|
-
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]),
|
|
13
|
+
var y = ({ filesApi: y, bucket: b, rootLabel: x = "My files", activeTab: S = v.MyFiles, onNotification: C, onOperationSuccess: w, forbiddenSymbolsRegExp: T, variant: E = i.Attach, actionProfile: D, labels: O, locale: k, disabledNewButtonTooltip: A, downloadDestination: j, buildValidationErrorMessage: M }) => {
|
|
14
|
+
let N = D ?? a(E), P = l({
|
|
15
|
+
filesApi: y,
|
|
16
|
+
bucket: b,
|
|
17
|
+
rootLabel: x,
|
|
18
|
+
activeTab: S,
|
|
19
|
+
onNotification: C
|
|
20
|
+
}), F = p({
|
|
21
|
+
filesApi: y,
|
|
22
|
+
bucket: b,
|
|
23
|
+
rootLabel: x,
|
|
24
|
+
activeTab: S,
|
|
25
|
+
cache: P.cache,
|
|
26
|
+
sharedRootMetaRef: P.sharedRootMetaRef,
|
|
27
|
+
invalidateFolders: P.invalidateFolders,
|
|
28
|
+
bumpRetry: P.bumpRetry,
|
|
29
|
+
onNotification: C
|
|
30
|
+
}), I = d({
|
|
31
|
+
filesApi: y,
|
|
32
|
+
bucket: b,
|
|
33
|
+
rootLabel: x,
|
|
34
|
+
activeTab: S,
|
|
35
|
+
folderPath: P.folderPath,
|
|
36
|
+
currentFolder: P.currentFolder,
|
|
37
|
+
sharedRootMetaRef: P.sharedRootMetaRef,
|
|
38
|
+
listingPermissionsCache: P.listingPermissionsCache,
|
|
39
|
+
invalidateFolders: P.invalidateFolders,
|
|
40
|
+
bumpRetry: P.bumpRetry,
|
|
41
|
+
mergeCreatedFolder: P.mergeCreatedFolder,
|
|
42
|
+
setFolderPath: P.setFolderPath,
|
|
43
|
+
onNotification: C,
|
|
44
|
+
onOperationSuccess: w,
|
|
45
|
+
downloadDestination: j,
|
|
46
|
+
forbiddenSymbolsRegExp: T
|
|
47
|
+
}), L = f({
|
|
48
|
+
filesApi: y,
|
|
49
|
+
bucket: b,
|
|
50
|
+
rootLabel: x,
|
|
51
|
+
bumpRetry: P.bumpRetry,
|
|
52
|
+
onNotification: C
|
|
53
|
+
}), R = u({
|
|
54
|
+
filesApi: y,
|
|
55
|
+
bucket: b,
|
|
56
|
+
rootLabel: x,
|
|
57
|
+
onNotification: C
|
|
58
|
+
}), z = o(P.currentFolder), B = g(() => S === v.Organization || S === v.Shared && P.folderPath === "" ? !1 : z, [
|
|
59
|
+
S,
|
|
60
|
+
P.folderPath,
|
|
61
|
+
z
|
|
62
|
+
]), V = g(() => S === v.Shared ? t : e, [S]), H = g(() => {
|
|
62
63
|
let e = {}, t = (t) => {
|
|
63
|
-
let n =
|
|
64
|
+
let n = O[t];
|
|
64
65
|
n != null && (e[t] = n);
|
|
65
66
|
};
|
|
66
|
-
return t(
|
|
67
|
+
return t(_.Download), S === v.MyFiles ? (t(_.Delete), B && (t(_.Rename), s(N) && (t(_.Copy), t(_.Move), t(_.Duplicate))), c(N) && t(_.RemoveAccess)) : S === v.Shared && c(N) && t(_.Unshare), N === r.Full && t(_.Info), e;
|
|
67
68
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
let n =
|
|
84
|
-
return n ?
|
|
85
|
-
}, [
|
|
86
|
-
let n =
|
|
87
|
-
return n ?
|
|
88
|
-
}, [
|
|
69
|
+
S,
|
|
70
|
+
B,
|
|
71
|
+
N,
|
|
72
|
+
O
|
|
73
|
+
]), U = g(() => I.isCreatingFolder || I.isDownloading || I.isDeleting || I.isRenaming || I.isCopying || I.isMoving || L.isUnsharing || L.isRemovingAccess || m(F.uploadBatchState), [
|
|
74
|
+
I.isCreatingFolder,
|
|
75
|
+
I.isDownloading,
|
|
76
|
+
I.isDeleting,
|
|
77
|
+
I.isRenaming,
|
|
78
|
+
I.isCopying,
|
|
79
|
+
I.isMoving,
|
|
80
|
+
L.isUnsharing,
|
|
81
|
+
L.isRemovingAccess,
|
|
82
|
+
F.uploadBatchState
|
|
83
|
+
]), W = h((e, t) => {
|
|
84
|
+
let n = I.onCreateFolderValidate(e, t);
|
|
85
|
+
return n ? M(n) : null;
|
|
86
|
+
}, [I, M]), G = h((e, t) => {
|
|
87
|
+
let n = I.onRenameValidate(e, t);
|
|
88
|
+
return n ? M(n, t) : null;
|
|
89
|
+
}, [I, M]);
|
|
89
90
|
return {
|
|
90
|
-
items:
|
|
91
|
-
isLoading:
|
|
92
|
-
error:
|
|
93
|
-
path:
|
|
94
|
-
onPathChange:
|
|
95
|
-
retry:
|
|
96
|
-
onSearchFiles:
|
|
97
|
-
isSearching:
|
|
98
|
-
searchResults:
|
|
99
|
-
clearSearchResults:
|
|
100
|
-
expandedPaths:
|
|
101
|
-
loadedPaths:
|
|
102
|
-
onExpandedPathsChange:
|
|
103
|
-
onFolderPopupPathChange:
|
|
104
|
-
folderPopupLoadingPaths:
|
|
105
|
-
onUploadFiles:
|
|
106
|
-
onUploadArchive:
|
|
107
|
-
onValidateUpload:
|
|
108
|
-
uploadBatchState:
|
|
109
|
-
cancelUpload:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
91
|
+
items: P.items,
|
|
92
|
+
isLoading: P.isLoading,
|
|
93
|
+
error: P.error,
|
|
94
|
+
path: P.path,
|
|
95
|
+
onPathChange: P.onPathChange,
|
|
96
|
+
retry: P.retry,
|
|
97
|
+
onSearchFiles: P.onSearchFiles,
|
|
98
|
+
isSearching: P.isSearching,
|
|
99
|
+
searchResults: P.searchResults,
|
|
100
|
+
clearSearchResults: P.clearSearchResults,
|
|
101
|
+
expandedPaths: P.expandedPaths,
|
|
102
|
+
loadedPaths: P.loadedPaths,
|
|
103
|
+
onExpandedPathsChange: P.onExpandedPathsChange,
|
|
104
|
+
onFolderPopupPathChange: P.onFolderPopupPathChange,
|
|
105
|
+
folderPopupLoadingPaths: P.folderPopupLoadingPaths,
|
|
106
|
+
onUploadFiles: F.onUploadFiles,
|
|
107
|
+
onUploadArchive: F.onUploadArchive,
|
|
108
|
+
onValidateUpload: F.onValidateUpload,
|
|
109
|
+
uploadBatchState: F.uploadBatchState,
|
|
110
|
+
cancelUpload: F.cancelUpload,
|
|
111
|
+
cancelUploadFile: F.cancelUploadFile,
|
|
112
|
+
clearUploadBatch: F.clearUploadBatch,
|
|
113
|
+
onCreateFolder: I.onCreateFolder,
|
|
114
|
+
onCreateFolderValidate: W,
|
|
115
|
+
isCreatingFolder: I.isCreatingFolder,
|
|
116
|
+
onDownloadFiles: I.onDownloadFiles,
|
|
117
|
+
isDownloading: I.isDownloading,
|
|
118
|
+
onDeleteFiles: I.onDeleteFiles,
|
|
119
|
+
isDeleting: I.isDeleting,
|
|
120
|
+
onRenameValidate: G,
|
|
121
|
+
onMoveToFiles: I.onMoveToFiles,
|
|
122
|
+
isRenaming: I.isRenaming,
|
|
123
|
+
onCopyFiles: I.onCopyFiles,
|
|
124
|
+
isCopying: I.isCopying,
|
|
125
|
+
isMoving: I.isMoving,
|
|
126
|
+
cancelCopyMove: I.cancelCopyMove,
|
|
127
|
+
uploadEnabled: B,
|
|
128
|
+
isNewButtonDisabled: !B,
|
|
129
|
+
disabledNewButtonTooltip: A,
|
|
130
|
+
visibleColumns: V,
|
|
131
|
+
dateLocale: k,
|
|
130
132
|
dateOptions: n,
|
|
131
|
-
actionLabels:
|
|
132
|
-
sharedWithMeIds:
|
|
133
|
-
sharedByMePaths:
|
|
134
|
-
onUnshareFiles:
|
|
135
|
-
isUnsharing:
|
|
136
|
-
onRemoveFilesAccess:
|
|
137
|
-
isRemovingAccess:
|
|
138
|
-
fileMetadata:
|
|
139
|
-
isFileMetadataLoading:
|
|
140
|
-
onGetInfo:
|
|
141
|
-
clearMetadata:
|
|
142
|
-
isAnyOperationInProgress:
|
|
133
|
+
actionLabels: H,
|
|
134
|
+
sharedWithMeIds: P.sharedWithMeIds,
|
|
135
|
+
sharedByMePaths: P.sharedByMePaths,
|
|
136
|
+
onUnshareFiles: L.onUnshareFiles,
|
|
137
|
+
isUnsharing: L.isUnsharing,
|
|
138
|
+
onRemoveFilesAccess: L.onRemoveFilesAccess,
|
|
139
|
+
isRemovingAccess: L.isRemovingAccess,
|
|
140
|
+
fileMetadata: R.fileMetadata,
|
|
141
|
+
isFileMetadataLoading: R.isFileMetadataLoading,
|
|
142
|
+
onGetInfo: R.onGetInfo,
|
|
143
|
+
clearMetadata: R.clearMetadata,
|
|
144
|
+
isAnyOperationInProgress: U
|
|
143
145
|
};
|
|
144
146
|
};
|
|
145
147
|
//#endregion
|
|
146
|
-
export {
|
|
148
|
+
export { y as useDialFileManager };
|
|
@@ -6,19 +6,18 @@ import { prepareCopyItems as f, prepareMoveRenameItems as p } from "../dial-file
|
|
|
6
6
|
import { findFirstSuccessfulCopyMoveItem as m } from "../dial-file-manager-mapping.util.js";
|
|
7
7
|
import { DownloadDestinationType as h } from "../download-destination.js";
|
|
8
8
|
import { useCallback as g, useRef as _, useState as v } from "react";
|
|
9
|
-
import { ArchiveItemDtoNodeTypeEnum as y,
|
|
9
|
+
import { ArchiveItemDtoNodeTypeEnum as y, CopyItemDtoNodeTypeEnum as b, DeleteItemDtoNodeTypeEnum as x, MoveItemDtoNodeTypeEnum as ee, RenameItemDtoNodeTypeEnum as te } from "@epam/ai-dial-chat-api-client";
|
|
10
10
|
import { NOT_ALLOWED_SYMBOLS as S, NotificationVariant as C } from "@epam/ai-dial-ui-kit";
|
|
11
11
|
import { DialFileManagerTabs as w, DialFileNodeType as T } from "@epam/ai-dial-react-file-manager";
|
|
12
12
|
//#region src/files/useDialFileMutations/useDialFileMutations.ts
|
|
13
13
|
var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, currentFolder: j, sharedRootMetaRef: M, listingPermissionsCache: N, invalidateFolders: P, bumpRetry: F, mergeCreatedFolder: I, setFolderPath: L, onNotification: R, onOperationSuccess: z, downloadDestination: B, forbiddenSymbolsRegExp: V }) => {
|
|
14
|
-
let [
|
|
14
|
+
let [ne, H] = v(!1), [re, U] = v(!1), [ie, W] = v(!1), [G, K] = v(!1), [q, J] = v(!1), [Y, X] = v(!1), Z = _(null), Q = _(null), $ = g((e, n) => {
|
|
15
15
|
let i = null;
|
|
16
16
|
if (!e || e.trim() === "") i = { reason: t.Empty };
|
|
17
17
|
else if (o(e, V)) i = {
|
|
18
18
|
reason: t.ForbiddenSymbols,
|
|
19
19
|
symbols: S
|
|
20
20
|
};
|
|
21
|
-
else if (e.startsWith(".")) i = { reason: t.LeadingDot };
|
|
22
21
|
else if (e === r) i = { reason: t.ReservedName };
|
|
23
22
|
else if (e.length > 255) i = {
|
|
24
23
|
reason: t.TooLong,
|
|
@@ -32,7 +31,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
return Q.current = i, i;
|
|
35
|
-
}, [V]),
|
|
34
|
+
}, [V]), ae = g(async (t, r, i) => {
|
|
36
35
|
let { parentVirtualPath: a, name: o } = s(r, O), l = d(a, O), u = j && A === l ? j : {
|
|
37
36
|
id: l,
|
|
38
37
|
path: l,
|
|
@@ -78,7 +77,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
78
77
|
z,
|
|
79
78
|
M,
|
|
80
79
|
R
|
|
81
|
-
]),
|
|
80
|
+
]), oe = g((t) => {
|
|
82
81
|
(async () => {
|
|
83
82
|
U(!0);
|
|
84
83
|
try {
|
|
@@ -128,7 +127,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
128
127
|
R,
|
|
129
128
|
E,
|
|
130
129
|
B
|
|
131
|
-
]),
|
|
130
|
+
]), se = g((t, n) => {
|
|
132
131
|
t.length !== 0 && (async () => {
|
|
133
132
|
W(!0);
|
|
134
133
|
let r = t.map((e) => {
|
|
@@ -140,7 +139,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
140
139
|
bucket: o,
|
|
141
140
|
path: s,
|
|
142
141
|
name: i,
|
|
143
|
-
nodeType: t ?
|
|
142
|
+
nodeType: t ? x.Folder : x.Item
|
|
144
143
|
};
|
|
145
144
|
});
|
|
146
145
|
try {
|
|
@@ -166,9 +165,9 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
166
165
|
reason: e.DeleteFailed
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
|
-
let i = r.filter((e) => e.nodeType ===
|
|
168
|
+
let i = r.filter((e) => e.nodeType === x.Folder).map((e) => e.path.endsWith("/") ? e.path : `${e.path}/`);
|
|
170
169
|
P([...new Set(r.map((e) => {
|
|
171
|
-
if (e.nodeType ===
|
|
170
|
+
if (e.nodeType === x.Folder) return e.path.endsWith("/") ? e.path : `${e.path}/`;
|
|
172
171
|
let t = e.path.lastIndexOf("/");
|
|
173
172
|
return t > 0 ? e.path.slice(0, t + 1) : "";
|
|
174
173
|
}))]), i.some((e) => A === e || A.startsWith(e)) && L((e) => e.replace(/[^/]+\/$/, "")), F(), W(!1);
|
|
@@ -184,7 +183,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
184
183
|
P,
|
|
185
184
|
F,
|
|
186
185
|
L
|
|
187
|
-
]),
|
|
186
|
+
]), ce = g((e, n) => {
|
|
188
187
|
if (!e || e.trim() === "") return { reason: t.Empty };
|
|
189
188
|
if (e === r) return { reason: t.ReservedName };
|
|
190
189
|
if (o(e, V)) return {
|
|
@@ -200,20 +199,21 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
200
199
|
reason: t.DuplicateName,
|
|
201
200
|
existingName: s.name
|
|
202
201
|
} : null;
|
|
203
|
-
}, [V, j]),
|
|
202
|
+
}, [V, j]), le = g((t, r) => {
|
|
204
203
|
if (t.length === 0 || q || Y) return;
|
|
205
204
|
let a = new AbortController();
|
|
206
205
|
Z.current = a, (async () => {
|
|
207
206
|
J(!0);
|
|
208
207
|
let o = f(t, D, O), s = o.map(({ dto: e }) => e);
|
|
209
208
|
try {
|
|
210
|
-
let { results: t } = await E.copyFiles(s, a.signal), c = t.filter((e) => !e.success).length,
|
|
211
|
-
if (
|
|
212
|
-
let e = m(o, t);
|
|
213
|
-
z?.({
|
|
214
|
-
kind:
|
|
209
|
+
let { results: t } = await E.copyFiles(s, a.signal), c = t.filter((e) => !e.success).length, u = t.length - c;
|
|
210
|
+
if (u > 0) {
|
|
211
|
+
let e = m(o, t), a = s.every((e) => l(e.sourcePath) === l(e.destinationPath)), c;
|
|
212
|
+
c = a ? u === 1 ? n.FileDuplicated : n.FilesDuplicated : u === 1 ? n.FileCopied : n.FilesCopied, z?.({
|
|
213
|
+
kind: c,
|
|
215
214
|
name: e?.destinationName,
|
|
216
|
-
count:
|
|
215
|
+
count: u,
|
|
216
|
+
isFolder: e?.dto.nodeType === b.Folder,
|
|
217
217
|
destinationFolderName: i(r, O)
|
|
218
218
|
});
|
|
219
219
|
}
|
|
@@ -244,21 +244,21 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
244
244
|
Y,
|
|
245
245
|
P,
|
|
246
246
|
F
|
|
247
|
-
]),
|
|
247
|
+
]), ue = g(() => {
|
|
248
248
|
Z.current?.abort();
|
|
249
249
|
}, []);
|
|
250
250
|
return {
|
|
251
|
-
isCreatingFolder:
|
|
252
|
-
isDownloading:
|
|
253
|
-
isDeleting:
|
|
251
|
+
isCreatingFolder: ne,
|
|
252
|
+
isDownloading: re,
|
|
253
|
+
isDeleting: ie,
|
|
254
254
|
isRenaming: G,
|
|
255
255
|
isCopying: q,
|
|
256
256
|
isMoving: Y,
|
|
257
|
-
onCreateFolder:
|
|
257
|
+
onCreateFolder: ae,
|
|
258
258
|
onCreateFolderValidate: $,
|
|
259
|
-
onDownloadFiles:
|
|
260
|
-
onDeleteFiles:
|
|
261
|
-
onRenameValidate:
|
|
259
|
+
onDownloadFiles: oe,
|
|
260
|
+
onDeleteFiles: se,
|
|
261
|
+
onRenameValidate: ce,
|
|
262
262
|
onMoveToFiles: g((t, r, o) => {
|
|
263
263
|
if (t.length === 0 || q || Y || G) return;
|
|
264
264
|
let { renameDtos: s, preparedMoveItems: c } = p(t, D, O), u = c.map(({ dto: e }) => e), d = new AbortController();
|
|
@@ -308,6 +308,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
308
308
|
kind: _ === 1 ? n.FileMoved : n.FilesMoved,
|
|
309
309
|
name: e?.destinationName,
|
|
310
310
|
count: _,
|
|
311
|
+
isFolder: e?.dto.nodeType === ee.Folder,
|
|
311
312
|
destinationFolderName: i(o, O)
|
|
312
313
|
});
|
|
313
314
|
}
|
|
@@ -316,7 +317,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
316
317
|
z?.({
|
|
317
318
|
kind: n.FileRenamed,
|
|
318
319
|
name: a(e.destinationPath, e.destinationPath),
|
|
319
|
-
isFolder: e.nodeType ===
|
|
320
|
+
isFolder: e.nodeType === te.Folder
|
|
320
321
|
});
|
|
321
322
|
}
|
|
322
323
|
y > 0 && (y === v ? R?.({
|
|
@@ -327,11 +328,11 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
327
328
|
reason: b ? e.MovePartiallyFailed : e.RenamePartiallyFailed,
|
|
328
329
|
count: y
|
|
329
330
|
}));
|
|
330
|
-
let
|
|
331
|
-
if (
|
|
332
|
-
let e =
|
|
331
|
+
let x = s.find((e) => e.nodeType === te.Folder && t.results.some((t) => t.success && t.sourcePath === e.sourcePath));
|
|
332
|
+
if (x != null) {
|
|
333
|
+
let e = x.sourcePath.endsWith("/") ? x.sourcePath : `${x.sourcePath}/`;
|
|
333
334
|
if (A === e || A.startsWith(e)) {
|
|
334
|
-
let t =
|
|
335
|
+
let t = x.destinationPath.endsWith("/") ? x.destinationPath : `${x.destinationPath}/`;
|
|
335
336
|
L(A.replace(e, t));
|
|
336
337
|
}
|
|
337
338
|
}
|
|
@@ -351,8 +352,8 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
351
352
|
F,
|
|
352
353
|
L
|
|
353
354
|
]),
|
|
354
|
-
onCopyFiles:
|
|
355
|
-
cancelCopyMove:
|
|
355
|
+
onCopyFiles: le,
|
|
356
|
+
cancelCopyMove: ue
|
|
356
357
|
};
|
|
357
358
|
};
|
|
358
359
|
//#endregion
|
|
@@ -19,138 +19,145 @@ var f = 5, p = (e) => e.error ? `${e.path} (${e.error})` : e.path, m = (e) => {
|
|
|
19
19
|
}, h = (e, t) => `${e}${t}/`, g = (e) => /\.zip$/i.test(e), _ = (e) => {
|
|
20
20
|
let [t] = e;
|
|
21
21
|
if (!(e.length !== 1 || t == null)) return g(t.fileContent.name) && !g(t.name) ? t : void 0;
|
|
22
|
-
}, v =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}), (async () => {
|
|
22
|
+
}, v = 0, y = () => (v += 1, `${Date.now()}-${v}`), b = (e, t) => ({
|
|
23
|
+
files: [...e?.files ?? [], ...t],
|
|
24
|
+
isOpen: !0
|
|
25
|
+
}), x = ({ filesApi: f, bucket: p, rootLabel: g, activeTab: v, cache: x, sharedRootMetaRef: S, invalidateFolders: C, bumpRetry: w, onNotification: T }) => {
|
|
26
|
+
let [E, D] = l(null), O = c(/* @__PURE__ */ new Map()), k = s((e, t, r) => {
|
|
27
|
+
let s = i(r, g), c = y();
|
|
28
|
+
D((e) => b(e, [{
|
|
29
|
+
id: c,
|
|
30
|
+
name: t,
|
|
31
|
+
status: o.Uploading
|
|
32
|
+
}])), (async () => {
|
|
33
|
+
let r = o.Failed;
|
|
33
34
|
try {
|
|
34
|
-
let { results:
|
|
35
|
-
|
|
35
|
+
let { results: i } = await f.uploadArchive(e, p, h(s, t)), a = i.filter((e) => e.success).length, c = i.filter((e) => !e.success), l = c.length, { names: d, restCount: g } = m(c);
|
|
36
|
+
i.length > 0 && a === 0 ? T?.({
|
|
36
37
|
variant: u.Error,
|
|
37
38
|
reason: n.UploadArchiveFailed,
|
|
38
|
-
names:
|
|
39
|
-
restCount:
|
|
40
|
-
}) :
|
|
39
|
+
names: d,
|
|
40
|
+
restCount: g
|
|
41
|
+
}) : (r = o.Completed, l > 0 && T?.({
|
|
41
42
|
variant: u.Error,
|
|
42
43
|
reason: n.UploadArchivePartiallyFailed,
|
|
43
|
-
count:
|
|
44
|
-
names:
|
|
45
|
-
restCount:
|
|
46
|
-
});
|
|
44
|
+
count: l,
|
|
45
|
+
names: d,
|
|
46
|
+
restCount: g
|
|
47
|
+
}));
|
|
47
48
|
} catch {
|
|
48
|
-
|
|
49
|
+
T?.({
|
|
49
50
|
variant: u.Error,
|
|
50
51
|
reason: n.UploadArchiveRequestFailed
|
|
51
52
|
});
|
|
52
53
|
} finally {
|
|
53
|
-
|
|
54
|
+
C([s]), w(), D((e) => a(e, c, {
|
|
55
|
+
status: r,
|
|
56
|
+
percent: 100
|
|
57
|
+
}));
|
|
54
58
|
}
|
|
55
59
|
})();
|
|
56
60
|
}, [
|
|
57
61
|
p,
|
|
58
62
|
g,
|
|
59
|
-
|
|
63
|
+
T,
|
|
60
64
|
f,
|
|
65
|
+
C,
|
|
66
|
+
w
|
|
67
|
+
]), A = s((e, s) => {
|
|
68
|
+
if (e.length === 0) return;
|
|
69
|
+
let c = _(e);
|
|
70
|
+
if (c != null) {
|
|
71
|
+
k(c.fileContent, c.name, s);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let l = e.map((e) => ({
|
|
75
|
+
id: y(),
|
|
76
|
+
name: e.name,
|
|
77
|
+
status: o.Queued
|
|
78
|
+
})), m = O.current;
|
|
79
|
+
for (let e of l) m.set(e.id, new AbortController());
|
|
80
|
+
D((e) => b(e, l));
|
|
81
|
+
let h = i(s, g), { bucket: E, path: A } = v === d.Shared ? r(h, S.current, p) : {
|
|
82
|
+
bucket: p,
|
|
83
|
+
path: h
|
|
84
|
+
}, j = new Set((x.get(h) ?? []).map((e) => e.name.toLowerCase()));
|
|
85
|
+
(async () => {
|
|
86
|
+
let r = 0, i = 0, s = 0, c = 0, d = async () => {
|
|
87
|
+
for (; r < e.length;) {
|
|
88
|
+
let n = r++, u = e[n], { id: d } = l[n], p = m.get(d);
|
|
89
|
+
if (p == null || p.signal.aborted) {
|
|
90
|
+
c += 1, m.delete(d), D((e) => a(e, d, o.Cancelled));
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
D((e) => a(e, d, {
|
|
94
|
+
status: o.Uploading,
|
|
95
|
+
percent: 0
|
|
96
|
+
}));
|
|
97
|
+
let h = j.has(u.name.toLowerCase()) ? t.Overwrite : t.CreateOnly;
|
|
98
|
+
try {
|
|
99
|
+
await f.uploadFile(E, `${A}${u.name}`, u.fileContent, {
|
|
100
|
+
signal: p.signal,
|
|
101
|
+
uploadMode: h,
|
|
102
|
+
onProgress: (e) => {
|
|
103
|
+
D((t) => a(t, d, {
|
|
104
|
+
status: o.Uploading,
|
|
105
|
+
percent: e
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}), D((e) => a(e, d, {
|
|
109
|
+
status: o.Completed,
|
|
110
|
+
percent: 100
|
|
111
|
+
})), i += 1;
|
|
112
|
+
} catch {
|
|
113
|
+
let e = o.Failed;
|
|
114
|
+
p.signal.aborted ? (e = o.Cancelled, c += 1) : s += 1, D((t) => a(t, d, e));
|
|
115
|
+
} finally {
|
|
116
|
+
m.delete(d);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
await Promise.all(Array.from({ length: 3 }, () => d())), c < e.length && (i === 0 && s > 0 ? T?.({
|
|
121
|
+
variant: u.Error,
|
|
122
|
+
reason: n.UploadFailed
|
|
123
|
+
}) : i > 0 && T?.({
|
|
124
|
+
variant: u.Success,
|
|
125
|
+
reason: n.UploadCompleted,
|
|
126
|
+
folder: A || g
|
|
127
|
+
})), C([h]), w();
|
|
128
|
+
})();
|
|
129
|
+
}, [
|
|
130
|
+
v,
|
|
131
|
+
p,
|
|
61
132
|
x,
|
|
62
|
-
|
|
63
|
-
|
|
133
|
+
g,
|
|
134
|
+
T,
|
|
135
|
+
f,
|
|
136
|
+
S,
|
|
137
|
+
C,
|
|
138
|
+
w,
|
|
139
|
+
k
|
|
140
|
+
]), j = s((e, t, n) => {
|
|
141
|
+
k(e, t, n);
|
|
142
|
+
}, [k]), M = s(async (t, n, r) => {
|
|
143
|
+
for (let n of t) n.name = e(n.name);
|
|
144
|
+
return { valid: !0 };
|
|
145
|
+
}, []), N = s((e) => {
|
|
146
|
+
O.current.get(e)?.abort();
|
|
147
|
+
}, []);
|
|
64
148
|
return {
|
|
65
|
-
onUploadFiles:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
D(c.fileContent, c.name, s);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
let l = new AbortController();
|
|
73
|
-
E.current = l, T({
|
|
74
|
-
files: e.map((e, t) => ({
|
|
75
|
-
id: `${Date.now()}-${t}`,
|
|
76
|
-
name: e.name,
|
|
77
|
-
status: o.Queued
|
|
78
|
-
})),
|
|
79
|
-
isOpen: !0
|
|
80
|
-
});
|
|
81
|
-
let m = i(s, g), { bucket: h, path: w } = v === d.Shared ? r(m, b.current, p) : {
|
|
82
|
-
bucket: p,
|
|
83
|
-
path: m
|
|
84
|
-
}, O = new Set((y.get(m) ?? []).map((e) => e.name.toLowerCase()));
|
|
85
|
-
(async () => {
|
|
86
|
-
let r = 0, i = 0, s = 0, c = async () => {
|
|
87
|
-
for (; r < e.length;) {
|
|
88
|
-
let n = r++, c = e[n];
|
|
89
|
-
if (l.signal.aborted) {
|
|
90
|
-
T((e) => a(e, n, o.Cancelled));
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
T((e) => a(e, n, {
|
|
94
|
-
status: o.Uploading,
|
|
95
|
-
percent: 0
|
|
96
|
-
}));
|
|
97
|
-
let u = O.has(c.name.toLowerCase()) ? t.Overwrite : t.CreateOnly;
|
|
98
|
-
try {
|
|
99
|
-
await f.uploadFile(h, `${w}${c.name}`, c.fileContent, {
|
|
100
|
-
signal: l.signal,
|
|
101
|
-
uploadMode: u,
|
|
102
|
-
onProgress: (e) => {
|
|
103
|
-
T((t) => a(t, n, {
|
|
104
|
-
status: o.Uploading,
|
|
105
|
-
percent: e
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
}), T((e) => a(e, n, {
|
|
109
|
-
status: o.Completed,
|
|
110
|
-
percent: 100
|
|
111
|
-
})), i += 1;
|
|
112
|
-
} catch {
|
|
113
|
-
let e = l.signal.aborted ? o.Cancelled : o.Failed;
|
|
114
|
-
e === o.Failed && (s += 1), T((t) => a(t, n, e));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
await Promise.all(Array.from({ length: 3 }, () => c())), l.signal.aborted || (i === 0 && s > 0 ? C?.({
|
|
119
|
-
variant: u.Error,
|
|
120
|
-
reason: n.UploadFailed
|
|
121
|
-
}) : C?.({
|
|
122
|
-
variant: u.Success,
|
|
123
|
-
reason: n.UploadCompleted,
|
|
124
|
-
folder: w || g
|
|
125
|
-
})), x([m]), S(), E.current = null, T(null);
|
|
126
|
-
})();
|
|
127
|
-
}, [
|
|
128
|
-
v,
|
|
129
|
-
p,
|
|
130
|
-
y,
|
|
131
|
-
g,
|
|
132
|
-
C,
|
|
133
|
-
f,
|
|
134
|
-
b,
|
|
135
|
-
x,
|
|
136
|
-
S,
|
|
137
|
-
D
|
|
138
|
-
]),
|
|
139
|
-
onUploadArchive: s((e, t, n) => {
|
|
140
|
-
D(e, t, n);
|
|
141
|
-
}, [D]),
|
|
142
|
-
onValidateUpload: s(async (t, n, r) => {
|
|
143
|
-
for (let n of t) n.name = e(n.name);
|
|
144
|
-
return { valid: !0 };
|
|
145
|
-
}, []),
|
|
146
|
-
uploadBatchState: w,
|
|
149
|
+
onUploadFiles: A,
|
|
150
|
+
onUploadArchive: j,
|
|
151
|
+
onValidateUpload: M,
|
|
152
|
+
uploadBatchState: E,
|
|
147
153
|
cancelUpload: s(() => {
|
|
148
|
-
|
|
154
|
+
for (let e of O.current.values()) e.abort();
|
|
149
155
|
}, []),
|
|
156
|
+
cancelUploadFile: N,
|
|
150
157
|
clearUploadBatch: s(() => {
|
|
151
|
-
|
|
158
|
+
D(null);
|
|
152
159
|
}, [])
|
|
153
160
|
};
|
|
154
161
|
};
|
|
155
162
|
//#endregion
|
|
156
|
-
export {
|
|
163
|
+
export { x as useDialFileUploadBatch };
|
package/index.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export declare interface AgentCapabilities {
|
|
|
182
182
|
hasConfiguration?: boolean;
|
|
183
183
|
hasChatCompletion?: boolean;
|
|
184
184
|
hasResponsesApi?: boolean;
|
|
185
|
+
hasSkills?: boolean;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
/** Input-attachment configuration for an agent (application) deployment. */
|
|
@@ -1592,8 +1593,6 @@ export declare type FileNameValidationError = {
|
|
|
1592
1593
|
} | {
|
|
1593
1594
|
reason: FileNameValidationErrorReason.DuplicateName;
|
|
1594
1595
|
existingName: string;
|
|
1595
|
-
} | {
|
|
1596
|
-
reason: FileNameValidationErrorReason.LeadingDot;
|
|
1597
1596
|
};
|
|
1598
1597
|
|
|
1599
1598
|
/**
|
|
@@ -1606,8 +1605,7 @@ export declare enum FileNameValidationErrorReason {
|
|
|
1606
1605
|
ForbiddenSymbols = "forbiddenSymbols",
|
|
1607
1606
|
ReservedName = "reservedName",
|
|
1608
1607
|
TooLong = "tooLong",
|
|
1609
|
-
DuplicateName = "duplicateName"
|
|
1610
|
-
LeadingDot = "leadingDot"
|
|
1608
|
+
DuplicateName = "duplicateName"
|
|
1611
1609
|
}
|
|
1612
1610
|
|
|
1613
1611
|
/**
|
|
@@ -1624,7 +1622,10 @@ export declare enum FileOperationKind {
|
|
|
1624
1622
|
FileCopied = "fileCopied",
|
|
1625
1623
|
FilesCopied = "filesCopied",
|
|
1626
1624
|
FileMoved = "fileMoved",
|
|
1627
|
-
FilesMoved = "filesMoved"
|
|
1625
|
+
FilesMoved = "filesMoved",
|
|
1626
|
+
/** A copy whose every item landed in its own source folder (Duplicate). */
|
|
1627
|
+
FileDuplicated = "fileDuplicated",
|
|
1628
|
+
FilesDuplicated = "filesDuplicated"
|
|
1628
1629
|
}
|
|
1629
1630
|
|
|
1630
1631
|
/**
|
|
@@ -1639,13 +1640,15 @@ export declare interface FileOperationSuccessEvent {
|
|
|
1639
1640
|
name?: string;
|
|
1640
1641
|
/** Number of items the operation covered, when applicable. */
|
|
1641
1642
|
count?: number;
|
|
1642
|
-
/**
|
|
1643
|
+
/**
|
|
1644
|
+
* Destination folder as a slash-joined virtual path starting at the root
|
|
1645
|
+
* label (e.g. `My files/reports`), for copy/move/duplicate operations.
|
|
1646
|
+
*/
|
|
1643
1647
|
destinationFolderName?: string;
|
|
1644
1648
|
/**
|
|
1645
|
-
* Whether the affected item is a folder rather than a file.
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
* "File renamed").
|
|
1649
|
+
* Whether the affected item is a folder rather than a file. Set for rename,
|
|
1650
|
+
* copy, move, and duplicate events; on a multi-item event it describes the
|
|
1651
|
+
* first successfully affected item (the one `name` refers to).
|
|
1649
1652
|
*/
|
|
1650
1653
|
isFolder?: boolean;
|
|
1651
1654
|
}
|
|
@@ -2619,6 +2622,7 @@ export declare interface ModelCapabilities {
|
|
|
2619
2622
|
hasResume?: boolean;
|
|
2620
2623
|
hasChatCompletion?: boolean;
|
|
2621
2624
|
hasResponsesApi?: boolean;
|
|
2625
|
+
hasSkills?: boolean;
|
|
2622
2626
|
reasoningEfforts?: string[];
|
|
2623
2627
|
}
|
|
2624
2628
|
|
|
@@ -4355,7 +4359,7 @@ export declare enum UnsupportedTriggerReason {
|
|
|
4355
4359
|
MissingRequiredFields = "missingRequiredFields"
|
|
4356
4360
|
}
|
|
4357
4361
|
|
|
4358
|
-
export declare const updateEntry: (prev: FileUploadBatchState | null,
|
|
4362
|
+
export declare const updateEntry: (prev: FileUploadBatchState | null, id: string, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
|
|
4359
4363
|
|
|
4360
4364
|
/** Max number of files uploaded concurrently within a single upload batch. */
|
|
4361
4365
|
export declare const UPLOAD_CONCURRENCY = 3;
|
|
@@ -5292,7 +5296,9 @@ export declare interface UseDialFileManagerResult {
|
|
|
5292
5296
|
uploadBatchState: FileUploadBatchState | null;
|
|
5293
5297
|
/** Upload: abort all in-flight and queued uploads. */
|
|
5294
5298
|
cancelUpload: () => void;
|
|
5295
|
-
/** Upload:
|
|
5299
|
+
/** Upload: abort one queued or in-flight upload by its entry id. */
|
|
5300
|
+
cancelUploadFile: (id: string) => void;
|
|
5301
|
+
/** Upload: empty the upload queue. */
|
|
5296
5302
|
clearUploadBatch: () => void;
|
|
5297
5303
|
/** Folder creation: called when user confirms a new folder name. */
|
|
5298
5304
|
onCreateFolder: (file: DialUploadFileItem, folderPath: string, fileId: string) => Promise<void>;
|
|
@@ -5359,7 +5365,7 @@ export declare interface UseDialFileManagerResult {
|
|
|
5359
5365
|
/**
|
|
5360
5366
|
* True while any mutating file-manager operation is in flight: the OR of
|
|
5361
5367
|
* `isCreatingFolder`, `isDownloading`, `isDeleting`, `isRenaming`, `isCopying`,
|
|
5362
|
-
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and
|
|
5368
|
+
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and any upload still queued or running.
|
|
5363
5369
|
*
|
|
5364
5370
|
* Deliberately excludes three flags, each already fully contained by its own
|
|
5365
5371
|
* scoped loading UI:
|
|
@@ -5505,10 +5511,11 @@ export declare interface UseDialFileSharingResult {
|
|
|
5505
5511
|
|
|
5506
5512
|
/**
|
|
5507
5513
|
* Manages upload batches (single-file and ZIP-archive extraction), including
|
|
5508
|
-
* concurrency-limited progress tracking and abort.
|
|
5509
|
-
*
|
|
5510
|
-
* `
|
|
5511
|
-
* cache
|
|
5514
|
+
* concurrency-limited progress tracking and per-file abort. A batch started
|
|
5515
|
+
* while another is on screen is appended to it, and settled entries stay in
|
|
5516
|
+
* `uploadBatchState` until `clearUploadBatch`. Invalidates the shared listing
|
|
5517
|
+
* cache for the destination folder through `invalidateFolders`/`bumpRetry`
|
|
5518
|
+
* after a batch settles — it never holds its own copy of the cache.
|
|
5512
5519
|
*/
|
|
5513
5520
|
export declare const useDialFileUploadBatch: ({ filesApi, bucket, rootLabel, activeTab, cache, sharedRootMetaRef, invalidateFolders, bumpRetry, onNotification, }: UseDialFileUploadBatchOptions) => UseDialFileUploadBatchResult;
|
|
5514
5521
|
|
|
@@ -5541,6 +5548,7 @@ export declare interface UseDialFileUploadBatchResult {
|
|
|
5541
5548
|
onValidateUpload: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => Promise<FileUploadValidationResult>;
|
|
5542
5549
|
uploadBatchState: FileUploadBatchState | null;
|
|
5543
5550
|
cancelUpload: () => void;
|
|
5551
|
+
cancelUploadFile: (id: string) => void;
|
|
5544
5552
|
clearUploadBatch: () => void;
|
|
5545
5553
|
}
|
|
5546
5554
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.173",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@epam/ai-dial-chat-api-client": "1.2.0-dev.
|
|
114
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.173",
|
|
115
115
|
"dompurify": "3.4.15",
|
|
116
116
|
"fflate": "^0.8.3",
|
|
117
117
|
"lru-cache": "^10.4.3",
|
|
@@ -120,22 +120,22 @@
|
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"react": "^19.2.8",
|
|
123
|
-
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.
|
|
124
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
125
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
126
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
127
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
128
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
129
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
130
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
131
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
123
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.173",
|
|
124
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.173",
|
|
125
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.173",
|
|
126
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.173",
|
|
127
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.173",
|
|
128
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.173",
|
|
129
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.173",
|
|
130
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.173",
|
|
131
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.173",
|
|
132
132
|
"@epam/ai-dial-react-file-manager": "^0.3.0-dev.13",
|
|
133
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
134
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
135
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
136
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
137
|
-
"@epam/ai-dial-ui-kit": "^0.15.0-dev.
|
|
138
|
-
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.
|
|
133
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.173",
|
|
134
|
+
"@epam/ai-dial-share": "1.2.0-dev.173",
|
|
135
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.173",
|
|
136
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.173",
|
|
137
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.21",
|
|
138
|
+
"@epam/ai-dial-usage-dashboard": "1.2.0-dev.173",
|
|
139
139
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
140
140
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
141
141
|
"@mcp-ui/client": "^7.1.1"
|