@epam/ai-dial-chat-hooks 1.3.0-dev.282 → 1.3.0-dev.289
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/api-error/api-error.d.ts +2 -0
- package/api-error/api-error.d.ts.map +1 -1
- package/api-error/api-error.js +31 -23
- package/catalog/map-skill-to-catalog-item.js +19 -19
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts +2 -4
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +94 -112
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts +41 -0
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts.map +1 -0
- package/catalog/useCatalogItemDelete/useCatalogItemDelete.js +37 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +32 -29
- package/catalog.js +11 -10
- package/conversation/conversation-title-stream.d.ts +33 -0
- package/conversation/conversation-title-stream.d.ts.map +1 -0
- package/conversation/conversation-title-stream.js +103 -0
- package/conversation/useConversationExport/useConversationExport.js +46 -46
- package/conversation/useConversationHandlers/useConversationHandlers.js +39 -39
- package/conversation/useConversationStream/useConversationStream.js +93 -93
- package/conversation.js +5 -4
- package/entry-points/catalog.d.ts +1 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/conversation.d.ts +1 -0
- package/entry-points/conversation.d.ts.map +1 -1
- package/entry-points/project.d.ts +3 -0
- package/entry-points/project.d.ts.map +1 -1
- package/files/dial-file-manager-copy-move.util.js +16 -16
- package/files/dial-file-manager-mapping.util.js +17 -17
- package/files/useDialFileListing/useDialFileListing.js +113 -113
- package/files/useDialFileMutations/useDialFileMutations.js +47 -47
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -1
- package/index.js +213 -208
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts +7 -1
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
- package/oauth/useToolsetLogin/useToolsetLogin.js +40 -21
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +10 -10
- package/package.json +18 -18
- package/project/project-events.d.ts +2 -2
- package/project/project-events.d.ts.map +1 -1
- package/project/project-events.js +3 -2
- package/project/project-mapping.js +12 -12
- package/project/project-refresh.d.ts +12 -0
- package/project/project-refresh.d.ts.map +1 -0
- package/project/project-refresh.js +6 -0
- package/project/project-watch-stream.d.ts +26 -0
- package/project/project-watch-stream.d.ts.map +1 -0
- package/project/project-watch-stream.js +39 -0
- package/project/projects-api-client.d.ts +6 -0
- package/project/projects-api-client.d.ts.map +1 -1
- package/project/projects-api-client.js +1 -0
- package/project/use-project-actions.js +12 -12
- package/project/use-project-conversations.d.ts +8 -6
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +129 -56
- package/project/use-project-watch.d.ts +24 -0
- package/project/use-project-watch.d.ts.map +1 -0
- package/project/use-project-watch.js +41 -0
- package/project/use-project.d.ts +4 -1
- package/project/use-project.d.ts.map +1 -1
- package/project/use-project.js +47 -22
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +49 -68
- package/project.js +8 -5
- package/prompt/prompt.d.ts +11 -0
- package/prompt/prompt.d.ts.map +1 -1
- package/prompt/prompt.js +7 -3
- package/scheduled-task/use-scheduled-task-runs.js +13 -13
- package/shared/serialized-writer.d.ts +10 -0
- package/shared/serialized-writer.d.ts.map +1 -0
- package/shared/serialized-writer.js +35 -0
- package/usage/map-user-usage-to-model-limits.js +21 -21
- package/useShareLink/useShareLink.js +18 -18
- package/utils.js +21 -21
|
@@ -4,7 +4,10 @@ export * from '../project/project-limits';
|
|
|
4
4
|
export * from '../project/project-form-errors';
|
|
5
5
|
export * from '../project/use-projects';
|
|
6
6
|
export * from '../project/use-project';
|
|
7
|
+
export * from '../project/use-project-watch';
|
|
8
|
+
export * from '../project/project-refresh';
|
|
7
9
|
export * from '../project/use-project-submit';
|
|
8
10
|
export * from '../project/use-project-conversations';
|
|
9
11
|
export * from '../project/use-project-actions';
|
|
12
|
+
export * from '../shared/serialized-writer';
|
|
10
13
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/entry-points/project.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/entry-points/project.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { getVirtualPathName as e } from "./dial-file-manager-path.util.js";
|
|
2
2
|
import { virtualPathToApiPath as t } from "./resolve-dial-file-api-path.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CopyItemDtoNodeTypeEnum as n, MoveItemDtoNodeTypeEnum as r, RenameItemDtoNodeTypeEnum as i } from "@epam/ai-dial-chat-api-client";
|
|
4
|
+
import { getParentFolderPath as a } from "@epam/ai-dial-chat-shared";
|
|
5
5
|
import { DialFileNodeType as o } from "@epam/ai-dial-react-file-manager";
|
|
6
6
|
//#region src/files/dial-file-manager-copy-move.util.ts
|
|
7
|
-
var s = (
|
|
8
|
-
let s =
|
|
7
|
+
var s = (r, i, a) => r.map((r) => {
|
|
8
|
+
let s = r.nodeType === o.FOLDER, c = t(r.sourceUrl, a), l = t(r.destinationUrl, a), u = e(r.sourceUrl, c);
|
|
9
9
|
return {
|
|
10
|
-
destinationName: e(
|
|
10
|
+
destinationName: e(r.destinationUrl, l),
|
|
11
11
|
dto: {
|
|
12
12
|
bucket: i,
|
|
13
13
|
sourcePath: s ? c.endsWith("/") ? c : `${c}/` : c.replace(/\/$/, ""),
|
|
14
14
|
destinationPath: s ? l.endsWith("/") ? l : `${l}/` : l.replace(/\/$/, ""),
|
|
15
|
-
overwrite:
|
|
16
|
-
nodeType: s ?
|
|
15
|
+
overwrite: r.overwrite === !0,
|
|
16
|
+
nodeType: s ? n.Folder : n.Item,
|
|
17
17
|
name: u
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
}), c = (
|
|
21
|
-
let l =
|
|
22
|
-
let
|
|
20
|
+
}), c = (n, s, c) => {
|
|
21
|
+
let l = n.map((n) => {
|
|
22
|
+
let r = n.nodeType === o.FOLDER, i = t(n.sourceUrl, c), s = t(n.destinationUrl, c), l = e(n.sourceUrl, i), u = e(n.destinationUrl, s), d = r ? i.endsWith("/") ? i : `${i}/` : i.replace(/\/$/, ""), f = r ? s.endsWith("/") ? s : `${s}/` : s.replace(/\/$/, "");
|
|
23
23
|
return {
|
|
24
|
-
isFolder:
|
|
24
|
+
isFolder: r,
|
|
25
25
|
name: l,
|
|
26
26
|
destinationName: u,
|
|
27
|
-
overwrite:
|
|
27
|
+
overwrite: n.overwrite === !0,
|
|
28
28
|
sourcePath: d,
|
|
29
29
|
destinationPath: f,
|
|
30
|
-
sourceParent:
|
|
31
|
-
destinationParent:
|
|
30
|
+
sourceParent: a(d),
|
|
31
|
+
destinationParent: a(f)
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
34
|
return {
|
|
@@ -36,7 +36,7 @@ var s = (n, i, a) => n.map((n) => {
|
|
|
36
36
|
bucket: s,
|
|
37
37
|
sourcePath: e.sourcePath,
|
|
38
38
|
destinationPath: e.destinationPath,
|
|
39
|
-
nodeType: e.isFolder ?
|
|
39
|
+
nodeType: e.isFolder ? i.Folder : i.Item,
|
|
40
40
|
name: e.name
|
|
41
41
|
})),
|
|
42
42
|
preparedMoveItems: l.filter((e) => e.sourceParent !== e.destinationParent).map((e) => ({
|
|
@@ -46,7 +46,7 @@ var s = (n, i, a) => n.map((n) => {
|
|
|
46
46
|
sourcePath: e.sourcePath,
|
|
47
47
|
destinationPath: e.destinationPath,
|
|
48
48
|
overwrite: e.overwrite,
|
|
49
|
-
nodeType: e.isFolder ?
|
|
49
|
+
nodeType: e.isFolder ? r.Folder : r.Item,
|
|
50
50
|
name: e.name
|
|
51
51
|
}
|
|
52
52
|
}))
|
|
@@ -3,8 +3,8 @@ import { safeDecodeURI as t } from "../shared/string-utils.js";
|
|
|
3
3
|
import { CORE_PERMISSION_MAP as n } from "./dial-file-manager.model.js";
|
|
4
4
|
import { buildSharedItemVirtualPath as r, dialCorePathToRelative as i } from "./dial-file-manager-path.util.js";
|
|
5
5
|
import { UploadNetworkError as a } from "./create-upload-file-with-progress.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ListFilesItemDtoNodeTypeEnum as o } from "@epam/ai-dial-chat-api-client";
|
|
7
|
+
import { FileUploadFailureReason as s } from "@epam/ai-dial-chat-shared";
|
|
8
8
|
import { DialFileManagerTabs as c, DialFileNodeType as l } from "@epam/ai-dial-react-file-manager";
|
|
9
9
|
//#region src/files/dial-file-manager-mapping.util.ts
|
|
10
10
|
var u = (e) => {
|
|
@@ -17,9 +17,9 @@ var u = (e) => {
|
|
|
17
17
|
}, f = (e, t, n, r, i) => {
|
|
18
18
|
let a = e.get(n);
|
|
19
19
|
if (a == null) return [];
|
|
20
|
-
let
|
|
20
|
+
let s = r.replace(/\/$/, "");
|
|
21
21
|
return a.map((a) => {
|
|
22
|
-
let c = a.nodeType ===
|
|
22
|
+
let c = a.nodeType === o.Folder, d = a.name, p = c ? `${s}/${d}/` : `${s}/${d}`, m = {
|
|
23
23
|
id: a.path,
|
|
24
24
|
name: d,
|
|
25
25
|
path: p,
|
|
@@ -41,17 +41,17 @@ var u = (e) => {
|
|
|
41
41
|
return m;
|
|
42
42
|
});
|
|
43
43
|
}, p = (e, t, n, r) => {
|
|
44
|
-
let i = new Map(e), a = [...i.get(t) ?? []],
|
|
44
|
+
let i = new Map(e), a = [...i.get(t) ?? []], s = {
|
|
45
45
|
name: n.name,
|
|
46
46
|
path: n.path,
|
|
47
47
|
folderId: n.folderId,
|
|
48
|
-
nodeType:
|
|
48
|
+
nodeType: o.Folder,
|
|
49
49
|
bucket: n.bucket,
|
|
50
50
|
parentPath: n.parentPath || void 0,
|
|
51
51
|
url: n.path,
|
|
52
52
|
permissions: r
|
|
53
53
|
};
|
|
54
|
-
return a.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || a.push(
|
|
54
|
+
return a.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || a.push(s), i.set(t, a), i;
|
|
55
55
|
}, m = (e, t, n) => {
|
|
56
56
|
if (!e) return e;
|
|
57
57
|
let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e) => e.id === t ? {
|
|
@@ -63,15 +63,15 @@ var u = (e) => {
|
|
|
63
63
|
files: i
|
|
64
64
|
};
|
|
65
65
|
}, h = {
|
|
66
|
-
403:
|
|
67
|
-
409:
|
|
68
|
-
413:
|
|
69
|
-
502:
|
|
70
|
-
503:
|
|
66
|
+
403: s.Forbidden,
|
|
67
|
+
409: s.Conflict,
|
|
68
|
+
413: s.TooLarge,
|
|
69
|
+
502: s.Unavailable,
|
|
70
|
+
503: s.Unavailable
|
|
71
71
|
}, g = (e) => e instanceof a || e instanceof TypeError || e instanceof Error && e.name === "FetchError", _ = async (t) => {
|
|
72
|
-
if (g(t)) return
|
|
72
|
+
if (g(t)) return s.Network;
|
|
73
73
|
let { status: n } = await e(t);
|
|
74
|
-
return (n == null ? void 0 : h[n]) ??
|
|
74
|
+
return (n == null ? void 0 : h[n]) ?? s.Unknown;
|
|
75
75
|
}, v = _, y = (e, t, n, r, a) => {
|
|
76
76
|
if (t === c.All) return Promise.reject(/* @__PURE__ */ Error("fetchByTab cannot list the All tab; list each section instead"));
|
|
77
77
|
if (t === c.Shared) {
|
|
@@ -134,19 +134,19 @@ var u = (e) => {
|
|
|
134
134
|
apiRoot: i(o.dialCorePath, o.bucket) + s
|
|
135
135
|
};
|
|
136
136
|
}, S = (e) => e.split("/").filter(Boolean).map(t), C = (e, t, n, a) => {
|
|
137
|
-
let
|
|
137
|
+
let s = e.nodeType === o.Folder, c = e.name, u = e.bucket ?? t, d = e.url ?? e.path ?? "", f = i(d, u).replace(/\/$/, ""), p = f.lastIndexOf("/"), m = p > 0 ? f.slice(0, p) : "", h;
|
|
138
138
|
if (a) {
|
|
139
139
|
let e = a.apiRoot ? S(m).slice(S(a.apiRoot).length) : [];
|
|
140
140
|
h = [a.virtualRoot, ...e].join("/");
|
|
141
141
|
} else h = r(m, n, !1);
|
|
142
|
-
let g =
|
|
142
|
+
let g = s ? `${h}/${c}/` : `${h}/${c}`;
|
|
143
143
|
return {
|
|
144
144
|
id: e.path,
|
|
145
145
|
name: c,
|
|
146
146
|
path: g,
|
|
147
147
|
url: e.url,
|
|
148
148
|
parentPath: h,
|
|
149
|
-
nodeType:
|
|
149
|
+
nodeType: s ? l.FOLDER : l.ITEM,
|
|
150
150
|
folderId: e.folderId,
|
|
151
151
|
bucket: u,
|
|
152
152
|
author: e.author,
|
|
@@ -2,64 +2,64 @@ import { getApiErrorStatus as e } from "../../api-error/api-error.js";
|
|
|
2
2
|
import { FileManagerNotificationReason as t } from "../dial-file-manager.types.js";
|
|
3
3
|
import { buildSharedItemVirtualPath as n, dialCorePathToRelative as r, findFolderByVirtualPath as i, normalizeVirtualPath as a } from "../dial-file-manager-path.util.js";
|
|
4
4
|
import { virtualPathToApiPath as o } from "../resolve-dial-file-api-path.js";
|
|
5
|
-
import { buildFromCache as ee, buildSharedSearchScope as s, fetchByTab as c, fetchForSearch as te, mapCorePermissions as ne, mapSearchItem as
|
|
6
|
-
import {
|
|
5
|
+
import { buildFromCache as ee, buildSharedSearchScope as s, fetchByTab as c, fetchForSearch as te, mapCorePermissions as ne, mapSearchItem as re, mergeCreatedFolderIntoCache as ie } from "../dial-file-manager-mapping.util.js";
|
|
6
|
+
import { ListFilesItemDtoNodeTypeEnum as l } from "@epam/ai-dial-chat-api-client";
|
|
7
|
+
import { getParentFolderPath as ae } from "@epam/ai-dial-chat-shared";
|
|
7
8
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
9
|
import { NotificationVariant as h } from "@epam/ai-dial-ui-kit";
|
|
9
|
-
import {
|
|
10
|
-
import { DialFileManagerTabs as _, DialFileNodeType as ae } from "@epam/ai-dial-react-file-manager";
|
|
10
|
+
import { DialFileManagerTabs as g, DialFileNodeType as oe } from "@epam/ai-dial-react-file-manager";
|
|
11
11
|
//#region src/files/useDialFileListing/useDialFileListing.ts
|
|
12
|
-
var
|
|
13
|
-
let [
|
|
12
|
+
var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x, isActive: S = !0, sessionKey: se }) => {
|
|
13
|
+
let [C, w] = m(""), [T, E] = m(() => /* @__PURE__ */ new Map()), D = p(T);
|
|
14
14
|
d(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
let [
|
|
18
|
-
|
|
19
|
-
let [
|
|
15
|
+
D.current = T;
|
|
16
|
+
}, [T]);
|
|
17
|
+
let [O, k] = m(() => /* @__PURE__ */ new Map()), [ce, A] = m(S), [le, ue] = m(S);
|
|
18
|
+
le !== S && (ue(S), A(S));
|
|
19
|
+
let [de, j] = m(null), [M, N] = m(0), [P, F] = m(void 0), [fe, I] = m(() => /* @__PURE__ */ new Set()), L = p(/* @__PURE__ */ new Map()), [pe, R] = m(!1), [me, z] = m(null), B = p(null), V = p(null), H = p(/* @__PURE__ */ new Set()), U = p(/* @__PURE__ */ new Set()), [W, G] = m(() => /* @__PURE__ */ new Set()), [he, K] = m(() => /* @__PURE__ */ new Set()), [q, J] = m(() => /* @__PURE__ */ new Set()), Y = `${b}|${se ?? ""}`, X = p(Y);
|
|
20
20
|
d(() => {
|
|
21
|
-
X.current !== Y && (X.current = Y,
|
|
21
|
+
X.current !== Y && (X.current = Y, E(/* @__PURE__ */ new Map()), k(/* @__PURE__ */ new Map()), w(""), F(void 0), L.current = /* @__PURE__ */ new Map(), H.current = /* @__PURE__ */ new Set(), U.current = /* @__PURE__ */ new Set(), K(/* @__PURE__ */ new Set()), J(/* @__PURE__ */ new Set()), B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1), G(/* @__PURE__ */ new Set()), N((e) => e + 1));
|
|
22
22
|
}, [Y]), d(() => () => {
|
|
23
23
|
B.current != null && clearTimeout(B.current), V.current?.();
|
|
24
24
|
}, []), d(() => {
|
|
25
|
-
if (!
|
|
26
|
-
|
|
25
|
+
if (!S) {
|
|
26
|
+
A(!1);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
let t = !1;
|
|
30
|
-
return
|
|
31
|
-
t || (
|
|
30
|
+
return A(!0), j(null), c(_, b, v, C, L.current).then(({ items: e, permissions: n }) => {
|
|
31
|
+
t || (E((t) => {
|
|
32
32
|
let n = new Map(t);
|
|
33
|
-
return n.set(
|
|
34
|
-
}),
|
|
33
|
+
return n.set(C, e), n;
|
|
34
|
+
}), k((e) => new Map(e).set(C, n)), b === g.Shared && C === "" && (F(e.map((e) => e.nodeType === l.Folder ? `/${y}/${e.name}/` : `/${y}/${e.name}`)), L.current = new Map(e.map((e) => [e.name, {
|
|
35
35
|
bucket: e.bucket ?? "",
|
|
36
36
|
dialCorePath: e.path
|
|
37
37
|
}]))));
|
|
38
38
|
}).catch((n) => {
|
|
39
|
-
t || (
|
|
39
|
+
t || (C !== "" && e(n) === 404 ? w(ae(C)) : j("dialFileManager.error"));
|
|
40
40
|
}).finally(() => {
|
|
41
|
-
t ||
|
|
41
|
+
t || A(!1);
|
|
42
42
|
}), () => {
|
|
43
43
|
t = !0;
|
|
44
44
|
};
|
|
45
45
|
}, [
|
|
46
|
-
|
|
47
|
-
y,
|
|
46
|
+
b,
|
|
48
47
|
v,
|
|
49
|
-
|
|
48
|
+
_,
|
|
50
49
|
C,
|
|
50
|
+
S,
|
|
51
51
|
M,
|
|
52
|
-
|
|
52
|
+
y
|
|
53
53
|
]), d(() => {
|
|
54
|
-
if (!
|
|
54
|
+
if (!S || b !== g.MyFiles) {
|
|
55
55
|
I(/* @__PURE__ */ new Set());
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
let e = !1;
|
|
59
|
-
return
|
|
59
|
+
return _.listSharedByMe(v).then((t) => {
|
|
60
60
|
e || I(new Set(t.items.map((e) => {
|
|
61
|
-
let t = r(e.path,
|
|
62
|
-
return n(t,
|
|
61
|
+
let t = r(e.path, v);
|
|
62
|
+
return n(t, y, e.nodeType === l.Folder);
|
|
63
63
|
})));
|
|
64
64
|
}).catch(() => {
|
|
65
65
|
e || I(/* @__PURE__ */ new Set());
|
|
@@ -67,35 +67,35 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
67
67
|
e = !0;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
|
-
|
|
71
|
-
y,
|
|
70
|
+
b,
|
|
72
71
|
v,
|
|
73
|
-
|
|
72
|
+
_,
|
|
73
|
+
S,
|
|
74
74
|
M,
|
|
75
|
-
|
|
75
|
+
y
|
|
76
76
|
]);
|
|
77
77
|
let Z = f(() => [{
|
|
78
|
-
id:
|
|
79
|
-
name:
|
|
80
|
-
path: `/${
|
|
78
|
+
id: v,
|
|
79
|
+
name: y,
|
|
80
|
+
path: `/${y}`,
|
|
81
81
|
parentPath: "",
|
|
82
|
-
nodeType:
|
|
83
|
-
folderId:
|
|
84
|
-
permissions: ne(
|
|
85
|
-
items: ee(
|
|
82
|
+
nodeType: oe.FOLDER,
|
|
83
|
+
folderId: v,
|
|
84
|
+
permissions: ne(O.get("")),
|
|
85
|
+
items: ee(T, O, "", `/${y}`, v)
|
|
86
86
|
}], [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
T,
|
|
88
|
+
O,
|
|
89
|
+
y,
|
|
90
|
+
v
|
|
91
91
|
]), ge = u((e) => {
|
|
92
92
|
if (e == null) {
|
|
93
|
-
|
|
93
|
+
w("");
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
let t = `/${
|
|
97
|
-
if (e === `/${
|
|
98
|
-
|
|
96
|
+
let t = `/${y}/`, n = `${y}/`;
|
|
97
|
+
if (e === `/${y}` || e === t || e === y || e === n) {
|
|
98
|
+
w("");
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
let r;
|
|
@@ -105,25 +105,25 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
105
105
|
let t = e.replace(/^\//, "");
|
|
106
106
|
r = t.startsWith(n) ? t.slice(n.length) : t;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
}, [
|
|
108
|
+
w(r && !r.endsWith("/") ? `${r}/` : r);
|
|
109
|
+
}, [y]), Q = u(() => {
|
|
110
110
|
N((e) => e + 1);
|
|
111
111
|
}, []), _e = Q, ve = u((e) => {
|
|
112
112
|
if (e.length === 0) return;
|
|
113
|
-
let n = new Set([...W].map((e) => o(e,
|
|
114
|
-
i.length > 0 && (
|
|
113
|
+
let n = new Set([...W].map((e) => o(e, y))), r = (e) => e === C || C.startsWith(e) || n.has(e), i = e.filter((e) => !r(e)), a = e.filter((e) => r(e) && e !== C);
|
|
114
|
+
i.length > 0 && (E((e) => {
|
|
115
115
|
let t = new Map(e);
|
|
116
116
|
return i.forEach((e) => t.delete(e)), t;
|
|
117
|
-
}),
|
|
117
|
+
}), k((e) => {
|
|
118
118
|
let t = new Map(e);
|
|
119
119
|
return i.forEach((e) => t.delete(e)), t;
|
|
120
120
|
})), a.forEach((e) => {
|
|
121
121
|
(async () => {
|
|
122
122
|
try {
|
|
123
|
-
let { items: t, permissions: n } = await c(
|
|
124
|
-
|
|
123
|
+
let { items: t, permissions: n } = await c(_, b, v, e, L.current);
|
|
124
|
+
E((n) => new Map(n).set(e, t)), n != null && k((t) => new Map(t).set(e, n));
|
|
125
125
|
} catch {
|
|
126
|
-
|
|
126
|
+
x?.({
|
|
127
127
|
variant: h.Error,
|
|
128
128
|
reason: t.FolderLoadFailed
|
|
129
129
|
});
|
|
@@ -131,32 +131,32 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
131
131
|
})();
|
|
132
132
|
});
|
|
133
133
|
}, [
|
|
134
|
-
|
|
135
|
-
y,
|
|
134
|
+
b,
|
|
136
135
|
v,
|
|
137
|
-
|
|
136
|
+
_,
|
|
137
|
+
C,
|
|
138
138
|
W,
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
y,
|
|
140
|
+
x
|
|
141
141
|
]), ye = u((e, t, n) => {
|
|
142
|
-
|
|
142
|
+
E((r) => ie(r, e, t, n));
|
|
143
143
|
}, []), be = u((e) => {
|
|
144
144
|
if (e.length === 0) return;
|
|
145
145
|
let t = new Set(e);
|
|
146
|
-
|
|
146
|
+
E((e) => {
|
|
147
147
|
let n = e.get("");
|
|
148
148
|
if (n == null) return e;
|
|
149
149
|
let r = new Map(e);
|
|
150
150
|
return r.set("", n.filter((e) => !t.has(e.name))), r;
|
|
151
|
-
}), F((t) => t?.filter((t) => !e.some((e) => t === `/${
|
|
152
|
-
}, [
|
|
153
|
-
if (!
|
|
154
|
-
let n = e == null ? "" : o(e,
|
|
151
|
+
}), F((t) => t?.filter((t) => !e.some((e) => t === `/${y}/${e}`)));
|
|
152
|
+
}, [y]), xe = u((e) => {
|
|
153
|
+
if (!S) return;
|
|
154
|
+
let n = e == null ? "" : o(e, y), r = e ?? `/${y}`;
|
|
155
155
|
J((e) => {
|
|
156
156
|
if (e.has(r)) return e;
|
|
157
157
|
let t = new Set(e);
|
|
158
158
|
return t.add(r), t;
|
|
159
|
-
}), !
|
|
159
|
+
}), !D.current.has(n) && (H.current.has(n) ? K((e) => {
|
|
160
160
|
let t = new Set(e);
|
|
161
161
|
return t.add(r), t;
|
|
162
162
|
}) : (H.current.add(n), K((e) => {
|
|
@@ -164,10 +164,10 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
164
164
|
return t.add(r), t;
|
|
165
165
|
}), (async () => {
|
|
166
166
|
try {
|
|
167
|
-
let { items: e, permissions: t } = await c(
|
|
168
|
-
|
|
167
|
+
let { items: e, permissions: t } = await c(_, b, v, n, L.current);
|
|
168
|
+
E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t)), U.current.delete(n);
|
|
169
169
|
} catch {
|
|
170
|
-
|
|
170
|
+
x?.({
|
|
171
171
|
variant: h.Error,
|
|
172
172
|
reason: t.FolderLoadFailed
|
|
173
173
|
});
|
|
@@ -179,38 +179,38 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
179
179
|
}
|
|
180
180
|
})()));
|
|
181
181
|
}, [
|
|
182
|
-
|
|
183
|
-
y,
|
|
182
|
+
b,
|
|
184
183
|
v,
|
|
185
|
-
|
|
184
|
+
_,
|
|
186
185
|
S,
|
|
187
|
-
|
|
186
|
+
x,
|
|
187
|
+
y
|
|
188
188
|
]), Se = f(() => {
|
|
189
189
|
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set([...W, ...q]);
|
|
190
190
|
for (let n of t) {
|
|
191
|
-
let t = o(n,
|
|
192
|
-
|
|
191
|
+
let t = o(n, y);
|
|
192
|
+
T.has(t) && e.add(n);
|
|
193
193
|
}
|
|
194
194
|
return e;
|
|
195
195
|
}, [
|
|
196
196
|
W,
|
|
197
197
|
q,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
T,
|
|
199
|
+
y
|
|
200
200
|
]), Ce = u((e) => {
|
|
201
|
-
|
|
202
|
-
e.has(t) || U.current.delete(o(t,
|
|
201
|
+
S && (W.forEach((t) => {
|
|
202
|
+
e.has(t) || U.current.delete(o(t, y));
|
|
203
203
|
}), G(e), [...e].filter((e) => {
|
|
204
|
-
let t = o(e,
|
|
205
|
-
return !
|
|
204
|
+
let t = o(e, y);
|
|
205
|
+
return !D.current.has(t) && !H.current.has(t) && !U.current.has(t);
|
|
206
206
|
}).forEach((e) => {
|
|
207
|
-
let n = o(e,
|
|
207
|
+
let n = o(e, y);
|
|
208
208
|
H.current.add(n), (async () => {
|
|
209
209
|
try {
|
|
210
|
-
let { items: e, permissions: t } = await c(
|
|
211
|
-
|
|
210
|
+
let { items: e, permissions: t } = await c(_, b, v, n, L.current);
|
|
211
|
+
E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t));
|
|
212
212
|
} catch {
|
|
213
|
-
U.current.add(n),
|
|
213
|
+
U.current.add(n), x?.({
|
|
214
214
|
variant: h.Error,
|
|
215
215
|
reason: t.FolderLoadFailed
|
|
216
216
|
});
|
|
@@ -223,21 +223,21 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
223
223
|
})();
|
|
224
224
|
}));
|
|
225
225
|
}, [
|
|
226
|
-
|
|
227
|
-
y,
|
|
226
|
+
b,
|
|
228
227
|
v,
|
|
228
|
+
_,
|
|
229
229
|
W,
|
|
230
|
-
C,
|
|
231
230
|
S,
|
|
232
|
-
|
|
231
|
+
x,
|
|
232
|
+
y
|
|
233
233
|
]), we = u(() => {
|
|
234
234
|
B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1);
|
|
235
235
|
}, []), Te = u((e, t) => {
|
|
236
|
-
|
|
237
|
-
if (B.current = null,
|
|
236
|
+
S && (B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, t.trim() ? B.current = setTimeout(() => {
|
|
237
|
+
if (B.current = null, b === g.Shared && C === "") {
|
|
238
238
|
V.current?.(), V.current = null, R(!0);
|
|
239
|
-
let e =
|
|
240
|
-
z(e.map((e) =>
|
|
239
|
+
let e = T.get("") ?? [], t = s(y, "", /* @__PURE__ */ new Map());
|
|
240
|
+
z(e.map((e) => re(e, e.bucket ?? v, y, t))), R(!1);
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
let e = !1;
|
|
@@ -245,10 +245,10 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
245
245
|
e = !0;
|
|
246
246
|
}, R(!0), (async () => {
|
|
247
247
|
try {
|
|
248
|
-
let { items: t } = await te(
|
|
248
|
+
let { items: t } = await te(_, b, v, C, L.current);
|
|
249
249
|
if (e) return;
|
|
250
|
-
let n =
|
|
251
|
-
z(t.map((e) =>
|
|
250
|
+
let n = b === g.Shared ? s(y, C, L.current) : void 0;
|
|
251
|
+
z(t.map((e) => re(e, e.bucket ?? v, y, n)));
|
|
252
252
|
} catch {
|
|
253
253
|
e || z([]);
|
|
254
254
|
} finally {
|
|
@@ -257,27 +257,27 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
257
257
|
})();
|
|
258
258
|
}, 300) : (z(null), R(!1)));
|
|
259
259
|
}, [
|
|
260
|
-
|
|
261
|
-
y,
|
|
262
|
-
E,
|
|
260
|
+
b,
|
|
263
261
|
v,
|
|
264
|
-
|
|
262
|
+
T,
|
|
263
|
+
_,
|
|
265
264
|
C,
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
S,
|
|
266
|
+
y
|
|
267
|
+
]), $ = C ? `/${y}/${C}` : `/${y}`, Ee = f(() => {
|
|
268
268
|
let e = Z[0];
|
|
269
|
-
if (e) return a($) === a(`/${
|
|
269
|
+
if (e) return a($) === a(`/${y}`) ? e : i(e.items ?? [], $);
|
|
270
270
|
}, [
|
|
271
271
|
Z,
|
|
272
272
|
$,
|
|
273
|
-
|
|
273
|
+
y
|
|
274
274
|
]);
|
|
275
275
|
return {
|
|
276
276
|
items: Z,
|
|
277
|
-
isLoading:
|
|
278
|
-
error:
|
|
277
|
+
isLoading: ce,
|
|
278
|
+
error: de,
|
|
279
279
|
path: $,
|
|
280
|
-
folderPath:
|
|
280
|
+
folderPath: C,
|
|
281
281
|
onPathChange: ge,
|
|
282
282
|
retry: Q,
|
|
283
283
|
onSearchFiles: Te,
|
|
@@ -289,13 +289,13 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
289
289
|
onExpandedPathsChange: Ce,
|
|
290
290
|
onFolderPopupPathChange: xe,
|
|
291
291
|
folderPopupLoadingPaths: he,
|
|
292
|
-
sharedWithMeIds: f(() =>
|
|
292
|
+
sharedWithMeIds: f(() => b === g.Shared ? P : void 0, [b, P]),
|
|
293
293
|
sharedByMePaths: fe,
|
|
294
294
|
currentFolder: Ee,
|
|
295
|
-
cache:
|
|
296
|
-
listingPermissionsCache:
|
|
295
|
+
cache: T,
|
|
296
|
+
listingPermissionsCache: O,
|
|
297
297
|
sharedRootMetaRef: L,
|
|
298
|
-
setFolderPath:
|
|
298
|
+
setFolderPath: w,
|
|
299
299
|
invalidateFolders: ve,
|
|
300
300
|
mergeCreatedFolder: ye,
|
|
301
301
|
bumpRetry: _e,
|
|
@@ -303,4 +303,4 @@ var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S
|
|
|
303
303
|
};
|
|
304
304
|
};
|
|
305
305
|
//#endregion
|
|
306
|
-
export {
|
|
306
|
+
export { _ as useDialFileListing };
|