@w6w/embed 0.2.28 → 0.2.29
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/dist/{ConfirmModal-Pv2-A_3U.js → ConfirmModal-WqBfWftD.js} +100 -83
- package/dist/{ConfirmModal-Pv2-A_3U.js.map → ConfirmModal-WqBfWftD.js.map} +1 -1
- package/dist/{CreateFunctionModal-B3LpcuI9.js → CreateFunctionModal-CCYi9deY.js} +2 -2
- package/dist/{CreateFunctionModal-B3LpcuI9.js.map → CreateFunctionModal-CCYi9deY.js.map} +1 -1
- package/dist/{DocumentFormModal-DieWYFi4.js → DocumentFormModal-CCIgA7pR.js} +2 -2
- package/dist/{DocumentFormModal-DieWYFi4.js.map → DocumentFormModal-CCIgA7pR.js.map} +1 -1
- package/dist/{ImportSpecModal-xwTzj4KB.js → ImportSpecModal-DoxsVxru.js} +2 -2
- package/dist/{ImportSpecModal-xwTzj4KB.js.map → ImportSpecModal-DoxsVxru.js.map} +1 -1
- package/dist/{ModelRoutesManager-DtByS4mE.js → ModelRoutesManager-DqeY1mdP.js} +110 -106
- package/dist/ModelRoutesManager-DqeY1mdP.js.map +1 -0
- package/dist/{WorkflowEditor-CvWkVmFn.js → WorkflowEditor-CBUwh85L.js} +3 -3
- package/dist/{WorkflowEditor-CvWkVmFn.js.map → WorkflowEditor-CBUwh85L.js.map} +1 -1
- package/dist/chrome/CallFromCodeButton.d.ts +12 -0
- package/dist/chrome/index.d.ts +1 -1
- package/dist/{editor-tools-CVYTsVFN.js → editor-tools--Y3wlBZE.js} +3 -3
- package/dist/{editor-tools-CVYTsVFN.js.map → editor-tools--Y3wlBZE.js.map} +1 -1
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +6 -6
- package/dist/forms.mjs +321 -297
- package/dist/forms.mjs.map +1 -1
- package/dist/lists.mjs +948 -909
- package/dist/lists.mjs.map +1 -1
- package/dist/rail.mjs +1 -1
- package/dist/repos/connections.d.ts +1 -0
- package/package.json +4 -4
- package/dist/ModelRoutesManager-DtByS4mE.js.map +0 -1
package/dist/forms.mjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { C as
|
|
3
|
-
import { jsx as t, jsxs as l, Fragment as
|
|
2
|
+
import { C as _e, a as Je } from "./CreateFunctionModal-CCYi9deY.js";
|
|
3
|
+
import { jsx as t, jsxs as l, Fragment as te } from "react/jsx-runtime";
|
|
4
4
|
import { ApiError as I } from "@w6w/sdk";
|
|
5
|
-
import { EmptyState as
|
|
5
|
+
import { EmptyState as A, DataTable as P, RowActionsMenu as U, useEnterSubmit as T, BudgetMeter as ie } from "@w6w/ui";
|
|
6
6
|
import { useState as m } from "react";
|
|
7
|
-
import {
|
|
8
|
-
import { u as
|
|
9
|
-
import { i as
|
|
10
|
-
import { M as
|
|
11
|
-
import { N as be, K as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
7
|
+
import { a as se, C as V, M as R } from "./ConfirmModal-WqBfWftD.js";
|
|
8
|
+
import { u as ne } from "./project-context-Tvp-La7A.js";
|
|
9
|
+
import { i as re, d as oe, b as de, h as ce, f as ue, c as me, u as he, g as ge } from "./vault-BSEWhMYC.js";
|
|
10
|
+
import { M as Ye } from "./ModelRoutesManager-DqeY1mdP.js";
|
|
11
|
+
import { N as be, K as ve, J as pe, Q as fe, M as ye } from "./models-CI0vLJ6o.js";
|
|
12
|
+
const Ne = ["string", "number", "boolean", "json"];
|
|
13
|
+
function X(e) {
|
|
14
14
|
if (e.type === "boolean" || e.type === "number" || e.type === "string") return String(e.value);
|
|
15
15
|
const n = JSON.stringify(e.value);
|
|
16
16
|
return n.length > 80 ? `${n.slice(0, 80)}…` : n;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
const n = e.slots, a =
|
|
21
|
-
a != null &&
|
|
22
|
-
}, N = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ t("h3", { children: "Variables" }) : n.header,
|
|
18
|
+
function Oe(e) {
|
|
19
|
+
var k;
|
|
20
|
+
const n = e.slots, a = ne(e.project), [h, s] = m(null), [p, d] = m(null), [f, b] = m(null), g = re(a ?? void 0, a != null), v = oe(), y = a != null, C = () => {
|
|
21
|
+
a != null && s({ mode: "create" });
|
|
22
|
+
}, N = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ t("h3", { children: "Variables" }) : n.header, i = n == null ? void 0 : n.actions, u = i === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !y, onClick: C, children: "+ Add variable" }) : typeof i == "function" ? i({ openCreate: C, canCreate: y }) : i, S = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(A, { testId: "vars-manager-empty", children: "No variables yet." }) : n.empty, M = [
|
|
23
23
|
{
|
|
24
24
|
key: "name",
|
|
25
25
|
header: "Variable",
|
|
26
|
-
render: (
|
|
27
|
-
/* @__PURE__ */ t("strong", { className: "list-name", title:
|
|
26
|
+
render: (r) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
|
|
27
|
+
/* @__PURE__ */ t("strong", { className: "list-name", title: r.name, children: r.name }),
|
|
28
28
|
" ",
|
|
29
|
-
/* @__PURE__ */ t("span", { className: "tag", children:
|
|
30
|
-
/* @__PURE__ */ l("div", { className: "muted small list-preview", title:
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
/* @__PURE__ */ t("span", { className: "tag", children: r.type }),
|
|
30
|
+
/* @__PURE__ */ l("div", { className: "muted small list-preview", title: X(r), children: [
|
|
31
|
+
X(r),
|
|
32
|
+
r.description && /* @__PURE__ */ l(te, { children: [
|
|
33
33
|
" · ",
|
|
34
|
-
|
|
34
|
+
r.description
|
|
35
35
|
] })
|
|
36
36
|
] })
|
|
37
37
|
] })
|
|
@@ -42,32 +42,41 @@ function Ke(e) {
|
|
|
42
42
|
align: "right",
|
|
43
43
|
link: !1,
|
|
44
44
|
actions: !0,
|
|
45
|
-
render: (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
render: (r) => /* @__PURE__ */ t(
|
|
46
|
+
U,
|
|
47
|
+
{
|
|
48
|
+
label: `Actions for ${r.name}`,
|
|
49
|
+
"data-testid": `var-actions-${r.id}`,
|
|
50
|
+
actions: [
|
|
51
|
+
{
|
|
52
|
+
label: "Call from code",
|
|
53
|
+
icon: "code",
|
|
54
|
+
onSelect: () => b(r.name),
|
|
55
|
+
"data-testid": `var-code-${r.id}`
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "Edit",
|
|
59
|
+
icon: "edit",
|
|
60
|
+
onSelect: () => s({ mode: "edit", v: r }),
|
|
61
|
+
"data-testid": `var-edit-${r.id}`
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "Delete",
|
|
65
|
+
icon: "delete",
|
|
66
|
+
danger: !0,
|
|
67
|
+
disabled: v.isPending,
|
|
68
|
+
onSelect: () => d(r),
|
|
69
|
+
"data-testid": `var-delete-${r.id}`
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
65
74
|
}
|
|
66
75
|
];
|
|
67
76
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
68
|
-
(N != null ||
|
|
77
|
+
(N != null || u != null) && /* @__PURE__ */ l("div", { className: "section-head", children: [
|
|
69
78
|
N,
|
|
70
|
-
|
|
79
|
+
u
|
|
71
80
|
] }),
|
|
72
81
|
(n == null ? void 0 : n.header) === void 0 && /* @__PURE__ */ l("p", { className: "muted small", children: [
|
|
73
82
|
"User-defined typed values addressable by name. Plaintext — use ",
|
|
@@ -76,85 +85,92 @@ function Ke(e) {
|
|
|
76
85
|
"for sensitive values."
|
|
77
86
|
] }),
|
|
78
87
|
g.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
79
|
-
((
|
|
88
|
+
((k = g.data) == null ? void 0 : k.length) === 0 && S,
|
|
80
89
|
g.data != null && g.data.length > 0 && /* @__PURE__ */ t(
|
|
81
|
-
|
|
90
|
+
P,
|
|
82
91
|
{
|
|
83
92
|
className: "w6w-data-table-rows",
|
|
84
|
-
columns:
|
|
93
|
+
columns: M,
|
|
85
94
|
rows: g.data,
|
|
86
|
-
rowKey: (
|
|
95
|
+
rowKey: (r) => r.id
|
|
87
96
|
}
|
|
88
97
|
),
|
|
89
98
|
h && a != null && /* @__PURE__ */ t(
|
|
90
|
-
|
|
99
|
+
Ce,
|
|
91
100
|
{
|
|
92
101
|
project: a,
|
|
93
102
|
initial: h.mode === "edit" ? h.v : void 0,
|
|
94
|
-
onClose: () =>
|
|
95
|
-
onSaved: () =>
|
|
103
|
+
onClose: () => s(null),
|
|
104
|
+
onSaved: () => s(null)
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
f != null && /* @__PURE__ */ t(
|
|
108
|
+
se,
|
|
109
|
+
{
|
|
110
|
+
resource: { kind: "var", name: f },
|
|
111
|
+
onClose: () => b(null)
|
|
96
112
|
}
|
|
97
113
|
),
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
p && a != null && /* @__PURE__ */ t(
|
|
115
|
+
V,
|
|
100
116
|
{
|
|
101
117
|
title: "Delete variable",
|
|
102
|
-
message: `Delete the variable "${
|
|
118
|
+
message: `Delete the variable "${p.name}"? This cannot be undone.`,
|
|
103
119
|
confirmLabel: "Delete",
|
|
104
120
|
onConfirm: () => {
|
|
105
|
-
|
|
121
|
+
v.mutate({ id: p.id, project: a }), d(null);
|
|
106
122
|
},
|
|
107
|
-
onClose: () =>
|
|
123
|
+
onClose: () => d(null)
|
|
108
124
|
}
|
|
109
125
|
)
|
|
110
126
|
] }) });
|
|
111
127
|
}
|
|
112
|
-
function
|
|
113
|
-
var k,
|
|
114
|
-
const n = !!e.initial, [a, h] = m(((k = e.initial) == null ? void 0 : k.name) ?? ""), [
|
|
128
|
+
function Ce(e) {
|
|
129
|
+
var k, r, E;
|
|
130
|
+
const n = !!e.initial, [a, h] = m(((k = e.initial) == null ? void 0 : k.name) ?? ""), [s, p] = m(((r = e.initial) == null ? void 0 : r.type) ?? "string"), [d, f] = m(() => e.initial ? e.initial.type === "string" ? String(e.initial.value ?? "") : JSON.stringify(e.initial.value, null, 2) : ""), [b, g] = m(((E = e.initial) == null ? void 0 : E.description) ?? ""), [v, y] = m(null);
|
|
115
131
|
function C() {
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
return
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
return Number.isFinite(
|
|
132
|
+
if (s === "string") return { ok: !0, value: d };
|
|
133
|
+
if (s === "boolean")
|
|
134
|
+
return d === "true" ? { ok: !0, value: !0 } : d === "false" ? { ok: !0, value: !1 } : { ok: !1, error: "Value must be `true` or `false`." };
|
|
135
|
+
if (s === "number") {
|
|
136
|
+
const c = Number(d);
|
|
137
|
+
return Number.isFinite(c) ? { ok: !0, value: c } : { ok: !1, error: "Value must be a finite number." };
|
|
122
138
|
}
|
|
123
139
|
try {
|
|
124
|
-
return { ok: !0, value: JSON.parse(
|
|
125
|
-
} catch (
|
|
126
|
-
return { ok: !1, error: `Invalid JSON: ${
|
|
140
|
+
return { ok: !0, value: JSON.parse(d) };
|
|
141
|
+
} catch (c) {
|
|
142
|
+
return { ok: !1, error: `Invalid JSON: ${c.message}` };
|
|
127
143
|
}
|
|
128
144
|
}
|
|
129
|
-
const
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
|
|
145
|
+
const N = de(), i = ce(), u = N.isPending || i.isPending;
|
|
146
|
+
function S() {
|
|
147
|
+
const c = C();
|
|
148
|
+
if (!c.ok) {
|
|
149
|
+
y(c.error);
|
|
134
150
|
return;
|
|
135
151
|
}
|
|
136
|
-
|
|
137
|
-
const
|
|
152
|
+
y(null);
|
|
153
|
+
const $ = {
|
|
138
154
|
onSuccess: () => e.onSaved(),
|
|
139
|
-
onError: (
|
|
155
|
+
onError: (w) => y((w instanceof I, w.message))
|
|
140
156
|
};
|
|
141
157
|
if (e.initial) {
|
|
142
|
-
|
|
158
|
+
i.mutate(
|
|
143
159
|
{
|
|
144
160
|
id: e.initial.id,
|
|
145
|
-
patch: { type:
|
|
161
|
+
patch: { type: s, value: c.value, description: b },
|
|
146
162
|
project: e.project
|
|
147
163
|
},
|
|
148
|
-
|
|
164
|
+
$
|
|
149
165
|
);
|
|
150
166
|
return;
|
|
151
167
|
}
|
|
152
|
-
|
|
153
|
-
{ input: { name: a, type:
|
|
154
|
-
|
|
168
|
+
N.mutate(
|
|
169
|
+
{ input: { name: a, type: s, value: c.value, description: b }, project: e.project },
|
|
170
|
+
$
|
|
155
171
|
);
|
|
156
172
|
}
|
|
157
|
-
const
|
|
173
|
+
const M = T(S, { enabled: !!a && !u });
|
|
158
174
|
return /* @__PURE__ */ l(
|
|
159
175
|
R,
|
|
160
176
|
{
|
|
@@ -170,41 +186,41 @@ function Se(e) {
|
|
|
170
186
|
type: "text",
|
|
171
187
|
value: a,
|
|
172
188
|
disabled: n,
|
|
173
|
-
onChange: (
|
|
189
|
+
onChange: (c) => h(c.target.value),
|
|
174
190
|
placeholder: "e.g. api_base_url",
|
|
175
191
|
maxLength: 64,
|
|
176
|
-
...
|
|
192
|
+
...M
|
|
177
193
|
}
|
|
178
194
|
),
|
|
179
195
|
!n && /* @__PURE__ */ t("span", { className: "hint", children: "Letters, digits, and underscores. Must start with a letter or underscore. Case-sensitive." })
|
|
180
196
|
] }),
|
|
181
197
|
/* @__PURE__ */ l("label", { className: "field", children: [
|
|
182
198
|
/* @__PURE__ */ t("span", { children: "Type" }),
|
|
183
|
-
/* @__PURE__ */ t("select", { value:
|
|
199
|
+
/* @__PURE__ */ t("select", { value: s, onChange: (c) => p(c.target.value), children: Ne.map((c) => /* @__PURE__ */ t("option", { value: c, children: c }, c)) })
|
|
184
200
|
] }),
|
|
185
201
|
/* @__PURE__ */ l("label", { className: "field", htmlFor: "var-value", children: [
|
|
186
202
|
/* @__PURE__ */ t("span", { children: "Value" }),
|
|
187
|
-
|
|
203
|
+
s === "boolean" ? /* @__PURE__ */ l("select", { id: "var-value", value: d || "true", onChange: (c) => f(c.target.value), children: [
|
|
188
204
|
/* @__PURE__ */ t("option", { value: "true", children: "true" }),
|
|
189
205
|
/* @__PURE__ */ t("option", { value: "false", children: "false" })
|
|
190
|
-
] }) :
|
|
206
|
+
] }) : s === "number" ? /* @__PURE__ */ t(
|
|
191
207
|
"input",
|
|
192
208
|
{
|
|
193
209
|
id: "var-value",
|
|
194
210
|
type: "number",
|
|
195
|
-
value:
|
|
196
|
-
onChange: (
|
|
211
|
+
value: d,
|
|
212
|
+
onChange: (c) => f(c.target.value),
|
|
197
213
|
placeholder: "0",
|
|
198
|
-
...
|
|
214
|
+
...M
|
|
199
215
|
}
|
|
200
|
-
) :
|
|
216
|
+
) : s === "json" ? /* @__PURE__ */ t(
|
|
201
217
|
"textarea",
|
|
202
218
|
{
|
|
203
219
|
id: "var-value",
|
|
204
220
|
className: "code",
|
|
205
221
|
rows: 6,
|
|
206
|
-
value:
|
|
207
|
-
onChange: (
|
|
222
|
+
value: d,
|
|
223
|
+
onChange: (c) => f(c.target.value),
|
|
208
224
|
placeholder: '{"key": "value"}'
|
|
209
225
|
}
|
|
210
226
|
) : /* @__PURE__ */ t(
|
|
@@ -212,10 +228,10 @@ function Se(e) {
|
|
|
212
228
|
{
|
|
213
229
|
id: "var-value",
|
|
214
230
|
type: "text",
|
|
215
|
-
value:
|
|
216
|
-
onChange: (
|
|
231
|
+
value: d,
|
|
232
|
+
onChange: (c) => f(c.target.value),
|
|
217
233
|
placeholder: "",
|
|
218
|
-
...
|
|
234
|
+
...M
|
|
219
235
|
}
|
|
220
236
|
)
|
|
221
237
|
] }),
|
|
@@ -226,39 +242,39 @@ function Se(e) {
|
|
|
226
242
|
{
|
|
227
243
|
type: "text",
|
|
228
244
|
value: b,
|
|
229
|
-
onChange: (
|
|
245
|
+
onChange: (c) => g(c.target.value),
|
|
230
246
|
placeholder: "Optional",
|
|
231
|
-
...
|
|
247
|
+
...M
|
|
232
248
|
}
|
|
233
249
|
)
|
|
234
250
|
] }),
|
|
235
|
-
|
|
251
|
+
v && /* @__PURE__ */ t("div", { className: "result error", children: v })
|
|
236
252
|
] }),
|
|
237
253
|
/* @__PURE__ */ l("div", { className: "modal-actions", children: [
|
|
238
254
|
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
|
|
239
|
-
/* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !a ||
|
|
255
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !a || u, onClick: S, children: u ? "Saving…" : n ? "Save changes" : "Save variable" })
|
|
240
256
|
] })
|
|
241
257
|
]
|
|
242
258
|
}
|
|
243
259
|
);
|
|
244
260
|
}
|
|
245
|
-
function
|
|
246
|
-
var
|
|
247
|
-
const n = e.slots, [a, h] = m(null), [
|
|
261
|
+
function Fe(e) {
|
|
262
|
+
var i;
|
|
263
|
+
const n = e.slots, [a, h] = m(null), [s, p] = m(null), d = ue(), f = me(), b = () => h({ mode: "create" }), g = (n == null ? void 0 : n.header) === void 0 ? /* @__PURE__ */ t("h3", { children: "Secrets" }) : n.header, v = n == null ? void 0 : n.actions, y = v === void 0 ? /* @__PURE__ */ t("button", { type: "button", className: "btn", onClick: b, children: "+ Add secret" }) : typeof v == "function" ? v({ openCreate: b, canCreate: !0 }) : v, C = (n == null ? void 0 : n.empty) === void 0 ? /* @__PURE__ */ t(A, { testId: "secrets-manager-empty", children: "No secrets yet." }) : n.empty, N = [
|
|
248
264
|
{
|
|
249
265
|
key: "name",
|
|
250
266
|
header: "Secret",
|
|
251
|
-
render: (
|
|
252
|
-
/* @__PURE__ */ t("strong", { className: "list-name", title:
|
|
267
|
+
render: (u) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
|
|
268
|
+
/* @__PURE__ */ t("strong", { className: "list-name", title: u.name, children: u.name }),
|
|
253
269
|
" ",
|
|
254
270
|
/* @__PURE__ */ t("code", { className: "muted small", children: "••••••••" }),
|
|
255
271
|
/* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
|
|
256
|
-
|
|
257
|
-
|
|
272
|
+
u.description && /* @__PURE__ */ l(te, { children: [
|
|
273
|
+
u.description,
|
|
258
274
|
" · "
|
|
259
275
|
] }),
|
|
260
276
|
"updated ",
|
|
261
|
-
new Date(
|
|
277
|
+
new Date(u.updatedAt).toLocaleString()
|
|
262
278
|
] })
|
|
263
279
|
] })
|
|
264
280
|
},
|
|
@@ -268,93 +284,97 @@ function We(e) {
|
|
|
268
284
|
align: "right",
|
|
269
285
|
link: !1,
|
|
270
286
|
actions: !0,
|
|
271
|
-
render: (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
render: (u) => /* @__PURE__ */ t(
|
|
288
|
+
U,
|
|
289
|
+
{
|
|
290
|
+
label: `Actions for ${u.name}`,
|
|
291
|
+
"data-testid": `secret-actions-${u.id}`,
|
|
292
|
+
actions: [
|
|
293
|
+
{
|
|
294
|
+
label: "Rotate",
|
|
295
|
+
icon: "edit",
|
|
296
|
+
onSelect: () => h({ mode: "edit", s: u }),
|
|
297
|
+
"data-testid": `secret-rotate-${u.id}`
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
label: "Delete",
|
|
301
|
+
icon: "delete",
|
|
302
|
+
danger: !0,
|
|
303
|
+
disabled: f.isPending,
|
|
304
|
+
onSelect: () => p(u),
|
|
305
|
+
"data-testid": `secret-delete-${u.id}`
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
)
|
|
290
310
|
}
|
|
291
311
|
];
|
|
292
312
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
293
|
-
(
|
|
294
|
-
|
|
295
|
-
|
|
313
|
+
(g != null || y != null) && /* @__PURE__ */ l("div", { className: "section-head", children: [
|
|
314
|
+
g,
|
|
315
|
+
y
|
|
296
316
|
] }),
|
|
297
317
|
(n == null ? void 0 : n.header) === void 0 && /* @__PURE__ */ t("p", { className: "muted small", children: "Secrets addressable by name. Stored encrypted at rest and never returned from the server — to change a secret, overwrite it." }),
|
|
298
|
-
|
|
299
|
-
((
|
|
300
|
-
|
|
301
|
-
|
|
318
|
+
d.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
319
|
+
((i = d.data) == null ? void 0 : i.length) === 0 && C,
|
|
320
|
+
d.data != null && d.data.length > 0 && /* @__PURE__ */ t(
|
|
321
|
+
P,
|
|
302
322
|
{
|
|
303
323
|
className: "w6w-data-table-rows",
|
|
304
|
-
columns:
|
|
305
|
-
rows:
|
|
306
|
-
rowKey: (
|
|
324
|
+
columns: N,
|
|
325
|
+
rows: d.data,
|
|
326
|
+
rowKey: (u) => u.id
|
|
307
327
|
}
|
|
308
328
|
),
|
|
309
329
|
a && /* @__PURE__ */ t(
|
|
310
|
-
|
|
330
|
+
Se,
|
|
311
331
|
{
|
|
312
332
|
initial: a.mode === "edit" ? a.s : void 0,
|
|
313
333
|
onClose: () => h(null),
|
|
314
334
|
onSaved: () => h(null)
|
|
315
335
|
}
|
|
316
336
|
),
|
|
317
|
-
|
|
318
|
-
|
|
337
|
+
s && /* @__PURE__ */ t(
|
|
338
|
+
V,
|
|
319
339
|
{
|
|
320
340
|
title: "Delete secret",
|
|
321
|
-
message: `Delete the secret "${
|
|
341
|
+
message: `Delete the secret "${s.name}"? This cannot be undone.`,
|
|
322
342
|
confirmLabel: "Delete",
|
|
323
343
|
onConfirm: () => {
|
|
324
|
-
|
|
344
|
+
f.mutate(s.id), p(null);
|
|
325
345
|
},
|
|
326
|
-
onClose: () =>
|
|
346
|
+
onClose: () => p(null)
|
|
327
347
|
}
|
|
328
348
|
)
|
|
329
349
|
] }) });
|
|
330
350
|
}
|
|
331
|
-
function
|
|
332
|
-
var
|
|
333
|
-
const n = !!e.initial, [a, h] = m(((
|
|
334
|
-
function
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
{ value:
|
|
351
|
+
function Se(e) {
|
|
352
|
+
var S, M, k;
|
|
353
|
+
const n = !!e.initial, [a, h] = m(((S = e.initial) == null ? void 0 : S.name) ?? ""), [s, p] = m(""), [d, f] = m(((M = e.initial) == null ? void 0 : M.description) ?? ""), [b, g] = m(null), v = he(), y = ge(((k = e.initial) == null ? void 0 : k.id) ?? ""), C = n ? y : v, N = !!a && (n || !!s) && !C.isPending;
|
|
354
|
+
function i() {
|
|
355
|
+
if (g(null), n) {
|
|
356
|
+
y.mutate(
|
|
357
|
+
{ value: s === "" ? void 0 : s, description: d },
|
|
338
358
|
{
|
|
339
359
|
onSuccess: () => e.onSaved(),
|
|
340
|
-
onError: (
|
|
360
|
+
onError: (r) => g((r instanceof I, r.message))
|
|
341
361
|
}
|
|
342
362
|
);
|
|
343
363
|
return;
|
|
344
364
|
}
|
|
345
|
-
if (
|
|
346
|
-
|
|
365
|
+
if (s === "") {
|
|
366
|
+
g("A secret value is required.");
|
|
347
367
|
return;
|
|
348
368
|
}
|
|
349
|
-
|
|
350
|
-
{ name: a, value:
|
|
369
|
+
v.mutate(
|
|
370
|
+
{ name: a, value: s, description: d },
|
|
351
371
|
{
|
|
352
372
|
onSuccess: () => e.onSaved(),
|
|
353
|
-
onError: (
|
|
373
|
+
onError: (r) => g((r instanceof I, r.message))
|
|
354
374
|
}
|
|
355
375
|
);
|
|
356
376
|
}
|
|
357
|
-
const
|
|
377
|
+
const u = T(i, { enabled: N });
|
|
358
378
|
return /* @__PURE__ */ l(
|
|
359
379
|
R,
|
|
360
380
|
{
|
|
@@ -370,10 +390,10 @@ function we(e) {
|
|
|
370
390
|
type: "text",
|
|
371
391
|
value: a,
|
|
372
392
|
disabled: n,
|
|
373
|
-
onChange: (
|
|
393
|
+
onChange: (r) => h(r.target.value),
|
|
374
394
|
placeholder: "e.g. openai_api_key",
|
|
375
395
|
maxLength: 64,
|
|
376
|
-
...
|
|
396
|
+
...u
|
|
377
397
|
}
|
|
378
398
|
),
|
|
379
399
|
!n && /* @__PURE__ */ t("span", { className: "hint", children: "Letters, digits, and underscores. Must start with a letter or underscore. Case-sensitive." })
|
|
@@ -385,8 +405,8 @@ function we(e) {
|
|
|
385
405
|
{
|
|
386
406
|
className: "code",
|
|
387
407
|
rows: 3,
|
|
388
|
-
value:
|
|
389
|
-
onChange: (
|
|
408
|
+
value: s,
|
|
409
|
+
onChange: (r) => p(r.target.value),
|
|
390
410
|
placeholder: n ? "Leave blank to keep the current value" : "sk-…",
|
|
391
411
|
autoComplete: "off",
|
|
392
412
|
spellCheck: !1
|
|
@@ -400,10 +420,10 @@ function we(e) {
|
|
|
400
420
|
"input",
|
|
401
421
|
{
|
|
402
422
|
type: "text",
|
|
403
|
-
value:
|
|
404
|
-
onChange: (
|
|
423
|
+
value: d,
|
|
424
|
+
onChange: (r) => f(r.target.value),
|
|
405
425
|
placeholder: "Optional",
|
|
406
|
-
...
|
|
426
|
+
...u
|
|
407
427
|
}
|
|
408
428
|
)
|
|
409
429
|
] }),
|
|
@@ -411,45 +431,45 @@ function we(e) {
|
|
|
411
431
|
] }),
|
|
412
432
|
/* @__PURE__ */ l("div", { className: "modal-actions", children: [
|
|
413
433
|
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
|
|
414
|
-
/* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !
|
|
434
|
+
/* @__PURE__ */ t("button", { type: "button", className: "btn", disabled: !N, onClick: i, children: C.isPending ? "Saving…" : n ? "Save changes" : "Save secret" })
|
|
415
435
|
] })
|
|
416
436
|
]
|
|
417
437
|
}
|
|
418
438
|
);
|
|
419
439
|
}
|
|
420
|
-
const
|
|
440
|
+
const Me = {
|
|
421
441
|
costMinor: "Cost",
|
|
422
442
|
tokens: "Tokens",
|
|
423
443
|
requests: "Requests"
|
|
424
|
-
},
|
|
444
|
+
}, ke = ["block", "warn"], Z = ["tenant", "account", "project", "route", "connection"], we = {
|
|
425
445
|
tenant: "Tenant",
|
|
426
446
|
account: "Account",
|
|
427
447
|
project: "Project",
|
|
428
448
|
route: "Model route",
|
|
429
449
|
connection: "Connection"
|
|
430
|
-
},
|
|
450
|
+
}, Ee = (e) => e === "route" || e === "connection", ee = ["day", "month"];
|
|
431
451
|
function B(e) {
|
|
432
452
|
return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
433
453
|
}
|
|
434
|
-
function
|
|
454
|
+
function $e(e, n) {
|
|
435
455
|
return e === "costMinor" ? (a) => `${n} ${(a / 100).toFixed(2)}` : B;
|
|
436
456
|
}
|
|
437
|
-
function
|
|
457
|
+
function je(e) {
|
|
438
458
|
return e.costMinor != null ? "costMinor" : e.tokens != null ? "tokens" : e.requests != null ? "requests" : null;
|
|
439
459
|
}
|
|
440
|
-
function
|
|
460
|
+
function De(e) {
|
|
441
461
|
return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
|
|
442
462
|
}
|
|
443
|
-
function
|
|
463
|
+
function xe(e) {
|
|
444
464
|
const n = [];
|
|
445
465
|
e.requests != null && n.push(`${B(e.requests)} requests`), e.tokens != null && n.push(`${B(e.tokens)} tokens`);
|
|
446
|
-
const a =
|
|
466
|
+
const a = De(e);
|
|
447
467
|
return a != null && n.push(a), n.length === 0 ? "no limit" : n.join(" · ");
|
|
448
468
|
}
|
|
449
469
|
function L(e) {
|
|
450
470
|
return e.scopeId == null ? `this ${e.scopeKind}` : `${e.scopeKind} ${e.scopeId}`;
|
|
451
471
|
}
|
|
452
|
-
function
|
|
472
|
+
function ae(e) {
|
|
453
473
|
return e instanceof I || e instanceof Error ? e.message : String(e);
|
|
454
474
|
}
|
|
455
475
|
function q(e) {
|
|
@@ -458,34 +478,34 @@ function q(e) {
|
|
|
458
478
|
const a = Number(n);
|
|
459
479
|
return Number.isFinite(a) ? a : null;
|
|
460
480
|
}
|
|
461
|
-
function
|
|
462
|
-
var
|
|
463
|
-
const n =
|
|
481
|
+
function Ke(e) {
|
|
482
|
+
var N;
|
|
483
|
+
const n = ne(e.projectId), [a, h] = m(null), [s, p] = m(null), [d, f] = m(null), b = be(n ?? void 0), g = ve(), v = b.data ?? [], y = n != null, C = [
|
|
464
484
|
{
|
|
465
485
|
key: "scope",
|
|
466
486
|
header: "Scope",
|
|
467
|
-
render: (
|
|
468
|
-
/* @__PURE__ */ t("strong", { className: "list-name", title: L(
|
|
487
|
+
render: (i) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
|
|
488
|
+
/* @__PURE__ */ t("strong", { className: "list-name", title: L(i), children: i.scopeKind }),
|
|
469
489
|
" ",
|
|
470
|
-
/* @__PURE__ */ t("span", { className:
|
|
471
|
-
/* @__PURE__ */ t("div", { className: "muted small list-preview", title: L(
|
|
490
|
+
/* @__PURE__ */ t("span", { className: i.onBreach === "warn" ? "tag warn" : "tag", children: i.onBreach }),
|
|
491
|
+
/* @__PURE__ */ t("div", { className: "muted small list-preview", title: L(i), children: i.scopeId == null ? `the whole ${i.scopeKind}` : i.scopeId })
|
|
472
492
|
] })
|
|
473
493
|
},
|
|
474
494
|
{
|
|
475
495
|
key: "window",
|
|
476
496
|
header: "Window",
|
|
477
|
-
render: (
|
|
497
|
+
render: (i) => i.window
|
|
478
498
|
},
|
|
479
499
|
{
|
|
480
500
|
key: "limits",
|
|
481
501
|
header: "Limit",
|
|
482
|
-
render: (
|
|
502
|
+
render: (i) => /* @__PURE__ */ t("span", { className: "muted small", children: xe(i.limits) })
|
|
483
503
|
},
|
|
484
504
|
{
|
|
485
505
|
key: "usage",
|
|
486
506
|
header: "Used",
|
|
487
507
|
// Rows only exist once the project-scoped query ran, so `project` is set here.
|
|
488
|
-
render: (
|
|
508
|
+
render: (i) => n == null ? null : /* @__PURE__ */ t(Le, { budget: i, projectId: n })
|
|
489
509
|
},
|
|
490
510
|
{
|
|
491
511
|
key: "actions",
|
|
@@ -493,25 +513,29 @@ function Fe(e) {
|
|
|
493
513
|
align: "right",
|
|
494
514
|
link: !1,
|
|
495
515
|
actions: !0,
|
|
496
|
-
render: (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
516
|
+
render: (i) => /* @__PURE__ */ t(
|
|
517
|
+
U,
|
|
518
|
+
{
|
|
519
|
+
label: "Budget actions",
|
|
520
|
+
"data-testid": `model-budget-actions-${i.id}`,
|
|
521
|
+
actions: [
|
|
522
|
+
{
|
|
523
|
+
label: "Edit",
|
|
524
|
+
icon: "edit",
|
|
525
|
+
onSelect: () => h({ budget: i }),
|
|
526
|
+
"data-testid": `model-budget-edit-${i.id}`
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
label: "Delete",
|
|
530
|
+
icon: "delete",
|
|
531
|
+
danger: !0,
|
|
532
|
+
disabled: g.isPending,
|
|
533
|
+
onSelect: () => p(i),
|
|
534
|
+
"data-testid": `model-budget-delete-${i.id}`
|
|
535
|
+
}
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
)
|
|
515
539
|
}
|
|
516
540
|
];
|
|
517
541
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
@@ -525,29 +549,29 @@ function Fe(e) {
|
|
|
525
549
|
{
|
|
526
550
|
type: "button",
|
|
527
551
|
className: "btn",
|
|
528
|
-
disabled: !
|
|
552
|
+
disabled: !y,
|
|
529
553
|
onClick: () => h({}),
|
|
530
554
|
"data-testid": "model-budget-add",
|
|
531
555
|
children: "+ Add budget"
|
|
532
556
|
}
|
|
533
557
|
)
|
|
534
558
|
] }),
|
|
535
|
-
|
|
559
|
+
d && /* @__PURE__ */ t("div", { className: "result error", role: "alert", "data-testid": "model-budget-delete-error", children: d }),
|
|
536
560
|
/* @__PURE__ */ l("div", { children: [
|
|
537
561
|
b.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
538
|
-
((
|
|
539
|
-
|
|
540
|
-
|
|
562
|
+
((N = b.data) == null ? void 0 : N.length) === 0 && /* @__PURE__ */ t(A, { testId: "model-budgets-empty", children: "No model budgets yet. Add one to cap spend or request volume." }),
|
|
563
|
+
v.length > 0 && /* @__PURE__ */ t(
|
|
564
|
+
P,
|
|
541
565
|
{
|
|
542
566
|
columns: C,
|
|
543
|
-
rows:
|
|
544
|
-
rowKey: (
|
|
567
|
+
rows: v,
|
|
568
|
+
rowKey: (i) => i.id,
|
|
545
569
|
testId: "model-budgets-table"
|
|
546
570
|
}
|
|
547
571
|
)
|
|
548
572
|
] }),
|
|
549
573
|
a != null && n != null && /* @__PURE__ */ t(
|
|
550
|
-
|
|
574
|
+
Ie,
|
|
551
575
|
{
|
|
552
576
|
project: n,
|
|
553
577
|
initial: a.budget,
|
|
@@ -555,78 +579,78 @@ function Fe(e) {
|
|
|
555
579
|
onSaved: () => h(null)
|
|
556
580
|
}
|
|
557
581
|
),
|
|
558
|
-
|
|
559
|
-
|
|
582
|
+
s != null && n != null && /* @__PURE__ */ t(
|
|
583
|
+
V,
|
|
560
584
|
{
|
|
561
585
|
title: "Delete model budget",
|
|
562
|
-
message: `Delete the budget on ${L(
|
|
586
|
+
message: `Delete the budget on ${L(s)}? Calls stop being capped by it immediately.`,
|
|
563
587
|
confirmLabel: "Delete",
|
|
564
588
|
onConfirm: () => {
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
{ project: n, id:
|
|
589
|
+
const i = s;
|
|
590
|
+
f(null), g.mutate(
|
|
591
|
+
{ project: n, id: i.id },
|
|
568
592
|
{
|
|
569
|
-
onError: (
|
|
570
|
-
`Could not delete the budget on ${L(
|
|
593
|
+
onError: (u) => f(
|
|
594
|
+
`Could not delete the budget on ${L(i)}: ${ae(u)}`
|
|
571
595
|
)
|
|
572
596
|
}
|
|
573
|
-
),
|
|
597
|
+
), p(null);
|
|
574
598
|
},
|
|
575
|
-
onClose: () =>
|
|
599
|
+
onClose: () => p(null)
|
|
576
600
|
}
|
|
577
601
|
)
|
|
578
602
|
] }) });
|
|
579
603
|
}
|
|
580
|
-
function
|
|
581
|
-
const n =
|
|
604
|
+
function Le(e) {
|
|
605
|
+
const n = ye(e.budget.id, e.projectId);
|
|
582
606
|
if (n.isLoading) return /* @__PURE__ */ t("span", { className: "muted small", children: "Loading…" });
|
|
583
607
|
const a = n.data;
|
|
584
608
|
if (a == null) return /* @__PURE__ */ t("span", { className: "muted small", children: "—" });
|
|
585
|
-
const h = a.limits ?? e.budget.limits,
|
|
586
|
-
return
|
|
587
|
-
|
|
609
|
+
const h = a.limits ?? e.budget.limits, s = je(h);
|
|
610
|
+
return s == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "no limit" }) : /* @__PURE__ */ t(
|
|
611
|
+
ie,
|
|
588
612
|
{
|
|
589
|
-
label:
|
|
590
|
-
used: a.used[
|
|
591
|
-
limit: h[
|
|
592
|
-
reserved: a.reserved[
|
|
593
|
-
format:
|
|
613
|
+
label: Me[s],
|
|
614
|
+
used: a.used[s],
|
|
615
|
+
limit: h[s] ?? 0,
|
|
616
|
+
reserved: a.reserved[s],
|
|
617
|
+
format: $e(s, h.currency ?? "USD"),
|
|
594
618
|
testId: `model-budget-meter-${e.budget.id}`
|
|
595
619
|
}
|
|
596
620
|
);
|
|
597
621
|
}
|
|
598
|
-
function
|
|
599
|
-
var
|
|
600
|
-
const n = !!e.initial, [a, h] = m(((
|
|
601
|
-
((
|
|
602
|
-
), [
|
|
603
|
-
((
|
|
604
|
-
), [C,
|
|
605
|
-
((
|
|
606
|
-
), [
|
|
607
|
-
function
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
const
|
|
613
|
-
return
|
|
622
|
+
function Ie(e) {
|
|
623
|
+
var K, W, Q, _, J, H, Y, z;
|
|
624
|
+
const n = !!e.initial, [a, h] = m(((K = e.initial) == null ? void 0 : K.scopeKind) ?? "project"), [s, p] = m(((W = e.initial) == null ? void 0 : W.scopeId) ?? ""), [d, f] = m(((Q = e.initial) == null ? void 0 : Q.window) ?? "day"), [b, g] = m(
|
|
625
|
+
((_ = e.initial) == null ? void 0 : _.limits.requests) != null ? String(e.initial.limits.requests) : ""
|
|
626
|
+
), [v, y] = m(
|
|
627
|
+
((J = e.initial) == null ? void 0 : J.limits.tokens) != null ? String(e.initial.limits.tokens) : ""
|
|
628
|
+
), [C, N] = m(
|
|
629
|
+
((H = e.initial) == null ? void 0 : H.limits.costMinor) != null ? String(e.initial.limits.costMinor / 100) : ""
|
|
630
|
+
), [i, u] = m(((Y = e.initial) == null ? void 0 : Y.limits.currency) ?? ""), [S, M] = m(((z = e.initial) == null ? void 0 : z.onBreach) ?? "warn"), [k, r] = m(null), E = pe(), c = fe(), $ = E.isPending || c.isPending, w = Ee(a), O = !!a && !!d && (!w || n || s.trim() !== "") && !$;
|
|
631
|
+
function le() {
|
|
632
|
+
const o = {}, D = q(b);
|
|
633
|
+
D != null && (o.requests = D);
|
|
634
|
+
const x = q(v);
|
|
635
|
+
x != null && (o.tokens = x);
|
|
636
|
+
const G = q(C);
|
|
637
|
+
return G != null && (o.costMinor = Math.round(G * 100)), o.costMinor != null && i.trim() !== "" && (o.currency = i.trim()), Object.keys(o).length === 0 ? null : o;
|
|
614
638
|
}
|
|
615
|
-
function
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
|
|
639
|
+
function F() {
|
|
640
|
+
const o = le();
|
|
641
|
+
if (o == null) {
|
|
642
|
+
r("Set at least one limit: requests, tokens or cost.");
|
|
619
643
|
return;
|
|
620
644
|
}
|
|
621
|
-
|
|
622
|
-
const
|
|
645
|
+
r(null);
|
|
646
|
+
const D = {
|
|
623
647
|
onSuccess: () => e.onSaved(),
|
|
624
|
-
onError: (
|
|
648
|
+
onError: (x) => r(ae(x))
|
|
625
649
|
};
|
|
626
650
|
if (e.initial) {
|
|
627
|
-
|
|
628
|
-
{ project: e.project, id: e.initial.id, patch: { window:
|
|
629
|
-
|
|
651
|
+
c.mutate(
|
|
652
|
+
{ project: e.project, id: e.initial.id, patch: { window: d, limits: o, onBreach: S } },
|
|
653
|
+
D
|
|
630
654
|
);
|
|
631
655
|
return;
|
|
632
656
|
}
|
|
@@ -636,16 +660,16 @@ function qe(e) {
|
|
|
636
660
|
input: {
|
|
637
661
|
scopeKind: a,
|
|
638
662
|
// Only route/connection budgets carry a scope id; the server refuses one elsewhere.
|
|
639
|
-
...
|
|
640
|
-
window:
|
|
641
|
-
limits:
|
|
642
|
-
onBreach:
|
|
663
|
+
...w ? { scopeId: s.trim() } : {},
|
|
664
|
+
window: d,
|
|
665
|
+
limits: o,
|
|
666
|
+
onBreach: S
|
|
643
667
|
}
|
|
644
668
|
},
|
|
645
|
-
|
|
669
|
+
D
|
|
646
670
|
);
|
|
647
671
|
}
|
|
648
|
-
const
|
|
672
|
+
const j = T(F, { enabled: O });
|
|
649
673
|
return /* @__PURE__ */ l(R, { title: e.initial ? "Edit model budget" : "Add model budget", onClose: e.onClose, children: [
|
|
650
674
|
/* @__PURE__ */ l("div", { className: "modal-body", children: [
|
|
651
675
|
/* @__PURE__ */ l("label", { className: "field", children: [
|
|
@@ -655,17 +679,17 @@ function qe(e) {
|
|
|
655
679
|
{
|
|
656
680
|
value: a,
|
|
657
681
|
disabled: n,
|
|
658
|
-
onChange: (
|
|
682
|
+
onChange: (o) => h(o.target.value),
|
|
659
683
|
"data-testid": "model-budget-scope-kind",
|
|
660
684
|
children: [
|
|
661
|
-
!
|
|
662
|
-
|
|
685
|
+
!Z.includes(a) && /* @__PURE__ */ t("option", { value: a, children: a }),
|
|
686
|
+
Z.map((o) => /* @__PURE__ */ t("option", { value: o, children: we[o] }, o))
|
|
663
687
|
]
|
|
664
688
|
}
|
|
665
689
|
),
|
|
666
690
|
!n && /* @__PURE__ */ t("span", { className: "hint", children: "What the budget caps — this tenant, account or project as a whole, or one model route or connection. Fixed once created." })
|
|
667
691
|
] }),
|
|
668
|
-
|
|
692
|
+
w && /* @__PURE__ */ l("label", { className: "field", children: [
|
|
669
693
|
/* @__PURE__ */ l("span", { children: [
|
|
670
694
|
a === "route" ? "Route" : "Connection id",
|
|
671
695
|
" *"
|
|
@@ -674,12 +698,12 @@ function qe(e) {
|
|
|
674
698
|
"input",
|
|
675
699
|
{
|
|
676
700
|
type: "text",
|
|
677
|
-
value:
|
|
701
|
+
value: s,
|
|
678
702
|
disabled: n,
|
|
679
|
-
onChange: (
|
|
703
|
+
onChange: (o) => p(o.target.value),
|
|
680
704
|
placeholder: a === "route" ? "e.g. fast" : "e.g. conn_…",
|
|
681
705
|
"data-testid": "model-budget-scope-id",
|
|
682
|
-
...
|
|
706
|
+
...j
|
|
683
707
|
}
|
|
684
708
|
),
|
|
685
709
|
!n && /* @__PURE__ */ t("span", { className: "hint", children: a === "route" ? "The route's name or id. Required for a route budget." : "The model-provider connection's id. Required for a connection budget." })
|
|
@@ -689,12 +713,12 @@ function qe(e) {
|
|
|
689
713
|
/* @__PURE__ */ l(
|
|
690
714
|
"select",
|
|
691
715
|
{
|
|
692
|
-
value:
|
|
693
|
-
onChange: (
|
|
716
|
+
value: d,
|
|
717
|
+
onChange: (o) => f(o.target.value),
|
|
694
718
|
"data-testid": "model-budget-window",
|
|
695
719
|
children: [
|
|
696
|
-
!
|
|
697
|
-
|
|
720
|
+
!ee.includes(d) && /* @__PURE__ */ t("option", { value: d, children: d }),
|
|
721
|
+
ee.map((o) => /* @__PURE__ */ t("option", { value: o, children: o }, o))
|
|
698
722
|
]
|
|
699
723
|
}
|
|
700
724
|
),
|
|
@@ -708,10 +732,10 @@ function qe(e) {
|
|
|
708
732
|
type: "number",
|
|
709
733
|
min: 0,
|
|
710
734
|
value: b,
|
|
711
|
-
onChange: (
|
|
735
|
+
onChange: (o) => g(o.target.value),
|
|
712
736
|
placeholder: "Unlimited",
|
|
713
737
|
"data-testid": "model-budget-requests",
|
|
714
|
-
...
|
|
738
|
+
...j
|
|
715
739
|
}
|
|
716
740
|
)
|
|
717
741
|
] }),
|
|
@@ -722,11 +746,11 @@ function qe(e) {
|
|
|
722
746
|
{
|
|
723
747
|
type: "number",
|
|
724
748
|
min: 0,
|
|
725
|
-
value:
|
|
726
|
-
onChange: (
|
|
749
|
+
value: v,
|
|
750
|
+
onChange: (o) => y(o.target.value),
|
|
727
751
|
placeholder: "Unlimited",
|
|
728
752
|
"data-testid": "model-budget-tokens",
|
|
729
|
-
...
|
|
753
|
+
...j
|
|
730
754
|
}
|
|
731
755
|
)
|
|
732
756
|
] }),
|
|
@@ -739,10 +763,10 @@ function qe(e) {
|
|
|
739
763
|
min: 0,
|
|
740
764
|
step: "0.01",
|
|
741
765
|
value: C,
|
|
742
|
-
onChange: (
|
|
766
|
+
onChange: (o) => N(o.target.value),
|
|
743
767
|
placeholder: "Unlimited",
|
|
744
768
|
"data-testid": "model-budget-cost",
|
|
745
|
-
...
|
|
769
|
+
...j
|
|
746
770
|
}
|
|
747
771
|
),
|
|
748
772
|
/* @__PURE__ */ t("span", { className: "hint", children: "In major units of the currency below (12.50 = 12.50 USD)." })
|
|
@@ -753,12 +777,12 @@ function qe(e) {
|
|
|
753
777
|
"input",
|
|
754
778
|
{
|
|
755
779
|
type: "text",
|
|
756
|
-
value:
|
|
757
|
-
onChange: (
|
|
780
|
+
value: i,
|
|
781
|
+
onChange: (o) => u(o.target.value),
|
|
758
782
|
placeholder: "USD",
|
|
759
783
|
maxLength: 8,
|
|
760
784
|
"data-testid": "model-budget-currency",
|
|
761
|
-
...
|
|
785
|
+
...j
|
|
762
786
|
}
|
|
763
787
|
)
|
|
764
788
|
] }),
|
|
@@ -767,10 +791,10 @@ function qe(e) {
|
|
|
767
791
|
/* @__PURE__ */ t(
|
|
768
792
|
"select",
|
|
769
793
|
{
|
|
770
|
-
value:
|
|
771
|
-
onChange: (
|
|
794
|
+
value: S,
|
|
795
|
+
onChange: (o) => M(o.target.value),
|
|
772
796
|
"data-testid": "model-budget-on-breach",
|
|
773
|
-
children:
|
|
797
|
+
children: ke.map((o) => /* @__PURE__ */ t("option", { value: o, children: o }, o))
|
|
774
798
|
}
|
|
775
799
|
),
|
|
776
800
|
/* @__PURE__ */ t("span", { className: "hint", children: "`block` refuses calls past the limit; `warn` lets them through and flags them." })
|
|
@@ -784,21 +808,21 @@ function qe(e) {
|
|
|
784
808
|
{
|
|
785
809
|
type: "button",
|
|
786
810
|
className: "btn",
|
|
787
|
-
disabled: !
|
|
788
|
-
onClick:
|
|
811
|
+
disabled: !O,
|
|
812
|
+
onClick: F,
|
|
789
813
|
"data-testid": "model-budget-save",
|
|
790
|
-
children:
|
|
814
|
+
children: $ ? "Saving…" : n ? "Save changes" : "Save budget"
|
|
791
815
|
}
|
|
792
816
|
)
|
|
793
817
|
] })
|
|
794
818
|
] });
|
|
795
819
|
}
|
|
796
820
|
export {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
821
|
+
_e as CreateEndpointModal,
|
|
822
|
+
Je as CreateFunctionModal,
|
|
823
|
+
Ke as ModelBudgetsManager,
|
|
824
|
+
Ye as ModelRoutesManager,
|
|
825
|
+
Fe as SecretsManager,
|
|
826
|
+
Oe as VarsManager
|
|
803
827
|
};
|
|
804
828
|
//# sourceMappingURL=forms.mjs.map
|