@epam/ai-dial-toolset-editor 1.2.0-dev.99 → 1.3.0-dev.5
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/AuthSection/AuthSection.d.ts.map +1 -1
- 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/toolsets.d.ts +4 -1
- package/constants/toolsets.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +424 -404
- package/models/general-form-props.d.ts +8 -2
- package/models/general-form-props.d.ts.map +1 -1
- package/models/toolset-editor-props.d.ts +12 -1
- 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 +5 -5
- package/utils/toolsets.d.ts +8 -0
- package/utils/toolsets.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -1,62 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ToolsetAuthTypes as
|
|
3
|
-
import { CopyButton as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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, TextRefinementField as g, mergeClasses as _, useCodeCopy as v, useTextRefinement as y } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { memo as b, useCallback as x, useEffect as S, useMemo as C, useRef as ee, useState as w } from "react";
|
|
5
|
+
import { IconBrandOauth as T, IconKey as te, IconLockOff as ne, IconLogin as E, IconLogout as re } from "@tabler/icons-react";
|
|
6
|
+
import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
7
|
+
import { ConfirmationPopup as ie, ConfirmationPopupVariant as ae, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as N, Radio as P, RadioGroup as F, SegmentedControl as I, Select as L, TagInput as oe } from "@epam/ai-dial-ui-kit";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var se = {
|
|
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", ce = { validateVersionPattern: i }, V = {
|
|
15
|
+
[s.OAuth]: T,
|
|
16
|
+
[s.ApiKey]: te,
|
|
17
|
+
[s.None]: ne
|
|
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
|
+
}, le = () => ({
|
|
25
|
+
authenticationType: s.None,
|
|
26
|
+
withLogin: l.WithoutLogin,
|
|
27
27
|
isLoggedIn: !1
|
|
28
|
-
}),
|
|
29
|
-
name:
|
|
30
|
-
version:
|
|
28
|
+
}), U = (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: le()
|
|
39
|
+
}), W = (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
|
+
}, G = (e) => W(e.trim()), K = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), q = (e) => {
|
|
47
47
|
let t = e?.trim() ?? "";
|
|
48
|
-
if (!t ||
|
|
48
|
+
if (!t || W(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 = K(e);
|
|
56
|
+
if (W(t)) return t;
|
|
57
57
|
}
|
|
58
58
|
return t;
|
|
59
|
-
},
|
|
59
|
+
}, J = (e) => !e?.trim() || G(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, ue = (e, t = !1) => Object.keys(o(e, ce)).length === 0 && G(e.endpoint) && Y(e.auth, t), de = new Set([
|
|
60
|
+
"name",
|
|
61
|
+
"description",
|
|
62
|
+
"iconUrl",
|
|
63
|
+
"version",
|
|
64
|
+
"topics",
|
|
65
|
+
"otherLocales"
|
|
66
|
+
]), fe = (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
|
+
}), pe = (e) => {
|
|
74
|
+
let t = {}, n = {};
|
|
75
|
+
for (let [r, i] of Object.entries(e)) (de.has(r) ? t : n)[r] = i;
|
|
76
|
+
return {
|
|
77
|
+
metadata: t,
|
|
78
|
+
setup: n
|
|
79
|
+
};
|
|
80
|
+
}, X = {
|
|
60
81
|
name: {
|
|
61
82
|
label: "Name",
|
|
62
83
|
placeholder: "Enter name"
|
|
@@ -95,381 +116,356 @@ var z = {
|
|
|
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
|
-
|
|
132
|
-
topics: t.topics,
|
|
133
|
-
otherLocales: t.otherLocales
|
|
134
|
-
},
|
|
135
|
-
errors: r,
|
|
136
|
-
onChange: d,
|
|
137
|
-
onNameBlur: f,
|
|
138
|
-
onVersionBlur: p,
|
|
139
|
-
iconPreviewUrl: y,
|
|
140
|
-
onAddAvatarClick: () => g(!0),
|
|
141
|
-
labels: _,
|
|
142
|
-
availableLocaleOptions: u
|
|
143
|
-
}), /* @__PURE__ */ L(e, {
|
|
144
|
-
isOpen: h,
|
|
145
|
-
onClose: () => g(!1),
|
|
146
|
-
onAttach: (e) => {
|
|
147
|
-
let [t] = e.files, n = t ? l(t, i, { resolvePreviewUrl: o }) : null;
|
|
148
|
-
n?.url && d({ iconUrl: n.url }), g(!1);
|
|
149
|
-
},
|
|
150
|
-
bucket: i,
|
|
151
|
-
FileManagerModal: a,
|
|
152
|
-
allowedMimeTypes: s,
|
|
153
|
-
maxFileSizeBytes: c,
|
|
154
|
-
labels: v
|
|
155
|
-
})] });
|
|
156
|
-
}, $ = /* @__PURE__ */ function(e) {
|
|
119
|
+
}, me = ({ form: e, errors: t, bucket: n, FileManagerModal: i, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: d, onVersionBlur: f, renderDescription: p, labels: m }) => {
|
|
120
|
+
let h = x((e) => {
|
|
121
|
+
let [t] = e.files;
|
|
122
|
+
return (t ? u(t, n, { resolvePreviewUrl: a }) : null)?.url;
|
|
123
|
+
}, [n, a]);
|
|
124
|
+
return /* @__PURE__ */ D(r, {
|
|
125
|
+
values: e,
|
|
126
|
+
errors: t,
|
|
127
|
+
onChange: l,
|
|
128
|
+
onNameBlur: d,
|
|
129
|
+
onVersionBlur: f,
|
|
130
|
+
avatarPicker: C(() => ({
|
|
131
|
+
bucket: n,
|
|
132
|
+
FileManagerModal: i,
|
|
133
|
+
resolveIconUrl: a,
|
|
134
|
+
resolveAttachedIconUrl: h,
|
|
135
|
+
allowedMimeTypes: o,
|
|
136
|
+
maxFileSizeBytes: s
|
|
137
|
+
}), [
|
|
138
|
+
n,
|
|
139
|
+
i,
|
|
140
|
+
a,
|
|
141
|
+
h,
|
|
142
|
+
o,
|
|
143
|
+
s
|
|
144
|
+
]),
|
|
145
|
+
availableLocaleOptions: c,
|
|
146
|
+
renderDescription: p,
|
|
147
|
+
labels: C(() => ({
|
|
148
|
+
form: m?.form ?? X,
|
|
149
|
+
avatarPicker: m?.avatarPicker
|
|
150
|
+
}), [m?.form, m?.avatarPicker])
|
|
151
|
+
});
|
|
152
|
+
}, Z = /* @__PURE__ */ function(e) {
|
|
157
153
|
return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
|
|
158
|
-
}({}),
|
|
159
|
-
let [
|
|
160
|
-
|
|
154
|
+
}({}), Q = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, he = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", ge = ({ 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: _ }) => {
|
|
155
|
+
let [v, y] = w(!1), [b, x] = w(!1), S = e.isLoggedIn || n || v, C = G(a) && Y(e, i) && !S, ee = (t) => {
|
|
156
|
+
S || t === e.authenticationType || m({
|
|
161
157
|
authenticationType: t,
|
|
162
|
-
withLogin:
|
|
158
|
+
withLogin: Q(t)
|
|
163
159
|
});
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
switch (e.auth != null &&
|
|
168
|
-
case
|
|
169
|
-
|
|
160
|
+
}, T = (e) => {
|
|
161
|
+
m({ withLogin: e });
|
|
162
|
+
}, te = (e) => {
|
|
163
|
+
switch (e.auth != null && m(e.auth), e.status) {
|
|
164
|
+
case Z.Success:
|
|
165
|
+
m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
170
166
|
return;
|
|
171
|
-
case
|
|
172
|
-
|
|
167
|
+
case Z.PopupBlocked:
|
|
168
|
+
p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
|
|
173
169
|
return;
|
|
174
|
-
case
|
|
175
|
-
|
|
170
|
+
case Z.InvalidConfig:
|
|
171
|
+
p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
|
|
176
172
|
return;
|
|
177
|
-
case
|
|
178
|
-
|
|
173
|
+
case Z.Failed:
|
|
174
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
|
|
179
175
|
return;
|
|
180
|
-
case
|
|
176
|
+
case Z.Cancelled: return;
|
|
181
177
|
}
|
|
182
|
-
},
|
|
183
|
-
if (!
|
|
184
|
-
if (e.authenticationType ===
|
|
185
|
-
|
|
178
|
+
}, ne = async () => {
|
|
179
|
+
if (!C) return;
|
|
180
|
+
if (e.authenticationType === s.OAuth) {
|
|
181
|
+
y(!0);
|
|
186
182
|
try {
|
|
187
|
-
|
|
183
|
+
te(await u({
|
|
188
184
|
auth: e,
|
|
189
|
-
ensureSaved:
|
|
185
|
+
ensureSaved: g
|
|
190
186
|
}));
|
|
191
187
|
} finally {
|
|
192
|
-
|
|
188
|
+
y(!1);
|
|
193
189
|
}
|
|
194
190
|
return;
|
|
195
191
|
}
|
|
196
|
-
let t = await
|
|
192
|
+
let t = await g();
|
|
197
193
|
if (t) {
|
|
198
|
-
|
|
194
|
+
y(!0);
|
|
199
195
|
try {
|
|
200
196
|
let n = {
|
|
201
197
|
url: t,
|
|
202
|
-
credentialsLevel:
|
|
198
|
+
credentialsLevel: c.User,
|
|
203
199
|
authenticationType: e.authenticationType,
|
|
204
200
|
apiKey: e.apiKey?.trim()
|
|
205
201
|
};
|
|
206
|
-
await
|
|
202
|
+
await o.login(t, n), m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
207
203
|
} catch (e) {
|
|
208
|
-
let { traceId: t } = await
|
|
209
|
-
|
|
204
|
+
let { traceId: t } = await d(e);
|
|
205
|
+
p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
210
206
|
} finally {
|
|
211
|
-
|
|
207
|
+
y(!1);
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
|
-
},
|
|
215
|
-
|
|
210
|
+
}, F = async () => {
|
|
211
|
+
y(!0);
|
|
216
212
|
try {
|
|
217
213
|
let t = {
|
|
218
214
|
url: r,
|
|
219
|
-
credentialsLevel:
|
|
215
|
+
credentialsLevel: c.User,
|
|
220
216
|
authenticationType: e.authenticationType
|
|
221
217
|
};
|
|
222
|
-
await
|
|
218
|
+
await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
223
219
|
} catch (e) {
|
|
224
|
-
let { traceId: t } = await
|
|
225
|
-
|
|
220
|
+
let { traceId: t } = await d(e);
|
|
221
|
+
p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
226
222
|
} finally {
|
|
227
|
-
|
|
223
|
+
y(!1);
|
|
228
224
|
}
|
|
229
|
-
},
|
|
225
|
+
}, L = () => e.isLoggedIn ? /* @__PURE__ */ D("div", {
|
|
230
226
|
className: "flex",
|
|
231
|
-
children: /* @__PURE__ */
|
|
232
|
-
label:
|
|
233
|
-
iconBefore: /* @__PURE__ */
|
|
234
|
-
size:
|
|
235
|
-
stroke:
|
|
227
|
+
children: /* @__PURE__ */ D(M, {
|
|
228
|
+
label: _?.logOutLabel ?? "Log out",
|
|
229
|
+
iconBefore: /* @__PURE__ */ D(re, {
|
|
230
|
+
size: k.MD,
|
|
231
|
+
stroke: A
|
|
236
232
|
}),
|
|
237
|
-
onClick: () =>
|
|
238
|
-
disabled: n ||
|
|
233
|
+
onClick: () => x(!0),
|
|
234
|
+
disabled: n || v
|
|
239
235
|
})
|
|
240
|
-
}) : /* @__PURE__ */
|
|
236
|
+
}) : /* @__PURE__ */ D("div", {
|
|
241
237
|
className: "flex",
|
|
242
|
-
children: /* @__PURE__ */
|
|
243
|
-
label:
|
|
244
|
-
iconBefore: /* @__PURE__ */
|
|
245
|
-
size:
|
|
246
|
-
stroke:
|
|
238
|
+
children: /* @__PURE__ */ D(M, {
|
|
239
|
+
label: _?.logInLabel ?? "Log in",
|
|
240
|
+
iconBefore: /* @__PURE__ */ D(E, {
|
|
241
|
+
size: k.MD,
|
|
242
|
+
stroke: A
|
|
247
243
|
}),
|
|
248
|
-
onClick:
|
|
249
|
-
disabled: !
|
|
244
|
+
onClick: ne,
|
|
245
|
+
disabled: !C
|
|
250
246
|
})
|
|
251
247
|
});
|
|
252
|
-
return /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ O("section", {
|
|
253
249
|
className: "flex flex-col gap-2",
|
|
254
250
|
children: [
|
|
255
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ D("h3", {
|
|
256
252
|
className: "dial-h3-text",
|
|
257
|
-
children:
|
|
253
|
+
children: _?.sectionTitle ?? "Authentication"
|
|
258
254
|
}),
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
"aria-label":
|
|
255
|
+
/* @__PURE__ */ D(I, {
|
|
256
|
+
"aria-label": _?.sectionTitle ?? "Authentication",
|
|
261
257
|
value: e.authenticationType,
|
|
262
|
-
onChange: (e) =>
|
|
258
|
+
onChange: (e) => ee(e),
|
|
263
259
|
segmentClassName: "px-2",
|
|
264
260
|
items: [
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
261
|
+
s.None,
|
|
262
|
+
s.OAuth,
|
|
263
|
+
s.ApiKey
|
|
268
264
|
].map((t) => {
|
|
269
|
-
let n =
|
|
265
|
+
let n = V[t];
|
|
270
266
|
return {
|
|
271
267
|
value: t,
|
|
272
|
-
label: /* @__PURE__ */
|
|
268
|
+
label: /* @__PURE__ */ O("div", {
|
|
273
269
|
className: "flex items-center gap-2",
|
|
274
|
-
children: [/* @__PURE__ */
|
|
270
|
+
children: [/* @__PURE__ */ D(n, {
|
|
275
271
|
className: "shrink-0",
|
|
276
|
-
size:
|
|
277
|
-
stroke:
|
|
272
|
+
size: k.SM,
|
|
273
|
+
stroke: A,
|
|
278
274
|
"aria-hidden": !0
|
|
279
|
-
}), /* @__PURE__ */
|
|
275
|
+
}), /* @__PURE__ */ D("span", {
|
|
280
276
|
className: "sr-only desktop:not-sr-only",
|
|
281
|
-
children:
|
|
277
|
+
children: he(t, _)
|
|
282
278
|
})]
|
|
283
279
|
}),
|
|
284
|
-
disabled:
|
|
280
|
+
disabled: S && e.authenticationType !== t
|
|
285
281
|
};
|
|
286
282
|
})
|
|
287
283
|
}),
|
|
288
|
-
e.authenticationType ===
|
|
284
|
+
e.authenticationType === s.None && /* @__PURE__ */ D("p", {
|
|
289
285
|
className: "dial-small-text pt-2 text-secondary",
|
|
290
|
-
children:
|
|
286
|
+
children: _?.openAccessDescription ?? "Open endpoint, no credentials"
|
|
291
287
|
}),
|
|
292
|
-
e.authenticationType ===
|
|
288
|
+
e.authenticationType === s.OAuth && /* @__PURE__ */ O("div", {
|
|
293
289
|
className: "flex flex-col gap-3 pt-2",
|
|
294
290
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ O("div", {
|
|
296
292
|
className: "flex flex-col gap-2",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
293
|
+
children: [/* @__PURE__ */ D(P, {
|
|
298
294
|
name: "oauth-login-mode",
|
|
299
295
|
id: "oauth-with-login",
|
|
300
|
-
value:
|
|
301
|
-
labelProps: { label:
|
|
302
|
-
isSelected: e.withLogin ===
|
|
303
|
-
disabled:
|
|
304
|
-
onChange:
|
|
305
|
-
}), /* @__PURE__ */
|
|
296
|
+
value: l.WithLogin,
|
|
297
|
+
labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
|
|
298
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
299
|
+
disabled: S,
|
|
300
|
+
onChange: T
|
|
301
|
+
}), /* @__PURE__ */ D(P, {
|
|
306
302
|
name: "oauth-login-mode",
|
|
307
303
|
id: "oauth-with-config",
|
|
308
|
-
value:
|
|
309
|
-
labelProps: { label:
|
|
310
|
-
isSelected: e.withLogin ===
|
|
311
|
-
disabled:
|
|
312
|
-
onChange:
|
|
304
|
+
value: l.WithConfig,
|
|
305
|
+
labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
|
|
306
|
+
isSelected: e.withLogin === l.WithConfig,
|
|
307
|
+
disabled: S,
|
|
308
|
+
onChange: T
|
|
313
309
|
})]
|
|
314
310
|
}),
|
|
315
|
-
e.withLogin ===
|
|
311
|
+
e.withLogin === l.WithConfig && /* @__PURE__ */ O("div", {
|
|
316
312
|
className: "flex flex-col gap-3",
|
|
317
313
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ D(j, {
|
|
319
315
|
id: "toolset-client-id",
|
|
320
316
|
value: e.clientId ?? "",
|
|
321
|
-
onChange: (e) =>
|
|
317
|
+
onChange: (e) => m({ clientId: e ?? "" }),
|
|
322
318
|
labelProps: {
|
|
323
|
-
label:
|
|
319
|
+
label: _?.clientIdLabel ?? "Client ID",
|
|
324
320
|
required: !0
|
|
325
321
|
},
|
|
326
|
-
placeholder:
|
|
322
|
+
placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
|
|
327
323
|
error: t.clientId || void 0,
|
|
328
324
|
invalid: !!t.clientId,
|
|
329
|
-
disabled:
|
|
325
|
+
disabled: S
|
|
330
326
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
327
|
+
/* @__PURE__ */ D(N, {
|
|
332
328
|
id: "toolset-client-secret",
|
|
333
329
|
value: e.clientSecret ?? "",
|
|
334
|
-
onChange: (e) =>
|
|
330
|
+
onChange: (e) => m({ clientSecret: e ?? "" }),
|
|
335
331
|
labelProps: {
|
|
336
|
-
label:
|
|
332
|
+
label: _?.clientSecretLabel ?? "Client secret",
|
|
337
333
|
required: !i
|
|
338
334
|
},
|
|
339
|
-
placeholder:
|
|
340
|
-
showPasswordLabel:
|
|
341
|
-
hidePasswordLabel:
|
|
335
|
+
placeholder: _?.clientSecretPlaceholder ?? "Enter client secret",
|
|
336
|
+
showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
|
|
337
|
+
hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
|
|
342
338
|
error: t.clientSecret || void 0,
|
|
343
339
|
invalid: !!t.clientSecret,
|
|
344
|
-
disabled:
|
|
340
|
+
disabled: S
|
|
345
341
|
}),
|
|
346
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ D(j, {
|
|
347
343
|
id: "toolset-authorization-endpoint",
|
|
348
344
|
value: e.authorizationEndpoint ?? "",
|
|
349
|
-
onChange: (e) =>
|
|
350
|
-
labelProps: { label:
|
|
351
|
-
placeholder:
|
|
345
|
+
onChange: (e) => m({ authorizationEndpoint: e ?? "" }),
|
|
346
|
+
labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
|
|
347
|
+
placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
|
|
352
348
|
error: t.authorizationEndpoint || void 0,
|
|
353
349
|
invalid: !!t.authorizationEndpoint,
|
|
354
|
-
disabled:
|
|
350
|
+
disabled: S
|
|
355
351
|
}),
|
|
356
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ D(j, {
|
|
357
353
|
id: "toolset-token-endpoint",
|
|
358
354
|
value: e.tokenEndpoint ?? "",
|
|
359
|
-
onChange: (e) =>
|
|
360
|
-
labelProps: { label:
|
|
361
|
-
placeholder:
|
|
355
|
+
onChange: (e) => m({ tokenEndpoint: e ?? "" }),
|
|
356
|
+
labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
|
|
357
|
+
placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
|
|
362
358
|
error: t.tokenEndpoint || void 0,
|
|
363
359
|
invalid: !!t.tokenEndpoint,
|
|
364
|
-
disabled:
|
|
360
|
+
disabled: S
|
|
365
361
|
}),
|
|
366
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ D(oe, {
|
|
367
363
|
id: "toolset-scopes",
|
|
368
|
-
labelProps: { label:
|
|
369
|
-
placeholder:
|
|
364
|
+
labelProps: { label: _?.scopesLabel ?? "Scopes" },
|
|
365
|
+
placeholder: _?.scopesPlaceholder ?? "Enter scopes",
|
|
370
366
|
value: e.scopes ?? [],
|
|
371
|
-
onChange: (e) =>
|
|
372
|
-
disabled:
|
|
373
|
-
tagClassName:
|
|
367
|
+
onChange: (e) => m({ scopes: e }),
|
|
368
|
+
disabled: S,
|
|
369
|
+
tagClassName: h
|
|
374
370
|
})
|
|
375
371
|
]
|
|
376
372
|
}),
|
|
377
|
-
|
|
373
|
+
L()
|
|
378
374
|
]
|
|
379
375
|
}),
|
|
380
|
-
e.authenticationType ===
|
|
376
|
+
e.authenticationType === s.ApiKey && /* @__PURE__ */ O("div", {
|
|
381
377
|
className: "flex flex-col gap-3 pt-2",
|
|
382
378
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ O("div", {
|
|
384
380
|
className: "flex flex-col gap-2",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
381
|
+
children: [/* @__PURE__ */ D(P, {
|
|
386
382
|
name: "apikey-login-mode",
|
|
387
383
|
id: "apikey-with-login",
|
|
388
|
-
value:
|
|
389
|
-
labelProps: { label:
|
|
390
|
-
isSelected: e.withLogin ===
|
|
391
|
-
disabled:
|
|
392
|
-
onChange:
|
|
393
|
-
}), /* @__PURE__ */
|
|
384
|
+
value: l.WithLogin,
|
|
385
|
+
labelProps: { label: _?.withLoginLabel ?? "With login" },
|
|
386
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
387
|
+
disabled: S,
|
|
388
|
+
onChange: T
|
|
389
|
+
}), /* @__PURE__ */ D(P, {
|
|
394
390
|
name: "apikey-login-mode",
|
|
395
391
|
id: "apikey-without-login",
|
|
396
|
-
value:
|
|
397
|
-
labelProps: { label:
|
|
398
|
-
isSelected: e.withLogin ===
|
|
399
|
-
disabled:
|
|
400
|
-
onChange:
|
|
392
|
+
value: l.WithoutLogin,
|
|
393
|
+
labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
|
|
394
|
+
isSelected: e.withLogin === l.WithoutLogin,
|
|
395
|
+
disabled: S,
|
|
396
|
+
onChange: T
|
|
401
397
|
})]
|
|
402
398
|
}),
|
|
403
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ O("div", {
|
|
404
400
|
className: "flex flex-col gap-3",
|
|
405
|
-
children: [/* @__PURE__ */
|
|
401
|
+
children: [/* @__PURE__ */ D(j, {
|
|
406
402
|
id: "toolset-key-header",
|
|
407
403
|
value: e.keyHeader ?? "",
|
|
408
|
-
onChange: (e) =>
|
|
404
|
+
onChange: (e) => m({ keyHeader: e ?? "" }),
|
|
409
405
|
labelProps: {
|
|
410
|
-
label:
|
|
406
|
+
label: _?.keyHeaderLabel ?? "API Key parameter name",
|
|
411
407
|
required: !0
|
|
412
408
|
},
|
|
413
|
-
placeholder:
|
|
409
|
+
placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
|
|
414
410
|
error: t.keyHeader || void 0,
|
|
415
411
|
invalid: !!t.keyHeader,
|
|
416
|
-
disabled:
|
|
417
|
-
}), e.withLogin ===
|
|
412
|
+
disabled: S
|
|
413
|
+
}), e.withLogin === l.WithLogin && /* @__PURE__ */ D(N, {
|
|
418
414
|
id: "toolset-api-key",
|
|
419
415
|
value: e.apiKey ?? "",
|
|
420
|
-
onChange: (e) =>
|
|
416
|
+
onChange: (e) => m({ apiKey: e ?? "" }),
|
|
421
417
|
labelProps: {
|
|
422
|
-
label:
|
|
418
|
+
label: _?.apiKeyLabel ?? "API key",
|
|
423
419
|
required: !0
|
|
424
420
|
},
|
|
425
|
-
placeholder:
|
|
426
|
-
showPasswordLabel:
|
|
427
|
-
hidePasswordLabel:
|
|
421
|
+
placeholder: _?.apiKeyPlaceholder ?? "Enter API key",
|
|
422
|
+
showPasswordLabel: _?.showApiKeyLabel ?? "Show API key",
|
|
423
|
+
hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
|
|
428
424
|
error: t.apiKey || void 0,
|
|
429
425
|
invalid: !!t.apiKey,
|
|
430
|
-
disabled:
|
|
426
|
+
disabled: S
|
|
431
427
|
})]
|
|
432
428
|
}),
|
|
433
|
-
e.withLogin !==
|
|
429
|
+
e.withLogin !== l.WithoutLogin && L()
|
|
434
430
|
]
|
|
435
431
|
}),
|
|
436
|
-
|
|
437
|
-
open:
|
|
438
|
-
header:
|
|
439
|
-
description:
|
|
440
|
-
confirmLabel:
|
|
441
|
-
cancelLabel:
|
|
442
|
-
variant:
|
|
443
|
-
isLoading:
|
|
444
|
-
disableConfirmButton:
|
|
445
|
-
onConfirm:
|
|
446
|
-
onCancel: () =>
|
|
447
|
-
onClose: () =>
|
|
432
|
+
b && /* @__PURE__ */ D(ie, {
|
|
433
|
+
open: b,
|
|
434
|
+
header: _?.logoutConfirmTitle ?? "Log out?",
|
|
435
|
+
description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
|
|
436
|
+
confirmLabel: _?.logOutLabel ?? "Log out",
|
|
437
|
+
cancelLabel: _?.cancelLabel ?? "Cancel",
|
|
438
|
+
variant: ae.Danger,
|
|
439
|
+
isLoading: v,
|
|
440
|
+
disableConfirmButton: v,
|
|
441
|
+
onConfirm: F,
|
|
442
|
+
onCancel: () => x(!1),
|
|
443
|
+
onClose: () => x(!1)
|
|
448
444
|
})
|
|
449
445
|
]
|
|
450
446
|
});
|
|
451
|
-
},
|
|
452
|
-
let { isCopied: r, copy: i } =
|
|
453
|
-
return /* @__PURE__ */
|
|
454
|
-
className:
|
|
447
|
+
}, _e = b(({ url: e, className: t, labels: n }) => {
|
|
448
|
+
let { isCopied: r, copy: i } = v(e), a = n?.copiedLabel ?? "Copied!";
|
|
449
|
+
return /* @__PURE__ */ O("div", {
|
|
450
|
+
className: _("flex flex-col gap-3", t),
|
|
455
451
|
children: [
|
|
456
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ O("div", {
|
|
457
453
|
className: "flex flex-col gap-1",
|
|
458
|
-
children: [/* @__PURE__ */
|
|
454
|
+
children: [/* @__PURE__ */ D("p", {
|
|
459
455
|
className: "dial-body-semi-text text-start text-primary",
|
|
460
456
|
children: n?.title ?? "Connect toolset"
|
|
461
|
-
}), /* @__PURE__ */
|
|
457
|
+
}), /* @__PURE__ */ D("p", {
|
|
462
458
|
className: "dial-small-text text-start text-secondary",
|
|
463
459
|
children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
|
|
464
460
|
})]
|
|
465
461
|
}),
|
|
466
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(f, {
|
|
467
463
|
copiedLabel: a,
|
|
468
464
|
copyLabel: n?.copyLabel ?? "Copy URL",
|
|
469
465
|
isCopied: r,
|
|
470
466
|
onClick: i
|
|
471
467
|
}) }),
|
|
472
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ D("span", {
|
|
473
469
|
role: "status",
|
|
474
470
|
"aria-live": "polite",
|
|
475
471
|
className: "sr-only",
|
|
@@ -477,16 +473,16 @@ var z = {
|
|
|
477
473
|
})
|
|
478
474
|
]
|
|
479
475
|
});
|
|
480
|
-
}),
|
|
481
|
-
let [g, _] =
|
|
482
|
-
value:
|
|
476
|
+
}), ve = ({ 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 }) => {
|
|
477
|
+
let [g, _] = w(null), v = !!a && !!r, y = C(() => [{
|
|
478
|
+
value: R.Http,
|
|
483
479
|
label: "HTTP"
|
|
484
480
|
}, {
|
|
485
|
-
value:
|
|
481
|
+
value: R.Sse,
|
|
486
482
|
label: "SSE"
|
|
487
483
|
}], []);
|
|
488
|
-
return
|
|
489
|
-
if (!r || !o || !
|
|
484
|
+
return S(() => {
|
|
485
|
+
if (!r || !o || !Y(e.auth, i)) {
|
|
490
486
|
_(null);
|
|
491
487
|
return;
|
|
492
488
|
}
|
|
@@ -507,56 +503,56 @@ var z = {
|
|
|
507
503
|
e.auth,
|
|
508
504
|
e.endpoint,
|
|
509
505
|
o
|
|
510
|
-
]), /* @__PURE__ */
|
|
506
|
+
]), /* @__PURE__ */ O("div", {
|
|
511
507
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
512
508
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ D(j, {
|
|
514
510
|
id: "toolset-endpoint",
|
|
515
511
|
value: e.endpoint,
|
|
516
512
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
517
513
|
labelProps: {
|
|
518
|
-
label:
|
|
514
|
+
label: m?.endpointLabel ?? "Endpoint",
|
|
519
515
|
required: !0
|
|
520
516
|
},
|
|
521
|
-
placeholder:
|
|
522
|
-
caption:
|
|
517
|
+
placeholder: m?.endpointPlaceholder ?? "https://...",
|
|
518
|
+
caption: m?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
|
|
523
519
|
error: t.endpoint || void 0,
|
|
524
520
|
invalid: !!t.endpoint
|
|
525
521
|
}),
|
|
526
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ D(F, {
|
|
527
523
|
labelProps: {
|
|
528
|
-
label:
|
|
524
|
+
label: m?.protocolLabel ?? "Protocol",
|
|
529
525
|
required: !0
|
|
530
526
|
},
|
|
531
527
|
id: "toolset-protocol",
|
|
532
|
-
items:
|
|
528
|
+
items: y,
|
|
533
529
|
value: e.protocol,
|
|
534
530
|
onChange: (e) => {
|
|
535
531
|
d({ protocol: e });
|
|
536
532
|
}
|
|
537
533
|
}),
|
|
538
|
-
g ? /* @__PURE__ */ L
|
|
534
|
+
g ? /* @__PURE__ */ D(L, {
|
|
539
535
|
id: "toolset-allowed-tools",
|
|
540
536
|
multiple: !0,
|
|
541
537
|
searchable: !0,
|
|
542
538
|
selectAll: !0,
|
|
543
|
-
labelProps: { label:
|
|
544
|
-
placeholder:
|
|
539
|
+
labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
|
|
540
|
+
placeholder: m?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
|
|
545
541
|
options: g.map((e) => ({
|
|
546
542
|
value: e,
|
|
547
543
|
label: e
|
|
548
544
|
})),
|
|
549
545
|
value: e.allowedTools,
|
|
550
546
|
onChange: (e) => d({ allowedTools: e })
|
|
551
|
-
}) : /* @__PURE__ */
|
|
547
|
+
}) : /* @__PURE__ */ D(oe, {
|
|
552
548
|
id: "toolset-allowed-tools",
|
|
553
|
-
labelProps: { label:
|
|
554
|
-
placeholder:
|
|
549
|
+
labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
|
|
550
|
+
placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
555
551
|
value: e.allowedTools,
|
|
556
552
|
onChange: (e) => d({ allowedTools: e }),
|
|
557
|
-
tagClassName:
|
|
553
|
+
tagClassName: h
|
|
558
554
|
}),
|
|
559
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ D(ge, {
|
|
560
556
|
auth: e.auth,
|
|
561
557
|
errors: t,
|
|
562
558
|
isSaving: n,
|
|
@@ -567,182 +563,206 @@ var z = {
|
|
|
567
563
|
onOAuthLogin: c,
|
|
568
564
|
onNotifySuccess: l,
|
|
569
565
|
onNotifyError: u,
|
|
570
|
-
onAuthChange:
|
|
571
|
-
onEnsureSaved:
|
|
572
|
-
labels:
|
|
566
|
+
onAuthChange: f,
|
|
567
|
+
onEnsureSaved: p,
|
|
568
|
+
labels: m?.auth
|
|
573
569
|
}),
|
|
574
|
-
v && /* @__PURE__ */
|
|
570
|
+
v && /* @__PURE__ */ D(_e, {
|
|
575
571
|
url: a ?? "",
|
|
576
|
-
labels:
|
|
572
|
+
labels: m?.connect,
|
|
577
573
|
className: "border-t border-tertiary pt-4"
|
|
578
574
|
})
|
|
579
575
|
]
|
|
580
576
|
});
|
|
581
|
-
},
|
|
577
|
+
}, ye = [
|
|
582
578
|
"keyHeader",
|
|
583
579
|
"apiKey",
|
|
584
580
|
"clientId",
|
|
585
581
|
"clientSecret",
|
|
586
582
|
"authorizationEndpoint",
|
|
587
583
|
"tokenEndpoint"
|
|
588
|
-
],
|
|
589
|
-
"name",
|
|
590
|
-
"version",
|
|
591
|
-
"endpoint",
|
|
592
|
-
...fe
|
|
593
|
-
], me = new Set(pe), he = (e) => {
|
|
584
|
+
], be = ["endpoint", ...ye], $ = new Set(be), xe = (e) => {
|
|
594
585
|
let t = {};
|
|
595
|
-
for (let n of Object.keys(e))
|
|
586
|
+
for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
|
|
596
587
|
return t;
|
|
597
|
-
},
|
|
598
|
-
let
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
588
|
+
}, Se = ({ initialForm: r, toolsetId: i, onPersist: o, onPostSaveLogin: c, onToolsetsChanged: u, onSaveSuccess: f, onSaveComplete: h, onBack: _, buildMcpUrl: v, listToolNames: b, authActions: T, onOAuthLogin: te, onNotifySuccess: ne, onNotifyError: E, bucket: re, FileManagerModal: O, resolveIconUrl: ie, allowedMimeTypes: ae, maxFileSizeBytes: k, availableLocaleOptions: A, onRefineDescription: j, labels: M }) => {
|
|
589
|
+
let N = !!i, [P, F] = w(""), I = i || P, [L, oe] = w({
|
|
590
|
+
initialForm: r,
|
|
591
|
+
key: 0
|
|
592
|
+
});
|
|
593
|
+
L.initialForm !== r && oe({
|
|
594
|
+
initialForm: r,
|
|
595
|
+
key: L.key + 1
|
|
596
|
+
});
|
|
597
|
+
let { values: R, setValues: z, markTouched: B, visibleErrorCodes: V, attemptSubmit: H } = a({
|
|
598
|
+
initialValues: C(() => fe(r), [r]),
|
|
599
|
+
validationOptions: ce,
|
|
600
|
+
reseedKey: L.key
|
|
601
|
+
}), [le, U] = w(r), W = C(() => ({
|
|
602
|
+
...le,
|
|
603
|
+
...R
|
|
604
|
+
}), [le, R]), [K, q] = w(!1), [J, Y] = w({}), [de, X] = w({}), Z = ee(null);
|
|
605
|
+
S(() => {
|
|
606
|
+
U(r), Z.current = r, Y({}), X({}), F("");
|
|
607
|
+
}, [r]);
|
|
608
|
+
let Q = x((e) => {
|
|
609
|
+
let { metadata: t, setup: r } = pe(e);
|
|
610
|
+
Object.keys(t).length > 0 && (z(t), "name" in t && B(n.Name), "version" in t && B(n.Version)), Object.keys(r).length !== 0 && (U((e) => ({
|
|
611
|
+
...e,
|
|
612
|
+
...r
|
|
613
|
+
})), X((e) => ({
|
|
614
|
+
...e,
|
|
615
|
+
...xe(r)
|
|
616
|
+
})), Y((e) => {
|
|
617
|
+
let t = { ...e };
|
|
618
|
+
for (let e of Object.keys(r)) delete t[e];
|
|
619
|
+
return t;
|
|
620
|
+
}));
|
|
621
|
+
}, [z, B]), he = x((e) => {
|
|
622
|
+
U((t) => ({
|
|
616
623
|
...t,
|
|
617
624
|
auth: {
|
|
618
625
|
...t.auth,
|
|
619
626
|
...e
|
|
620
627
|
}
|
|
621
|
-
})),
|
|
628
|
+
})), X((t) => ({
|
|
622
629
|
...t,
|
|
623
|
-
...
|
|
624
|
-
})),
|
|
630
|
+
...xe(e)
|
|
631
|
+
})), Y((t) => {
|
|
625
632
|
let n = { ...t };
|
|
626
|
-
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of
|
|
633
|
+
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of ye) delete n[e];
|
|
627
634
|
else for (let t of Object.keys(e)) delete n[t];
|
|
628
635
|
return n;
|
|
629
|
-
}), "isLoggedIn" in e &&
|
|
630
|
-
}, [
|
|
631
|
-
if (
|
|
632
|
-
|
|
636
|
+
}), "isLoggedIn" in e && u();
|
|
637
|
+
}, [u]), ge = x(async () => {
|
|
638
|
+
if (I && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(W)) return I;
|
|
639
|
+
q(!0);
|
|
633
640
|
try {
|
|
634
|
-
let e = await
|
|
635
|
-
return e ? (
|
|
641
|
+
let e = await o(W, I);
|
|
642
|
+
return e ? (I || F(e), Z.current = W, await u(), e) : null;
|
|
636
643
|
} catch {
|
|
637
644
|
return null;
|
|
638
645
|
} finally {
|
|
639
|
-
|
|
646
|
+
q(!1);
|
|
640
647
|
}
|
|
641
648
|
}, [
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
]),
|
|
647
|
-
let
|
|
648
|
-
return
|
|
649
|
-
}, [
|
|
650
|
-
let e = $(
|
|
651
|
-
if (Object.keys(
|
|
652
|
-
|
|
649
|
+
W,
|
|
650
|
+
I,
|
|
651
|
+
o,
|
|
652
|
+
u
|
|
653
|
+
]), _e = x(async () => await ge() ?? !1, [ge]), $ = x((e) => {
|
|
654
|
+
let t = M?.validation, n = {};
|
|
655
|
+
return e.endpoint.trim() ? G(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"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !G(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !G(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
|
|
656
|
+
}, [M, N]), Se = x(async () => {
|
|
657
|
+
let e = H(), t = $(W);
|
|
658
|
+
if (!e || Object.keys(t).length > 0) {
|
|
659
|
+
Y(t);
|
|
653
660
|
return;
|
|
654
661
|
}
|
|
655
|
-
|
|
662
|
+
Y({}), q(!0);
|
|
656
663
|
try {
|
|
657
|
-
let e = await
|
|
664
|
+
let e = await o(W, I);
|
|
658
665
|
if (!e) return;
|
|
659
|
-
await
|
|
666
|
+
await u(), f(W);
|
|
660
667
|
try {
|
|
661
|
-
await
|
|
668
|
+
await c(e, W.auth), h();
|
|
662
669
|
} catch (e) {
|
|
663
|
-
let { traceId: t } = await
|
|
664
|
-
|
|
670
|
+
let { traceId: t } = await d(e);
|
|
671
|
+
E(M?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
665
672
|
}
|
|
666
673
|
} catch {} finally {
|
|
667
|
-
|
|
674
|
+
q(!1);
|
|
668
675
|
}
|
|
669
676
|
}, [
|
|
670
|
-
|
|
677
|
+
H,
|
|
678
|
+
W,
|
|
671
679
|
$,
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
680
|
+
I,
|
|
681
|
+
o,
|
|
682
|
+
u,
|
|
675
683
|
f,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
]),
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
684
|
+
h,
|
|
685
|
+
c,
|
|
686
|
+
E,
|
|
687
|
+
M
|
|
688
|
+
]), Ce = y({
|
|
689
|
+
value: R.description,
|
|
690
|
+
onChange: (e) => Q({ description: e }),
|
|
691
|
+
onRefine: j,
|
|
692
|
+
disabled: K,
|
|
693
|
+
resetKey: L.key
|
|
694
|
+
}), we = j ? (e, t) => /* @__PURE__ */ D(g, {
|
|
695
|
+
isEnabled: !0,
|
|
696
|
+
fieldId: t,
|
|
697
|
+
label: M?.general?.form?.description.label ?? "Description",
|
|
698
|
+
labels: M?.refinement,
|
|
699
|
+
refinement: Ce,
|
|
700
|
+
disabled: Ce.isPending || K,
|
|
701
|
+
children: e
|
|
702
|
+
}) : void 0, Te = C(() => !ue(W, N), [W, N]), Ee = C(() => {
|
|
703
|
+
let t = M?.validation, n = $(W), r = { ...J };
|
|
704
|
+
for (let e of be) {
|
|
705
|
+
if (!de[e]) continue;
|
|
706
|
+
let t = n[e];
|
|
707
|
+
t ? r[e] = t : delete r[e];
|
|
686
708
|
}
|
|
687
|
-
return t;
|
|
709
|
+
return V.name === e.Required ? r.name = t?.nameRequired ?? "Name is required" : V.name === e.TooLong ? r.name = t?.nameTooLong ?? `Use ${m} characters or fewer.` : V.name === e.ControlCharacters && (r.name = t?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), V.description === e.TooLong && (r.description = t?.descriptionTooLong ?? `Use ${p} characters or fewer.`), V.version === e.InvalidFormat && (r.version = t?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
|
|
688
710
|
}, [
|
|
689
|
-
|
|
690
|
-
|
|
711
|
+
de,
|
|
712
|
+
J,
|
|
713
|
+
W,
|
|
714
|
+
M,
|
|
691
715
|
V,
|
|
692
716
|
$
|
|
693
|
-
]),
|
|
694
|
-
return /* @__PURE__ */
|
|
695
|
-
title:
|
|
696
|
-
onBack:
|
|
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
|
-
|
|
722
|
-
|
|
717
|
+
]), De = v && I ? v(I) : void 0;
|
|
718
|
+
return /* @__PURE__ */ D(t, {
|
|
719
|
+
title: N ? M?.layout?.editTitle ?? "Edit toolset" : M?.layout?.createTitle ?? "Create toolset",
|
|
720
|
+
onBack: _,
|
|
721
|
+
onCancel: _,
|
|
722
|
+
onSubmit: Se,
|
|
723
|
+
submitLabel: N ? M?.layout?.saveLabel ?? "Save" : M?.layout?.createLabel ?? "Create",
|
|
724
|
+
isSubmitting: K,
|
|
725
|
+
isSubmitDisabled: Te || Ce.isPending,
|
|
726
|
+
metadataSectionClassName: se.metadataSection,
|
|
727
|
+
setupSectionClassName: se.setupSection,
|
|
728
|
+
labels: {
|
|
729
|
+
backAriaLabel: M?.layout?.backAriaLabel ?? "Back to catalog",
|
|
730
|
+
savingStatusLabel: M?.layout?.savingStatusLabel ?? "Saving",
|
|
731
|
+
metadataTitle: M?.layout?.metadataSectionTitle ?? "Metadata",
|
|
732
|
+
setupTitle: M?.layout?.setupSectionTitle ?? "Setup",
|
|
733
|
+
cancelLabel: M?.layout?.cancelLabel ?? "Cancel"
|
|
734
|
+
},
|
|
735
|
+
metadata: /* @__PURE__ */ D(me, {
|
|
736
|
+
form: W,
|
|
737
|
+
errors: Ee,
|
|
738
|
+
bucket: re,
|
|
739
|
+
FileManagerModal: O,
|
|
740
|
+
resolveIconUrl: ie,
|
|
741
|
+
allowedMimeTypes: ae,
|
|
742
|
+
maxFileSizeBytes: k,
|
|
743
|
+
availableLocaleOptions: A,
|
|
744
|
+
onChange: Q,
|
|
745
|
+
renderDescription: we,
|
|
746
|
+
labels: M?.general
|
|
723
747
|
}),
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
onAuthChange: Q,
|
|
741
|
-
onEnsureSaved: ae,
|
|
742
|
-
labels: P?.settings
|
|
743
|
-
})
|
|
748
|
+
setup: /* @__PURE__ */ D(ve, {
|
|
749
|
+
form: W,
|
|
750
|
+
errors: Ee,
|
|
751
|
+
isSaving: K,
|
|
752
|
+
toolsetId: I,
|
|
753
|
+
isEditMode: N,
|
|
754
|
+
connectUrl: De,
|
|
755
|
+
listToolNames: b,
|
|
756
|
+
authActions: T,
|
|
757
|
+
onOAuthLogin: te,
|
|
758
|
+
onNotifySuccess: ne,
|
|
759
|
+
onNotifyError: E,
|
|
760
|
+
onChange: Q,
|
|
761
|
+
onAuthChange: he,
|
|
762
|
+
onEnsureSaved: _e,
|
|
763
|
+
labels: M?.settings
|
|
744
764
|
})
|
|
745
765
|
});
|
|
746
766
|
};
|
|
747
767
|
//#endregion
|
|
748
|
-
export {
|
|
768
|
+
export { V as AUTH_TYPE_ICONS, z as DEFAULT_TOOLSET_NAME, B as DEFAULT_TOOLSET_VERSION, me as GeneralForm, se as TOOLSET_EDITOR_CLASS, Se as ToolsetEditor, Z as ToolsetOAuthLoginStatus, R as ToolsetTransportType, U as getDefaultToolsetForm, H as getStorageSafeUniqueToolsetName, Y as isToolsetAuthValid, ue as isToolsetFormValid, G as isValidEndpointUrl, q as normalizeReturnedEndpointUrl };
|