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