@epam/ai-dial-chat-hooks 1.2.0-dev.170 → 1.2.0-dev.174
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/conversation/message-utils.js +44 -2
- package/conversation.d.ts +33 -0
- package/conversation.js +26 -26
- 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 +58 -17
- package/index.js +95 -95
- 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
|
|
|
@@ -9,6 +9,48 @@ var i = (t, n, r, i) => i && n === r - 1 && t.role === e.Assistant, a = (e) => {
|
|
|
9
9
|
return null;
|
|
10
10
|
}, o = (t) => t.role === e.Assistant && (t.custom_content?.stages?.length ?? 0) > 0, s = (t) => {
|
|
11
11
|
for (let n = t.length - 1; n >= 0; n--) if (t[n].role === e.User) return t[n].custom_content?.configuration_value;
|
|
12
|
-
}, c = (e) =>
|
|
12
|
+
}, c = (e) => {
|
|
13
|
+
if (typeof e.default == "boolean") return e.default;
|
|
14
|
+
let t = e.oneOf;
|
|
15
|
+
if (Array.isArray(t) && t.length === 1) {
|
|
16
|
+
let e = t[0];
|
|
17
|
+
if (typeof e == "object" && e && "const" in e && typeof e.const == "boolean") return e.const;
|
|
18
|
+
}
|
|
19
|
+
}, l = (e) => {
|
|
20
|
+
let t = e?.properties;
|
|
21
|
+
if (t == null) return;
|
|
22
|
+
let n = Object.entries(t).flatMap(([e, t]) => {
|
|
23
|
+
let n = c(t);
|
|
24
|
+
return n === void 0 ? [] : [[e, n]];
|
|
25
|
+
});
|
|
26
|
+
return n.length > 0 ? Object.fromEntries(n) : void 0;
|
|
27
|
+
}, u = (t) => {
|
|
28
|
+
let n = -1;
|
|
29
|
+
for (let r = t.length - 1; r >= 0; r--) if (t[r].role === e.User) {
|
|
30
|
+
n = r;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
let r = t[n]?.custom_content?.configuration_value;
|
|
34
|
+
for (let i = n + 1; i < t.length; i++) {
|
|
35
|
+
let n = t[i];
|
|
36
|
+
if (n.role !== e.Assistant) continue;
|
|
37
|
+
let a = l(n.custom_content?.form_schema);
|
|
38
|
+
a && (r = {
|
|
39
|
+
...r,
|
|
40
|
+
...a
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return r;
|
|
44
|
+
}, d = (t, n, r) => {
|
|
45
|
+
let i = n.length - 1, a = n[i];
|
|
46
|
+
if (a?.role !== e.Assistant) return;
|
|
47
|
+
let o = l(a.custom_content?.form_schema);
|
|
48
|
+
if (!o) return;
|
|
49
|
+
let s = Object.fromEntries(r.filter((e) => e in o).sort().map((e) => [e, o[e]]));
|
|
50
|
+
if (Object.keys(s).length !== 0) return {
|
|
51
|
+
key: `${t}|${i}|${JSON.stringify(s)}`,
|
|
52
|
+
values: s
|
|
53
|
+
};
|
|
54
|
+
}, f = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? t.PlainText : t.Markdown;
|
|
13
55
|
//#endregion
|
|
14
|
-
export { a as getLastDeploymentId, s as getLastUserMessageToolConfiguration, i as isMessageStreaming, o as messageHasStages,
|
|
56
|
+
export { d as getFormSchemaToolSyncKey, a as getLastDeploymentId, s as getLastUserMessageToolConfiguration, u as getLatestToolConfiguration, l as getToolConfigurationFromFormSchema, i as isMessageStreaming, o as messageHasStages, f as normalizeResponseFormat };
|
package/conversation.d.ts
CHANGED
|
@@ -424,6 +424,21 @@ export declare const getConversationPath: (conversationId: string) => string;
|
|
|
424
424
|
*/
|
|
425
425
|
export declare const getConversationSource: (item: Pick<ConversationListItemDto, "sharedWithMe" | "publishedWithMe">) => FilterTab;
|
|
426
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Returns the tool values the conversation's last message sets through its
|
|
429
|
+
* `form_schema`, restricted to `toolIds`, plus a key identifying that exact
|
|
430
|
+
* application. `undefined` when the last message is not an assistant message
|
|
431
|
+
* or sets no known tool.
|
|
432
|
+
*
|
|
433
|
+
* Streamed chunks and reloads re-create an identical `form_schema`; comparing
|
|
434
|
+
* keys rather than object identity applies an app's value once and leaves a
|
|
435
|
+
* later user toggle alone until the app sends a different value.
|
|
436
|
+
*/
|
|
437
|
+
export declare const getFormSchemaToolSyncKey: (conversationId: string, messages: Message[], toolIds: readonly string[]) => {
|
|
438
|
+
key: string;
|
|
439
|
+
values: Record<string, boolean>;
|
|
440
|
+
} | undefined;
|
|
441
|
+
|
|
427
442
|
/**
|
|
428
443
|
* Returns the deployment the conversation was last running on: scanning
|
|
429
444
|
* backwards, the `new_deployment_id` of a `model_changed` status message or
|
|
@@ -447,6 +462,15 @@ export declare const getLastDeploymentId: (messages: Message[]) => string | null
|
|
|
447
462
|
*/
|
|
448
463
|
export declare const getLastUserMessageToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
449
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Returns the tool configuration a (re-)loaded conversation should show: the
|
|
467
|
+
* last user message's `configuration_value`, overlaid in order by the
|
|
468
|
+
* `form_schema` values of the assistant messages after it. An app that turned
|
|
469
|
+
* a toggle off in its final response must not see it re-armed on reload just
|
|
470
|
+
* because the user message that started the run had it on.
|
|
471
|
+
*/
|
|
472
|
+
export declare const getLatestToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
473
|
+
|
|
450
474
|
/**
|
|
451
475
|
* Extracts the deployment/model ID from a DIAL Core conversation ID.
|
|
452
476
|
*
|
|
@@ -530,6 +554,15 @@ export declare const getStarterSubmitText: (starter: StarterOption, description?
|
|
|
530
554
|
*/
|
|
531
555
|
export declare const getTimeOfDayGreeting: (hour: number, translations: GreetingTranslations, firstName?: string) => string;
|
|
532
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Returns the boolean values an assistant message's `form_schema` sets, keyed
|
|
559
|
+
* by property name, or `undefined` when no property resolves to a boolean.
|
|
560
|
+
* Lets a DIAL app switch a tools-menu toggle (e.g. `deep_research`) per
|
|
561
|
+
* message — on while a run is in progress, off once its result is delivered.
|
|
562
|
+
* Not filtered by tool id: `restoreToolConfiguration` ignores unknown ids.
|
|
563
|
+
*/
|
|
564
|
+
export declare const getToolConfigurationFromFormSchema: (formSchema: DeploymentConfigurationSchema | undefined) => Record<string, boolean> | undefined;
|
|
565
|
+
|
|
533
566
|
/** Pre-translated greeting phrase strings for each time-of-day period. */
|
|
534
567
|
export declare interface GreetingTranslations {
|
|
535
568
|
morningWithName: string;
|
package/conversation.js
CHANGED
|
@@ -5,29 +5,29 @@ import { formatAppVersion as m, sanitizeFooterHtml as h } from "./conversation/f
|
|
|
5
5
|
import { getModelIdFromConversationId as g } from "./conversation/get-model-id-from-conversation-id.js";
|
|
6
6
|
import { getTimeOfDayGreeting as _ } from "./conversation/greeting.js";
|
|
7
7
|
import { createDeploymentChangedMessage as v } from "./conversation/message-factory.js";
|
|
8
|
-
import {
|
|
9
|
-
import { getQuickAppConversationStarters as
|
|
10
|
-
import { mapStages as
|
|
11
|
-
import { getStarterPopulateText as
|
|
12
|
-
import { deriveConversationRowActionState as
|
|
13
|
-
import { useActiveConversationSync as
|
|
14
|
-
import { useAsyncConfirmDialog as
|
|
15
|
-
import { useConversationLookupMaps as
|
|
16
|
-
import { getConversationSource as
|
|
17
|
-
import { useImportFilePicker as
|
|
18
|
-
import { useMessageSelectionReply as
|
|
19
|
-
import { useAttachmentUpload as
|
|
20
|
-
import { AudioTranscriptionError as
|
|
21
|
-
import { useTranscribeAudio as
|
|
22
|
-
import { attachmentToDto as
|
|
23
|
-
import { createMessagePair as
|
|
24
|
-
import { hasActiveToolConfig as
|
|
25
|
-
import { getStarterConversationText as
|
|
26
|
-
import { getConversationPath as
|
|
27
|
-
import { useConversationHandlers as
|
|
28
|
-
import { applyChunkToMessages as
|
|
29
|
-
import { isAwaitingGenerationResume as
|
|
30
|
-
import { useConversationStream as
|
|
31
|
-
import { useChatSettingsFormConfig as
|
|
32
|
-
import { useToolsMenu as
|
|
33
|
-
export {
|
|
8
|
+
import { getFormSchemaToolSyncKey as y, getLastDeploymentId as b, getLastUserMessageToolConfiguration as x, getLatestToolConfiguration as S, getToolConfigurationFromFormSchema as C, isMessageStreaming as w, messageHasStages as T, normalizeResponseFormat as E } from "./conversation/message-utils.js";
|
|
9
|
+
import { getQuickAppConversationStarters as D } from "./conversation/quick-app-conversation-starters.js";
|
|
10
|
+
import { mapStages as O, toStage as k } from "./conversation/stage.js";
|
|
11
|
+
import { getStarterPopulateText as A, getStartersFromSchema as j } from "./conversation/starter-option.js";
|
|
12
|
+
import { deriveConversationRowActionState as M } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
|
|
13
|
+
import { useActiveConversationSync as N } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
|
|
14
|
+
import { useAsyncConfirmDialog as P } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
|
|
15
|
+
import { useConversationLookupMaps as F } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
|
|
16
|
+
import { getConversationSource as I, useConversationPanelItems as L } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
|
|
17
|
+
import { useImportFilePicker as R } from "./conversation/useImportFilePicker/useImportFilePicker.js";
|
|
18
|
+
import { useMessageSelectionReply as z } from "./conversation/useMessageSelectionReply/useMessageSelectionReply.js";
|
|
19
|
+
import { useAttachmentUpload as B } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
|
|
20
|
+
import { AudioTranscriptionError as V, AudioTranscriptionErrorReason as H } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
|
|
21
|
+
import { useTranscribeAudio as U } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
|
|
22
|
+
import { attachmentToDto as W, attachmentsToDtos as G } from "./conversation/useConversationHandlers/attachment-to-dto.js";
|
|
23
|
+
import { createMessagePair as K } from "./conversation/useConversationHandlers/message-factory.js";
|
|
24
|
+
import { hasActiveToolConfig as q, isAnswerIncomplete as J, isMessageChanged as Y, shouldRerunGenerationOnEdit as X } from "./conversation/useConversationHandlers/message-utils.js";
|
|
25
|
+
import { getStarterConversationText as Z, getStarterDisplayText as Q, getStarterSubmitText as $ } from "./conversation/useConversationHandlers/starter-option.js";
|
|
26
|
+
import { getConversationPath as ee } from "./conversation/useConversationStream/conversation-path.js";
|
|
27
|
+
import { useConversationHandlers as te } from "./conversation/useConversationHandlers/useConversationHandlers.js";
|
|
28
|
+
import { applyChunkToMessages as ne, mergeStages as re } from "./conversation/useConversationStream/apply-chunk.js";
|
|
29
|
+
import { isAwaitingGenerationResume as ie } from "./conversation/useConversationStream/generation-resume.js";
|
|
30
|
+
import { useConversationStream as ae } from "./conversation/useConversationStream/useConversationStream.js";
|
|
31
|
+
import { useChatSettingsFormConfig as oe } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
|
|
32
|
+
import { useToolsMenu as se } from "./useToolsMenu/useToolsMenu.js";
|
|
33
|
+
export { V as AudioTranscriptionError, H as AudioTranscriptionErrorReason, a as DEFAULT_GENERATION_CONFLICT_MESSAGE, o as DEFAULT_GENERATION_PERSISTENCE_ERROR_MESSAGE, s as DEFAULT_STREAM_IDLE_TIMEOUT_MS, c as GenerationConflictError, l as GenerationPersistenceError, u as StreamInterruptedError, d as StreamUpstreamError, ne as applyChunkToMessages, W as attachmentToDto, G as attachmentsToDtos, e as buildAnnouncementSignature, f as createChatStreamApi, v as createDeploymentChangedMessage, K as createMessagePair, M as deriveConversationRowActionState, m as formatAppVersion, ee as getConversationPath, I as getConversationSource, y as getFormSchemaToolSyncKey, b as getLastDeploymentId, x as getLastUserMessageToolConfiguration, S as getLatestToolConfiguration, g as getModelIdFromConversationId, D as getQuickAppConversationStarters, Z as getStarterConversationText, Q as getStarterDisplayText, A as getStarterPopulateText, $ as getStarterSubmitText, j as getStartersFromSchema, _ as getTimeOfDayGreeting, C as getToolConfigurationFromFormSchema, q as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, J as isAnswerIncomplete, ie as isAwaitingGenerationResume, Y as isMessageChanged, w as isMessageStreaming, O as mapStages, re as mergeStages, T as messageHasStages, E as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, h as sanitizeFooterHtml, X as shouldRerunGenerationOnEdit, p as shouldWatchForDisplayNameUpdate, k as toStage, N as useActiveConversationSync, P as useAsyncConfirmDialog, B as useAttachmentUpload, oe as useChatSettingsFormConfig, te as useConversationHandlers, F as useConversationLookupMaps, L as useConversationPanelItems, ae as useConversationStream, R as useImportFilePicker, z as useMessageSelectionReply, se as useToolsMenu, U as useTranscribeAudio };
|
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 };
|