@epam/ai-dial-toolset-editor 1.2.0-dev.28 → 1.2.0-dev.282
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 +4 -1
- package/constants/toolsets.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +399 -392
- 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 +7 -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,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, mergeClasses as g, useCodeCopy as _ } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { memo as v, useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
|
|
5
|
+
import { IconBrandOauth as w, IconKey as ee, IconLockOff as T, IconLogin as E, IconLogout as te } from "@tabler/icons-react";
|
|
6
|
+
import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
7
|
+
import { ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as ie, Radio as N, RadioGroup as P, SegmentedControl as F, Select as ae, TagInput as I } from "@epam/ai-dial-ui-kit";
|
|
8
|
+
//#region src/constants/public-class-names.ts
|
|
9
|
+
var L = {
|
|
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", oe = { validateVersionPattern: i }, V = {
|
|
15
|
+
[s.OAuth]: w,
|
|
16
|
+
[s.ApiKey]: ee,
|
|
17
|
+
[s.None]: T
|
|
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
|
+
}, U = () => ({
|
|
25
|
+
authenticationType: s.None,
|
|
26
|
+
withLogin: l.WithoutLogin,
|
|
24
27
|
isLoggedIn: !1
|
|
25
|
-
}),
|
|
26
|
-
name:
|
|
27
|
-
version:
|
|
28
|
+
}), W = (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: U()
|
|
39
|
+
}), G = (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
|
+
}, K = (e) => G(e.trim()), q = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), se = (e) => {
|
|
44
47
|
let t = e?.trim() ?? "";
|
|
45
|
-
if (!t ||
|
|
48
|
+
if (!t || G(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 = q(e);
|
|
56
|
+
if (G(t)) return t;
|
|
54
57
|
}
|
|
55
58
|
return t;
|
|
56
|
-
},
|
|
59
|
+
}, J = (e) => !e?.trim() || K(e), Y = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && J(e.authorizationEndpoint) && J(e.tokenEndpoint) : !0, ce = (e, t = !1) => Object.keys(o(e, oe)).length === 0 && K(e.endpoint) && Y(e.auth, t), X = new Set([
|
|
60
|
+
"name",
|
|
61
|
+
"description",
|
|
62
|
+
"iconUrl",
|
|
63
|
+
"version",
|
|
64
|
+
"topics",
|
|
65
|
+
"otherLocales"
|
|
66
|
+
]), le = (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
|
+
}), ue = (e) => {
|
|
74
|
+
let t = {}, n = {};
|
|
75
|
+
for (let [r, i] of Object.entries(e)) (X.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,381 +116,355 @@ 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
|
+
}, de = ({ form: e, errors: t, bucket: n, FileManagerModal: i, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: d, onVersionBlur: f, labels: p }) => {
|
|
120
|
+
let m = y((e) => {
|
|
121
|
+
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: x(() => ({
|
|
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: x(() => ({
|
|
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
|
+
}({}), fe = (e, t) => e === s.None ? l.WithoutLogin : e === s.OAuth && !t ? l.WithConfig : l.WithLogin, pe = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", me = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: u, onNotifySuccess: f, onNotifyError: p, onAuthChange: m, onEnsureSaved: g, labels: _ }) => {
|
|
154
|
+
let [v, y] = C(!1), [b, x] = C(!1), S = e.isLoggedIn || n || v, w = K(a) && Y(e, i) && !S, ee = (t) => {
|
|
155
|
+
S || t === e.authenticationType || m({
|
|
158
156
|
authenticationType: t,
|
|
159
|
-
withLogin:
|
|
157
|
+
withLogin: fe(t, !!e.clientId?.trim())
|
|
160
158
|
});
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
switch (e.auth != null &&
|
|
165
|
-
case
|
|
166
|
-
|
|
159
|
+
}, T = (e) => {
|
|
160
|
+
m({ withLogin: e });
|
|
161
|
+
}, P = (e) => {
|
|
162
|
+
switch (e.auth != null && m(e.auth), e.status) {
|
|
163
|
+
case Q.Success:
|
|
164
|
+
m({ 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 (!
|
|
181
|
-
if (e.authenticationType ===
|
|
182
|
-
|
|
177
|
+
}, ae = async () => {
|
|
178
|
+
if (!w) return;
|
|
179
|
+
if (e.authenticationType === s.OAuth) {
|
|
180
|
+
y(!0);
|
|
183
181
|
try {
|
|
184
|
-
|
|
182
|
+
P(await u({
|
|
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,
|
|
199
|
-
credentialsLevel:
|
|
197
|
+
credentialsLevel: c.User,
|
|
200
198
|
authenticationType: e.authenticationType,
|
|
201
199
|
apiKey: e.apiKey?.trim()
|
|
202
200
|
};
|
|
203
|
-
await
|
|
201
|
+
await o.login(t, n), m({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
|
|
204
202
|
} catch (e) {
|
|
205
|
-
let { traceId: t } = await
|
|
206
|
-
|
|
203
|
+
let { traceId: t } = await d(e);
|
|
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
|
+
}, L = async () => {
|
|
210
|
+
y(!0);
|
|
213
211
|
try {
|
|
214
212
|
let t = {
|
|
215
213
|
url: r,
|
|
216
|
-
credentialsLevel:
|
|
214
|
+
credentialsLevel: c.User,
|
|
217
215
|
authenticationType: e.authenticationType
|
|
218
216
|
};
|
|
219
|
-
await
|
|
217
|
+
await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), f(_?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
220
218
|
} catch (e) {
|
|
221
|
-
let { traceId: t } = await
|
|
222
|
-
|
|
219
|
+
let { traceId: t } = await d(e);
|
|
220
|
+
p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
223
221
|
} finally {
|
|
224
|
-
|
|
222
|
+
y(!1);
|
|
225
223
|
}
|
|
226
|
-
},
|
|
224
|
+
}, R = () => e.isLoggedIn ? /* @__PURE__ */ D("div", {
|
|
227
225
|
className: "flex",
|
|
228
|
-
children: /* @__PURE__ */
|
|
229
|
-
label:
|
|
230
|
-
iconBefore: /* @__PURE__ */
|
|
231
|
-
size:
|
|
232
|
-
stroke:
|
|
226
|
+
children: /* @__PURE__ */ D(M, {
|
|
227
|
+
label: _?.logOutLabel ?? "Log out",
|
|
228
|
+
iconBefore: /* @__PURE__ */ D(te, {
|
|
229
|
+
size: k.MD,
|
|
230
|
+
stroke: A
|
|
233
231
|
}),
|
|
234
|
-
onClick: () =>
|
|
235
|
-
disabled: n ||
|
|
232
|
+
onClick: () => x(!0),
|
|
233
|
+
disabled: n || v
|
|
236
234
|
})
|
|
237
|
-
}) : /* @__PURE__ */
|
|
235
|
+
}) : /* @__PURE__ */ D("div", {
|
|
238
236
|
className: "flex",
|
|
239
|
-
children: /* @__PURE__ */
|
|
240
|
-
label:
|
|
241
|
-
iconBefore: /* @__PURE__ */
|
|
242
|
-
size:
|
|
243
|
-
stroke:
|
|
237
|
+
children: /* @__PURE__ */ D(M, {
|
|
238
|
+
label: _?.logInLabel ?? "Log in",
|
|
239
|
+
iconBefore: /* @__PURE__ */ D(E, {
|
|
240
|
+
size: k.MD,
|
|
241
|
+
stroke: A
|
|
244
242
|
}),
|
|
245
|
-
onClick:
|
|
246
|
-
disabled: !
|
|
243
|
+
onClick: ae,
|
|
244
|
+
disabled: !w
|
|
247
245
|
})
|
|
248
246
|
});
|
|
249
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ O("section", {
|
|
250
248
|
className: "flex flex-col gap-2",
|
|
251
249
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ D("h3", {
|
|
253
251
|
className: "dial-h3-text",
|
|
254
|
-
children:
|
|
252
|
+
children: _?.sectionTitle ?? "Authentication"
|
|
255
253
|
}),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
"aria-label":
|
|
254
|
+
/* @__PURE__ */ D(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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
s.None,
|
|
261
|
+
s.OAuth,
|
|
262
|
+
s.ApiKey
|
|
265
263
|
].map((t) => {
|
|
266
|
-
let n =
|
|
264
|
+
let n = V[t];
|
|
267
265
|
return {
|
|
268
266
|
value: t,
|
|
269
|
-
label: /* @__PURE__ */
|
|
267
|
+
label: /* @__PURE__ */ O("div", {
|
|
270
268
|
className: "flex items-center gap-2",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ D(n, {
|
|
272
270
|
className: "shrink-0",
|
|
273
|
-
size:
|
|
274
|
-
stroke:
|
|
271
|
+
size: k.SM,
|
|
272
|
+
stroke: A,
|
|
275
273
|
"aria-hidden": !0
|
|
276
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ D("span", {
|
|
277
275
|
className: "sr-only desktop:not-sr-only",
|
|
278
|
-
children:
|
|
276
|
+
children: pe(t, _)
|
|
279
277
|
})]
|
|
280
278
|
}),
|
|
281
|
-
disabled:
|
|
279
|
+
disabled: S && e.authenticationType !== t
|
|
282
280
|
};
|
|
283
281
|
})
|
|
284
282
|
}),
|
|
285
|
-
e.authenticationType ===
|
|
283
|
+
e.authenticationType === s.None && /* @__PURE__ */ D("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 ===
|
|
287
|
+
e.authenticationType === s.OAuth && /* @__PURE__ */ O("div", {
|
|
290
288
|
className: "flex flex-col gap-3 pt-2",
|
|
291
289
|
children: [
|
|
292
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ O("div", {
|
|
293
291
|
className: "flex flex-col gap-2",
|
|
294
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ D(N, {
|
|
295
293
|
name: "oauth-login-mode",
|
|
296
294
|
id: "oauth-with-login",
|
|
297
|
-
value:
|
|
298
|
-
labelProps: { label:
|
|
299
|
-
isSelected: e.withLogin ===
|
|
300
|
-
disabled:
|
|
301
|
-
onChange:
|
|
302
|
-
}), /* @__PURE__ */
|
|
295
|
+
value: l.WithLogin,
|
|
296
|
+
labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
|
|
297
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
298
|
+
disabled: S,
|
|
299
|
+
onChange: T
|
|
300
|
+
}), /* @__PURE__ */ D(N, {
|
|
303
301
|
name: "oauth-login-mode",
|
|
304
302
|
id: "oauth-with-config",
|
|
305
|
-
value:
|
|
306
|
-
labelProps: { label:
|
|
307
|
-
isSelected: e.withLogin ===
|
|
308
|
-
disabled:
|
|
309
|
-
onChange:
|
|
303
|
+
value: l.WithConfig,
|
|
304
|
+
labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
|
|
305
|
+
isSelected: e.withLogin === l.WithConfig,
|
|
306
|
+
disabled: S,
|
|
307
|
+
onChange: T
|
|
310
308
|
})]
|
|
311
309
|
}),
|
|
312
|
-
e.withLogin ===
|
|
310
|
+
e.withLogin === l.WithConfig && /* @__PURE__ */ O("div", {
|
|
313
311
|
className: "flex flex-col gap-3",
|
|
314
312
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ D(j, {
|
|
316
314
|
id: "toolset-client-id",
|
|
317
315
|
value: e.clientId ?? "",
|
|
318
|
-
onChange: (e) =>
|
|
316
|
+
onChange: (e) => m({ 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: S
|
|
327
325
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ D(ie, {
|
|
329
327
|
id: "toolset-client-secret",
|
|
330
328
|
value: e.clientSecret ?? "",
|
|
331
|
-
onChange: (e) =>
|
|
329
|
+
onChange: (e) => m({ 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: S
|
|
342
340
|
}),
|
|
343
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ D(j, {
|
|
344
342
|
id: "toolset-authorization-endpoint",
|
|
345
343
|
value: e.authorizationEndpoint ?? "",
|
|
346
|
-
onChange: (e) =>
|
|
347
|
-
labelProps: { label:
|
|
348
|
-
placeholder:
|
|
344
|
+
onChange: (e) => m({ 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: S
|
|
352
350
|
}),
|
|
353
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ D(j, {
|
|
354
352
|
id: "toolset-token-endpoint",
|
|
355
353
|
value: e.tokenEndpoint ?? "",
|
|
356
|
-
onChange: (e) =>
|
|
357
|
-
labelProps: { label:
|
|
358
|
-
placeholder:
|
|
354
|
+
onChange: (e) => m({ 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: S
|
|
362
360
|
}),
|
|
363
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ D(I, {
|
|
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) => m({ scopes: e }),
|
|
367
|
+
disabled: S,
|
|
368
|
+
tagClassName: h
|
|
371
369
|
})
|
|
372
370
|
]
|
|
373
371
|
}),
|
|
374
|
-
|
|
372
|
+
R()
|
|
375
373
|
]
|
|
376
374
|
}),
|
|
377
|
-
e.authenticationType ===
|
|
375
|
+
e.authenticationType === s.ApiKey && /* @__PURE__ */ O("div", {
|
|
378
376
|
className: "flex flex-col gap-3 pt-2",
|
|
379
377
|
children: [
|
|
380
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ O("div", {
|
|
381
379
|
className: "flex flex-col gap-2",
|
|
382
|
-
children: [/* @__PURE__ */
|
|
380
|
+
children: [/* @__PURE__ */ D(N, {
|
|
383
381
|
name: "apikey-login-mode",
|
|
384
382
|
id: "apikey-with-login",
|
|
385
|
-
value:
|
|
386
|
-
labelProps: { label:
|
|
387
|
-
isSelected: e.withLogin ===
|
|
388
|
-
disabled:
|
|
389
|
-
onChange:
|
|
390
|
-
}), /* @__PURE__ */
|
|
383
|
+
value: l.WithLogin,
|
|
384
|
+
labelProps: { label: _?.withLoginLabel ?? "With login" },
|
|
385
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
386
|
+
disabled: S,
|
|
387
|
+
onChange: T
|
|
388
|
+
}), /* @__PURE__ */ D(N, {
|
|
391
389
|
name: "apikey-login-mode",
|
|
392
390
|
id: "apikey-without-login",
|
|
393
|
-
value:
|
|
394
|
-
labelProps: { label:
|
|
395
|
-
isSelected: e.withLogin ===
|
|
396
|
-
disabled:
|
|
397
|
-
onChange:
|
|
391
|
+
value: l.WithoutLogin,
|
|
392
|
+
labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
|
|
393
|
+
isSelected: e.withLogin === l.WithoutLogin,
|
|
394
|
+
disabled: S,
|
|
395
|
+
onChange: T
|
|
398
396
|
})]
|
|
399
397
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ O("div", {
|
|
401
399
|
className: "flex flex-col gap-3",
|
|
402
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ D(j, {
|
|
403
401
|
id: "toolset-key-header",
|
|
404
402
|
value: e.keyHeader ?? "",
|
|
405
|
-
onChange: (e) =>
|
|
403
|
+
onChange: (e) => m({ 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 ===
|
|
411
|
+
disabled: S
|
|
412
|
+
}), e.withLogin === l.WithLogin && /* @__PURE__ */ D(ie, {
|
|
415
413
|
id: "toolset-api-key",
|
|
416
414
|
value: e.apiKey ?? "",
|
|
417
|
-
onChange: (e) =>
|
|
415
|
+
onChange: (e) => m({ 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: S
|
|
428
426
|
})]
|
|
429
427
|
}),
|
|
430
|
-
e.withLogin !==
|
|
428
|
+
e.withLogin !== l.WithoutLogin && R()
|
|
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__ */ D(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: L,
|
|
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
|
+
}, $ = v(({ url: e, className: t, labels: n }) => {
|
|
447
|
+
let { isCopied: r, copy: i } = _(e), a = n?.copiedLabel ?? "Copied!";
|
|
448
|
+
return /* @__PURE__ */ O("div", {
|
|
449
|
+
className: g("flex flex-col gap-3", t),
|
|
452
450
|
children: [
|
|
453
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ O("div", {
|
|
454
452
|
className: "flex flex-col gap-1",
|
|
455
|
-
children: [/* @__PURE__ */
|
|
453
|
+
children: [/* @__PURE__ */ D("p", {
|
|
456
454
|
className: "dial-body-semi-text text-start text-primary",
|
|
457
455
|
children: n?.title ?? "Connect toolset"
|
|
458
|
-
}), /* @__PURE__ */
|
|
456
|
+
}), /* @__PURE__ */ D("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__ */ D("div", { children: /* @__PURE__ */ D(f, {
|
|
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__ */ D("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
|
+
}), he = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: m }) => {
|
|
476
|
+
let [g, _] = C(null), v = !!a && !!r, y = x(() => [{
|
|
477
|
+
value: R.Http,
|
|
480
478
|
label: "HTTP"
|
|
481
479
|
}, {
|
|
482
|
-
value:
|
|
480
|
+
value: R.Sse,
|
|
483
481
|
label: "SSE"
|
|
484
482
|
}], []);
|
|
485
|
-
return
|
|
486
|
-
if (!r || !o || !
|
|
483
|
+
return b(() => {
|
|
484
|
+
if (!r || !o || !Y(e.auth, i)) {
|
|
487
485
|
_(null);
|
|
488
486
|
return;
|
|
489
487
|
}
|
|
@@ -504,10 +502,10 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
504
502
|
e.auth,
|
|
505
503
|
e.endpoint,
|
|
506
504
|
o
|
|
507
|
-
]), /* @__PURE__ */
|
|
505
|
+
]), /* @__PURE__ */ O("div", {
|
|
508
506
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
509
507
|
children: [
|
|
510
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ D(j, {
|
|
511
509
|
id: "toolset-endpoint",
|
|
512
510
|
value: e.endpoint,
|
|
513
511
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
@@ -520,7 +518,7 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
520
518
|
error: t.endpoint || void 0,
|
|
521
519
|
invalid: !!t.endpoint
|
|
522
520
|
}),
|
|
523
|
-
/* @__PURE__ */ P
|
|
521
|
+
/* @__PURE__ */ D(P, {
|
|
524
522
|
labelProps: {
|
|
525
523
|
label: m?.protocolLabel ?? "Protocol",
|
|
526
524
|
required: !0
|
|
@@ -532,7 +530,7 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
532
530
|
d({ protocol: e });
|
|
533
531
|
}
|
|
534
532
|
}),
|
|
535
|
-
g ? /* @__PURE__ */
|
|
533
|
+
g ? /* @__PURE__ */ D(ae, {
|
|
536
534
|
id: "toolset-allowed-tools",
|
|
537
535
|
multiple: !0,
|
|
538
536
|
searchable: !0,
|
|
@@ -545,15 +543,15 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
545
543
|
})),
|
|
546
544
|
value: e.allowedTools,
|
|
547
545
|
onChange: (e) => d({ allowedTools: e })
|
|
548
|
-
}) : /* @__PURE__ */
|
|
546
|
+
}) : /* @__PURE__ */ D(I, {
|
|
549
547
|
id: "toolset-allowed-tools",
|
|
550
548
|
labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
|
|
551
549
|
placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
552
550
|
value: e.allowedTools,
|
|
553
551
|
onChange: (e) => d({ allowedTools: e }),
|
|
554
|
-
tagClassName:
|
|
552
|
+
tagClassName: h
|
|
555
553
|
}),
|
|
556
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ D(me, {
|
|
557
555
|
auth: e.auth,
|
|
558
556
|
errors: t,
|
|
559
557
|
isSaving: n,
|
|
@@ -568,178 +566,187 @@ var B = /* @__PURE__ */ function(e) {
|
|
|
568
566
|
onEnsureSaved: p,
|
|
569
567
|
labels: m?.auth
|
|
570
568
|
}),
|
|
571
|
-
v && /* @__PURE__ */
|
|
569
|
+
v && /* @__PURE__ */ D($, {
|
|
572
570
|
url: a ?? "",
|
|
573
571
|
labels: m?.connect,
|
|
574
572
|
className: "border-t border-tertiary pt-4"
|
|
575
573
|
})
|
|
576
574
|
]
|
|
577
575
|
});
|
|
578
|
-
},
|
|
576
|
+
}, ge = [
|
|
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
|
+
], _e = ["endpoint", ...ge], ve = new Set(_e), ye = (e) => {
|
|
591
584
|
let t = {};
|
|
592
|
-
for (let n of Object.keys(e))
|
|
585
|
+
for (let n of Object.keys(e)) ve.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
|
+
}, be = ({ initialForm: r, toolsetId: i, onPersist: o, onPostSaveLogin: c, onToolsetsChanged: u, onSaveSuccess: f, onSaveComplete: h, onBack: g, buildMcpUrl: _, listToolNames: v, authActions: w, onOAuthLogin: ee, onNotifySuccess: T, onNotifyError: E, bucket: te, FileManagerModal: O, resolveIconUrl: ne, allowedMimeTypes: re, maxFileSizeBytes: k, availableLocaleOptions: A, labels: j }) => {
|
|
588
|
+
let M = !!i, [ie, N] = C(""), P = i || ie, [F, ae] = C({
|
|
589
|
+
initialForm: r,
|
|
590
|
+
key: 0
|
|
591
|
+
});
|
|
592
|
+
F.initialForm !== r && ae({
|
|
593
|
+
initialForm: r,
|
|
594
|
+
key: F.key + 1
|
|
595
|
+
});
|
|
596
|
+
let { values: I, setValues: R, markTouched: z, visibleErrorCodes: B, attemptSubmit: V } = a({
|
|
597
|
+
initialValues: x(() => le(r), [r]),
|
|
598
|
+
validationOptions: oe,
|
|
599
|
+
reseedKey: F.key
|
|
600
|
+
}), [H, U] = C(r), W = x(() => ({
|
|
601
|
+
...H,
|
|
602
|
+
...I
|
|
603
|
+
}), [H, I]), [G, q] = C(!1), [se, J] = C({}), [Y, X] = C({}), Z = S(null);
|
|
604
|
+
b(() => {
|
|
605
|
+
U(r), Z.current = r, J({}), X({}), N("");
|
|
606
|
+
}, [r]);
|
|
607
|
+
let Q = y((e) => {
|
|
608
|
+
let { metadata: t, setup: r } = ue(e);
|
|
609
|
+
Object.keys(t).length > 0 && (R(t), "name" in t && z(n.Name), "version" in t && z(n.Version)), Object.keys(r).length !== 0 && (U((e) => ({
|
|
610
|
+
...e,
|
|
611
|
+
...r
|
|
612
|
+
})), X((e) => ({
|
|
613
|
+
...e,
|
|
614
|
+
...ye(r)
|
|
615
|
+
})), J((e) => {
|
|
616
|
+
let t = { ...e };
|
|
617
|
+
for (let e of Object.keys(r)) delete t[e];
|
|
618
|
+
return t;
|
|
619
|
+
}));
|
|
620
|
+
}, [R, z]), fe = y((e) => {
|
|
621
|
+
U((t) => ({
|
|
613
622
|
...t,
|
|
614
623
|
auth: {
|
|
615
624
|
...t.auth,
|
|
616
625
|
...e
|
|
617
626
|
}
|
|
618
|
-
})),
|
|
627
|
+
})), X((t) => ({
|
|
619
628
|
...t,
|
|
620
|
-
...
|
|
621
|
-
})),
|
|
629
|
+
...ye(e)
|
|
630
|
+
})), J((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 ge) delete n[e];
|
|
624
633
|
else for (let t of Object.keys(e)) delete n[t];
|
|
625
634
|
return n;
|
|
626
|
-
}), "isLoggedIn" in e &&
|
|
627
|
-
}, [
|
|
628
|
-
if (
|
|
629
|
-
|
|
635
|
+
}), "isLoggedIn" in e && u();
|
|
636
|
+
}, [u]), pe = y(async () => {
|
|
637
|
+
if (P && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(W)) return P;
|
|
638
|
+
q(!0);
|
|
630
639
|
try {
|
|
631
|
-
let e = await
|
|
632
|
-
return e ? (
|
|
640
|
+
let e = await o(W, P);
|
|
641
|
+
return e ? (P || N(e), Z.current = W, await u(), e) : null;
|
|
633
642
|
} catch {
|
|
634
643
|
return null;
|
|
635
644
|
} finally {
|
|
636
|
-
|
|
645
|
+
q(!1);
|
|
637
646
|
}
|
|
638
647
|
}, [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
]),
|
|
644
|
-
let
|
|
645
|
-
return
|
|
646
|
-
}, [
|
|
647
|
-
let e =
|
|
648
|
-
if (Object.keys(
|
|
649
|
-
|
|
648
|
+
W,
|
|
649
|
+
P,
|
|
650
|
+
o,
|
|
651
|
+
u
|
|
652
|
+
]), me = y(async () => await pe() ?? !1, [pe]), $ = y((e) => {
|
|
653
|
+
let t = j?.validation, n = {};
|
|
654
|
+
return e.endpoint.trim() ? K(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !M && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !K(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !K(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
|
|
655
|
+
}, [j, M]), ve = y(async () => {
|
|
656
|
+
let e = V(), t = $(W);
|
|
657
|
+
if (!e || Object.keys(t).length > 0) {
|
|
658
|
+
J(t);
|
|
650
659
|
return;
|
|
651
660
|
}
|
|
652
|
-
|
|
661
|
+
J({}), q(!0);
|
|
653
662
|
try {
|
|
654
|
-
let e = await
|
|
663
|
+
let e = await o(W, P);
|
|
655
664
|
if (!e) return;
|
|
656
|
-
await
|
|
665
|
+
await u(), f(W);
|
|
657
666
|
try {
|
|
658
|
-
await
|
|
667
|
+
await c(e, W.auth), h();
|
|
659
668
|
} catch (e) {
|
|
660
|
-
let { traceId: t } = await
|
|
661
|
-
|
|
669
|
+
let { traceId: t } = await d(e);
|
|
670
|
+
E(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
662
671
|
}
|
|
663
672
|
} catch {} finally {
|
|
664
|
-
|
|
673
|
+
q(!1);
|
|
665
674
|
}
|
|
666
675
|
}, [
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
676
|
+
V,
|
|
677
|
+
W,
|
|
678
|
+
$,
|
|
679
|
+
P,
|
|
680
|
+
o,
|
|
681
|
+
u,
|
|
672
682
|
f,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
]),
|
|
678
|
-
let
|
|
679
|
-
for (let
|
|
680
|
-
if (!
|
|
681
|
-
let
|
|
682
|
-
|
|
683
|
+
h,
|
|
684
|
+
c,
|
|
685
|
+
E,
|
|
686
|
+
j
|
|
687
|
+
]), be = x(() => !ce(W, M), [W, M]), xe = x(() => {
|
|
688
|
+
let t = j?.validation, n = $(W), r = { ...se };
|
|
689
|
+
for (let e of _e) {
|
|
690
|
+
if (!Y[e]) continue;
|
|
691
|
+
let t = n[e];
|
|
692
|
+
t ? r[e] = t : delete r[e];
|
|
683
693
|
}
|
|
684
|
-
return t;
|
|
694
|
+
return B.name === e.Required ? r.name = t?.nameRequired ?? "Name is required" : B.name === e.TooLong ? r.name = t?.nameTooLong ?? `Use ${m} characters or fewer.` : B.name === e.ControlCharacters && (r.name = t?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), B.description === e.TooLong && (r.description = t?.descriptionTooLong ?? `Use ${p} characters or fewer.`), B.version === e.InvalidFormat && (r.version = t?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
|
|
685
695
|
}, [
|
|
686
|
-
|
|
696
|
+
Y,
|
|
697
|
+
se,
|
|
687
698
|
W,
|
|
699
|
+
j,
|
|
688
700
|
B,
|
|
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
|
-
})
|
|
701
|
+
$
|
|
702
|
+
]), Se = _ && P ? _(P) : void 0;
|
|
703
|
+
return /* @__PURE__ */ D(t, {
|
|
704
|
+
title: M ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
|
|
705
|
+
onBack: g,
|
|
706
|
+
onCancel: g,
|
|
707
|
+
onSubmit: ve,
|
|
708
|
+
submitLabel: M ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
|
|
709
|
+
isSubmitting: G,
|
|
710
|
+
isSubmitDisabled: be,
|
|
711
|
+
metadataSectionClassName: L.metadataSection,
|
|
712
|
+
setupSectionClassName: L.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__ */ D(de, {
|
|
721
|
+
form: W,
|
|
722
|
+
errors: xe,
|
|
723
|
+
bucket: te,
|
|
724
|
+
FileManagerModal: O,
|
|
725
|
+
resolveIconUrl: ne,
|
|
726
|
+
allowedMimeTypes: re,
|
|
727
|
+
maxFileSizeBytes: k,
|
|
728
|
+
availableLocaleOptions: A,
|
|
729
|
+
onChange: Q,
|
|
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__ */ D(he, {
|
|
733
|
+
form: W,
|
|
734
|
+
errors: xe,
|
|
735
|
+
isSaving: G,
|
|
736
|
+
toolsetId: P,
|
|
737
|
+
isEditMode: M,
|
|
738
|
+
connectUrl: Se,
|
|
739
|
+
listToolNames: v,
|
|
740
|
+
authActions: w,
|
|
741
|
+
onOAuthLogin: ee,
|
|
742
|
+
onNotifySuccess: T,
|
|
743
|
+
onNotifyError: E,
|
|
744
|
+
onChange: Q,
|
|
745
|
+
onAuthChange: fe,
|
|
746
|
+
onEnsureSaved: me,
|
|
747
|
+
labels: j?.settings
|
|
741
748
|
})
|
|
742
749
|
});
|
|
743
750
|
};
|
|
744
751
|
//#endregion
|
|
745
|
-
export {
|
|
752
|
+
export { V as AUTH_TYPE_ICONS, z as DEFAULT_TOOLSET_NAME, B as DEFAULT_TOOLSET_VERSION, de as GeneralForm, L as TOOLSET_EDITOR_CLASS, be as ToolsetEditor, Q as ToolsetOAuthLoginStatus, R as ToolsetTransportType, W as getDefaultToolsetForm, H as getStorageSafeUniqueToolsetName, Y as isToolsetAuthValid, ce as isToolsetFormValid, K as isValidEndpointUrl, se as normalizeReturnedEndpointUrl };
|