@epam/ai-dial-toolset-editor 1.2.0-dev.225 → 1.2.0-dev.229
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/ToolsetEditor/ToolsetEditor.d.ts.map +1 -1
- package/constants/toolsets.d.ts +3 -0
- package/constants/toolsets.d.ts.map +1 -1
- package/index.js +260 -260
- package/models/toolset-editor-props.d.ts +1 -1
- package/models/toolset-editor-props.d.ts.map +1 -1
- package/package.json +5 -5
- package/utils/toolsets.d.ts.map +1 -1
|
@@ -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":"AAeA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AA4C5E,uKAAuK;AACvK,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAqahD,CAAC"}
|
package/constants/toolsets.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeploymentCreationFormValidationOptions } from '../../../builder-form/src/index.ts';
|
|
1
2
|
import { ToolsetAuthTypes } from '../../../chat-hooks/src/index.ts';
|
|
2
3
|
import { TablerIcon } from '@tabler/icons-react';
|
|
3
4
|
export declare enum ToolsetTransportType {
|
|
@@ -10,6 +11,8 @@ export declare enum ToolsetTransportType {
|
|
|
10
11
|
export declare const DEFAULT_TOOLSET_NAME = "New toolset";
|
|
11
12
|
/** Default display version seeded into a new toolset form. */
|
|
12
13
|
export declare const DEFAULT_TOOLSET_VERSION = "1.0.0";
|
|
14
|
+
/** Metadata checks for a toolset: the version must be SemVer 2.0.0, as DIAL Admin requires. */
|
|
15
|
+
export declare const TOOLSET_METADATA_VALIDATION_OPTIONS: DeploymentCreationFormValidationOptions;
|
|
13
16
|
/** Icon shown for each toolset authentication-type segment; labels arrive via the auth labels. */
|
|
14
17
|
export declare const AUTH_TYPE_ICONS: Record<ToolsetAuthTypes, TablerIcon>;
|
|
15
18
|
//# sourceMappingURL=toolsets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/constants/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B,qCAAqC;IACrC,IAAI,SAAS;IACb,wCAAwC;IACxC,GAAG,QAAQ;CACZ;AAED,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,kGAAkG;AAClG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAIhE,CAAC"}
|
|
1
|
+
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/constants/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B,qCAAqC;IACrC,IAAI,SAAS;IACb,wCAAwC;IACxC,GAAG,QAAQ;CACZ;AAED,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,+FAA+F;AAC/F,eAAO,MAAM,mCAAmC,EAAE,uCACE,CAAC;AAErD,kGAAkG;AAClG,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAIhE,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { DeploymentCreationFieldErrorCode as e, EntityEditor as t, MetadataField as n, MetadataForm as r,
|
|
2
|
-
import { ToolsetAuthTypes as
|
|
3
|
-
import { CopyButton as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { IconBrandOauth as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as
|
|
1
|
+
import { DeploymentCreationFieldErrorCode as e, EntityEditor as t, MetadataField as n, MetadataForm as r, SEMVER_VERSION_PATTERN as i, useMetadataForm as a, validateDeploymentCreationFields as o } from "@epam/ai-dial-builder-form";
|
|
2
|
+
import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, dialFileToAttachment as u, getApiErrorDetails as d } from "@epam/ai-dial-chat-hooks";
|
|
3
|
+
import { CopyButton as f, ENTITY_DESCRIPTION_MAX_LENGTH as p, ENTITY_NAME_MAX_LENGTH as m, TAG_INPUT_TAG_CLASS_NAME as h, mergeClasses as g, useCodeCopy as _ } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { memo as v, useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
5
|
+
import { IconBrandOauth as w, IconKey as ee, IconLockOff as T, IconLogin as E, IconLogout as te } from "@tabler/icons-react";
|
|
6
|
+
import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
7
|
+
import { ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as ie, Radio as N, RadioGroup as P, SegmentedControl as F, Select as ae, TagInput as I } from "@epam/ai-dial-ui-kit";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var L = {
|
|
10
10
|
metadataSection: "dial-toolset-editor-metadata-section",
|
|
11
11
|
setupSection: "dial-toolset-editor-setup-section"
|
|
12
|
-
},
|
|
12
|
+
}, R = /* @__PURE__ */ function(e) {
|
|
13
13
|
return e.Http = "HTTP", e.Sse = "SSE", e;
|
|
14
|
-
}({}),
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
},
|
|
14
|
+
}({}), z = "New toolset", B = "1.0.0", oe = { validateVersionPattern: i }, V = {
|
|
15
|
+
[s.OAuth]: w,
|
|
16
|
+
[s.ApiKey]: ee,
|
|
17
|
+
[s.None]: T
|
|
18
|
+
}, H = ({ defaultName: e = z, 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
|
-
},
|
|
25
|
-
authenticationType:
|
|
26
|
-
withLogin:
|
|
24
|
+
}, U = () => ({
|
|
25
|
+
authenticationType: s.None,
|
|
26
|
+
withLogin: l.WithoutLogin,
|
|
27
27
|
isLoggedIn: !1
|
|
28
|
-
}),
|
|
29
|
-
name:
|
|
30
|
-
version:
|
|
28
|
+
}), W = (e = []) => ({
|
|
29
|
+
name: H({ existingNames: e }),
|
|
30
|
+
version: B,
|
|
31
31
|
iconUrl: "",
|
|
32
32
|
description: "",
|
|
33
33
|
topics: [],
|
|
34
34
|
otherLocales: [],
|
|
35
35
|
endpoint: "",
|
|
36
|
-
protocol:
|
|
36
|
+
protocol: R.Http,
|
|
37
37
|
allowedTools: [],
|
|
38
|
-
auth:
|
|
39
|
-
}),
|
|
38
|
+
auth: U()
|
|
39
|
+
}), G = (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
|
+
}, K = (e) => G(e.trim()), q = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), se = (e) => {
|
|
47
47
|
let t = e?.trim() ?? "";
|
|
48
|
-
if (!t ||
|
|
48
|
+
if (!t || G(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 = q(e);
|
|
56
|
+
if (G(t)) return t;
|
|
57
57
|
}
|
|
58
58
|
return t;
|
|
59
|
-
},
|
|
59
|
+
}, J = (e) => !e?.trim() || K(e), Y = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && J(e.authorizationEndpoint) && J(e.tokenEndpoint) : !0, ce = (e, t = !1) => Object.keys(o(e, oe)).length === 0 && K(e.endpoint) && Y(e.auth, t), X = new Set([
|
|
60
60
|
"name",
|
|
61
61
|
"description",
|
|
62
62
|
"iconUrl",
|
|
63
63
|
"version",
|
|
64
64
|
"topics",
|
|
65
65
|
"otherLocales"
|
|
66
|
-
]),
|
|
66
|
+
]), le = (e) => ({
|
|
67
67
|
name: e.name,
|
|
68
68
|
description: e.description,
|
|
69
69
|
iconUrl: e.iconUrl,
|
|
70
70
|
version: e.version,
|
|
71
71
|
topics: e.topics,
|
|
72
72
|
otherLocales: e.otherLocales
|
|
73
|
-
}),
|
|
73
|
+
}), ue = (e) => {
|
|
74
74
|
let t = {}, n = {};
|
|
75
|
-
for (let [r, i] of Object.entries(e)) (
|
|
75
|
+
for (let [r, i] of Object.entries(e)) (X.has(r) ? t : n)[r] = i;
|
|
76
76
|
return {
|
|
77
77
|
metadata: t,
|
|
78
78
|
setup: n
|
|
@@ -116,18 +116,18 @@ var R = {
|
|
|
116
116
|
saveLabel: "Save"
|
|
117
117
|
},
|
|
118
118
|
ariaLabel: "General"
|
|
119
|
-
},
|
|
120
|
-
let m =
|
|
119
|
+
}, de = ({ form: e, errors: t, bucket: n, FileManagerModal: i, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: d, onVersionBlur: f, labels: p }) => {
|
|
120
|
+
let m = y((e) => {
|
|
121
121
|
let [t] = e.files;
|
|
122
|
-
return (t ?
|
|
122
|
+
return (t ? u(t, n, { resolvePreviewUrl: a }) : null)?.url;
|
|
123
123
|
}, [n, a]);
|
|
124
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ D(r, {
|
|
125
125
|
values: e,
|
|
126
126
|
errors: t,
|
|
127
|
-
onChange:
|
|
127
|
+
onChange: l,
|
|
128
128
|
onNameBlur: d,
|
|
129
129
|
onVersionBlur: f,
|
|
130
|
-
avatarPicker:
|
|
130
|
+
avatarPicker: x(() => ({
|
|
131
131
|
bucket: n,
|
|
132
132
|
FileManagerModal: i,
|
|
133
133
|
resolveIconUrl: a,
|
|
@@ -143,25 +143,25 @@ var R = {
|
|
|
143
143
|
s
|
|
144
144
|
]),
|
|
145
145
|
availableLocaleOptions: c,
|
|
146
|
-
labels:
|
|
146
|
+
labels: x(() => ({
|
|
147
147
|
form: p?.form ?? Z,
|
|
148
148
|
avatarPicker: p?.avatarPicker
|
|
149
149
|
}), [p?.form, p?.avatarPicker])
|
|
150
150
|
});
|
|
151
151
|
}, Q = /* @__PURE__ */ function(e) {
|
|
152
152
|
return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
|
|
153
|
-
}({}),
|
|
154
|
-
let [v, y] =
|
|
155
|
-
|
|
153
|
+
}({}), fe = (e, t) => e === s.None ? l.WithoutLogin : e === s.OAuth && !t ? l.WithConfig : l.WithLogin, pe = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", me = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: u, onNotifySuccess: f, onNotifyError: p, onAuthChange: m, onEnsureSaved: g, labels: _ }) => {
|
|
154
|
+
let [v, y] = C(!1), [b, x] = C(!1), S = e.isLoggedIn || n || v, w = K(a) && Y(e, i) && !S, ee = (t) => {
|
|
155
|
+
S || t === e.authenticationType || m({
|
|
156
156
|
authenticationType: t,
|
|
157
|
-
withLogin:
|
|
157
|
+
withLogin: fe(t, !!e.clientId?.trim())
|
|
158
158
|
});
|
|
159
|
+
}, T = (e) => {
|
|
160
|
+
m({ withLogin: e });
|
|
159
161
|
}, P = (e) => {
|
|
160
|
-
|
|
161
|
-
}, I = (e) => {
|
|
162
|
-
switch (e.auth != null && h(e.auth), e.status) {
|
|
162
|
+
switch (e.auth != null && m(e.auth), e.status) {
|
|
163
163
|
case Q.Success:
|
|
164
|
-
|
|
164
|
+
m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
165
165
|
return;
|
|
166
166
|
case Q.PopupBlocked:
|
|
167
167
|
p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
|
|
@@ -174,12 +174,12 @@ var R = {
|
|
|
174
174
|
return;
|
|
175
175
|
case Q.Cancelled: return;
|
|
176
176
|
}
|
|
177
|
-
},
|
|
177
|
+
}, ae = async () => {
|
|
178
178
|
if (!w) return;
|
|
179
|
-
if (e.authenticationType ===
|
|
179
|
+
if (e.authenticationType === s.OAuth) {
|
|
180
180
|
y(!0);
|
|
181
181
|
try {
|
|
182
|
-
|
|
182
|
+
P(await u({
|
|
183
183
|
auth: e,
|
|
184
184
|
ensureSaved: g
|
|
185
185
|
}));
|
|
@@ -194,126 +194,126 @@ var R = {
|
|
|
194
194
|
try {
|
|
195
195
|
let n = {
|
|
196
196
|
url: t,
|
|
197
|
-
credentialsLevel:
|
|
197
|
+
credentialsLevel: c.User,
|
|
198
198
|
authenticationType: e.authenticationType,
|
|
199
199
|
apiKey: e.apiKey?.trim()
|
|
200
200
|
};
|
|
201
|
-
await
|
|
201
|
+
await o.login(t, n), m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
202
202
|
} catch (e) {
|
|
203
|
-
let { traceId: t } = await
|
|
203
|
+
let { traceId: t } = await d(e);
|
|
204
204
|
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
205
205
|
} finally {
|
|
206
206
|
y(!1);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
},
|
|
209
|
+
}, L = async () => {
|
|
210
210
|
y(!0);
|
|
211
211
|
try {
|
|
212
212
|
let t = {
|
|
213
213
|
url: r,
|
|
214
|
-
credentialsLevel:
|
|
214
|
+
credentialsLevel: c.User,
|
|
215
215
|
authenticationType: e.authenticationType
|
|
216
216
|
};
|
|
217
|
-
await
|
|
217
|
+
await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
218
218
|
} catch (e) {
|
|
219
|
-
let { traceId: t } = await
|
|
219
|
+
let { traceId: t } = await d(e);
|
|
220
220
|
p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
221
221
|
} finally {
|
|
222
222
|
y(!1);
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, R = () => e.isLoggedIn ? /* @__PURE__ */ D("div", {
|
|
225
225
|
className: "flex",
|
|
226
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ D(M, {
|
|
227
227
|
label: _?.logOutLabel ?? "Log out",
|
|
228
|
-
iconBefore: /* @__PURE__ */
|
|
229
|
-
size:
|
|
230
|
-
stroke:
|
|
228
|
+
iconBefore: /* @__PURE__ */ D(te, {
|
|
229
|
+
size: k.MD,
|
|
230
|
+
stroke: A
|
|
231
231
|
}),
|
|
232
232
|
onClick: () => x(!0),
|
|
233
233
|
disabled: n || v
|
|
234
234
|
})
|
|
235
|
-
}) : /* @__PURE__ */
|
|
235
|
+
}) : /* @__PURE__ */ D("div", {
|
|
236
236
|
className: "flex",
|
|
237
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ D(M, {
|
|
238
238
|
label: _?.logInLabel ?? "Log in",
|
|
239
|
-
iconBefore: /* @__PURE__ */ E
|
|
240
|
-
size:
|
|
241
|
-
stroke:
|
|
239
|
+
iconBefore: /* @__PURE__ */ D(E, {
|
|
240
|
+
size: k.MD,
|
|
241
|
+
stroke: A
|
|
242
242
|
}),
|
|
243
|
-
onClick:
|
|
243
|
+
onClick: ae,
|
|
244
244
|
disabled: !w
|
|
245
245
|
})
|
|
246
246
|
});
|
|
247
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ O("section", {
|
|
248
248
|
className: "flex flex-col gap-2",
|
|
249
249
|
children: [
|
|
250
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ D("h3", {
|
|
251
251
|
className: "dial-h3-text",
|
|
252
252
|
children: _?.sectionTitle ?? "Authentication"
|
|
253
253
|
}),
|
|
254
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ D(F, {
|
|
255
255
|
"aria-label": _?.sectionTitle ?? "Authentication",
|
|
256
256
|
value: e.authenticationType,
|
|
257
257
|
onChange: (e) => ee(e),
|
|
258
258
|
segmentClassName: "px-2",
|
|
259
259
|
items: [
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
s.None,
|
|
261
|
+
s.OAuth,
|
|
262
|
+
s.ApiKey
|
|
263
263
|
].map((t) => {
|
|
264
|
-
let n =
|
|
264
|
+
let n = V[t];
|
|
265
265
|
return {
|
|
266
266
|
value: t,
|
|
267
|
-
label: /* @__PURE__ */
|
|
267
|
+
label: /* @__PURE__ */ O("div", {
|
|
268
268
|
className: "flex items-center gap-2",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ D(n, {
|
|
270
270
|
className: "shrink-0",
|
|
271
|
-
size:
|
|
272
|
-
stroke:
|
|
271
|
+
size: k.SM,
|
|
272
|
+
stroke: A,
|
|
273
273
|
"aria-hidden": !0
|
|
274
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ D("span", {
|
|
275
275
|
className: "sr-only desktop:not-sr-only",
|
|
276
|
-
children:
|
|
276
|
+
children: pe(t, _)
|
|
277
277
|
})]
|
|
278
278
|
}),
|
|
279
|
-
disabled:
|
|
279
|
+
disabled: S && e.authenticationType !== t
|
|
280
280
|
};
|
|
281
281
|
})
|
|
282
282
|
}),
|
|
283
|
-
e.authenticationType ===
|
|
283
|
+
e.authenticationType === s.None && /* @__PURE__ */ D("p", {
|
|
284
284
|
className: "dial-small-text pt-2 text-secondary",
|
|
285
285
|
children: _?.openAccessDescription ?? "Open endpoint, no credentials"
|
|
286
286
|
}),
|
|
287
|
-
e.authenticationType ===
|
|
287
|
+
e.authenticationType === s.OAuth && /* @__PURE__ */ O("div", {
|
|
288
288
|
className: "flex flex-col gap-3 pt-2",
|
|
289
289
|
children: [
|
|
290
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ O("div", {
|
|
291
291
|
className: "flex flex-col gap-2",
|
|
292
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ D(N, {
|
|
293
293
|
name: "oauth-login-mode",
|
|
294
294
|
id: "oauth-with-login",
|
|
295
|
-
value:
|
|
295
|
+
value: l.WithLogin,
|
|
296
296
|
labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
|
|
297
|
-
isSelected: e.withLogin ===
|
|
298
|
-
disabled:
|
|
299
|
-
onChange:
|
|
300
|
-
}), /* @__PURE__ */
|
|
297
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
298
|
+
disabled: S,
|
|
299
|
+
onChange: T
|
|
300
|
+
}), /* @__PURE__ */ D(N, {
|
|
301
301
|
name: "oauth-login-mode",
|
|
302
302
|
id: "oauth-with-config",
|
|
303
|
-
value:
|
|
303
|
+
value: l.WithConfig,
|
|
304
304
|
labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
|
|
305
|
-
isSelected: e.withLogin ===
|
|
306
|
-
disabled:
|
|
307
|
-
onChange:
|
|
305
|
+
isSelected: e.withLogin === l.WithConfig,
|
|
306
|
+
disabled: S,
|
|
307
|
+
onChange: T
|
|
308
308
|
})]
|
|
309
309
|
}),
|
|
310
|
-
e.withLogin ===
|
|
310
|
+
e.withLogin === l.WithConfig && /* @__PURE__ */ O("div", {
|
|
311
311
|
className: "flex flex-col gap-3",
|
|
312
312
|
children: [
|
|
313
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ D(j, {
|
|
314
314
|
id: "toolset-client-id",
|
|
315
315
|
value: e.clientId ?? "",
|
|
316
|
-
onChange: (e) =>
|
|
316
|
+
onChange: (e) => m({ clientId: e ?? "" }),
|
|
317
317
|
labelProps: {
|
|
318
318
|
label: _?.clientIdLabel ?? "Client ID",
|
|
319
319
|
required: !0
|
|
@@ -321,12 +321,12 @@ var R = {
|
|
|
321
321
|
placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
|
|
322
322
|
error: t.clientId || void 0,
|
|
323
323
|
invalid: !!t.clientId,
|
|
324
|
-
disabled:
|
|
324
|
+
disabled: S
|
|
325
325
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ D(ie, {
|
|
327
327
|
id: "toolset-client-secret",
|
|
328
328
|
value: e.clientSecret ?? "",
|
|
329
|
-
onChange: (e) =>
|
|
329
|
+
onChange: (e) => m({ clientSecret: e ?? "" }),
|
|
330
330
|
labelProps: {
|
|
331
331
|
label: _?.clientSecretLabel ?? "Client secret",
|
|
332
332
|
required: !i
|
|
@@ -336,71 +336,71 @@ var R = {
|
|
|
336
336
|
hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
|
|
337
337
|
error: t.clientSecret || void 0,
|
|
338
338
|
invalid: !!t.clientSecret,
|
|
339
|
-
disabled:
|
|
339
|
+
disabled: S
|
|
340
340
|
}),
|
|
341
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ D(j, {
|
|
342
342
|
id: "toolset-authorization-endpoint",
|
|
343
343
|
value: e.authorizationEndpoint ?? "",
|
|
344
|
-
onChange: (e) =>
|
|
344
|
+
onChange: (e) => m({ authorizationEndpoint: e ?? "" }),
|
|
345
345
|
labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
|
|
346
346
|
placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
|
|
347
347
|
error: t.authorizationEndpoint || void 0,
|
|
348
348
|
invalid: !!t.authorizationEndpoint,
|
|
349
|
-
disabled:
|
|
349
|
+
disabled: S
|
|
350
350
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ D(j, {
|
|
352
352
|
id: "toolset-token-endpoint",
|
|
353
353
|
value: e.tokenEndpoint ?? "",
|
|
354
|
-
onChange: (e) =>
|
|
354
|
+
onChange: (e) => m({ tokenEndpoint: e ?? "" }),
|
|
355
355
|
labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
|
|
356
356
|
placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
|
|
357
357
|
error: t.tokenEndpoint || void 0,
|
|
358
358
|
invalid: !!t.tokenEndpoint,
|
|
359
|
-
disabled:
|
|
359
|
+
disabled: S
|
|
360
360
|
}),
|
|
361
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ D(I, {
|
|
362
362
|
id: "toolset-scopes",
|
|
363
363
|
labelProps: { label: _?.scopesLabel ?? "Scopes" },
|
|
364
364
|
placeholder: _?.scopesPlaceholder ?? "Enter scopes",
|
|
365
365
|
value: e.scopes ?? [],
|
|
366
|
-
onChange: (e) =>
|
|
367
|
-
disabled:
|
|
368
|
-
tagClassName:
|
|
366
|
+
onChange: (e) => m({ scopes: e }),
|
|
367
|
+
disabled: S,
|
|
368
|
+
tagClassName: h
|
|
369
369
|
})
|
|
370
370
|
]
|
|
371
371
|
}),
|
|
372
|
-
|
|
372
|
+
R()
|
|
373
373
|
]
|
|
374
374
|
}),
|
|
375
|
-
e.authenticationType ===
|
|
375
|
+
e.authenticationType === s.ApiKey && /* @__PURE__ */ O("div", {
|
|
376
376
|
className: "flex flex-col gap-3 pt-2",
|
|
377
377
|
children: [
|
|
378
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ O("div", {
|
|
379
379
|
className: "flex flex-col gap-2",
|
|
380
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ D(N, {
|
|
381
381
|
name: "apikey-login-mode",
|
|
382
382
|
id: "apikey-with-login",
|
|
383
|
-
value:
|
|
383
|
+
value: l.WithLogin,
|
|
384
384
|
labelProps: { label: _?.withLoginLabel ?? "With login" },
|
|
385
|
-
isSelected: e.withLogin ===
|
|
386
|
-
disabled:
|
|
387
|
-
onChange:
|
|
388
|
-
}), /* @__PURE__ */
|
|
385
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
386
|
+
disabled: S,
|
|
387
|
+
onChange: T
|
|
388
|
+
}), /* @__PURE__ */ D(N, {
|
|
389
389
|
name: "apikey-login-mode",
|
|
390
390
|
id: "apikey-without-login",
|
|
391
|
-
value:
|
|
391
|
+
value: l.WithoutLogin,
|
|
392
392
|
labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
|
|
393
|
-
isSelected: e.withLogin ===
|
|
394
|
-
disabled:
|
|
395
|
-
onChange:
|
|
393
|
+
isSelected: e.withLogin === l.WithoutLogin,
|
|
394
|
+
disabled: S,
|
|
395
|
+
onChange: T
|
|
396
396
|
})]
|
|
397
397
|
}),
|
|
398
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ O("div", {
|
|
399
399
|
className: "flex flex-col gap-3",
|
|
400
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ D(j, {
|
|
401
401
|
id: "toolset-key-header",
|
|
402
402
|
value: e.keyHeader ?? "",
|
|
403
|
-
onChange: (e) =>
|
|
403
|
+
onChange: (e) => m({ keyHeader: e ?? "" }),
|
|
404
404
|
labelProps: {
|
|
405
405
|
label: _?.keyHeaderLabel ?? "API Key parameter name",
|
|
406
406
|
required: !0
|
|
@@ -408,11 +408,11 @@ var R = {
|
|
|
408
408
|
placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
|
|
409
409
|
error: t.keyHeader || void 0,
|
|
410
410
|
invalid: !!t.keyHeader,
|
|
411
|
-
disabled:
|
|
412
|
-
}), e.withLogin ===
|
|
411
|
+
disabled: S
|
|
412
|
+
}), e.withLogin === l.WithLogin && /* @__PURE__ */ D(ie, {
|
|
413
413
|
id: "toolset-api-key",
|
|
414
414
|
value: e.apiKey ?? "",
|
|
415
|
-
onChange: (e) =>
|
|
415
|
+
onChange: (e) => m({ apiKey: e ?? "" }),
|
|
416
416
|
labelProps: {
|
|
417
417
|
label: _?.apiKeyLabel ?? "API key",
|
|
418
418
|
required: !0
|
|
@@ -422,13 +422,13 @@ var R = {
|
|
|
422
422
|
hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
|
|
423
423
|
error: t.apiKey || void 0,
|
|
424
424
|
invalid: !!t.apiKey,
|
|
425
|
-
disabled:
|
|
425
|
+
disabled: S
|
|
426
426
|
})]
|
|
427
427
|
}),
|
|
428
|
-
e.withLogin !==
|
|
428
|
+
e.withLogin !== l.WithoutLogin && R()
|
|
429
429
|
]
|
|
430
430
|
}),
|
|
431
|
-
b && /* @__PURE__ */
|
|
431
|
+
b && /* @__PURE__ */ D(ne, {
|
|
432
432
|
open: b,
|
|
433
433
|
header: _?.logoutConfirmTitle ?? "Log out?",
|
|
434
434
|
description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
|
|
@@ -437,34 +437,34 @@ var R = {
|
|
|
437
437
|
variant: re.Danger,
|
|
438
438
|
isLoading: v,
|
|
439
439
|
disableConfirmButton: v,
|
|
440
|
-
onConfirm:
|
|
440
|
+
onConfirm: L,
|
|
441
441
|
onCancel: () => x(!1),
|
|
442
442
|
onClose: () => x(!1)
|
|
443
443
|
})
|
|
444
444
|
]
|
|
445
445
|
});
|
|
446
|
-
},
|
|
447
|
-
let { isCopied: r, copy: i } =
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
className:
|
|
446
|
+
}, $ = v(({ url: e, className: t, labels: n }) => {
|
|
447
|
+
let { isCopied: r, copy: i } = _(e), a = n?.copiedLabel ?? "Copied!";
|
|
448
|
+
return /* @__PURE__ */ O("div", {
|
|
449
|
+
className: g("flex flex-col gap-3", t),
|
|
450
450
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ O("div", {
|
|
452
452
|
className: "flex flex-col gap-1",
|
|
453
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ D("p", {
|
|
454
454
|
className: "dial-body-semi-text text-start text-primary",
|
|
455
455
|
children: n?.title ?? "Connect toolset"
|
|
456
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ D("p", {
|
|
457
457
|
className: "dial-small-text text-start text-secondary",
|
|
458
458
|
children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
|
|
459
459
|
})]
|
|
460
460
|
}),
|
|
461
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(f, {
|
|
462
462
|
copiedLabel: a,
|
|
463
463
|
copyLabel: n?.copyLabel ?? "Copy URL",
|
|
464
464
|
isCopied: r,
|
|
465
465
|
onClick: i
|
|
466
466
|
}) }),
|
|
467
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ D("span", {
|
|
468
468
|
role: "status",
|
|
469
469
|
"aria-live": "polite",
|
|
470
470
|
className: "sr-only",
|
|
@@ -472,16 +472,16 @@ var R = {
|
|
|
472
472
|
})
|
|
473
473
|
]
|
|
474
474
|
});
|
|
475
|
-
}),
|
|
476
|
-
let [g, _] =
|
|
477
|
-
value:
|
|
475
|
+
}), he = ({ 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: m }) => {
|
|
476
|
+
let [g, _] = C(null), v = !!a && !!r, y = x(() => [{
|
|
477
|
+
value: R.Http,
|
|
478
478
|
label: "HTTP"
|
|
479
479
|
}, {
|
|
480
|
-
value:
|
|
480
|
+
value: R.Sse,
|
|
481
481
|
label: "SSE"
|
|
482
482
|
}], []);
|
|
483
|
-
return
|
|
484
|
-
if (!r || !o || !
|
|
483
|
+
return b(() => {
|
|
484
|
+
if (!r || !o || !Y(e.auth, i)) {
|
|
485
485
|
_(null);
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
@@ -502,56 +502,56 @@ var R = {
|
|
|
502
502
|
e.auth,
|
|
503
503
|
e.endpoint,
|
|
504
504
|
o
|
|
505
|
-
]), /* @__PURE__ */
|
|
505
|
+
]), /* @__PURE__ */ O("div", {
|
|
506
506
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
507
507
|
children: [
|
|
508
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ D(j, {
|
|
509
509
|
id: "toolset-endpoint",
|
|
510
510
|
value: e.endpoint,
|
|
511
511
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
512
512
|
labelProps: {
|
|
513
|
-
label:
|
|
513
|
+
label: m?.endpointLabel ?? "Endpoint",
|
|
514
514
|
required: !0
|
|
515
515
|
},
|
|
516
|
-
placeholder:
|
|
517
|
-
caption:
|
|
516
|
+
placeholder: m?.endpointPlaceholder ?? "https://...",
|
|
517
|
+
caption: m?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
|
|
518
518
|
error: t.endpoint || void 0,
|
|
519
519
|
invalid: !!t.endpoint
|
|
520
520
|
}),
|
|
521
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ D(P, {
|
|
522
522
|
labelProps: {
|
|
523
|
-
label:
|
|
523
|
+
label: m?.protocolLabel ?? "Protocol",
|
|
524
524
|
required: !0
|
|
525
525
|
},
|
|
526
526
|
id: "toolset-protocol",
|
|
527
|
-
items:
|
|
527
|
+
items: y,
|
|
528
528
|
value: e.protocol,
|
|
529
529
|
onChange: (e) => {
|
|
530
530
|
d({ protocol: e });
|
|
531
531
|
}
|
|
532
532
|
}),
|
|
533
|
-
g ? /* @__PURE__ */
|
|
533
|
+
g ? /* @__PURE__ */ D(ae, {
|
|
534
534
|
id: "toolset-allowed-tools",
|
|
535
535
|
multiple: !0,
|
|
536
536
|
searchable: !0,
|
|
537
537
|
selectAll: !0,
|
|
538
|
-
labelProps: { label:
|
|
539
|
-
placeholder:
|
|
538
|
+
labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
|
|
539
|
+
placeholder: m?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
|
|
540
540
|
options: g.map((e) => ({
|
|
541
541
|
value: e,
|
|
542
542
|
label: e
|
|
543
543
|
})),
|
|
544
544
|
value: e.allowedTools,
|
|
545
545
|
onChange: (e) => d({ allowedTools: e })
|
|
546
|
-
}) : /* @__PURE__ */
|
|
546
|
+
}) : /* @__PURE__ */ D(I, {
|
|
547
547
|
id: "toolset-allowed-tools",
|
|
548
|
-
labelProps: { label:
|
|
549
|
-
placeholder:
|
|
548
|
+
labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
|
|
549
|
+
placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
550
550
|
value: e.allowedTools,
|
|
551
551
|
onChange: (e) => d({ allowedTools: e }),
|
|
552
|
-
tagClassName:
|
|
552
|
+
tagClassName: h
|
|
553
553
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ D(me, {
|
|
555
555
|
auth: e.auth,
|
|
556
556
|
errors: t,
|
|
557
557
|
isSaving: n,
|
|
@@ -564,152 +564,152 @@ var R = {
|
|
|
564
564
|
onNotifyError: u,
|
|
565
565
|
onAuthChange: f,
|
|
566
566
|
onEnsureSaved: p,
|
|
567
|
-
labels:
|
|
567
|
+
labels: m?.auth
|
|
568
568
|
}),
|
|
569
|
-
v && /* @__PURE__ */
|
|
569
|
+
v && /* @__PURE__ */ D($, {
|
|
570
570
|
url: a ?? "",
|
|
571
|
-
labels:
|
|
571
|
+
labels: m?.connect,
|
|
572
572
|
className: "border-t border-tertiary pt-4"
|
|
573
573
|
})
|
|
574
574
|
]
|
|
575
575
|
});
|
|
576
|
-
},
|
|
576
|
+
}, ge = [
|
|
577
577
|
"keyHeader",
|
|
578
578
|
"apiKey",
|
|
579
579
|
"clientId",
|
|
580
580
|
"clientSecret",
|
|
581
581
|
"authorizationEndpoint",
|
|
582
582
|
"tokenEndpoint"
|
|
583
|
-
],
|
|
583
|
+
], _e = ["endpoint", ...ge], ve = new Set(_e), ye = (e) => {
|
|
584
584
|
let t = {};
|
|
585
|
-
for (let n of Object.keys(e))
|
|
585
|
+
for (let n of Object.keys(e)) ve.has(n) && (t[n] = !0);
|
|
586
586
|
return t;
|
|
587
|
-
},
|
|
588
|
-
let M = !!
|
|
587
|
+
}, be = ({ initialForm: r, toolsetId: i, onPersist: o, onPostSaveLogin: c, onToolsetsChanged: u, onSaveSuccess: f, onSaveComplete: h, onBack: g, buildMcpUrl: _, listToolNames: v, authActions: w, onOAuthLogin: ee, onNotifySuccess: T, onNotifyError: E, bucket: te, FileManagerModal: O, resolveIconUrl: ne, allowedMimeTypes: re, maxFileSizeBytes: k, availableLocaleOptions: A, labels: j }) => {
|
|
588
|
+
let M = !!i, [ie, N] = C(""), P = i || ie, [F, ae] = C({
|
|
589
589
|
initialForm: r,
|
|
590
590
|
key: 0
|
|
591
591
|
});
|
|
592
|
-
|
|
592
|
+
F.initialForm !== r && ae({
|
|
593
593
|
initialForm: r,
|
|
594
|
-
key:
|
|
594
|
+
key: F.key + 1
|
|
595
595
|
});
|
|
596
|
-
let { values:
|
|
597
|
-
initialValues:
|
|
598
|
-
validationOptions:
|
|
599
|
-
reseedKey:
|
|
600
|
-
}), [
|
|
601
|
-
...
|
|
602
|
-
...
|
|
603
|
-
}), [
|
|
604
|
-
|
|
605
|
-
|
|
596
|
+
let { values: I, setValues: R, markTouched: z, visibleErrorCodes: B, attemptSubmit: V } = a({
|
|
597
|
+
initialValues: x(() => le(r), [r]),
|
|
598
|
+
validationOptions: oe,
|
|
599
|
+
reseedKey: F.key
|
|
600
|
+
}), [H, U] = C(r), W = x(() => ({
|
|
601
|
+
...H,
|
|
602
|
+
...I
|
|
603
|
+
}), [H, I]), [G, q] = C(!1), [se, J] = C({}), [Y, X] = C({}), Z = S(null);
|
|
604
|
+
b(() => {
|
|
605
|
+
U(r), Z.current = r, J({}), X({}), N("");
|
|
606
606
|
}, [r]);
|
|
607
|
-
let
|
|
608
|
-
let { metadata: t, setup: r } =
|
|
609
|
-
Object.keys(t).length > 0 && (
|
|
607
|
+
let Q = y((e) => {
|
|
608
|
+
let { metadata: t, setup: r } = ue(e);
|
|
609
|
+
Object.keys(t).length > 0 && (R(t), "name" in t && z(n.Name), "version" in t && z(n.Version)), Object.keys(r).length !== 0 && (U((e) => ({
|
|
610
610
|
...e,
|
|
611
611
|
...r
|
|
612
|
-
})),
|
|
612
|
+
})), X((e) => ({
|
|
613
613
|
...e,
|
|
614
|
-
...
|
|
615
|
-
})),
|
|
614
|
+
...ye(r)
|
|
615
|
+
})), J((e) => {
|
|
616
616
|
let t = { ...e };
|
|
617
617
|
for (let e of Object.keys(r)) delete t[e];
|
|
618
618
|
return t;
|
|
619
619
|
}));
|
|
620
|
-
}, [
|
|
621
|
-
|
|
620
|
+
}, [R, z]), fe = y((e) => {
|
|
621
|
+
U((t) => ({
|
|
622
622
|
...t,
|
|
623
623
|
auth: {
|
|
624
624
|
...t.auth,
|
|
625
625
|
...e
|
|
626
626
|
}
|
|
627
|
-
})),
|
|
627
|
+
})), X((t) => ({
|
|
628
628
|
...t,
|
|
629
|
-
...
|
|
630
|
-
})),
|
|
629
|
+
...ye(e)
|
|
630
|
+
})), J((t) => {
|
|
631
631
|
let n = { ...t };
|
|
632
|
-
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 ge) delete n[e];
|
|
633
633
|
else for (let t of Object.keys(e)) delete n[t];
|
|
634
634
|
return n;
|
|
635
|
-
}), "isLoggedIn" in e &&
|
|
636
|
-
}, [
|
|
637
|
-
if (
|
|
638
|
-
|
|
635
|
+
}), "isLoggedIn" in e && u();
|
|
636
|
+
}, [u]), pe = y(async () => {
|
|
637
|
+
if (P && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(W)) return P;
|
|
638
|
+
q(!0);
|
|
639
639
|
try {
|
|
640
|
-
let e = await
|
|
641
|
-
return e ? (
|
|
640
|
+
let e = await o(W, P);
|
|
641
|
+
return e ? (P || N(e), Z.current = W, await u(), e) : null;
|
|
642
642
|
} catch {
|
|
643
643
|
return null;
|
|
644
644
|
} finally {
|
|
645
|
-
|
|
645
|
+
q(!1);
|
|
646
646
|
}
|
|
647
647
|
}, [
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
]),
|
|
648
|
+
W,
|
|
649
|
+
P,
|
|
650
|
+
o,
|
|
651
|
+
u
|
|
652
|
+
]), me = y(async () => await pe() ?? !1, [pe]), $ = y((e) => {
|
|
653
653
|
let t = j?.validation, n = {};
|
|
654
|
-
return e.endpoint.trim() ?
|
|
655
|
-
}, [j, M]),
|
|
656
|
-
let e =
|
|
654
|
+
return e.endpoint.trim() ? K(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 === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.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() && !K(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !K(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
|
|
655
|
+
}, [j, M]), ve = y(async () => {
|
|
656
|
+
let e = V(), t = $(W);
|
|
657
657
|
if (!e || Object.keys(t).length > 0) {
|
|
658
|
-
|
|
658
|
+
J(t);
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
J({}), q(!0);
|
|
662
662
|
try {
|
|
663
|
-
let e = await
|
|
663
|
+
let e = await o(W, P);
|
|
664
664
|
if (!e) return;
|
|
665
|
-
await
|
|
665
|
+
await u(), f(W);
|
|
666
666
|
try {
|
|
667
|
-
await
|
|
667
|
+
await c(e, W.auth), h();
|
|
668
668
|
} catch (e) {
|
|
669
|
-
let { traceId: t } = await
|
|
670
|
-
|
|
669
|
+
let { traceId: t } = await d(e);
|
|
670
|
+
E(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
671
671
|
}
|
|
672
672
|
} catch {} finally {
|
|
673
|
-
|
|
673
|
+
q(!1);
|
|
674
674
|
}
|
|
675
675
|
}, [
|
|
676
|
-
|
|
677
|
-
|
|
676
|
+
V,
|
|
677
|
+
W,
|
|
678
678
|
$,
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
679
|
+
P,
|
|
680
|
+
o,
|
|
681
|
+
u,
|
|
682
|
+
f,
|
|
683
683
|
h,
|
|
684
|
-
|
|
685
|
-
|
|
684
|
+
c,
|
|
685
|
+
E,
|
|
686
686
|
j
|
|
687
|
-
]), be =
|
|
688
|
-
let t = j?.validation, n = $(
|
|
689
|
-
for (let e of
|
|
690
|
-
if (!
|
|
687
|
+
]), be = x(() => !ce(W, M), [W, M]), xe = x(() => {
|
|
688
|
+
let t = j?.validation, n = $(W), r = { ...se };
|
|
689
|
+
for (let e of _e) {
|
|
690
|
+
if (!Y[e]) continue;
|
|
691
691
|
let t = n[e];
|
|
692
692
|
t ? r[e] = t : delete r[e];
|
|
693
693
|
}
|
|
694
|
-
return
|
|
694
|
+
return B.name === e.Required ? r.name = t?.nameRequired ?? "Name is required" : B.name === e.TooLong ? r.name = t?.nameTooLong ?? `Use ${m} characters or fewer.` : B.name === e.ControlCharacters && (r.name = t?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), B.description === e.TooLong && (r.description = t?.descriptionTooLong ?? `Use ${p} characters or fewer.`), B.version === e.InvalidFormat && (r.version = t?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
|
|
695
695
|
}, [
|
|
696
|
-
oe,
|
|
697
696
|
Y,
|
|
698
|
-
|
|
697
|
+
se,
|
|
698
|
+
W,
|
|
699
699
|
j,
|
|
700
|
-
|
|
700
|
+
B,
|
|
701
701
|
$
|
|
702
|
-
]), Se = _ &&
|
|
703
|
-
return /* @__PURE__ */
|
|
702
|
+
]), Se = _ && P ? _(P) : void 0;
|
|
703
|
+
return /* @__PURE__ */ D(t, {
|
|
704
704
|
title: M ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
|
|
705
705
|
onBack: g,
|
|
706
706
|
onCancel: g,
|
|
707
|
-
onSubmit:
|
|
707
|
+
onSubmit: ve,
|
|
708
708
|
submitLabel: M ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
|
|
709
|
-
isSubmitting:
|
|
709
|
+
isSubmitting: G,
|
|
710
710
|
isSubmitDisabled: be,
|
|
711
|
-
metadataSectionClassName:
|
|
712
|
-
setupSectionClassName:
|
|
711
|
+
metadataSectionClassName: L.metadataSection,
|
|
712
|
+
setupSectionClassName: L.setupSection,
|
|
713
713
|
labels: {
|
|
714
714
|
backAriaLabel: j?.layout?.backAriaLabel ?? "Back to catalog",
|
|
715
715
|
savingStatusLabel: j?.layout?.savingStatusLabel ?? "Saving",
|
|
@@ -717,36 +717,36 @@ var R = {
|
|
|
717
717
|
setupTitle: j?.layout?.setupSectionTitle ?? "Setup",
|
|
718
718
|
cancelLabel: j?.layout?.cancelLabel ?? "Cancel"
|
|
719
719
|
},
|
|
720
|
-
metadata: /* @__PURE__ */
|
|
721
|
-
form:
|
|
720
|
+
metadata: /* @__PURE__ */ D(de, {
|
|
721
|
+
form: W,
|
|
722
722
|
errors: xe,
|
|
723
|
-
bucket:
|
|
724
|
-
FileManagerModal:
|
|
725
|
-
resolveIconUrl:
|
|
726
|
-
allowedMimeTypes:
|
|
723
|
+
bucket: te,
|
|
724
|
+
FileManagerModal: O,
|
|
725
|
+
resolveIconUrl: ne,
|
|
726
|
+
allowedMimeTypes: re,
|
|
727
727
|
maxFileSizeBytes: k,
|
|
728
728
|
availableLocaleOptions: A,
|
|
729
|
-
onChange:
|
|
729
|
+
onChange: Q,
|
|
730
730
|
labels: j?.general
|
|
731
731
|
}),
|
|
732
|
-
setup: /* @__PURE__ */
|
|
733
|
-
form:
|
|
732
|
+
setup: /* @__PURE__ */ D(he, {
|
|
733
|
+
form: W,
|
|
734
734
|
errors: xe,
|
|
735
|
-
isSaving:
|
|
736
|
-
toolsetId:
|
|
735
|
+
isSaving: G,
|
|
736
|
+
toolsetId: P,
|
|
737
737
|
isEditMode: M,
|
|
738
738
|
connectUrl: Se,
|
|
739
|
-
listToolNames:
|
|
739
|
+
listToolNames: v,
|
|
740
740
|
authActions: w,
|
|
741
741
|
onOAuthLogin: ee,
|
|
742
|
-
onNotifySuccess:
|
|
743
|
-
onNotifyError:
|
|
744
|
-
onChange:
|
|
745
|
-
onAuthChange:
|
|
746
|
-
onEnsureSaved:
|
|
742
|
+
onNotifySuccess: T,
|
|
743
|
+
onNotifyError: E,
|
|
744
|
+
onChange: Q,
|
|
745
|
+
onAuthChange: fe,
|
|
746
|
+
onEnsureSaved: me,
|
|
747
747
|
labels: j?.settings
|
|
748
748
|
})
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
751
|
//#endregion
|
|
752
|
-
export {
|
|
752
|
+
export { V as AUTH_TYPE_ICONS, z as DEFAULT_TOOLSET_NAME, B as DEFAULT_TOOLSET_VERSION, de as GeneralForm, L as TOOLSET_EDITOR_CLASS, be as ToolsetEditor, Q as ToolsetOAuthLoginStatus, R as ToolsetTransportType, W as getDefaultToolsetForm, H as getStorageSafeUniqueToolsetName, Y as isToolsetAuthValid, ce as isToolsetFormValid, K as isValidEndpointUrl, se as normalizeReturnedEndpointUrl };
|
|
@@ -14,7 +14,7 @@ export interface ToolsetEditorValidationLabels {
|
|
|
14
14
|
nameControlCharacters?: string;
|
|
15
15
|
/** Message for a description over the shared length limit. Defaults to `'Use 2000 characters or fewer.'`. */
|
|
16
16
|
descriptionTooLong?: string;
|
|
17
|
-
/** Message for a malformed version. Defaults to `'Version
|
|
17
|
+
/** Message for a malformed version. Defaults to `'Version must follow semantic versioning (e.g., 1.0.0)'`. */
|
|
18
18
|
versionInvalid?: string;
|
|
19
19
|
/** Message for a missing endpoint. Defaults to `'Endpoint is required'`. */
|
|
20
20
|
endpointRequired?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolset-editor-props.d.ts","sourceRoot":"","sources":["../../src/models/toolset-editor-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,yFAAyF;AACzF,MAAM,WAAW,6BAA6B;IAC5C,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gIAAgI;IAChI,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6GAA6G;IAC7G,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,
|
|
1
|
+
{"version":3,"file":"toolset-editor-props.d.ts","sourceRoot":"","sources":["../../src/models/toolset-editor-props.ts"],"names":[],"mappings":"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"}
|
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.229",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
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.229"
|
|
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.
|
|
26
|
-
"@epam/ai-dial-ui-kit": "^0.15.0-dev.
|
|
24
|
+
"@epam/ai-dial-chat-hooks": "1.2.0-dev.229",
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.229",
|
|
26
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.30",
|
|
27
27
|
"react": "^19.2.8"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
package/utils/toolsets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,4BAA4B,CAAC;AAQpC,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"}
|