@epam/ai-dial-toolset-editor 1.2.0-dev.176 → 1.2.0-dev.181
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/components/GeneralForm/GeneralForm.d.ts +4 -1
- package/components/GeneralForm/GeneralForm.d.ts.map +1 -1
- package/components/ToolsetEditor/ToolsetEditor.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +352 -347
- package/models/general-form-props.d.ts +5 -1
- package/models/general-form-props.d.ts.map +1 -1
- package/package.json +4 -4
- package/utils/toolsets.d.ts +8 -0
- package/utils/toolsets.d.ts.map +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { GeneralFormProps } from '../../models/general-form-props';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* General (metadata) form shared by the Toolset and Custom App editors.
|
|
5
|
+
* @deprecated Render `MetadataForm` from `@epam/ai-dial-builder-form` and supply `avatarPicker.resolveAttachedIconUrl` instead.
|
|
6
|
+
*/
|
|
4
7
|
export declare const GeneralForm: FC<GeneralFormProps>;
|
|
5
8
|
//# sourceMappingURL=GeneralForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralForm.d.ts","sourceRoot":"","sources":["../../../src/components/GeneralForm/GeneralForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GeneralForm.d.ts","sourceRoot":"","sources":["../../../src/components/GeneralForm/GeneralForm.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAmCxE;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmE5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolsetEditor.d.ts","sourceRoot":"","sources":["../../../src/components/ToolsetEditor/ToolsetEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolsetEditor.d.ts","sourceRoot":"","sources":["../../../src/components/ToolsetEditor/ToolsetEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAgD5E,uKAAuK;AACvK,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAqahD,CAAC"}
|
package/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.visible{visibility:visible}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.max-w-\[1060px\]{max-width:1060px}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.items-center{align-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.border-
|
|
1
|
+
.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.visible{visibility:visible}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.max-w-\[1060px\]{max-width:1060px}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.items-center{align-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.border-t{border-top-width:1px}.border-tertiary{border-color:var(--stroke-tertiary,#e0e6f0)}.px-2{padding-left:.5rem;padding-right:.5rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-start{text-align:start}.text-primary{color:var(--text-primary,#161b2d)}.text-secondary{color:var(--text-secondary,#57647a)}@media (min-width:1280px){.desktop\:not-sr-only{height:auto;margin:0;overflow:visible;padding:0;position:static;width:auto;clip:auto;white-space:normal}}
|
package/index.js
CHANGED
|
@@ -1,62 +1,83 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeploymentCreationFieldErrorCode as e, EntityEditor as t, MetadataField as n, MetadataForm as r, useMetadataForm as i, validateDeploymentCreationFields as a } from "@epam/ai-dial-builder-form";
|
|
2
2
|
import { ToolsetAuthTypes as o, ToolsetCredentialsLevel as s, WithLogin as c, dialFileToAttachment as l, getApiErrorDetails as u } from "@epam/ai-dial-chat-hooks";
|
|
3
3
|
import { CopyButton as d, ENTITY_DESCRIPTION_MAX_LENGTH as f, ENTITY_NAME_MAX_LENGTH as p, TAG_INPUT_TAG_CLASS_NAME as m, mergeClasses as h, useCodeCopy as g } from "@epam/ai-dial-chat-shared";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { memo as _, useCallback as v, useEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
5
|
+
import { IconBrandOauth as C, IconKey as w, IconLockOff as ee, IconLogin as te, IconLogout as T } from "@tabler/icons-react";
|
|
6
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
7
|
+
import { ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as O, DIAL_KIT_ICON_STROKE as k, Input as A, NeutralButton as j, PasswordInput as M, Radio as N, RadioGroup as P, SegmentedControl as F, Select as I, TagInput as L } from "@epam/ai-dial-ui-kit";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var R = {
|
|
10
10
|
metadataSection: "dial-toolset-editor-metadata-section",
|
|
11
11
|
setupSection: "dial-toolset-editor-setup-section"
|
|
12
|
-
},
|
|
12
|
+
}, z = /* @__PURE__ */ function(e) {
|
|
13
13
|
return e.Http = "HTTP", e.Sse = "SSE", e;
|
|
14
|
-
}({}),
|
|
15
|
-
[o.OAuth]:
|
|
16
|
-
[o.ApiKey]:
|
|
17
|
-
[o.None]:
|
|
18
|
-
},
|
|
14
|
+
}({}), B = "New toolset", V = "0.0.1", H = {
|
|
15
|
+
[o.OAuth]: C,
|
|
16
|
+
[o.ApiKey]: w,
|
|
17
|
+
[o.None]: ee
|
|
18
|
+
}, U = ({ defaultName: e = B, existingNames: t }) => {
|
|
19
19
|
let n = new Set(t);
|
|
20
20
|
if (!n.has(e)) return e;
|
|
21
21
|
let r = 1;
|
|
22
22
|
for (; n.has(`${e} ${r}`);) r += 1;
|
|
23
23
|
return `${e} ${r}`;
|
|
24
|
-
},
|
|
24
|
+
}, W = () => ({
|
|
25
25
|
authenticationType: o.None,
|
|
26
26
|
withLogin: c.WithoutLogin,
|
|
27
27
|
isLoggedIn: !1
|
|
28
|
-
}),
|
|
29
|
-
name:
|
|
30
|
-
version:
|
|
28
|
+
}), G = (e = []) => ({
|
|
29
|
+
name: U({ existingNames: e }),
|
|
30
|
+
version: V,
|
|
31
31
|
iconUrl: "",
|
|
32
32
|
description: "",
|
|
33
33
|
topics: [],
|
|
34
34
|
otherLocales: [],
|
|
35
35
|
endpoint: "",
|
|
36
|
-
protocol:
|
|
36
|
+
protocol: z.Http,
|
|
37
37
|
allowedTools: [],
|
|
38
|
-
auth:
|
|
39
|
-
}),
|
|
38
|
+
auth: W()
|
|
39
|
+
}), K = (e) => {
|
|
40
40
|
if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
|
|
41
41
|
try {
|
|
42
42
|
return !!new URL(e);
|
|
43
43
|
} catch {
|
|
44
44
|
return !1;
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, q = (e) => K(e.trim()), ie = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), J = (e) => {
|
|
47
47
|
let t = e?.trim() ?? "";
|
|
48
|
-
if (!t ||
|
|
48
|
+
if (!t || K(t)) return t;
|
|
49
49
|
let n = [t];
|
|
50
50
|
try {
|
|
51
51
|
let e = decodeURIComponent(t);
|
|
52
52
|
e !== t && n.push(e);
|
|
53
53
|
} catch {}
|
|
54
54
|
for (let e of n) {
|
|
55
|
-
let t =
|
|
56
|
-
if (
|
|
55
|
+
let t = ie(e);
|
|
56
|
+
if (K(t)) return t;
|
|
57
57
|
}
|
|
58
58
|
return t;
|
|
59
|
-
},
|
|
59
|
+
}, Y = (e) => !e?.trim() || q(e), X = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === o.ApiKey ? e.keyHeader?.trim() ? e.withLogin === c.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === o.OAuth && e.withLogin === c.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && Y(e.authorizationEndpoint) && Y(e.tokenEndpoint) : !0, ae = (e, t = !1) => Object.keys(a(e, { validateVersionPattern: !0 })).length === 0 && q(e.endpoint) && X(e.auth, t), oe = new Set([
|
|
60
|
+
"name",
|
|
61
|
+
"description",
|
|
62
|
+
"iconUrl",
|
|
63
|
+
"version",
|
|
64
|
+
"topics",
|
|
65
|
+
"otherLocales"
|
|
66
|
+
]), se = (e) => ({
|
|
67
|
+
name: e.name,
|
|
68
|
+
description: e.description,
|
|
69
|
+
iconUrl: e.iconUrl,
|
|
70
|
+
version: e.version,
|
|
71
|
+
topics: e.topics,
|
|
72
|
+
otherLocales: e.otherLocales
|
|
73
|
+
}), ce = (e) => {
|
|
74
|
+
let t = {}, n = {};
|
|
75
|
+
for (let [r, i] of Object.entries(e)) (oe.has(r) ? t : n)[r] = i;
|
|
76
|
+
return {
|
|
77
|
+
metadata: t,
|
|
78
|
+
setup: n
|
|
79
|
+
};
|
|
80
|
+
}, Z = {
|
|
60
81
|
name: {
|
|
61
82
|
label: "Name",
|
|
62
83
|
placeholder: "Enter name"
|
|
@@ -95,105 +116,81 @@ var B = {
|
|
|
95
116
|
saveLabel: "Save"
|
|
96
117
|
},
|
|
97
118
|
ariaLabel: "General"
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
otherLocales: t.otherLocales
|
|
132
|
-
},
|
|
133
|
-
errors: r,
|
|
134
|
-
onChange: d,
|
|
135
|
-
onNameBlur: f,
|
|
136
|
-
onVersionBlur: p,
|
|
137
|
-
iconPreviewUrl: y,
|
|
138
|
-
onAddAvatarClick: () => g(!0),
|
|
139
|
-
labels: _,
|
|
140
|
-
availableLocaleOptions: u
|
|
141
|
-
}), /* @__PURE__ */ R(e, {
|
|
142
|
-
isOpen: h,
|
|
143
|
-
onClose: () => g(!1),
|
|
144
|
-
onAttach: (e) => {
|
|
145
|
-
let [t] = e.files, n = t ? l(t, i, { resolvePreviewUrl: o }) : null;
|
|
146
|
-
n?.url && d({ iconUrl: n.url }), g(!1);
|
|
147
|
-
},
|
|
148
|
-
bucket: i,
|
|
149
|
-
FileManagerModal: a,
|
|
150
|
-
allowedMimeTypes: s,
|
|
151
|
-
maxFileSizeBytes: c,
|
|
152
|
-
labels: v
|
|
153
|
-
})] });
|
|
154
|
-
}, $ = /* @__PURE__ */ function(e) {
|
|
119
|
+
}, le = ({ form: e, errors: t, bucket: n, FileManagerModal: i, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: u, onNameBlur: d, onVersionBlur: f, labels: p }) => {
|
|
120
|
+
let m = v((e) => {
|
|
121
|
+
let [t] = e.files;
|
|
122
|
+
return (t ? l(t, n, { resolvePreviewUrl: a }) : null)?.url;
|
|
123
|
+
}, [n, a]);
|
|
124
|
+
return /* @__PURE__ */ E(r, {
|
|
125
|
+
values: e,
|
|
126
|
+
errors: t,
|
|
127
|
+
onChange: u,
|
|
128
|
+
onNameBlur: d,
|
|
129
|
+
onVersionBlur: f,
|
|
130
|
+
avatarPicker: b(() => ({
|
|
131
|
+
bucket: n,
|
|
132
|
+
FileManagerModal: i,
|
|
133
|
+
resolveIconUrl: a,
|
|
134
|
+
resolveAttachedIconUrl: m,
|
|
135
|
+
allowedMimeTypes: o,
|
|
136
|
+
maxFileSizeBytes: s
|
|
137
|
+
}), [
|
|
138
|
+
n,
|
|
139
|
+
i,
|
|
140
|
+
a,
|
|
141
|
+
m,
|
|
142
|
+
o,
|
|
143
|
+
s
|
|
144
|
+
]),
|
|
145
|
+
availableLocaleOptions: c,
|
|
146
|
+
labels: b(() => ({
|
|
147
|
+
form: p?.form ?? Z,
|
|
148
|
+
avatarPicker: p?.avatarPicker
|
|
149
|
+
}), [p?.form, p?.avatarPicker])
|
|
150
|
+
});
|
|
151
|
+
}, Q = /* @__PURE__ */ function(e) {
|
|
155
152
|
return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
|
|
156
|
-
}({}),
|
|
157
|
-
let [
|
|
158
|
-
|
|
153
|
+
}({}), ue = (e, t) => e === o.None ? c.WithoutLogin : e === o.OAuth && !t ? c.WithConfig : c.WithLogin, de = (e, t) => e === o.None ? t?.typeNone ?? "Open access" : e === o.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", fe = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: l, onOAuthLogin: d, onNotifySuccess: f, onNotifyError: p, onAuthChange: h, onEnsureSaved: g, labels: _ }) => {
|
|
154
|
+
let [v, y] = S(!1), [b, x] = S(!1), C = e.isLoggedIn || n || v, w = q(a) && X(e, i) && !C, ee = (t) => {
|
|
155
|
+
C || t === e.authenticationType || h({
|
|
159
156
|
authenticationType: t,
|
|
160
|
-
withLogin:
|
|
157
|
+
withLogin: ue(t, !!e.clientId?.trim())
|
|
161
158
|
});
|
|
162
|
-
}, N = (e) => {
|
|
163
|
-
h({ withLogin: e });
|
|
164
159
|
}, P = (e) => {
|
|
160
|
+
h({ withLogin: e });
|
|
161
|
+
}, I = (e) => {
|
|
165
162
|
switch (e.auth != null && h(e.auth), e.status) {
|
|
166
|
-
case
|
|
167
|
-
h({ isLoggedIn: !0 }), f(
|
|
163
|
+
case Q.Success:
|
|
164
|
+
h({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
168
165
|
return;
|
|
169
|
-
case
|
|
170
|
-
p(
|
|
166
|
+
case Q.PopupBlocked:
|
|
167
|
+
p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
|
|
171
168
|
return;
|
|
172
|
-
case
|
|
173
|
-
p(
|
|
169
|
+
case Q.InvalidConfig:
|
|
170
|
+
p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
|
|
174
171
|
return;
|
|
175
|
-
case
|
|
176
|
-
p(
|
|
172
|
+
case Q.Failed:
|
|
173
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
|
|
177
174
|
return;
|
|
178
|
-
case
|
|
175
|
+
case Q.Cancelled: return;
|
|
179
176
|
}
|
|
180
|
-
},
|
|
181
|
-
if (!
|
|
177
|
+
}, R = async () => {
|
|
178
|
+
if (!w) return;
|
|
182
179
|
if (e.authenticationType === o.OAuth) {
|
|
183
|
-
|
|
180
|
+
y(!0);
|
|
184
181
|
try {
|
|
185
|
-
|
|
182
|
+
I(await d({
|
|
186
183
|
auth: e,
|
|
187
184
|
ensureSaved: g
|
|
188
185
|
}));
|
|
189
186
|
} finally {
|
|
190
|
-
|
|
187
|
+
y(!1);
|
|
191
188
|
}
|
|
192
189
|
return;
|
|
193
190
|
}
|
|
194
191
|
let t = await g();
|
|
195
192
|
if (t) {
|
|
196
|
-
|
|
193
|
+
y(!0);
|
|
197
194
|
try {
|
|
198
195
|
let n = {
|
|
199
196
|
url: t,
|
|
@@ -201,173 +198,173 @@ var B = {
|
|
|
201
198
|
authenticationType: e.authenticationType,
|
|
202
199
|
apiKey: e.apiKey?.trim()
|
|
203
200
|
};
|
|
204
|
-
await l.login(t, n), h({ isLoggedIn: !0 }), f(
|
|
201
|
+
await l.login(t, n), h({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
205
202
|
} catch (e) {
|
|
206
203
|
let { traceId: t } = await u(e);
|
|
207
|
-
p(
|
|
204
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
208
205
|
} finally {
|
|
209
|
-
|
|
206
|
+
y(!1);
|
|
210
207
|
}
|
|
211
208
|
}
|
|
212
|
-
},
|
|
213
|
-
|
|
209
|
+
}, z = async () => {
|
|
210
|
+
y(!0);
|
|
214
211
|
try {
|
|
215
212
|
let t = {
|
|
216
213
|
url: r,
|
|
217
214
|
credentialsLevel: s.User,
|
|
218
215
|
authenticationType: e.authenticationType
|
|
219
216
|
};
|
|
220
|
-
await l.logout(r, t), h({ isLoggedIn: !1 }),
|
|
217
|
+
await l.logout(r, t), h({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
221
218
|
} catch (e) {
|
|
222
219
|
let { traceId: t } = await u(e);
|
|
223
|
-
p(
|
|
220
|
+
p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
224
221
|
} finally {
|
|
225
|
-
|
|
222
|
+
y(!1);
|
|
226
223
|
}
|
|
227
|
-
}, B = () => e.isLoggedIn ? /* @__PURE__ */
|
|
224
|
+
}, B = () => e.isLoggedIn ? /* @__PURE__ */ E("div", {
|
|
228
225
|
className: "flex",
|
|
229
|
-
children: /* @__PURE__ */
|
|
230
|
-
label:
|
|
231
|
-
iconBefore: /* @__PURE__ */
|
|
232
|
-
size:
|
|
233
|
-
stroke:
|
|
226
|
+
children: /* @__PURE__ */ E(j, {
|
|
227
|
+
label: _?.logOutLabel ?? "Log out",
|
|
228
|
+
iconBefore: /* @__PURE__ */ E(T, {
|
|
229
|
+
size: O.MD,
|
|
230
|
+
stroke: k
|
|
234
231
|
}),
|
|
235
|
-
onClick: () =>
|
|
236
|
-
disabled: n ||
|
|
232
|
+
onClick: () => x(!0),
|
|
233
|
+
disabled: n || v
|
|
237
234
|
})
|
|
238
|
-
}) : /* @__PURE__ */
|
|
235
|
+
}) : /* @__PURE__ */ E("div", {
|
|
239
236
|
className: "flex",
|
|
240
|
-
children: /* @__PURE__ */
|
|
241
|
-
label:
|
|
242
|
-
iconBefore: /* @__PURE__ */
|
|
243
|
-
size:
|
|
244
|
-
stroke:
|
|
237
|
+
children: /* @__PURE__ */ E(j, {
|
|
238
|
+
label: _?.logInLabel ?? "Log in",
|
|
239
|
+
iconBefore: /* @__PURE__ */ E(te, {
|
|
240
|
+
size: O.MD,
|
|
241
|
+
stroke: k
|
|
245
242
|
}),
|
|
246
|
-
onClick:
|
|
247
|
-
disabled: !
|
|
243
|
+
onClick: R,
|
|
244
|
+
disabled: !w
|
|
248
245
|
})
|
|
249
246
|
});
|
|
250
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ D("section", {
|
|
251
248
|
className: "flex flex-col gap-2",
|
|
252
249
|
children: [
|
|
253
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ E("h3", {
|
|
254
251
|
className: "dial-h3-text",
|
|
255
|
-
children:
|
|
252
|
+
children: _?.sectionTitle ?? "Authentication"
|
|
256
253
|
}),
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
"aria-label":
|
|
254
|
+
/* @__PURE__ */ E(F, {
|
|
255
|
+
"aria-label": _?.sectionTitle ?? "Authentication",
|
|
259
256
|
value: e.authenticationType,
|
|
260
|
-
onChange: (e) =>
|
|
257
|
+
onChange: (e) => ee(e),
|
|
261
258
|
segmentClassName: "px-2",
|
|
262
259
|
items: [
|
|
263
260
|
o.None,
|
|
264
261
|
o.OAuth,
|
|
265
262
|
o.ApiKey
|
|
266
263
|
].map((t) => {
|
|
267
|
-
let n =
|
|
264
|
+
let n = H[t];
|
|
268
265
|
return {
|
|
269
266
|
value: t,
|
|
270
|
-
label: /* @__PURE__ */
|
|
267
|
+
label: /* @__PURE__ */ D("div", {
|
|
271
268
|
className: "flex items-center gap-2",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ E(n, {
|
|
273
270
|
className: "shrink-0",
|
|
274
|
-
size:
|
|
275
|
-
stroke:
|
|
271
|
+
size: O.SM,
|
|
272
|
+
stroke: k,
|
|
276
273
|
"aria-hidden": !0
|
|
277
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ E("span", {
|
|
278
275
|
className: "sr-only desktop:not-sr-only",
|
|
279
|
-
children:
|
|
276
|
+
children: de(t, _)
|
|
280
277
|
})]
|
|
281
278
|
}),
|
|
282
|
-
disabled:
|
|
279
|
+
disabled: C && e.authenticationType !== t
|
|
283
280
|
};
|
|
284
281
|
})
|
|
285
282
|
}),
|
|
286
|
-
e.authenticationType === o.None && /* @__PURE__ */
|
|
283
|
+
e.authenticationType === o.None && /* @__PURE__ */ E("p", {
|
|
287
284
|
className: "dial-small-text pt-2 text-secondary",
|
|
288
|
-
children:
|
|
285
|
+
children: _?.openAccessDescription ?? "Open endpoint, no credentials"
|
|
289
286
|
}),
|
|
290
|
-
e.authenticationType === o.OAuth && /* @__PURE__ */
|
|
287
|
+
e.authenticationType === o.OAuth && /* @__PURE__ */ D("div", {
|
|
291
288
|
className: "flex flex-col gap-3 pt-2",
|
|
292
289
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ D("div", {
|
|
294
291
|
className: "flex flex-col gap-2",
|
|
295
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ E(N, {
|
|
296
293
|
name: "oauth-login-mode",
|
|
297
294
|
id: "oauth-with-login",
|
|
298
295
|
value: c.WithLogin,
|
|
299
|
-
labelProps: { label:
|
|
296
|
+
labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
|
|
300
297
|
isSelected: e.withLogin === c.WithLogin,
|
|
301
|
-
disabled:
|
|
302
|
-
onChange:
|
|
303
|
-
}), /* @__PURE__ */
|
|
298
|
+
disabled: C,
|
|
299
|
+
onChange: P
|
|
300
|
+
}), /* @__PURE__ */ E(N, {
|
|
304
301
|
name: "oauth-login-mode",
|
|
305
302
|
id: "oauth-with-config",
|
|
306
303
|
value: c.WithConfig,
|
|
307
|
-
labelProps: { label:
|
|
304
|
+
labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
|
|
308
305
|
isSelected: e.withLogin === c.WithConfig,
|
|
309
|
-
disabled:
|
|
310
|
-
onChange:
|
|
306
|
+
disabled: C,
|
|
307
|
+
onChange: P
|
|
311
308
|
})]
|
|
312
309
|
}),
|
|
313
|
-
e.withLogin === c.WithConfig && /* @__PURE__ */
|
|
310
|
+
e.withLogin === c.WithConfig && /* @__PURE__ */ D("div", {
|
|
314
311
|
className: "flex flex-col gap-3",
|
|
315
312
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ E(A, {
|
|
317
314
|
id: "toolset-client-id",
|
|
318
315
|
value: e.clientId ?? "",
|
|
319
316
|
onChange: (e) => h({ clientId: e ?? "" }),
|
|
320
317
|
labelProps: {
|
|
321
|
-
label:
|
|
318
|
+
label: _?.clientIdLabel ?? "Client ID",
|
|
322
319
|
required: !0
|
|
323
320
|
},
|
|
324
|
-
placeholder:
|
|
321
|
+
placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
|
|
325
322
|
error: t.clientId || void 0,
|
|
326
323
|
invalid: !!t.clientId,
|
|
327
|
-
disabled:
|
|
324
|
+
disabled: C
|
|
328
325
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ E(M, {
|
|
330
327
|
id: "toolset-client-secret",
|
|
331
328
|
value: e.clientSecret ?? "",
|
|
332
329
|
onChange: (e) => h({ clientSecret: e ?? "" }),
|
|
333
330
|
labelProps: {
|
|
334
|
-
label:
|
|
331
|
+
label: _?.clientSecretLabel ?? "Client secret",
|
|
335
332
|
required: !i
|
|
336
333
|
},
|
|
337
|
-
placeholder:
|
|
338
|
-
showPasswordLabel:
|
|
339
|
-
hidePasswordLabel:
|
|
334
|
+
placeholder: _?.clientSecretPlaceholder ?? "Enter client secret",
|
|
335
|
+
showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
|
|
336
|
+
hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
|
|
340
337
|
error: t.clientSecret || void 0,
|
|
341
338
|
invalid: !!t.clientSecret,
|
|
342
|
-
disabled:
|
|
339
|
+
disabled: C
|
|
343
340
|
}),
|
|
344
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ E(A, {
|
|
345
342
|
id: "toolset-authorization-endpoint",
|
|
346
343
|
value: e.authorizationEndpoint ?? "",
|
|
347
344
|
onChange: (e) => h({ authorizationEndpoint: e ?? "" }),
|
|
348
|
-
labelProps: { label:
|
|
349
|
-
placeholder:
|
|
345
|
+
labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
|
|
346
|
+
placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
|
|
350
347
|
error: t.authorizationEndpoint || void 0,
|
|
351
348
|
invalid: !!t.authorizationEndpoint,
|
|
352
|
-
disabled:
|
|
349
|
+
disabled: C
|
|
353
350
|
}),
|
|
354
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ E(A, {
|
|
355
352
|
id: "toolset-token-endpoint",
|
|
356
353
|
value: e.tokenEndpoint ?? "",
|
|
357
354
|
onChange: (e) => h({ tokenEndpoint: e ?? "" }),
|
|
358
|
-
labelProps: { label:
|
|
359
|
-
placeholder:
|
|
355
|
+
labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
|
|
356
|
+
placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
|
|
360
357
|
error: t.tokenEndpoint || void 0,
|
|
361
358
|
invalid: !!t.tokenEndpoint,
|
|
362
|
-
disabled:
|
|
359
|
+
disabled: C
|
|
363
360
|
}),
|
|
364
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ E(L, {
|
|
365
362
|
id: "toolset-scopes",
|
|
366
|
-
labelProps: { label:
|
|
367
|
-
placeholder:
|
|
363
|
+
labelProps: { label: _?.scopesLabel ?? "Scopes" },
|
|
364
|
+
placeholder: _?.scopesPlaceholder ?? "Enter scopes",
|
|
368
365
|
value: e.scopes ?? [],
|
|
369
366
|
onChange: (e) => h({ scopes: e }),
|
|
370
|
-
disabled:
|
|
367
|
+
disabled: C,
|
|
371
368
|
tagClassName: m
|
|
372
369
|
})
|
|
373
370
|
]
|
|
@@ -375,99 +372,99 @@ var B = {
|
|
|
375
372
|
B()
|
|
376
373
|
]
|
|
377
374
|
}),
|
|
378
|
-
e.authenticationType === o.ApiKey && /* @__PURE__ */
|
|
375
|
+
e.authenticationType === o.ApiKey && /* @__PURE__ */ D("div", {
|
|
379
376
|
className: "flex flex-col gap-3 pt-2",
|
|
380
377
|
children: [
|
|
381
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ D("div", {
|
|
382
379
|
className: "flex flex-col gap-2",
|
|
383
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ E(N, {
|
|
384
381
|
name: "apikey-login-mode",
|
|
385
382
|
id: "apikey-with-login",
|
|
386
383
|
value: c.WithLogin,
|
|
387
|
-
labelProps: { label:
|
|
384
|
+
labelProps: { label: _?.withLoginLabel ?? "With login" },
|
|
388
385
|
isSelected: e.withLogin === c.WithLogin,
|
|
389
|
-
disabled:
|
|
390
|
-
onChange:
|
|
391
|
-
}), /* @__PURE__ */
|
|
386
|
+
disabled: C,
|
|
387
|
+
onChange: P
|
|
388
|
+
}), /* @__PURE__ */ E(N, {
|
|
392
389
|
name: "apikey-login-mode",
|
|
393
390
|
id: "apikey-without-login",
|
|
394
391
|
value: c.WithoutLogin,
|
|
395
|
-
labelProps: { label:
|
|
392
|
+
labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
|
|
396
393
|
isSelected: e.withLogin === c.WithoutLogin,
|
|
397
|
-
disabled:
|
|
398
|
-
onChange:
|
|
394
|
+
disabled: C,
|
|
395
|
+
onChange: P
|
|
399
396
|
})]
|
|
400
397
|
}),
|
|
401
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ D("div", {
|
|
402
399
|
className: "flex flex-col gap-3",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ E(A, {
|
|
404
401
|
id: "toolset-key-header",
|
|
405
402
|
value: e.keyHeader ?? "",
|
|
406
403
|
onChange: (e) => h({ keyHeader: e ?? "" }),
|
|
407
404
|
labelProps: {
|
|
408
|
-
label:
|
|
405
|
+
label: _?.keyHeaderLabel ?? "API Key parameter name",
|
|
409
406
|
required: !0
|
|
410
407
|
},
|
|
411
|
-
placeholder:
|
|
408
|
+
placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
|
|
412
409
|
error: t.keyHeader || void 0,
|
|
413
410
|
invalid: !!t.keyHeader,
|
|
414
|
-
disabled:
|
|
415
|
-
}), e.withLogin === c.WithLogin && /* @__PURE__ */
|
|
411
|
+
disabled: C
|
|
412
|
+
}), e.withLogin === c.WithLogin && /* @__PURE__ */ E(M, {
|
|
416
413
|
id: "toolset-api-key",
|
|
417
414
|
value: e.apiKey ?? "",
|
|
418
415
|
onChange: (e) => h({ apiKey: e ?? "" }),
|
|
419
416
|
labelProps: {
|
|
420
|
-
label:
|
|
417
|
+
label: _?.apiKeyLabel ?? "API key",
|
|
421
418
|
required: !0
|
|
422
419
|
},
|
|
423
|
-
placeholder:
|
|
424
|
-
showPasswordLabel:
|
|
425
|
-
hidePasswordLabel:
|
|
420
|
+
placeholder: _?.apiKeyPlaceholder ?? "Enter API key",
|
|
421
|
+
showPasswordLabel: _?.showApiKeyLabel ?? "Show API key",
|
|
422
|
+
hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
|
|
426
423
|
error: t.apiKey || void 0,
|
|
427
424
|
invalid: !!t.apiKey,
|
|
428
|
-
disabled:
|
|
425
|
+
disabled: C
|
|
429
426
|
})]
|
|
430
427
|
}),
|
|
431
428
|
e.withLogin !== c.WithoutLogin && B()
|
|
432
429
|
]
|
|
433
430
|
}),
|
|
434
|
-
|
|
435
|
-
open:
|
|
436
|
-
header:
|
|
437
|
-
description:
|
|
438
|
-
confirmLabel:
|
|
439
|
-
cancelLabel:
|
|
440
|
-
variant:
|
|
441
|
-
isLoading:
|
|
442
|
-
disableConfirmButton:
|
|
443
|
-
onConfirm:
|
|
444
|
-
onCancel: () =>
|
|
445
|
-
onClose: () =>
|
|
431
|
+
b && /* @__PURE__ */ E(ne, {
|
|
432
|
+
open: b,
|
|
433
|
+
header: _?.logoutConfirmTitle ?? "Log out?",
|
|
434
|
+
description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
|
|
435
|
+
confirmLabel: _?.logOutLabel ?? "Log out",
|
|
436
|
+
cancelLabel: _?.cancelLabel ?? "Cancel",
|
|
437
|
+
variant: re.Danger,
|
|
438
|
+
isLoading: v,
|
|
439
|
+
disableConfirmButton: v,
|
|
440
|
+
onConfirm: z,
|
|
441
|
+
onCancel: () => x(!1),
|
|
442
|
+
onClose: () => x(!1)
|
|
446
443
|
})
|
|
447
444
|
]
|
|
448
445
|
});
|
|
449
|
-
},
|
|
446
|
+
}, pe = _(({ url: e, className: t, labels: n }) => {
|
|
450
447
|
let { isCopied: r, copy: i } = g(e), a = n?.copiedLabel ?? "Copied!";
|
|
451
|
-
return /* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ D("div", {
|
|
452
449
|
className: h("flex flex-col gap-3", t),
|
|
453
450
|
children: [
|
|
454
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ D("div", {
|
|
455
452
|
className: "flex flex-col gap-1",
|
|
456
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ E("p", {
|
|
457
454
|
className: "dial-body-semi-text text-start text-primary",
|
|
458
455
|
children: n?.title ?? "Connect toolset"
|
|
459
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ E("p", {
|
|
460
457
|
className: "dial-small-text text-start text-secondary",
|
|
461
458
|
children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
|
|
462
459
|
})]
|
|
463
460
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ E("div", { children: /* @__PURE__ */ E(d, {
|
|
465
462
|
copiedLabel: a,
|
|
466
463
|
copyLabel: n?.copyLabel ?? "Copy URL",
|
|
467
464
|
isCopied: r,
|
|
468
465
|
onClick: i
|
|
469
466
|
}) }),
|
|
470
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ E("span", {
|
|
471
468
|
role: "status",
|
|
472
469
|
"aria-live": "polite",
|
|
473
470
|
className: "sr-only",
|
|
@@ -475,16 +472,16 @@ var B = {
|
|
|
475
472
|
})
|
|
476
473
|
]
|
|
477
474
|
});
|
|
478
|
-
}),
|
|
479
|
-
let [g, _] =
|
|
480
|
-
value:
|
|
475
|
+
}), me = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: h }) => {
|
|
476
|
+
let [g, _] = S(null), v = !!a && !!r, x = b(() => [{
|
|
477
|
+
value: z.Http,
|
|
481
478
|
label: "HTTP"
|
|
482
479
|
}, {
|
|
483
|
-
value:
|
|
480
|
+
value: z.Sse,
|
|
484
481
|
label: "SSE"
|
|
485
482
|
}], []);
|
|
486
|
-
return
|
|
487
|
-
if (!r || !o || !
|
|
483
|
+
return y(() => {
|
|
484
|
+
if (!r || !o || !X(e.auth, i)) {
|
|
488
485
|
_(null);
|
|
489
486
|
return;
|
|
490
487
|
}
|
|
@@ -505,10 +502,10 @@ var B = {
|
|
|
505
502
|
e.auth,
|
|
506
503
|
e.endpoint,
|
|
507
504
|
o
|
|
508
|
-
]), /* @__PURE__ */
|
|
505
|
+
]), /* @__PURE__ */ D("div", {
|
|
509
506
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
510
507
|
children: [
|
|
511
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ E(A, {
|
|
512
509
|
id: "toolset-endpoint",
|
|
513
510
|
value: e.endpoint,
|
|
514
511
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
@@ -521,19 +518,19 @@ var B = {
|
|
|
521
518
|
error: t.endpoint || void 0,
|
|
522
519
|
invalid: !!t.endpoint
|
|
523
520
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ E(P, {
|
|
525
522
|
labelProps: {
|
|
526
523
|
label: h?.protocolLabel ?? "Protocol",
|
|
527
524
|
required: !0
|
|
528
525
|
},
|
|
529
526
|
id: "toolset-protocol",
|
|
530
|
-
items:
|
|
527
|
+
items: x,
|
|
531
528
|
value: e.protocol,
|
|
532
529
|
onChange: (e) => {
|
|
533
530
|
d({ protocol: e });
|
|
534
531
|
}
|
|
535
532
|
}),
|
|
536
|
-
g ? /* @__PURE__ */
|
|
533
|
+
g ? /* @__PURE__ */ E(I, {
|
|
537
534
|
id: "toolset-allowed-tools",
|
|
538
535
|
multiple: !0,
|
|
539
536
|
searchable: !0,
|
|
@@ -546,7 +543,7 @@ var B = {
|
|
|
546
543
|
})),
|
|
547
544
|
value: e.allowedTools,
|
|
548
545
|
onChange: (e) => d({ allowedTools: e })
|
|
549
|
-
}) : /* @__PURE__ */
|
|
546
|
+
}) : /* @__PURE__ */ E(L, {
|
|
550
547
|
id: "toolset-allowed-tools",
|
|
551
548
|
labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
|
|
552
549
|
placeholder: h?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
@@ -554,7 +551,7 @@ var B = {
|
|
|
554
551
|
onChange: (e) => d({ allowedTools: e }),
|
|
555
552
|
tagClassName: m
|
|
556
553
|
}),
|
|
557
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ E(fe, {
|
|
558
555
|
auth: e.auth,
|
|
559
556
|
errors: t,
|
|
560
557
|
isSaving: n,
|
|
@@ -569,179 +566,187 @@ var B = {
|
|
|
569
566
|
onEnsureSaved: p,
|
|
570
567
|
labels: h?.auth
|
|
571
568
|
}),
|
|
572
|
-
v && /* @__PURE__ */
|
|
569
|
+
v && /* @__PURE__ */ E(pe, {
|
|
573
570
|
url: a ?? "",
|
|
574
571
|
labels: h?.connect,
|
|
575
572
|
className: "border-t border-tertiary pt-4"
|
|
576
573
|
})
|
|
577
574
|
]
|
|
578
575
|
});
|
|
579
|
-
},
|
|
576
|
+
}, he = [
|
|
580
577
|
"keyHeader",
|
|
581
578
|
"apiKey",
|
|
582
579
|
"clientId",
|
|
583
580
|
"clientSecret",
|
|
584
581
|
"authorizationEndpoint",
|
|
585
582
|
"tokenEndpoint"
|
|
586
|
-
], he =
|
|
587
|
-
"name",
|
|
588
|
-
"version",
|
|
589
|
-
"description",
|
|
590
|
-
"endpoint",
|
|
591
|
-
...me
|
|
592
|
-
], ge = new Set(he), _e = (e) => {
|
|
583
|
+
], ge = ["endpoint", ...he], $ = new Set(ge), _e = { validateVersionPattern: !0 }, ve = (e) => {
|
|
593
584
|
let t = {};
|
|
594
|
-
for (let n of Object.keys(e))
|
|
585
|
+
for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
|
|
595
586
|
return t;
|
|
596
|
-
},
|
|
597
|
-
let
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
587
|
+
}, ye = ({ initialForm: r, toolsetId: a, onPersist: s, onPostSaveLogin: l, onToolsetsChanged: d, onSaveSuccess: m, onSaveComplete: h, onBack: g, buildMcpUrl: _, listToolNames: C, authActions: w, onOAuthLogin: ee, onNotifySuccess: te, onNotifyError: T, bucket: D, FileManagerModal: ne, resolveIconUrl: re, allowedMimeTypes: O, maxFileSizeBytes: k, availableLocaleOptions: A, labels: j }) => {
|
|
588
|
+
let M = !!a, [N, P] = S(""), F = a || N, [I, L] = S({
|
|
589
|
+
initialForm: r,
|
|
590
|
+
key: 0
|
|
591
|
+
});
|
|
592
|
+
I.initialForm !== r && L({
|
|
593
|
+
initialForm: r,
|
|
594
|
+
key: I.key + 1
|
|
595
|
+
});
|
|
596
|
+
let { values: z, setValues: B, markTouched: V, visibleErrorCodes: H, attemptSubmit: U } = i({
|
|
597
|
+
initialValues: b(() => se(r), [r]),
|
|
598
|
+
validationOptions: _e,
|
|
599
|
+
reseedKey: I.key
|
|
600
|
+
}), [W, G] = S(r), K = b(() => ({
|
|
601
|
+
...W,
|
|
602
|
+
...z
|
|
603
|
+
}), [W, z]), [ie, J] = S(!1), [Y, X] = S({}), [oe, Z] = S({}), Q = x(null);
|
|
604
|
+
y(() => {
|
|
605
|
+
G(r), Q.current = r, X({}), Z({}), P("");
|
|
606
|
+
}, [r]);
|
|
607
|
+
let ue = v((e) => {
|
|
608
|
+
let { metadata: t, setup: r } = ce(e);
|
|
609
|
+
Object.keys(t).length > 0 && (B(t), "name" in t && V(n.Name), "version" in t && V(n.Version)), Object.keys(r).length !== 0 && (G((e) => ({
|
|
610
|
+
...e,
|
|
611
|
+
...r
|
|
612
|
+
})), Z((e) => ({
|
|
613
|
+
...e,
|
|
614
|
+
...ve(r)
|
|
615
|
+
})), X((e) => {
|
|
616
|
+
let t = { ...e };
|
|
617
|
+
for (let e of Object.keys(r)) delete t[e];
|
|
618
|
+
return t;
|
|
619
|
+
}));
|
|
620
|
+
}, [B, V]), de = v((e) => {
|
|
621
|
+
G((t) => ({
|
|
615
622
|
...t,
|
|
616
623
|
auth: {
|
|
617
624
|
...t.auth,
|
|
618
625
|
...e
|
|
619
626
|
}
|
|
620
|
-
})),
|
|
627
|
+
})), Z((t) => ({
|
|
621
628
|
...t,
|
|
622
|
-
...
|
|
623
|
-
})),
|
|
629
|
+
...ve(e)
|
|
630
|
+
})), X((t) => {
|
|
624
631
|
let n = { ...t };
|
|
625
|
-
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of
|
|
632
|
+
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of he) delete n[e];
|
|
626
633
|
else for (let t of Object.keys(e)) delete n[t];
|
|
627
634
|
return n;
|
|
628
635
|
}), "isLoggedIn" in e && d();
|
|
629
|
-
}, [d]),
|
|
630
|
-
if (
|
|
631
|
-
|
|
636
|
+
}, [d]), fe = v(async () => {
|
|
637
|
+
if (F && Q.current != null && JSON.stringify(Q.current) === JSON.stringify(K)) return F;
|
|
638
|
+
J(!0);
|
|
632
639
|
try {
|
|
633
|
-
let e = await s(
|
|
634
|
-
return e ? (
|
|
640
|
+
let e = await s(K, F);
|
|
641
|
+
return e ? (F || P(e), Q.current = K, await d(), e) : null;
|
|
635
642
|
} catch {
|
|
636
643
|
return null;
|
|
637
644
|
} finally {
|
|
638
|
-
|
|
645
|
+
J(!1);
|
|
639
646
|
}
|
|
640
647
|
}, [
|
|
641
|
-
|
|
642
|
-
|
|
648
|
+
K,
|
|
649
|
+
F,
|
|
643
650
|
s,
|
|
644
651
|
d
|
|
645
|
-
]),
|
|
646
|
-
let
|
|
647
|
-
return
|
|
648
|
-
}, [
|
|
649
|
-
let e = $(
|
|
650
|
-
if (Object.keys(
|
|
651
|
-
|
|
652
|
+
]), pe = v(async () => await fe() ?? !1, [fe]), $ = v((e) => {
|
|
653
|
+
let t = j?.validation, n = {};
|
|
654
|
+
return e.endpoint.trim() ? q(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === o.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === c.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === o.OAuth && e.auth.withLogin === c.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !M && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !q(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !q(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
|
|
655
|
+
}, [j, M]), ye = v(async () => {
|
|
656
|
+
let e = U(), t = $(K);
|
|
657
|
+
if (!e || Object.keys(t).length > 0) {
|
|
658
|
+
X(t);
|
|
652
659
|
return;
|
|
653
660
|
}
|
|
654
|
-
|
|
661
|
+
X({}), J(!0);
|
|
655
662
|
try {
|
|
656
|
-
let e = await s(
|
|
663
|
+
let e = await s(K, F);
|
|
657
664
|
if (!e) return;
|
|
658
|
-
await d(), m(
|
|
665
|
+
await d(), m(K);
|
|
659
666
|
try {
|
|
660
|
-
await l(e,
|
|
667
|
+
await l(e, K.auth), h();
|
|
661
668
|
} catch (e) {
|
|
662
669
|
let { traceId: t } = await u(e);
|
|
663
|
-
|
|
670
|
+
T(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
664
671
|
}
|
|
665
672
|
} catch {} finally {
|
|
666
|
-
|
|
673
|
+
J(!1);
|
|
667
674
|
}
|
|
668
675
|
}, [
|
|
669
|
-
|
|
676
|
+
U,
|
|
677
|
+
K,
|
|
670
678
|
$,
|
|
671
|
-
|
|
679
|
+
F,
|
|
672
680
|
s,
|
|
673
681
|
d,
|
|
674
682
|
m,
|
|
675
|
-
|
|
683
|
+
h,
|
|
676
684
|
l,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
]),
|
|
680
|
-
let
|
|
681
|
-
for (let
|
|
682
|
-
if (!
|
|
683
|
-
let
|
|
684
|
-
|
|
685
|
+
T,
|
|
686
|
+
j
|
|
687
|
+
]), be = b(() => !ae(K, M), [K, M]), xe = b(() => {
|
|
688
|
+
let t = j?.validation, n = $(K), r = { ...Y };
|
|
689
|
+
for (let e of ge) {
|
|
690
|
+
if (!oe[e]) continue;
|
|
691
|
+
let t = n[e];
|
|
692
|
+
t ? r[e] = t : delete r[e];
|
|
685
693
|
}
|
|
686
|
-
return t;
|
|
694
|
+
return H.name === e.Required ? r.name = t?.nameRequired ?? "Name is required" : H.name === e.TooLong ? r.name = t?.nameTooLong ?? `Use ${p} characters or fewer.` : H.name === e.ControlCharacters && (r.name = t?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), H.description === e.TooLong && (r.description = t?.descriptionTooLong ?? `Use ${f} characters or fewer.`), H.version === e.InvalidFormat && (r.version = t?.versionInvalid ?? "Version may only contain letters, digits, dots, underscores, and dashes"), r;
|
|
687
695
|
}, [
|
|
688
|
-
|
|
689
|
-
|
|
696
|
+
oe,
|
|
697
|
+
Y,
|
|
698
|
+
K,
|
|
699
|
+
j,
|
|
690
700
|
H,
|
|
691
701
|
$
|
|
692
|
-
]),
|
|
693
|
-
return /* @__PURE__ */
|
|
694
|
-
title:
|
|
695
|
-
onBack:
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
})
|
|
702
|
+
]), Se = _ && F ? _(F) : void 0;
|
|
703
|
+
return /* @__PURE__ */ E(t, {
|
|
704
|
+
title: M ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
|
|
705
|
+
onBack: g,
|
|
706
|
+
onCancel: g,
|
|
707
|
+
onSubmit: ye,
|
|
708
|
+
submitLabel: M ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
|
|
709
|
+
isSubmitting: ie,
|
|
710
|
+
isSubmitDisabled: be,
|
|
711
|
+
metadataSectionClassName: R.metadataSection,
|
|
712
|
+
setupSectionClassName: R.setupSection,
|
|
713
|
+
labels: {
|
|
714
|
+
backAriaLabel: j?.layout?.backAriaLabel ?? "Back to catalog",
|
|
715
|
+
savingStatusLabel: j?.layout?.savingStatusLabel ?? "Saving",
|
|
716
|
+
metadataTitle: j?.layout?.metadataSectionTitle ?? "Metadata",
|
|
717
|
+
setupTitle: j?.layout?.setupSectionTitle ?? "Setup",
|
|
718
|
+
cancelLabel: j?.layout?.cancelLabel ?? "Cancel"
|
|
719
|
+
},
|
|
720
|
+
metadata: /* @__PURE__ */ E(le, {
|
|
721
|
+
form: K,
|
|
722
|
+
errors: xe,
|
|
723
|
+
bucket: D,
|
|
724
|
+
FileManagerModal: ne,
|
|
725
|
+
resolveIconUrl: re,
|
|
726
|
+
allowedMimeTypes: O,
|
|
727
|
+
maxFileSizeBytes: k,
|
|
728
|
+
availableLocaleOptions: A,
|
|
729
|
+
onChange: ue,
|
|
730
|
+
labels: j?.general
|
|
722
731
|
}),
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
onAuthChange: Q,
|
|
740
|
-
onEnsureSaved: se,
|
|
741
|
-
labels: P?.settings
|
|
742
|
-
})
|
|
732
|
+
setup: /* @__PURE__ */ E(me, {
|
|
733
|
+
form: K,
|
|
734
|
+
errors: xe,
|
|
735
|
+
isSaving: ie,
|
|
736
|
+
toolsetId: F,
|
|
737
|
+
isEditMode: M,
|
|
738
|
+
connectUrl: Se,
|
|
739
|
+
listToolNames: C,
|
|
740
|
+
authActions: w,
|
|
741
|
+
onOAuthLogin: ee,
|
|
742
|
+
onNotifySuccess: te,
|
|
743
|
+
onNotifyError: T,
|
|
744
|
+
onChange: ue,
|
|
745
|
+
onAuthChange: de,
|
|
746
|
+
onEnsureSaved: pe,
|
|
747
|
+
labels: j?.settings
|
|
743
748
|
})
|
|
744
749
|
});
|
|
745
750
|
};
|
|
746
751
|
//#endregion
|
|
747
|
-
export {
|
|
752
|
+
export { H as AUTH_TYPE_ICONS, B as DEFAULT_TOOLSET_NAME, V as DEFAULT_TOOLSET_VERSION, le as GeneralForm, R as TOOLSET_EDITOR_CLASS, ye as ToolsetEditor, Q as ToolsetOAuthLoginStatus, z as ToolsetTransportType, G as getDefaultToolsetForm, U as getStorageSafeUniqueToolsetName, X as isToolsetAuthValid, ae as isToolsetFormValid, q as isValidEndpointUrl, J as normalizeReturnedEndpointUrl };
|
|
@@ -5,6 +5,7 @@ import { DeploymentGeneralFormData, ToolsetFormErrors } from './toolset-form';
|
|
|
5
5
|
* Pre-translated labels for the general (metadata) form. Each group is
|
|
6
6
|
* optional and replaced as a whole; omitting one falls back to the library's
|
|
7
7
|
* English defaults.
|
|
8
|
+
* @deprecated Use `MetadataFormLabels` from `@epam/ai-dial-builder-form`.
|
|
8
9
|
*/
|
|
9
10
|
export interface GeneralFormLabels {
|
|
10
11
|
/** Labels for the embedded `DeploymentCreationForm` fields. */
|
|
@@ -12,7 +13,10 @@ export interface GeneralFormLabels {
|
|
|
12
13
|
/** Labels for the avatar picker modal. */
|
|
13
14
|
avatarPicker?: AvatarPickerModalLabels;
|
|
14
15
|
}
|
|
15
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Props of the general (metadata) form shared by the Toolset and Custom App editors.
|
|
18
|
+
* @deprecated Use `MetadataFormProps` from `@epam/ai-dial-builder-form`.
|
|
19
|
+
*/
|
|
16
20
|
export interface GeneralFormProps {
|
|
17
21
|
/** Current general form values. */
|
|
18
22
|
form: DeploymentGeneralFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-form-props.d.ts","sourceRoot":"","sources":["../../src/models/general-form-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"general-form-props.d.ts","sourceRoot":"","sources":["../../src/models/general-form-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,4BAA4B,CAAC;IACpC,0CAA0C;IAC1C,YAAY,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,IAAI,EAAE,yBAAyB,CAAC;IAChC,oFAAoF;IACpF,MAAM,EAAE,iBAAiB,CAAC;IAC1B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,gBAAgB,EAAE,aAAa,CAAC,iCAAiC,CAAC,CAAC;IACnE,sEAAsE;IACtE,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,4CAA4C;IAC5C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,sBAAsB,EAAE,kCAAkC,EAAE,CAAC;IAC7D,6DAA6D;IAC7D,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,yBAAyB,CAAC,KAAK,IAAI,CAAC;IAC9D,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,wEAAwE;IACxE,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-toolset-editor",
|
|
3
3
|
"description": "Host-agnostic form for authoring and editing a DIAL MCP toolset",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.181",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
21
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.181"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@epam/ai-dial-chat-hooks": "1.2.0-dev.
|
|
25
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
24
|
+
"@epam/ai-dial-chat-hooks": "1.2.0-dev.181",
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.181",
|
|
26
26
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.21",
|
|
27
27
|
"react": "^19.2.8"
|
|
28
28
|
},
|
package/utils/toolsets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeploymentCreationFormValues } from '../../../builder-form/src/index.ts';
|
|
1
2
|
import { ToolsetAuthFormData, ToolsetFormData } from '../models/toolset-form';
|
|
2
3
|
/**
|
|
3
4
|
* Returns a storage-safe toolset name that does not collide with any existing
|
|
@@ -30,4 +31,11 @@ export declare const normalizeReturnedEndpointUrl: (value?: string) => string;
|
|
|
30
31
|
export declare const isToolsetAuthValid: (auth: ToolsetAuthFormData, isEditMode?: boolean) => boolean;
|
|
31
32
|
/** Returns whether the editor form can be saved without surfacing validation errors. */
|
|
32
33
|
export declare const isToolsetFormValid: (form: ToolsetFormData, isEditMode?: boolean) => boolean;
|
|
34
|
+
/** Returns the Metadata-section slice of a toolset form. */
|
|
35
|
+
export declare const pickToolsetMetadata: (form: ToolsetFormData) => DeploymentCreationFormValues;
|
|
36
|
+
/** Splits a toolset form patch into its Metadata part and its Setup part. */
|
|
37
|
+
export declare const splitToolsetFormPatch: (patch: Partial<ToolsetFormData>) => {
|
|
38
|
+
metadata: Partial<DeploymentCreationFormValues>;
|
|
39
|
+
setup: Partial<ToolsetFormData>;
|
|
40
|
+
};
|
|
33
41
|
//# sourceMappingURL=toolsets.d.ts.map
|
package/utils/toolsets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAAI,iCAG7C;IACD,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,KAAG,MAOH,CAAC;AAQF,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,GAChC,gBAAe,MAAM,EAAO,KAC3B,eAWD,CAAC;AAmBH,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,OACR,CAAC;AAK5C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,MAAM,KAAG,MAkB7D,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,mBAAmB,EACzB,oBAAkB,KACjB,OAmBF,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,eAAe,EACrB,oBAAkB,KACjB,OAKwC,CAAC;AAW5C,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,GAC9B,MAAM,eAAe,KACpB,4BAOD,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,GAChC,OAAO,OAAO,CAAC,eAAe,CAAC,KAC9B;IACD,QAAQ,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAChD,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAWjC,CAAC"}
|