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