@epam/ai-dial-toolset-editor 1.2.0-dev.20 → 1.2.0-dev.201
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/constants/public-class-names.d.ts +7 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/constants/toolsets.d.ts +1 -1
- package/index.css +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +386 -379
- package/models/general-form-props.d.ts +5 -1
- package/models/general-form-props.d.ts.map +1 -1
- package/models/toolset-editor-props.d.ts +6 -0
- package/models/toolset-editor-props.d.ts.map +1 -1
- package/models/toolset-form.d.ts +2 -0
- package/models/toolset-form.d.ts.map +1 -1
- package/package.json +6 -5
- package/utils/toolsets.d.ts +8 -0
- package/utils/toolsets.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -1,59 +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
|
-
import {
|
|
4
|
-
import { memo as
|
|
5
|
-
import { IconBrandOauth as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
//#region src/constants/
|
|
9
|
-
var
|
|
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 { 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
|
+
//#region src/constants/public-class-names.ts
|
|
9
|
+
var R = {
|
|
10
|
+
metadataSection: "dial-toolset-editor-metadata-section",
|
|
11
|
+
setupSection: "dial-toolset-editor-setup-section"
|
|
12
|
+
}, z = /* @__PURE__ */ function(e) {
|
|
10
13
|
return e.Http = "HTTP", e.Sse = "SSE", e;
|
|
11
|
-
}({}),
|
|
12
|
-
[o.OAuth]:
|
|
13
|
-
[o.ApiKey]:
|
|
14
|
-
[o.None]:
|
|
15
|
-
},
|
|
14
|
+
}({}), B = "New toolset", V = "1.0.0", H = {
|
|
15
|
+
[o.OAuth]: C,
|
|
16
|
+
[o.ApiKey]: w,
|
|
17
|
+
[o.None]: ee
|
|
18
|
+
}, U = ({ defaultName: e = B, existingNames: t }) => {
|
|
16
19
|
let n = new Set(t);
|
|
17
20
|
if (!n.has(e)) return e;
|
|
18
21
|
let r = 1;
|
|
19
22
|
for (; n.has(`${e} ${r}`);) r += 1;
|
|
20
23
|
return `${e} ${r}`;
|
|
21
|
-
},
|
|
24
|
+
}, W = () => ({
|
|
22
25
|
authenticationType: o.None,
|
|
23
26
|
withLogin: c.WithoutLogin,
|
|
24
27
|
isLoggedIn: !1
|
|
25
|
-
}),
|
|
26
|
-
name:
|
|
27
|
-
version:
|
|
28
|
+
}), G = (e = []) => ({
|
|
29
|
+
name: U({ existingNames: e }),
|
|
30
|
+
version: V,
|
|
28
31
|
iconUrl: "",
|
|
29
32
|
description: "",
|
|
30
33
|
topics: [],
|
|
31
34
|
otherLocales: [],
|
|
32
35
|
endpoint: "",
|
|
33
|
-
protocol:
|
|
36
|
+
protocol: z.Http,
|
|
34
37
|
allowedTools: [],
|
|
35
|
-
auth:
|
|
36
|
-
}),
|
|
38
|
+
auth: W()
|
|
39
|
+
}), K = (e) => {
|
|
37
40
|
if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
|
|
38
41
|
try {
|
|
39
42
|
return !!new URL(e);
|
|
40
43
|
} catch {
|
|
41
44
|
return !1;
|
|
42
45
|
}
|
|
43
|
-
},
|
|
46
|
+
}, q = (e) => K(e.trim()), ie = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), J = (e) => {
|
|
44
47
|
let t = e?.trim() ?? "";
|
|
45
|
-
if (!t ||
|
|
48
|
+
if (!t || K(t)) return t;
|
|
46
49
|
let n = [t];
|
|
47
50
|
try {
|
|
48
51
|
let e = decodeURIComponent(t);
|
|
49
52
|
e !== t && n.push(e);
|
|
50
53
|
} catch {}
|
|
51
54
|
for (let e of n) {
|
|
52
|
-
let t =
|
|
53
|
-
if (
|
|
55
|
+
let t = ie(e);
|
|
56
|
+
if (K(t)) return t;
|
|
54
57
|
}
|
|
55
58
|
return t;
|
|
56
|
-
},
|
|
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 = {
|
|
57
81
|
name: {
|
|
58
82
|
label: "Name",
|
|
59
83
|
placeholder: "Enter name"
|
|
@@ -92,107 +116,81 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
92
116
|
saveLabel: "Save"
|
|
93
117
|
},
|
|
94
118
|
ariaLabel: "General"
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
version: t.version,
|
|
129
|
-
topics: t.topics,
|
|
130
|
-
otherLocales: t.otherLocales
|
|
131
|
-
},
|
|
132
|
-
errors: r,
|
|
133
|
-
onChange: d,
|
|
134
|
-
onNameBlur: f,
|
|
135
|
-
onVersionBlur: p,
|
|
136
|
-
iconPreviewUrl: y,
|
|
137
|
-
onAddAvatarClick: () => g(!0),
|
|
138
|
-
labels: _,
|
|
139
|
-
availableLocaleOptions: u
|
|
140
|
-
}), /* @__PURE__ */ P(e, {
|
|
141
|
-
isOpen: h,
|
|
142
|
-
onClose: () => g(!1),
|
|
143
|
-
onAttach: (e) => {
|
|
144
|
-
let [t] = e.files, n = t ? l(t, i, { resolvePreviewUrl: o }) : null;
|
|
145
|
-
n?.url && d({ iconUrl: n.url }), g(!1);
|
|
146
|
-
},
|
|
147
|
-
bucket: i,
|
|
148
|
-
FileManagerModal: a,
|
|
149
|
-
allowedMimeTypes: s,
|
|
150
|
-
maxFileSizeBytes: c,
|
|
151
|
-
labels: v
|
|
152
|
-
})] });
|
|
153
|
-
}, $ = /* @__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) {
|
|
154
152
|
return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
|
|
155
|
-
}({}),
|
|
156
|
-
let [
|
|
157
|
-
|
|
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({
|
|
158
156
|
authenticationType: t,
|
|
159
|
-
withLogin:
|
|
157
|
+
withLogin: ue(t, !!e.clientId?.trim())
|
|
160
158
|
});
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
switch (e.auth != null &&
|
|
165
|
-
case
|
|
166
|
-
|
|
159
|
+
}, P = (e) => {
|
|
160
|
+
h({ withLogin: e });
|
|
161
|
+
}, I = (e) => {
|
|
162
|
+
switch (e.auth != null && h(e.auth), e.status) {
|
|
163
|
+
case Q.Success:
|
|
164
|
+
h({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
167
165
|
return;
|
|
168
|
-
case
|
|
169
|
-
|
|
166
|
+
case Q.PopupBlocked:
|
|
167
|
+
p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
|
|
170
168
|
return;
|
|
171
|
-
case
|
|
172
|
-
|
|
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.");
|
|
173
171
|
return;
|
|
174
|
-
case
|
|
175
|
-
|
|
172
|
+
case Q.Failed:
|
|
173
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
|
|
176
174
|
return;
|
|
177
|
-
case
|
|
175
|
+
case Q.Cancelled: return;
|
|
178
176
|
}
|
|
179
|
-
},
|
|
180
|
-
if (!
|
|
177
|
+
}, R = async () => {
|
|
178
|
+
if (!w) return;
|
|
181
179
|
if (e.authenticationType === o.OAuth) {
|
|
182
|
-
|
|
180
|
+
y(!0);
|
|
183
181
|
try {
|
|
184
|
-
|
|
182
|
+
I(await d({
|
|
185
183
|
auth: e,
|
|
186
|
-
ensureSaved:
|
|
184
|
+
ensureSaved: g
|
|
187
185
|
}));
|
|
188
186
|
} finally {
|
|
189
|
-
|
|
187
|
+
y(!1);
|
|
190
188
|
}
|
|
191
189
|
return;
|
|
192
190
|
}
|
|
193
|
-
let t = await
|
|
191
|
+
let t = await g();
|
|
194
192
|
if (t) {
|
|
195
|
-
|
|
193
|
+
y(!0);
|
|
196
194
|
try {
|
|
197
195
|
let n = {
|
|
198
196
|
url: t,
|
|
@@ -200,273 +198,273 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
200
198
|
authenticationType: e.authenticationType,
|
|
201
199
|
apiKey: e.apiKey?.trim()
|
|
202
200
|
};
|
|
203
|
-
await l.login(t, n),
|
|
201
|
+
await l.login(t, n), h({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
204
202
|
} catch (e) {
|
|
205
203
|
let { traceId: t } = await u(e);
|
|
206
|
-
|
|
204
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
207
205
|
} finally {
|
|
208
|
-
|
|
206
|
+
y(!1);
|
|
209
207
|
}
|
|
210
208
|
}
|
|
211
|
-
},
|
|
212
|
-
|
|
209
|
+
}, z = async () => {
|
|
210
|
+
y(!0);
|
|
213
211
|
try {
|
|
214
212
|
let t = {
|
|
215
213
|
url: r,
|
|
216
214
|
credentialsLevel: s.User,
|
|
217
215
|
authenticationType: e.authenticationType
|
|
218
216
|
};
|
|
219
|
-
await l.logout(r, t),
|
|
217
|
+
await l.logout(r, t), h({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
220
218
|
} catch (e) {
|
|
221
219
|
let { traceId: t } = await u(e);
|
|
222
|
-
|
|
220
|
+
p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
223
221
|
} finally {
|
|
224
|
-
|
|
222
|
+
y(!1);
|
|
225
223
|
}
|
|
226
|
-
},
|
|
224
|
+
}, B = () => e.isLoggedIn ? /* @__PURE__ */ E("div", {
|
|
227
225
|
className: "flex",
|
|
228
|
-
children: /* @__PURE__ */
|
|
229
|
-
label:
|
|
230
|
-
iconBefore: /* @__PURE__ */
|
|
231
|
-
size:
|
|
232
|
-
stroke:
|
|
226
|
+
children: /* @__PURE__ */ E(j, {
|
|
227
|
+
label: _?.logOutLabel ?? "Log out",
|
|
228
|
+
iconBefore: /* @__PURE__ */ E(T, {
|
|
229
|
+
size: O.MD,
|
|
230
|
+
stroke: k
|
|
233
231
|
}),
|
|
234
|
-
onClick: () =>
|
|
235
|
-
disabled: n ||
|
|
232
|
+
onClick: () => x(!0),
|
|
233
|
+
disabled: n || v
|
|
236
234
|
})
|
|
237
|
-
}) : /* @__PURE__ */
|
|
235
|
+
}) : /* @__PURE__ */ E("div", {
|
|
238
236
|
className: "flex",
|
|
239
|
-
children: /* @__PURE__ */
|
|
240
|
-
label:
|
|
241
|
-
iconBefore: /* @__PURE__ */
|
|
242
|
-
size:
|
|
243
|
-
stroke:
|
|
237
|
+
children: /* @__PURE__ */ E(j, {
|
|
238
|
+
label: _?.logInLabel ?? "Log in",
|
|
239
|
+
iconBefore: /* @__PURE__ */ E(te, {
|
|
240
|
+
size: O.MD,
|
|
241
|
+
stroke: k
|
|
244
242
|
}),
|
|
245
|
-
onClick:
|
|
246
|
-
disabled: !
|
|
243
|
+
onClick: R,
|
|
244
|
+
disabled: !w
|
|
247
245
|
})
|
|
248
246
|
});
|
|
249
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ D("section", {
|
|
250
248
|
className: "flex flex-col gap-2",
|
|
251
249
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ E("h3", {
|
|
253
251
|
className: "dial-h3-text",
|
|
254
|
-
children:
|
|
252
|
+
children: _?.sectionTitle ?? "Authentication"
|
|
255
253
|
}),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
"aria-label":
|
|
254
|
+
/* @__PURE__ */ E(F, {
|
|
255
|
+
"aria-label": _?.sectionTitle ?? "Authentication",
|
|
258
256
|
value: e.authenticationType,
|
|
259
|
-
onChange: (e) =>
|
|
257
|
+
onChange: (e) => ee(e),
|
|
260
258
|
segmentClassName: "px-2",
|
|
261
259
|
items: [
|
|
262
260
|
o.None,
|
|
263
261
|
o.OAuth,
|
|
264
262
|
o.ApiKey
|
|
265
263
|
].map((t) => {
|
|
266
|
-
let n =
|
|
264
|
+
let n = H[t];
|
|
267
265
|
return {
|
|
268
266
|
value: t,
|
|
269
|
-
label: /* @__PURE__ */
|
|
267
|
+
label: /* @__PURE__ */ D("div", {
|
|
270
268
|
className: "flex items-center gap-2",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ E(n, {
|
|
272
270
|
className: "shrink-0",
|
|
273
|
-
size:
|
|
274
|
-
stroke:
|
|
271
|
+
size: O.SM,
|
|
272
|
+
stroke: k,
|
|
275
273
|
"aria-hidden": !0
|
|
276
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ E("span", {
|
|
277
275
|
className: "sr-only desktop:not-sr-only",
|
|
278
|
-
children:
|
|
276
|
+
children: de(t, _)
|
|
279
277
|
})]
|
|
280
278
|
}),
|
|
281
|
-
disabled:
|
|
279
|
+
disabled: C && e.authenticationType !== t
|
|
282
280
|
};
|
|
283
281
|
})
|
|
284
282
|
}),
|
|
285
|
-
e.authenticationType === o.None && /* @__PURE__ */
|
|
283
|
+
e.authenticationType === o.None && /* @__PURE__ */ E("p", {
|
|
286
284
|
className: "dial-small-text pt-2 text-secondary",
|
|
287
|
-
children:
|
|
285
|
+
children: _?.openAccessDescription ?? "Open endpoint, no credentials"
|
|
288
286
|
}),
|
|
289
|
-
e.authenticationType === o.OAuth && /* @__PURE__ */
|
|
287
|
+
e.authenticationType === o.OAuth && /* @__PURE__ */ D("div", {
|
|
290
288
|
className: "flex flex-col gap-3 pt-2",
|
|
291
289
|
children: [
|
|
292
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ D("div", {
|
|
293
291
|
className: "flex flex-col gap-2",
|
|
294
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ E(N, {
|
|
295
293
|
name: "oauth-login-mode",
|
|
296
294
|
id: "oauth-with-login",
|
|
297
295
|
value: c.WithLogin,
|
|
298
|
-
labelProps: { label:
|
|
296
|
+
labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
|
|
299
297
|
isSelected: e.withLogin === c.WithLogin,
|
|
300
|
-
disabled:
|
|
301
|
-
onChange:
|
|
302
|
-
}), /* @__PURE__ */
|
|
298
|
+
disabled: C,
|
|
299
|
+
onChange: P
|
|
300
|
+
}), /* @__PURE__ */ E(N, {
|
|
303
301
|
name: "oauth-login-mode",
|
|
304
302
|
id: "oauth-with-config",
|
|
305
303
|
value: c.WithConfig,
|
|
306
|
-
labelProps: { label:
|
|
304
|
+
labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
|
|
307
305
|
isSelected: e.withLogin === c.WithConfig,
|
|
308
|
-
disabled:
|
|
309
|
-
onChange:
|
|
306
|
+
disabled: C,
|
|
307
|
+
onChange: P
|
|
310
308
|
})]
|
|
311
309
|
}),
|
|
312
|
-
e.withLogin === c.WithConfig && /* @__PURE__ */
|
|
310
|
+
e.withLogin === c.WithConfig && /* @__PURE__ */ D("div", {
|
|
313
311
|
className: "flex flex-col gap-3",
|
|
314
312
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ E(A, {
|
|
316
314
|
id: "toolset-client-id",
|
|
317
315
|
value: e.clientId ?? "",
|
|
318
|
-
onChange: (e) =>
|
|
316
|
+
onChange: (e) => h({ clientId: e ?? "" }),
|
|
319
317
|
labelProps: {
|
|
320
|
-
label:
|
|
318
|
+
label: _?.clientIdLabel ?? "Client ID",
|
|
321
319
|
required: !0
|
|
322
320
|
},
|
|
323
|
-
placeholder:
|
|
321
|
+
placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
|
|
324
322
|
error: t.clientId || void 0,
|
|
325
323
|
invalid: !!t.clientId,
|
|
326
|
-
disabled:
|
|
324
|
+
disabled: C
|
|
327
325
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ E(M, {
|
|
329
327
|
id: "toolset-client-secret",
|
|
330
328
|
value: e.clientSecret ?? "",
|
|
331
|
-
onChange: (e) =>
|
|
329
|
+
onChange: (e) => h({ clientSecret: e ?? "" }),
|
|
332
330
|
labelProps: {
|
|
333
|
-
label:
|
|
331
|
+
label: _?.clientSecretLabel ?? "Client secret",
|
|
334
332
|
required: !i
|
|
335
333
|
},
|
|
336
|
-
placeholder:
|
|
337
|
-
showPasswordLabel:
|
|
338
|
-
hidePasswordLabel:
|
|
334
|
+
placeholder: _?.clientSecretPlaceholder ?? "Enter client secret",
|
|
335
|
+
showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
|
|
336
|
+
hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
|
|
339
337
|
error: t.clientSecret || void 0,
|
|
340
338
|
invalid: !!t.clientSecret,
|
|
341
|
-
disabled:
|
|
339
|
+
disabled: C
|
|
342
340
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ E(A, {
|
|
344
342
|
id: "toolset-authorization-endpoint",
|
|
345
343
|
value: e.authorizationEndpoint ?? "",
|
|
346
|
-
onChange: (e) =>
|
|
347
|
-
labelProps: { label:
|
|
348
|
-
placeholder:
|
|
344
|
+
onChange: (e) => h({ authorizationEndpoint: e ?? "" }),
|
|
345
|
+
labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
|
|
346
|
+
placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
|
|
349
347
|
error: t.authorizationEndpoint || void 0,
|
|
350
348
|
invalid: !!t.authorizationEndpoint,
|
|
351
|
-
disabled:
|
|
349
|
+
disabled: C
|
|
352
350
|
}),
|
|
353
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ E(A, {
|
|
354
352
|
id: "toolset-token-endpoint",
|
|
355
353
|
value: e.tokenEndpoint ?? "",
|
|
356
|
-
onChange: (e) =>
|
|
357
|
-
labelProps: { label:
|
|
358
|
-
placeholder:
|
|
354
|
+
onChange: (e) => h({ tokenEndpoint: e ?? "" }),
|
|
355
|
+
labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
|
|
356
|
+
placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
|
|
359
357
|
error: t.tokenEndpoint || void 0,
|
|
360
358
|
invalid: !!t.tokenEndpoint,
|
|
361
|
-
disabled:
|
|
359
|
+
disabled: C
|
|
362
360
|
}),
|
|
363
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ E(L, {
|
|
364
362
|
id: "toolset-scopes",
|
|
365
|
-
labelProps: { label:
|
|
366
|
-
placeholder:
|
|
363
|
+
labelProps: { label: _?.scopesLabel ?? "Scopes" },
|
|
364
|
+
placeholder: _?.scopesPlaceholder ?? "Enter scopes",
|
|
367
365
|
value: e.scopes ?? [],
|
|
368
|
-
onChange: (e) =>
|
|
369
|
-
disabled:
|
|
370
|
-
tagClassName:
|
|
366
|
+
onChange: (e) => h({ scopes: e }),
|
|
367
|
+
disabled: C,
|
|
368
|
+
tagClassName: m
|
|
371
369
|
})
|
|
372
370
|
]
|
|
373
371
|
}),
|
|
374
|
-
|
|
372
|
+
B()
|
|
375
373
|
]
|
|
376
374
|
}),
|
|
377
|
-
e.authenticationType === o.ApiKey && /* @__PURE__ */
|
|
375
|
+
e.authenticationType === o.ApiKey && /* @__PURE__ */ D("div", {
|
|
378
376
|
className: "flex flex-col gap-3 pt-2",
|
|
379
377
|
children: [
|
|
380
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ D("div", {
|
|
381
379
|
className: "flex flex-col gap-2",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ E(N, {
|
|
383
381
|
name: "apikey-login-mode",
|
|
384
382
|
id: "apikey-with-login",
|
|
385
383
|
value: c.WithLogin,
|
|
386
|
-
labelProps: { label:
|
|
384
|
+
labelProps: { label: _?.withLoginLabel ?? "With login" },
|
|
387
385
|
isSelected: e.withLogin === c.WithLogin,
|
|
388
|
-
disabled:
|
|
389
|
-
onChange:
|
|
390
|
-
}), /* @__PURE__ */
|
|
386
|
+
disabled: C,
|
|
387
|
+
onChange: P
|
|
388
|
+
}), /* @__PURE__ */ E(N, {
|
|
391
389
|
name: "apikey-login-mode",
|
|
392
390
|
id: "apikey-without-login",
|
|
393
391
|
value: c.WithoutLogin,
|
|
394
|
-
labelProps: { label:
|
|
392
|
+
labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
|
|
395
393
|
isSelected: e.withLogin === c.WithoutLogin,
|
|
396
|
-
disabled:
|
|
397
|
-
onChange:
|
|
394
|
+
disabled: C,
|
|
395
|
+
onChange: P
|
|
398
396
|
})]
|
|
399
397
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ D("div", {
|
|
401
399
|
className: "flex flex-col gap-3",
|
|
402
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ E(A, {
|
|
403
401
|
id: "toolset-key-header",
|
|
404
402
|
value: e.keyHeader ?? "",
|
|
405
|
-
onChange: (e) =>
|
|
403
|
+
onChange: (e) => h({ keyHeader: e ?? "" }),
|
|
406
404
|
labelProps: {
|
|
407
|
-
label:
|
|
405
|
+
label: _?.keyHeaderLabel ?? "API Key parameter name",
|
|
408
406
|
required: !0
|
|
409
407
|
},
|
|
410
|
-
placeholder:
|
|
408
|
+
placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
|
|
411
409
|
error: t.keyHeader || void 0,
|
|
412
410
|
invalid: !!t.keyHeader,
|
|
413
|
-
disabled:
|
|
414
|
-
}), e.withLogin === c.WithLogin && /* @__PURE__ */
|
|
411
|
+
disabled: C
|
|
412
|
+
}), e.withLogin === c.WithLogin && /* @__PURE__ */ E(M, {
|
|
415
413
|
id: "toolset-api-key",
|
|
416
414
|
value: e.apiKey ?? "",
|
|
417
|
-
onChange: (e) =>
|
|
415
|
+
onChange: (e) => h({ apiKey: e ?? "" }),
|
|
418
416
|
labelProps: {
|
|
419
|
-
label:
|
|
417
|
+
label: _?.apiKeyLabel ?? "API key",
|
|
420
418
|
required: !0
|
|
421
419
|
},
|
|
422
|
-
placeholder:
|
|
423
|
-
showPasswordLabel:
|
|
424
|
-
hidePasswordLabel:
|
|
420
|
+
placeholder: _?.apiKeyPlaceholder ?? "Enter API key",
|
|
421
|
+
showPasswordLabel: _?.showApiKeyLabel ?? "Show API key",
|
|
422
|
+
hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
|
|
425
423
|
error: t.apiKey || void 0,
|
|
426
424
|
invalid: !!t.apiKey,
|
|
427
|
-
disabled:
|
|
425
|
+
disabled: C
|
|
428
426
|
})]
|
|
429
427
|
}),
|
|
430
|
-
e.withLogin !== c.WithoutLogin &&
|
|
428
|
+
e.withLogin !== c.WithoutLogin && B()
|
|
431
429
|
]
|
|
432
430
|
}),
|
|
433
|
-
|
|
434
|
-
open:
|
|
435
|
-
header:
|
|
436
|
-
description:
|
|
437
|
-
confirmLabel:
|
|
438
|
-
cancelLabel:
|
|
439
|
-
variant:
|
|
440
|
-
isLoading:
|
|
441
|
-
disableConfirmButton:
|
|
442
|
-
onConfirm:
|
|
443
|
-
onCancel: () =>
|
|
444
|
-
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)
|
|
445
443
|
})
|
|
446
444
|
]
|
|
447
445
|
});
|
|
448
|
-
},
|
|
449
|
-
let { isCopied: r, copy: i } =
|
|
450
|
-
return /* @__PURE__ */
|
|
451
|
-
className:
|
|
446
|
+
}, pe = _(({ url: e, className: t, labels: n }) => {
|
|
447
|
+
let { isCopied: r, copy: i } = g(e), a = n?.copiedLabel ?? "Copied!";
|
|
448
|
+
return /* @__PURE__ */ D("div", {
|
|
449
|
+
className: h("flex flex-col gap-3", t),
|
|
452
450
|
children: [
|
|
453
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ D("div", {
|
|
454
452
|
className: "flex flex-col gap-1",
|
|
455
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ E("p", {
|
|
456
454
|
className: "dial-body-semi-text text-start text-primary",
|
|
457
455
|
children: n?.title ?? "Connect toolset"
|
|
458
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ E("p", {
|
|
459
457
|
className: "dial-small-text text-start text-secondary",
|
|
460
458
|
children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
|
|
461
459
|
})]
|
|
462
460
|
}),
|
|
463
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ E("div", { children: /* @__PURE__ */ E(d, {
|
|
464
462
|
copiedLabel: a,
|
|
465
463
|
copyLabel: n?.copyLabel ?? "Copy URL",
|
|
466
464
|
isCopied: r,
|
|
467
465
|
onClick: i
|
|
468
466
|
}) }),
|
|
469
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ E("span", {
|
|
470
468
|
role: "status",
|
|
471
469
|
"aria-live": "polite",
|
|
472
470
|
className: "sr-only",
|
|
@@ -474,16 +472,16 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
474
472
|
})
|
|
475
473
|
]
|
|
476
474
|
});
|
|
477
|
-
}),
|
|
478
|
-
let [g, _] =
|
|
479
|
-
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,
|
|
480
478
|
label: "HTTP"
|
|
481
479
|
}, {
|
|
482
|
-
value:
|
|
480
|
+
value: z.Sse,
|
|
483
481
|
label: "SSE"
|
|
484
482
|
}], []);
|
|
485
|
-
return
|
|
486
|
-
if (!r || !o || !
|
|
483
|
+
return y(() => {
|
|
484
|
+
if (!r || !o || !X(e.auth, i)) {
|
|
487
485
|
_(null);
|
|
488
486
|
return;
|
|
489
487
|
}
|
|
@@ -504,56 +502,56 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
504
502
|
e.auth,
|
|
505
503
|
e.endpoint,
|
|
506
504
|
o
|
|
507
|
-
]), /* @__PURE__ */
|
|
505
|
+
]), /* @__PURE__ */ D("div", {
|
|
508
506
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
509
507
|
children: [
|
|
510
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ E(A, {
|
|
511
509
|
id: "toolset-endpoint",
|
|
512
510
|
value: e.endpoint,
|
|
513
511
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
514
512
|
labelProps: {
|
|
515
|
-
label:
|
|
513
|
+
label: h?.endpointLabel ?? "Endpoint",
|
|
516
514
|
required: !0
|
|
517
515
|
},
|
|
518
|
-
placeholder:
|
|
519
|
-
caption:
|
|
516
|
+
placeholder: h?.endpointPlaceholder ?? "https://...",
|
|
517
|
+
caption: h?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
|
|
520
518
|
error: t.endpoint || void 0,
|
|
521
519
|
invalid: !!t.endpoint
|
|
522
520
|
}),
|
|
523
|
-
/* @__PURE__ */ P
|
|
521
|
+
/* @__PURE__ */ E(P, {
|
|
524
522
|
labelProps: {
|
|
525
|
-
label:
|
|
523
|
+
label: h?.protocolLabel ?? "Protocol",
|
|
526
524
|
required: !0
|
|
527
525
|
},
|
|
528
526
|
id: "toolset-protocol",
|
|
529
|
-
items:
|
|
527
|
+
items: x,
|
|
530
528
|
value: e.protocol,
|
|
531
529
|
onChange: (e) => {
|
|
532
530
|
d({ protocol: e });
|
|
533
531
|
}
|
|
534
532
|
}),
|
|
535
|
-
g ? /* @__PURE__ */
|
|
533
|
+
g ? /* @__PURE__ */ E(I, {
|
|
536
534
|
id: "toolset-allowed-tools",
|
|
537
535
|
multiple: !0,
|
|
538
536
|
searchable: !0,
|
|
539
537
|
selectAll: !0,
|
|
540
|
-
labelProps: { label:
|
|
541
|
-
placeholder:
|
|
538
|
+
labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
|
|
539
|
+
placeholder: h?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
|
|
542
540
|
options: g.map((e) => ({
|
|
543
541
|
value: e,
|
|
544
542
|
label: e
|
|
545
543
|
})),
|
|
546
544
|
value: e.allowedTools,
|
|
547
545
|
onChange: (e) => d({ allowedTools: e })
|
|
548
|
-
}) : /* @__PURE__ */
|
|
546
|
+
}) : /* @__PURE__ */ E(L, {
|
|
549
547
|
id: "toolset-allowed-tools",
|
|
550
|
-
labelProps: { label:
|
|
551
|
-
placeholder:
|
|
548
|
+
labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
|
|
549
|
+
placeholder: h?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
552
550
|
value: e.allowedTools,
|
|
553
551
|
onChange: (e) => d({ allowedTools: e }),
|
|
554
|
-
tagClassName:
|
|
552
|
+
tagClassName: m
|
|
555
553
|
}),
|
|
556
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ E(fe, {
|
|
557
555
|
auth: e.auth,
|
|
558
556
|
errors: t,
|
|
559
557
|
isSaving: n,
|
|
@@ -566,180 +564,189 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
566
564
|
onNotifyError: u,
|
|
567
565
|
onAuthChange: f,
|
|
568
566
|
onEnsureSaved: p,
|
|
569
|
-
labels:
|
|
567
|
+
labels: h?.auth
|
|
570
568
|
}),
|
|
571
|
-
v && /* @__PURE__ */
|
|
569
|
+
v && /* @__PURE__ */ E(pe, {
|
|
572
570
|
url: a ?? "",
|
|
573
|
-
labels:
|
|
571
|
+
labels: h?.connect,
|
|
574
572
|
className: "border-t border-tertiary pt-4"
|
|
575
573
|
})
|
|
576
574
|
]
|
|
577
575
|
});
|
|
578
|
-
},
|
|
576
|
+
}, he = [
|
|
579
577
|
"keyHeader",
|
|
580
578
|
"apiKey",
|
|
581
579
|
"clientId",
|
|
582
580
|
"clientSecret",
|
|
583
581
|
"authorizationEndpoint",
|
|
584
582
|
"tokenEndpoint"
|
|
585
|
-
],
|
|
586
|
-
"name",
|
|
587
|
-
"version",
|
|
588
|
-
"endpoint",
|
|
589
|
-
...de
|
|
590
|
-
], pe = new Set(fe), me = (e) => {
|
|
583
|
+
], ge = ["endpoint", ...he], $ = new Set(ge), _e = { validateVersionPattern: !0 }, ve = (e) => {
|
|
591
584
|
let t = {};
|
|
592
|
-
for (let n of Object.keys(e))
|
|
585
|
+
for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
|
|
593
586
|
return t;
|
|
594
|
-
},
|
|
595
|
-
let
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
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) => ({
|
|
613
622
|
...t,
|
|
614
623
|
auth: {
|
|
615
624
|
...t.auth,
|
|
616
625
|
...e
|
|
617
626
|
}
|
|
618
|
-
})),
|
|
627
|
+
})), Z((t) => ({
|
|
619
628
|
...t,
|
|
620
|
-
...
|
|
621
|
-
})),
|
|
629
|
+
...ve(e)
|
|
630
|
+
})), X((t) => {
|
|
622
631
|
let n = { ...t };
|
|
623
|
-
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];
|
|
624
633
|
else for (let t of Object.keys(e)) delete n[t];
|
|
625
634
|
return n;
|
|
626
635
|
}), "isLoggedIn" in e && d();
|
|
627
|
-
}, [d]),
|
|
628
|
-
if (
|
|
629
|
-
|
|
636
|
+
}, [d]), fe = v(async () => {
|
|
637
|
+
if (F && Q.current != null && JSON.stringify(Q.current) === JSON.stringify(K)) return F;
|
|
638
|
+
J(!0);
|
|
630
639
|
try {
|
|
631
|
-
let e = await s(
|
|
632
|
-
return e ? (
|
|
640
|
+
let e = await s(K, F);
|
|
641
|
+
return e ? (F || P(e), Q.current = K, await d(), e) : null;
|
|
633
642
|
} catch {
|
|
634
643
|
return null;
|
|
635
644
|
} finally {
|
|
636
|
-
|
|
645
|
+
J(!1);
|
|
637
646
|
}
|
|
638
647
|
}, [
|
|
639
|
-
|
|
640
|
-
|
|
648
|
+
K,
|
|
649
|
+
F,
|
|
641
650
|
s,
|
|
642
651
|
d
|
|
643
|
-
]),
|
|
644
|
-
let
|
|
645
|
-
return
|
|
646
|
-
}, [
|
|
647
|
-
let e =
|
|
648
|
-
if (Object.keys(
|
|
649
|
-
|
|
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);
|
|
650
659
|
return;
|
|
651
660
|
}
|
|
652
|
-
|
|
661
|
+
X({}), J(!0);
|
|
653
662
|
try {
|
|
654
|
-
let e = await s(
|
|
663
|
+
let e = await s(K, F);
|
|
655
664
|
if (!e) return;
|
|
656
|
-
await d(),
|
|
665
|
+
await d(), m(K);
|
|
657
666
|
try {
|
|
658
|
-
await l(e,
|
|
667
|
+
await l(e, K.auth), h();
|
|
659
668
|
} catch (e) {
|
|
660
669
|
let { traceId: t } = await u(e);
|
|
661
|
-
|
|
670
|
+
T(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
662
671
|
}
|
|
663
672
|
} catch {} finally {
|
|
664
|
-
|
|
673
|
+
J(!1);
|
|
665
674
|
}
|
|
666
675
|
}, [
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
676
|
+
U,
|
|
677
|
+
K,
|
|
678
|
+
$,
|
|
679
|
+
F,
|
|
670
680
|
s,
|
|
671
681
|
d,
|
|
672
|
-
|
|
673
|
-
|
|
682
|
+
m,
|
|
683
|
+
h,
|
|
674
684
|
l,
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
]),
|
|
678
|
-
let
|
|
679
|
-
for (let
|
|
680
|
-
if (!
|
|
681
|
-
let
|
|
682
|
-
|
|
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];
|
|
683
693
|
}
|
|
684
|
-
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;
|
|
685
695
|
}, [
|
|
696
|
+
oe,
|
|
697
|
+
Y,
|
|
686
698
|
K,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
]),
|
|
691
|
-
return /* @__PURE__ */
|
|
692
|
-
title:
|
|
693
|
-
onBack:
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
})
|
|
699
|
+
j,
|
|
700
|
+
H,
|
|
701
|
+
$
|
|
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
|
|
720
731
|
}),
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
onAuthChange: ne,
|
|
738
|
-
onEnsureSaved: ie,
|
|
739
|
-
labels: M?.settings
|
|
740
|
-
})
|
|
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
|
|
741
748
|
})
|
|
742
749
|
});
|
|
743
750
|
};
|
|
744
751
|
//#endregion
|
|
745
|
-
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 };
|