@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
|
@@ -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
|
}
|
|
@@ -1798,6 +1801,21 @@ export declare const getConversationSource: (item: Pick<ConversationListItemDto,
|
|
|
1798
1801
|
*/
|
|
1799
1802
|
export declare const getExternalServiceFallbackName: (serviceName: string) => string;
|
|
1800
1803
|
|
|
1804
|
+
/**
|
|
1805
|
+
* Returns the tool values the conversation's last message sets through its
|
|
1806
|
+
* `form_schema`, restricted to `toolIds`, plus a key identifying that exact
|
|
1807
|
+
* application. `undefined` when the last message is not an assistant message
|
|
1808
|
+
* or sets no known tool.
|
|
1809
|
+
*
|
|
1810
|
+
* Streamed chunks and reloads re-create an identical `form_schema`; comparing
|
|
1811
|
+
* keys rather than object identity applies an app's value once and leaves a
|
|
1812
|
+
* later user toggle alone until the app sends a different value.
|
|
1813
|
+
*/
|
|
1814
|
+
export declare const getFormSchemaToolSyncKey: (conversationId: string, messages: Message[], toolIds: readonly string[]) => {
|
|
1815
|
+
key: string;
|
|
1816
|
+
values: Record<string, boolean>;
|
|
1817
|
+
} | undefined;
|
|
1818
|
+
|
|
1801
1819
|
/**
|
|
1802
1820
|
* Returns the deployment the conversation was last running on: scanning
|
|
1803
1821
|
* backwards, the `new_deployment_id` of a `model_changed` status message or
|
|
@@ -1821,6 +1839,15 @@ export declare const getLastDeploymentId: (messages: Message[]) => string | null
|
|
|
1821
1839
|
*/
|
|
1822
1840
|
export declare const getLastUserMessageToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
1823
1841
|
|
|
1842
|
+
/**
|
|
1843
|
+
* Returns the tool configuration a (re-)loaded conversation should show: the
|
|
1844
|
+
* last user message's `configuration_value`, overlaid in order by the
|
|
1845
|
+
* `form_schema` values of the assistant messages after it. An app that turned
|
|
1846
|
+
* a toggle off in its final response must not see it re-armed on reload just
|
|
1847
|
+
* because the user message that started the run had it on.
|
|
1848
|
+
*/
|
|
1849
|
+
export declare const getLatestToolConfiguration: (messages: Message[]) => Record<string, unknown> | undefined;
|
|
1850
|
+
|
|
1824
1851
|
/**
|
|
1825
1852
|
* Extracts the deployment/model ID from a DIAL Core conversation ID.
|
|
1826
1853
|
*
|
|
@@ -1924,6 +1951,15 @@ export declare const getStarterSubmitText: (starter: StarterOption, description?
|
|
|
1924
1951
|
*/
|
|
1925
1952
|
export declare const getTimeOfDayGreeting: (hour: number, translations: GreetingTranslations, firstName?: string) => string;
|
|
1926
1953
|
|
|
1954
|
+
/**
|
|
1955
|
+
* Returns the boolean values an assistant message's `form_schema` sets, keyed
|
|
1956
|
+
* by property name, or `undefined` when no property resolves to a boolean.
|
|
1957
|
+
* Lets a DIAL app switch a tools-menu toggle (e.g. `deep_research`) per
|
|
1958
|
+
* message — on while a run is in progress, off once its result is delivered.
|
|
1959
|
+
* Not filtered by tool id: `restoreToolConfiguration` ignores unknown ids.
|
|
1960
|
+
*/
|
|
1961
|
+
export declare const getToolConfigurationFromFormSchema: (formSchema: DeploymentConfigurationSchema | undefined) => Record<string, boolean> | undefined;
|
|
1962
|
+
|
|
1927
1963
|
/** Name of the same-origin `BroadcastChannel` shared by an OAuth flow's opener and its callback popup. */
|
|
1928
1964
|
export declare const getToolsetOAuthChannelName: (flowId: string) => string;
|
|
1929
1965
|
|
|
@@ -2619,6 +2655,7 @@ export declare interface ModelCapabilities {
|
|
|
2619
2655
|
hasResume?: boolean;
|
|
2620
2656
|
hasChatCompletion?: boolean;
|
|
2621
2657
|
hasResponsesApi?: boolean;
|
|
2658
|
+
hasSkills?: boolean;
|
|
2622
2659
|
reasoningEfforts?: string[];
|
|
2623
2660
|
}
|
|
2624
2661
|
|
|
@@ -4355,7 +4392,7 @@ export declare enum UnsupportedTriggerReason {
|
|
|
4355
4392
|
MissingRequiredFields = "missingRequiredFields"
|
|
4356
4393
|
}
|
|
4357
4394
|
|
|
4358
|
-
export declare const updateEntry: (prev: FileUploadBatchState | null,
|
|
4395
|
+
export declare const updateEntry: (prev: FileUploadBatchState | null, id: string, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
|
|
4359
4396
|
|
|
4360
4397
|
/** Max number of files uploaded concurrently within a single upload batch. */
|
|
4361
4398
|
export declare const UPLOAD_CONCURRENCY = 3;
|
|
@@ -5292,7 +5329,9 @@ export declare interface UseDialFileManagerResult {
|
|
|
5292
5329
|
uploadBatchState: FileUploadBatchState | null;
|
|
5293
5330
|
/** Upload: abort all in-flight and queued uploads. */
|
|
5294
5331
|
cancelUpload: () => void;
|
|
5295
|
-
/** Upload:
|
|
5332
|
+
/** Upload: abort one queued or in-flight upload by its entry id. */
|
|
5333
|
+
cancelUploadFile: (id: string) => void;
|
|
5334
|
+
/** Upload: empty the upload queue. */
|
|
5296
5335
|
clearUploadBatch: () => void;
|
|
5297
5336
|
/** Folder creation: called when user confirms a new folder name. */
|
|
5298
5337
|
onCreateFolder: (file: DialUploadFileItem, folderPath: string, fileId: string) => Promise<void>;
|
|
@@ -5359,7 +5398,7 @@ export declare interface UseDialFileManagerResult {
|
|
|
5359
5398
|
/**
|
|
5360
5399
|
* True while any mutating file-manager operation is in flight: the OR of
|
|
5361
5400
|
* `isCreatingFolder`, `isDownloading`, `isDeleting`, `isRenaming`, `isCopying`,
|
|
5362
|
-
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and
|
|
5401
|
+
* `isMoving`, `isUnsharing`, `isRemovingAccess`, and any upload still queued or running.
|
|
5363
5402
|
*
|
|
5364
5403
|
* Deliberately excludes three flags, each already fully contained by its own
|
|
5365
5404
|
* scoped loading UI:
|
|
@@ -5505,10 +5544,11 @@ export declare interface UseDialFileSharingResult {
|
|
|
5505
5544
|
|
|
5506
5545
|
/**
|
|
5507
5546
|
* Manages upload batches (single-file and ZIP-archive extraction), including
|
|
5508
|
-
* concurrency-limited progress tracking and abort.
|
|
5509
|
-
*
|
|
5510
|
-
* `
|
|
5511
|
-
* cache
|
|
5547
|
+
* concurrency-limited progress tracking and per-file abort. A batch started
|
|
5548
|
+
* while another is on screen is appended to it, and settled entries stay in
|
|
5549
|
+
* `uploadBatchState` until `clearUploadBatch`. Invalidates the shared listing
|
|
5550
|
+
* cache for the destination folder through `invalidateFolders`/`bumpRetry`
|
|
5551
|
+
* after a batch settles — it never holds its own copy of the cache.
|
|
5512
5552
|
*/
|
|
5513
5553
|
export declare const useDialFileUploadBatch: ({ filesApi, bucket, rootLabel, activeTab, cache, sharedRootMetaRef, invalidateFolders, bumpRetry, onNotification, }: UseDialFileUploadBatchOptions) => UseDialFileUploadBatchResult;
|
|
5514
5554
|
|
|
@@ -5541,6 +5581,7 @@ export declare interface UseDialFileUploadBatchResult {
|
|
|
5541
5581
|
onValidateUpload: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => Promise<FileUploadValidationResult>;
|
|
5542
5582
|
uploadBatchState: FileUploadBatchState | null;
|
|
5543
5583
|
cancelUpload: () => void;
|
|
5584
|
+
cancelUploadFile: (id: string) => void;
|
|
5544
5585
|
clearUploadBatch: () => void;
|
|
5545
5586
|
}
|
|
5546
5587
|
|