@epam/ai-dial-chat-hooks 1.4.0-dev.8 → 1.4.0-dev.81
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/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
- package/catalog/create-publish-api.d.ts +9 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +8 -0
- package/catalog/entity-details.d.ts +5 -2
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.d.ts +4 -0
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +15 -13
- package/catalog/publish-dependency-icons.d.ts +22 -0
- package/catalog/publish-dependency-icons.d.ts.map +1 -0
- package/catalog/publish-dependency-icons.js +11 -0
- package/catalog/publish.d.ts +15 -2
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +15 -4
- package/catalog/use-publish-dependencies.d.ts +19 -0
- package/catalog/use-publish-dependencies.d.ts.map +1 -0
- package/catalog/use-publish-dependencies.js +25 -0
- package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
- package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistory.js +49 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
- package/catalog/version-history.d.ts +42 -0
- package/catalog/version-history.d.ts.map +1 -0
- package/catalog/version-history.js +27 -0
- package/catalog.js +36 -31
- package/conversation/announcement-message.d.ts +12 -0
- package/conversation/announcement-message.d.ts.map +1 -1
- package/conversation/announcement-message.js +16 -10
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +119 -96
- package/conversation.js +44 -44
- package/entry-points/catalog.d.ts +5 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +1 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/project.d.ts +5 -0
- package/entry-points/project.d.ts.map +1 -1
- package/entry-points/scheduled-tasks.d.ts +1 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/utils.d.ts +3 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -32
- package/files/annotation.d.ts +3 -3
- package/files/annotation.d.ts.map +1 -1
- package/files/annotation.js +12 -11
- package/files/attachment-canvas.d.ts +1 -1
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +135 -135
- package/files/attachment-type-labels.d.ts +3 -0
- package/files/attachment-type-labels.d.ts.map +1 -0
- package/files/attachment-type-labels.js +12 -0
- package/files/attachment-types.d.ts +0 -2
- package/files/attachment-types.d.ts.map +1 -1
- package/files/attachment-types.js +7 -14
- package/files/dial-file.d.ts +18 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +30 -5
- package/index.d.ts +15 -0
- package/index.d.ts.map +1 -1
- package/index.js +255 -241
- package/org-units/models.d.ts +9 -0
- package/org-units/models.d.ts.map +1 -0
- package/org-units/types.d.ts +14 -0
- package/org-units/types.d.ts.map +1 -0
- package/org-units/types.js +6 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts +19 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
- package/org-units/useOrgUnits/useOrgUnits.js +34 -0
- package/package.json +19 -19
- package/project/project-sharing-client.d.ts +8 -0
- package/project/project-sharing-client.d.ts.map +1 -0
- package/project/project-sharing-client.js +11 -0
- package/project/project-sharing.d.ts +28 -0
- package/project/project-sharing.d.ts.map +1 -0
- package/project/project-sharing.js +22 -0
- package/project/use-pinned-project-chats.d.ts +4 -2
- package/project/use-pinned-project-chats.d.ts.map +1 -1
- package/project/use-pinned-project-chats.js +152 -96
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +2 -2
- package/project/use-project-remove-from-list.d.ts +30 -0
- package/project/use-project-remove-from-list.d.ts.map +1 -0
- package/project/use-project-remove-from-list.js +39 -0
- package/project/use-project-revoke-access.d.ts +15 -0
- package/project/use-project-revoke-access.d.ts.map +1 -0
- package/project/use-project-revoke-access.js +32 -0
- package/project/use-project-share-recipients.d.ts +7 -0
- package/project/use-project-share-recipients.d.ts.map +1 -0
- package/project/use-project-share-recipients.js +36 -0
- package/project/use-projects.d.ts +1 -0
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +2 -1
- package/project.js +7 -2
- package/scheduled-task/scheduled-task-description.d.ts +19 -13
- package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-description.js +39 -55
- package/scheduled-task/scheduled-task-display.d.ts +19 -5
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +43 -38
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
- package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +92 -115
- package/scheduled-tasks.js +14 -13
- package/shared/timezones.d.ts +30 -0
- package/shared/timezones.d.ts.map +1 -0
- package/shared/timezones.js +102 -0
- package/utils.js +5 -3
- package/shared/cron-day-of-month.d.ts +0 -21
- package/shared/cron-day-of-month.d.ts.map +0 -1
- package/shared/cron-day-of-month.js +0 -13
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { isDialFileId as e } from "./dial-file.js";
|
|
2
|
-
import { AttachmentContentType as
|
|
3
|
-
import { MIMEType as
|
|
4
|
-
import { annotationHighlightIds as
|
|
5
|
-
import { LRUCache as
|
|
1
|
+
import { isDialFileId as e, isDialStoredFileId as t } from "./dial-file.js";
|
|
2
|
+
import { AttachmentContentType as n, AttachmentErrorType as r, OoxmlFileType as i, OoxmlHighlightKind as a, getOoxmlFileType as o } from "@epam/ai-dial-attachment-canvas";
|
|
3
|
+
import { MIMEType as s, base64ToBlob as c, tryBase64ToBytes as l } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { annotationHighlightIds as u, annotationToOfficeHighlightLocations as d, annotationsToPdfHighlights as f, gatherSameSourceAnnotations as p, getAnnotationPdfPage as m, parsePdfPageReference as h } from "@epam/ai-dial-quotations";
|
|
5
|
+
import { LRUCache as g } from "lru-cache";
|
|
6
6
|
//#region src/files/attachment-canvas.ts
|
|
7
|
-
var
|
|
8
|
-
let t =
|
|
7
|
+
var _ = (e, t) => URL.createObjectURL(c(e, t)), v = (e) => {
|
|
8
|
+
let t = l(e);
|
|
9
9
|
return t == null ? e : new TextDecoder().decode(t);
|
|
10
|
-
},
|
|
11
|
-
type:
|
|
12
|
-
errorType: e === 403 ?
|
|
13
|
-
url:
|
|
14
|
-
}),
|
|
15
|
-
type:
|
|
16
|
-
errorType:
|
|
10
|
+
}, y = (e, t) => ({
|
|
11
|
+
type: n.Error,
|
|
12
|
+
errorType: e === 403 ? r.Forbidden : r.LoadFailed,
|
|
13
|
+
url: t
|
|
14
|
+
}), b = (e) => ({
|
|
15
|
+
type: n.Error,
|
|
16
|
+
errorType: r.LoadFailed,
|
|
17
17
|
url: e
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
},
|
|
18
|
+
}), x = new g({ max: 10 }), S = new g({ max: 50 }), C = () => {
|
|
19
|
+
x.clear(), S.clear();
|
|
20
|
+
}, w = async (e, t) => {
|
|
21
21
|
let n = t.resolveDialFileMetadataUrl(e);
|
|
22
22
|
if (n != null) try {
|
|
23
23
|
let e = await fetch(n);
|
|
@@ -27,128 +27,128 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
27
27
|
} catch {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
},
|
|
31
|
-
let r = await
|
|
30
|
+
}, T = async (e, t, n) => {
|
|
31
|
+
let r = await w(t, n);
|
|
32
32
|
if (r == null) return fetch(e).then((e) => {
|
|
33
33
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
34
34
|
return e.blob();
|
|
35
35
|
});
|
|
36
|
-
let i =
|
|
36
|
+
let i = x.get(e);
|
|
37
37
|
if (i != null && i.etag === r) return i.promise;
|
|
38
|
-
|
|
38
|
+
x.delete(e);
|
|
39
39
|
let a = fetch(e).then((e) => {
|
|
40
40
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
41
41
|
return e.blob();
|
|
42
42
|
}).catch((t) => {
|
|
43
|
-
throw
|
|
43
|
+
throw x.delete(e), t;
|
|
44
44
|
});
|
|
45
|
-
return
|
|
45
|
+
return x.set(e, {
|
|
46
46
|
etag: r,
|
|
47
47
|
promise: a
|
|
48
48
|
}), a;
|
|
49
|
-
},
|
|
50
|
-
let r = await
|
|
49
|
+
}, E = async (e, t, n) => {
|
|
50
|
+
let r = await w(t, n);
|
|
51
51
|
if (r == null) return fetch(e).then((e) => {
|
|
52
52
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
53
53
|
return e.text();
|
|
54
54
|
});
|
|
55
|
-
let i =
|
|
55
|
+
let i = S.get(e);
|
|
56
56
|
if (i != null && i.etag === r) return i.promise;
|
|
57
|
-
|
|
57
|
+
S.delete(e);
|
|
58
58
|
let a = fetch(e).then((e) => {
|
|
59
59
|
if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
|
|
60
60
|
return e.text();
|
|
61
61
|
}).catch((t) => {
|
|
62
|
-
throw
|
|
62
|
+
throw S.delete(e), t;
|
|
63
63
|
});
|
|
64
|
-
return
|
|
64
|
+
return S.set(e, {
|
|
65
65
|
etag: r,
|
|
66
66
|
promise: a
|
|
67
67
|
}), a;
|
|
68
|
-
},
|
|
69
|
-
if (t.url != null && e(t.url)) return
|
|
70
|
-
if (t.referenceUrl != null && e(t.referenceUrl)) return
|
|
71
|
-
},
|
|
68
|
+
}, D = (e) => e.split("#")[0], O = (t) => {
|
|
69
|
+
if (t.url != null && e(t.url)) return D(t.url);
|
|
70
|
+
if (t.referenceUrl != null && e(t.referenceUrl)) return D(t.referenceUrl);
|
|
71
|
+
}, k = async (e, t) => {
|
|
72
72
|
let n = "file" in e ? e.file : void 0, r = n != null && n.size === 0, i = n != null && !r ? void 0 : t.resolveDialUrl(e);
|
|
73
73
|
if (n != null && i == null) return URL.createObjectURL(n);
|
|
74
74
|
if (i != null) try {
|
|
75
|
-
let n = await
|
|
75
|
+
let n = await T(i, O(e) ?? "", t);
|
|
76
76
|
return URL.createObjectURL(n);
|
|
77
77
|
} catch (e) {
|
|
78
78
|
let t = e.status;
|
|
79
|
-
return t == null ?
|
|
79
|
+
return t == null ? b(i) : y(t, i);
|
|
80
80
|
}
|
|
81
81
|
if (e.previewUrl != null) return e.previewUrl;
|
|
82
|
-
if (e.data != null) return
|
|
83
|
-
},
|
|
84
|
-
if (e.data != null) return
|
|
82
|
+
if (e.data != null) return _(e.data, e.contentType);
|
|
83
|
+
}, A = async (e, t) => {
|
|
84
|
+
if (e.data != null) return v(e.data);
|
|
85
85
|
let n = t.resolveDialUrl(e);
|
|
86
86
|
if (n != null) try {
|
|
87
|
-
return await
|
|
87
|
+
return await E(n, O(e) ?? "", t);
|
|
88
88
|
} catch (e) {
|
|
89
89
|
let t = e.status;
|
|
90
|
-
return t == null ?
|
|
90
|
+
return t == null ? b(n) : y(t, n);
|
|
91
91
|
}
|
|
92
92
|
if ("file" in e) return e.file.text();
|
|
93
|
-
},
|
|
94
|
-
let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 :
|
|
93
|
+
}, j = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, M = (e, t) => {
|
|
94
|
+
let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 : t.resolveDialUrl(e);
|
|
95
95
|
return r != null && a == null ? {
|
|
96
|
-
type:
|
|
96
|
+
type: n.Image,
|
|
97
97
|
url: URL.createObjectURL(r)
|
|
98
98
|
} : a == null ? e.previewUrl == null ? e.data == null ? null : {
|
|
99
|
-
type:
|
|
100
|
-
url:
|
|
99
|
+
type: n.Image,
|
|
100
|
+
url: _(e.data, e.contentType)
|
|
101
101
|
} : {
|
|
102
|
-
type:
|
|
102
|
+
type: n.Image,
|
|
103
103
|
url: e.previewUrl
|
|
104
104
|
} : {
|
|
105
|
-
type:
|
|
105
|
+
type: n.Image,
|
|
106
106
|
url: a
|
|
107
107
|
};
|
|
108
|
-
},
|
|
109
|
-
let r = await
|
|
108
|
+
}, N = async (e, t) => {
|
|
109
|
+
let r = await A(e, t);
|
|
110
110
|
return r == null ? null : typeof r == "string" ? {
|
|
111
|
-
type:
|
|
111
|
+
type: n.PlainText,
|
|
112
112
|
text: r
|
|
113
113
|
} : r;
|
|
114
|
-
},
|
|
115
|
-
let r = await
|
|
114
|
+
}, P = async (e, t) => {
|
|
115
|
+
let r = await A(e, t);
|
|
116
116
|
return r == null ? null : typeof r == "string" ? {
|
|
117
|
-
type:
|
|
117
|
+
type: n.Markdown,
|
|
118
118
|
text: r
|
|
119
119
|
} : r;
|
|
120
|
-
},
|
|
121
|
-
let i = await
|
|
120
|
+
}, F = 1048576, I = async (e, t, r) => {
|
|
121
|
+
let i = await A(e, t);
|
|
122
122
|
return i == null ? null : typeof i == "string" ? {
|
|
123
|
-
type:
|
|
123
|
+
type: n.Code,
|
|
124
124
|
text: i,
|
|
125
125
|
language: r
|
|
126
126
|
} : i;
|
|
127
|
-
},
|
|
127
|
+
}, L = (e) => {
|
|
128
128
|
try {
|
|
129
129
|
return new URL(e, window.location.href).origin;
|
|
130
130
|
} catch {
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
},
|
|
134
|
-
let r =
|
|
133
|
+
}, R = async (e, t) => {
|
|
134
|
+
let r = t.resolveDialUrl(e) ?? void 0;
|
|
135
135
|
if (r != null) return {
|
|
136
|
-
type:
|
|
136
|
+
type: n.Html,
|
|
137
137
|
url: r,
|
|
138
|
-
isSameOriginUrl:
|
|
138
|
+
isSameOriginUrl: L(r) === L(window.location.href),
|
|
139
139
|
resolveSourceText: async () => {
|
|
140
|
-
let
|
|
141
|
-
if (
|
|
142
|
-
return
|
|
140
|
+
let n = await A(e, t);
|
|
141
|
+
if (n == null || typeof n != "string") throw Error("Failed to resolve HTML source text");
|
|
142
|
+
return n;
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
-
let i = await
|
|
146
|
-
return i == null ? null : typeof i == "string" ? i.length >
|
|
147
|
-
type:
|
|
145
|
+
let i = await A(e, t);
|
|
146
|
+
return i == null ? null : typeof i == "string" ? i.length > F ? null : {
|
|
147
|
+
type: n.Html,
|
|
148
148
|
srcdoc: i,
|
|
149
|
-
srcdocHostUrl:
|
|
149
|
+
srcdocHostUrl: t.htmlSrcdocHostUrl
|
|
150
150
|
} : i;
|
|
151
|
-
},
|
|
151
|
+
}, z = (e, t) => ({
|
|
152
152
|
id: e,
|
|
153
153
|
bboxes: [{
|
|
154
154
|
page: t,
|
|
@@ -161,44 +161,44 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
161
161
|
backgroundColor: "transparent",
|
|
162
162
|
opacity: 0
|
|
163
163
|
}
|
|
164
|
-
}),
|
|
165
|
-
let a =
|
|
166
|
-
if (a?.type !==
|
|
167
|
-
let
|
|
168
|
-
if (
|
|
169
|
-
let c = (r.find((
|
|
164
|
+
}), B = (e, r, i) => {
|
|
165
|
+
let a = e.body?.source?.attachment;
|
|
166
|
+
if (a?.type !== s.PDF) return null;
|
|
167
|
+
let o = t(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
|
|
168
|
+
if (o == null) return null;
|
|
169
|
+
let c = (r.find((t) => t.annotations.includes(e))?.annotations ?? [e]).filter((e) => e.body?.source?.attachment?.url === a.url), l = c.indexOf(e), d = f(c), p = u(c)[l], h = m(e), g = d.some((e) => e.id === p);
|
|
170
170
|
if (!g && h != null) {
|
|
171
|
-
let e = `page-anchor-${
|
|
171
|
+
let e = `page-anchor-${p}`;
|
|
172
172
|
return {
|
|
173
|
-
type:
|
|
174
|
-
url:
|
|
175
|
-
highlights: [...
|
|
173
|
+
type: n.Pdf,
|
|
174
|
+
url: o,
|
|
175
|
+
highlights: [...d, z(e, h)],
|
|
176
176
|
selectedHighlightId: e,
|
|
177
177
|
page: h
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
return {
|
|
181
|
-
type:
|
|
182
|
-
url:
|
|
183
|
-
highlights:
|
|
184
|
-
selectedHighlightId: g ?
|
|
181
|
+
type: n.Pdf,
|
|
182
|
+
url: o,
|
|
183
|
+
highlights: d,
|
|
184
|
+
selectedHighlightId: g ? p : void 0,
|
|
185
185
|
page: h
|
|
186
186
|
};
|
|
187
|
-
},
|
|
187
|
+
}, V = (e) => {
|
|
188
188
|
switch (e.type) {
|
|
189
189
|
case "docx_text_anchor": return {
|
|
190
|
-
kind:
|
|
190
|
+
kind: a.DocxTableRow,
|
|
191
191
|
cells: e.cells,
|
|
192
192
|
occurrence: e.occurrence
|
|
193
193
|
};
|
|
194
194
|
case "pptx_text_anchor": return {
|
|
195
|
-
kind:
|
|
195
|
+
kind: a.PptxTableRow,
|
|
196
196
|
cells: e.cells,
|
|
197
197
|
occurrence: e.occurrence,
|
|
198
198
|
slide: e.slide
|
|
199
199
|
};
|
|
200
200
|
case "docx_text_range": return {
|
|
201
|
-
kind:
|
|
201
|
+
kind: a.DocxTextRange,
|
|
202
202
|
story: e.story,
|
|
203
203
|
path: e.path,
|
|
204
204
|
start: e.start,
|
|
@@ -206,7 +206,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
206
206
|
text: e.text
|
|
207
207
|
};
|
|
208
208
|
case "pptx_text_range": return {
|
|
209
|
-
kind:
|
|
209
|
+
kind: a.PptxTextRange,
|
|
210
210
|
slide: e.slide,
|
|
211
211
|
shapeId: e.shapeId,
|
|
212
212
|
start: e.start,
|
|
@@ -214,111 +214,111 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
214
214
|
text: e.text
|
|
215
215
|
};
|
|
216
216
|
case "excel_rc_range": return {
|
|
217
|
-
kind:
|
|
217
|
+
kind: a.XlsxCellRange,
|
|
218
218
|
sheet: e.sheet,
|
|
219
219
|
start: e.start,
|
|
220
220
|
end: e.end
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
},
|
|
224
|
-
let s =
|
|
223
|
+
}, H = (e, r, a) => {
|
|
224
|
+
let s = e.body?.source?.attachment;
|
|
225
225
|
if (s?.url == null) return null;
|
|
226
|
-
let c =
|
|
227
|
-
if (c !==
|
|
228
|
-
let
|
|
229
|
-
if (
|
|
230
|
-
let
|
|
231
|
-
return
|
|
232
|
-
let r =
|
|
226
|
+
let c = o(s.title ?? s.url, s.type);
|
|
227
|
+
if (c !== i.Docx && c !== i.Xlsx && c !== i.Pptx) return null;
|
|
228
|
+
let l = t(s.url) ? a.resolveDialFileDownloadUrl(s.url) : s.url;
|
|
229
|
+
if (l == null) return null;
|
|
230
|
+
let f = p(e, r), m = [], h, g = u(f);
|
|
231
|
+
return f.forEach((t, n) => {
|
|
232
|
+
let r = d(t);
|
|
233
233
|
if (r.length === 0) return;
|
|
234
|
-
let i = g[
|
|
234
|
+
let i = g[n];
|
|
235
235
|
m.push({
|
|
236
236
|
id: i,
|
|
237
|
-
locations: r.map(
|
|
238
|
-
}),
|
|
237
|
+
locations: r.map(V)
|
|
238
|
+
}), t === e && h == null && (h = i);
|
|
239
239
|
}), {
|
|
240
|
-
type:
|
|
241
|
-
url:
|
|
240
|
+
type: n.Ooxml,
|
|
241
|
+
url: l,
|
|
242
242
|
format: c,
|
|
243
243
|
...m.length > 0 ? {
|
|
244
244
|
highlights: m,
|
|
245
245
|
selectedHighlightId: h
|
|
246
246
|
} : {}
|
|
247
247
|
};
|
|
248
|
-
},
|
|
249
|
-
let i =
|
|
248
|
+
}, U = (e, t, n, r) => {
|
|
249
|
+
let i = B(e, t, r) ?? H(e, n, r);
|
|
250
250
|
if (i == null) return null;
|
|
251
251
|
let a = e.body?.source?.attachment, o = a?.url?.split("/").pop() ?? "";
|
|
252
252
|
return {
|
|
253
253
|
content: i,
|
|
254
254
|
fileName: a?.title || decodeURIComponent(o)
|
|
255
255
|
};
|
|
256
|
-
},
|
|
257
|
-
let i =
|
|
256
|
+
}, W = (e, r) => {
|
|
257
|
+
let i = h(e.url);
|
|
258
258
|
if (i == null) return null;
|
|
259
|
-
let a =
|
|
259
|
+
let a = t(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
|
|
260
260
|
if (a == null) return null;
|
|
261
261
|
if (i.page == null) return {
|
|
262
|
-
type:
|
|
262
|
+
type: n.Pdf,
|
|
263
263
|
url: a
|
|
264
264
|
};
|
|
265
265
|
let o = `reference-page-${i.page}`;
|
|
266
266
|
return {
|
|
267
|
-
type:
|
|
267
|
+
type: n.Pdf,
|
|
268
268
|
url: a,
|
|
269
|
-
highlights: [
|
|
269
|
+
highlights: [z(o, i.page)],
|
|
270
270
|
selectedHighlightId: o,
|
|
271
271
|
page: i.page
|
|
272
272
|
};
|
|
273
|
-
},
|
|
273
|
+
}, G = (e) => {
|
|
274
274
|
try {
|
|
275
275
|
let t = new URL(e).protocol;
|
|
276
276
|
return t === "http:" || t === "https:" || t === "blob:";
|
|
277
277
|
} catch {
|
|
278
278
|
return !1;
|
|
279
279
|
}
|
|
280
|
-
},
|
|
281
|
-
let r = await
|
|
280
|
+
}, K = (t) => t.url != null && !e(t.url) && G(t.url) ? t.url : void 0, q = async (e, t) => {
|
|
281
|
+
let r = await k(e, t);
|
|
282
282
|
if (r != null) return typeof r == "string" ? {
|
|
283
|
-
type:
|
|
283
|
+
type: n.Pdf,
|
|
284
284
|
url: r
|
|
285
285
|
} : r;
|
|
286
|
-
let i =
|
|
286
|
+
let i = K(e);
|
|
287
287
|
return i == null ? null : {
|
|
288
|
-
type:
|
|
288
|
+
type: n.Pdf,
|
|
289
289
|
url: i
|
|
290
290
|
};
|
|
291
|
-
},
|
|
292
|
-
let i = await
|
|
291
|
+
}, J = async (e, t, r) => {
|
|
292
|
+
let i = await k(e, t);
|
|
293
293
|
if (i != null) return typeof i == "string" ? {
|
|
294
|
-
type:
|
|
294
|
+
type: n.Ooxml,
|
|
295
295
|
url: i,
|
|
296
296
|
format: r
|
|
297
297
|
} : i;
|
|
298
|
-
let a =
|
|
298
|
+
let a = K(e);
|
|
299
299
|
return a == null ? null : {
|
|
300
|
-
type:
|
|
300
|
+
type: n.Ooxml,
|
|
301
301
|
url: a,
|
|
302
302
|
format: r
|
|
303
303
|
};
|
|
304
|
-
},
|
|
305
|
-
let r = await
|
|
304
|
+
}, Y = async (e, t) => {
|
|
305
|
+
let r = await A(e, t);
|
|
306
306
|
if (r == null) return null;
|
|
307
307
|
if (typeof r != "string") return r;
|
|
308
308
|
try {
|
|
309
309
|
let e = JSON.parse(r);
|
|
310
310
|
return {
|
|
311
|
-
type:
|
|
311
|
+
type: n.Json,
|
|
312
312
|
value: e
|
|
313
313
|
};
|
|
314
314
|
} catch {
|
|
315
315
|
return {
|
|
316
|
-
type:
|
|
316
|
+
type: n.PlainText,
|
|
317
317
|
text: r
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
},
|
|
321
|
-
let a = await
|
|
320
|
+
}, X = async (e, t, r, i) => {
|
|
321
|
+
let a = await A(e, t);
|
|
322
322
|
if (a == null || typeof a != "string") return null;
|
|
323
323
|
let o = {};
|
|
324
324
|
try {
|
|
@@ -326,7 +326,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
326
326
|
typeof e == "object" && e && (o = e);
|
|
327
327
|
} catch {}
|
|
328
328
|
return {
|
|
329
|
-
type:
|
|
329
|
+
type: n.Visualizer,
|
|
330
330
|
url: r.url,
|
|
331
331
|
mimeType: e.contentType,
|
|
332
332
|
data: o,
|
|
@@ -339,7 +339,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
339
339
|
visualizerName: r.title,
|
|
340
340
|
requestTimeout: r.requestTimeout
|
|
341
341
|
};
|
|
342
|
-
},
|
|
342
|
+
}, Z = (e, t, r, i) => {
|
|
343
343
|
let a = {
|
|
344
344
|
width: r.width,
|
|
345
345
|
height: r.height,
|
|
@@ -347,9 +347,9 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
347
347
|
themeId: i
|
|
348
348
|
}, o = [], s = [];
|
|
349
349
|
return e.forEach((e) => {
|
|
350
|
-
let
|
|
351
|
-
|
|
352
|
-
url:
|
|
350
|
+
let n = t(e);
|
|
351
|
+
n != null && (s.push(e), o.push({
|
|
352
|
+
url: n,
|
|
353
353
|
mimeType: e.contentType,
|
|
354
354
|
visualizerData: { layout: a }
|
|
355
355
|
}));
|
|
@@ -358,7 +358,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
358
358
|
resolved: []
|
|
359
359
|
} : {
|
|
360
360
|
content: {
|
|
361
|
-
type:
|
|
361
|
+
type: n.GroupedVisualizer,
|
|
362
362
|
url: r.url,
|
|
363
363
|
attachments: o,
|
|
364
364
|
layout: a,
|
|
@@ -369,4 +369,4 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
|
|
|
369
369
|
};
|
|
370
370
|
};
|
|
371
371
|
//#endregion
|
|
372
|
-
export {
|
|
372
|
+
export { H as annotationToOoxmlCanvasContent, B as annotationToPdfCanvasContent, C as clearAttachmentCache, j as hasAttachmentTextSource, W as referenceAttachmentToPdfCanvasContent, U as resolveAnnotationCanvasContent, I as resolveCodeCanvasContent, Z as resolveGroupedVisualizerCanvasContent, R as resolveHtmlCanvasContent, M as resolveImageCanvasContent, Y as resolveJsonCanvasContent, P as resolveMarkdownCanvasContent, J as resolveOoxmlCanvasContent, q as resolvePdfCanvasContent, N as resolveTextCanvasContent, X as resolveVisualizerCanvasContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-type-labels.d.ts","sourceRoot":"","sources":["../../src/files/attachment-type-labels.ts"],"names":[],"mappings":"AASA,iIAAiI;AACjI,eAAO,MAAM,oCAAoC,GAAI,OAAO,MAAM,EAAE,KAAG,MAiBxD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { normalizeMimeType as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { extension as t } from "mime-types";
|
|
3
|
+
//#region src/files/attachment-type-labels.ts
|
|
4
|
+
var n = (n) => n.map((n) => {
|
|
5
|
+
if (n.endsWith("/*")) return n;
|
|
6
|
+
let r = e(n), i = t(r);
|
|
7
|
+
if (i !== !1) return `.${i}`;
|
|
8
|
+
let a = r.split("/")[1];
|
|
9
|
+
return a == null ? n : `.${a.toLowerCase()}`;
|
|
10
|
+
}).join(", ");
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as mimeTypesToAttachmentExtensionLabels };
|
|
@@ -16,6 +16,4 @@ export declare const mimeTypesToDialFileAcceptTypes: (types?: string[]) => DialF
|
|
|
16
16
|
* given or any type accepts everything.
|
|
17
17
|
*/
|
|
18
18
|
export declare const mimeTypesToFileAccept: (types?: string[]) => string | undefined;
|
|
19
|
-
/** Formats MIME types as a human-readable, comma-separated list of dotted extensions (or the MIME type itself for wildcards). */
|
|
20
|
-
export declare const mimeTypesToAttachmentExtensionLabels: (types: string[]) => string;
|
|
21
19
|
//# sourceMappingURL=attachment-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-types.d.ts","sourceRoot":"","sources":["../../src/files/attachment-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"attachment-types.d.ts","sourceRoot":"","sources":["../../src/files/attachment-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,KACX,IAAI,IAAI,kBAAgE,CAAC;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EAAE,KACf,kBAAkB,EAAE,GAAG,SAYzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,KAAG,MAAM,GAAG,SASjE,CAAC"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { normalizeMimeType as e } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { extension as t } from "mime-types";
|
|
3
2
|
//#region src/files/attachment-types.ts
|
|
4
|
-
var
|
|
5
|
-
if (
|
|
6
|
-
},
|
|
7
|
-
let
|
|
8
|
-
if (
|
|
9
|
-
}
|
|
10
|
-
if (n.endsWith("/*")) return n;
|
|
11
|
-
let r = e(n), i = t(r);
|
|
12
|
-
if (i !== !1) return `.${i}`;
|
|
13
|
-
let a = r.split("/")[1];
|
|
14
|
-
return a == null ? n : `.${a.toLowerCase()}`;
|
|
15
|
-
}).join(", ");
|
|
3
|
+
var t = "*/*", n = (e) => e.startsWith(".") || e.includes("/"), r = (r) => {
|
|
4
|
+
if (r != null) return r.map((n) => n === "*" ? t : n.startsWith(".") ? n : e(n)).filter(n);
|
|
5
|
+
}, i = (e) => {
|
|
6
|
+
let n = r(e);
|
|
7
|
+
if (n != null && n.length !== 0 && !n.some((e) => e === t)) return n.join(",");
|
|
8
|
+
};
|
|
16
9
|
//#endregion
|
|
17
|
-
export {
|
|
10
|
+
export { n as isDialFileAcceptType, r as mimeTypesToDialFileAcceptTypes, i as mimeTypesToFileAccept };
|
package/files/dial-file.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { DialFile } from '@epam/ai-dial-ui-kit';
|
|
2
2
|
/** True when `url` looks like a DIAL Core file id (`files/{bucket}/{path}`). */
|
|
3
3
|
export declare const isDialFileId: (url: string) => boolean;
|
|
4
|
+
/** The decoded parts of a DIAL Core project file id, `projects/{bucket}/{path}/files/{filePath}`. */
|
|
5
|
+
export interface DialProjectFileIdParts {
|
|
6
|
+
/** The project id, `projects/{bucket}/{path}`, with every segment decoded. */
|
|
7
|
+
projectId: string;
|
|
8
|
+
/** The decoded segments of the file path inside the project, e.g. `['artifacts', 'run-1', 'data.csv']`. */
|
|
9
|
+
filePath: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns the decoded parts of a DIAL Core project file id, ignoring any
|
|
13
|
+
* `#...` fragment, or `undefined` when `url` is not one: no `projects/`
|
|
14
|
+
* prefix, no project path, a folder (trailing `/`), an empty segment or a
|
|
15
|
+
* malformed escape.
|
|
16
|
+
*/
|
|
17
|
+
export declare const parseDialProjectFileId: (url: string) => DialProjectFileIdParts | undefined;
|
|
18
|
+
/** True when `url` is a DIAL Core id of a file inside a project, `projects/{bucket}/{path}/files/{filePath}`; see {@link parseDialProjectFileId}. */
|
|
19
|
+
export declare const isDialProjectFileId: (url: string) => boolean;
|
|
20
|
+
/** True when `url` is a DIAL Core file id (`files/…`) or a project file id (`projects/…/files/…`): an id the host resolves to one of its own download routes. */
|
|
21
|
+
export declare const isDialStoredFileId: (url: string) => boolean;
|
|
4
22
|
/** True when `url` is a DIAL Core folder id: a file id ending with `/`, ignoring any `#...` fragment. */
|
|
5
23
|
export declare const isDialFolderId: (url: string) => boolean;
|
|
6
24
|
/**
|
package/files/dial-file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dial-file.d.ts","sourceRoot":"","sources":["../../src/files/dial-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGvE,gFAAgF;AAChF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"dial-file.d.ts","sourceRoot":"","sources":["../../src/files/dial-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGvE,gFAAgF;AAChF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAAmC,CAAC;AAK/E,qGAAqG;AACrG,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAkBD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,KACV,sBAAsB,GAAG,SAqB3B,CAAC;AAEF,qJAAqJ;AACrJ,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,OACb,CAAC;AAEtC,iKAAiK;AACjK,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,OACF,CAAC;AAEhD,yGAAyG;AACzG,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OACS,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,cAAc,MAAM,EACpB,QAAQ,MAAM,KACb,MAmBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,KACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAcrC,CAAC;AAEF,oFAAoF;AACpF,oBAAY,iBAAiB;IAC3B,wBAAwB;IACxB,IAAI,SAAS;IACb,0BAA0B;IAC1B,MAAM,WAAW;IACjB,6BAA6B;IAC7B,QAAQ,aAAa;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,KAC3C,iBAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC,EAC7C,QAAQ,MAAM,KACb,MAAM,GAAG,IAcX,CAAC"}
|
package/files/dial-file.js
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
import { safeDecodeURI as e } from "../shared/string-utils.js";
|
|
2
2
|
import { DialFileNodeType as t } from "@epam/ai-dial-ui-kit";
|
|
3
3
|
//#region src/files/dial-file.ts
|
|
4
|
-
var n = (e) => e.startsWith("files/"), r =
|
|
4
|
+
var n = (e) => e.startsWith("files/"), r = "projects/", i = "/files/", a = (e) => {
|
|
5
|
+
let t = [];
|
|
6
|
+
for (let n of e.split("/")) {
|
|
7
|
+
let e;
|
|
8
|
+
try {
|
|
9
|
+
e = decodeURIComponent(n);
|
|
10
|
+
} catch {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (e === "") return;
|
|
14
|
+
t.push(e);
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}, o = (e) => {
|
|
18
|
+
let t = e.split("#")[0];
|
|
19
|
+
if (!t.startsWith(r)) return;
|
|
20
|
+
let n = t.indexOf("/", 9);
|
|
21
|
+
if (n <= 9) return;
|
|
22
|
+
let o = t.indexOf(i, n);
|
|
23
|
+
if (o <= n) return;
|
|
24
|
+
let s = a(t.slice(9, o)), c = a(t.slice(o + 7));
|
|
25
|
+
if (s != null && c != null) return {
|
|
26
|
+
projectId: `${r}${s.join("/")}`,
|
|
27
|
+
filePath: c
|
|
28
|
+
};
|
|
29
|
+
}, s = (e) => o(e) != null, c = (e) => n(e) || s(e), l = (e) => n(e) && e.split("#")[0].endsWith("/"), u = (t, r) => {
|
|
5
30
|
let i = `files/${r}/`;
|
|
6
31
|
if (t.startsWith(i)) return e(t.slice(i.length));
|
|
7
32
|
if (n(t)) {
|
|
@@ -12,7 +37,7 @@ var n = (e) => e.startsWith("files/"), r = (e) => n(e) && e.split("#")[0].endsWi
|
|
|
12
37
|
}
|
|
13
38
|
}
|
|
14
39
|
return t;
|
|
15
|
-
},
|
|
40
|
+
}, d = (e) => {
|
|
16
41
|
if (!n(e)) return;
|
|
17
42
|
let t = e.slice(6), r = t.indexOf("/");
|
|
18
43
|
if (r < 0) return;
|
|
@@ -26,13 +51,13 @@ var n = (e) => e.startsWith("files/"), r = (e) => n(e) && e.split("#")[0].endsWi
|
|
|
26
51
|
bucket: i,
|
|
27
52
|
path: o
|
|
28
53
|
};
|
|
29
|
-
},
|
|
54
|
+
}, f = /* @__PURE__ */ function(e) {
|
|
30
55
|
return e.File = "file", e.Folder = "folder", e.Multiple = "multiple", e;
|
|
31
|
-
}({}),
|
|
56
|
+
}({}), p = (e) => e.length === 1 ? e[0].nodeType === t.FOLDER ? "folder" : "file" : "multiple", m = (e, t) => {
|
|
32
57
|
let r = e.url ?? e.id ?? "";
|
|
33
58
|
if (!r) return null;
|
|
34
59
|
let i = (n(r) ? r : `files/${e.bucket ?? t}/${r.replace(/^\/+/, "")}`).split("/").filter((e) => e !== ".." && e !== ".").join("/");
|
|
35
60
|
return i.endsWith("/") ? i : `${i}/`;
|
|
36
61
|
};
|
|
37
62
|
//#endregion
|
|
38
|
-
export {
|
|
63
|
+
export { f as FileSelectionKind, p as getFileSelectionKind, n as isDialFileId, l as isDialFolderId, s as isDialProjectFileId, c as isDialStoredFileId, o as parseDialProjectFileId, d as resolveDialFileBucketAndPath, m as resolveDialFolderPath, u as resolveRelativeDialFilePath };
|