@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/lists.mjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as l, jsx as t, Fragment as q } from "react/jsx-runtime";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { F as Rt, E as Pt } from "./CreateFunctionModal-
|
|
5
|
-
import { d as
|
|
6
|
-
import { u as
|
|
7
|
-
import { CallableList as qt, ReliabilityList as _t, EmptyState as
|
|
8
|
-
import { I as
|
|
9
|
-
import { i as
|
|
10
|
-
import { a3 as
|
|
11
|
-
import { n as
|
|
12
|
-
import { f as
|
|
13
|
-
import {
|
|
14
|
-
import { D as
|
|
15
|
-
import { k as
|
|
16
|
-
import { H as
|
|
17
|
-
import { ApiError as
|
|
18
|
-
import { useQueryClient as
|
|
19
|
-
import { u as
|
|
20
|
-
import { M as
|
|
21
|
-
import { j as
|
|
22
|
-
import { u as
|
|
23
|
-
import { v as
|
|
24
|
-
import { x as mt, w as ke, a as ht, p as
|
|
25
|
-
import { u as yt, b as
|
|
26
|
-
import { h as
|
|
27
|
-
function
|
|
28
|
-
const { kind: n } = e, a =
|
|
3
|
+
import { useState as p, useMemo as oe, useEffect as xt } from "react";
|
|
4
|
+
import { F as Rt, E as Pt } from "./CreateFunctionModal-CCYi9deY.js";
|
|
5
|
+
import { d as Kt, f as Ot, h as Ft, b as Ge, n as Me, u as jt, m as Qt } from "./endpoints-DArAqoLT.js";
|
|
6
|
+
import { u as ne, b as xe } from "./project-context-Tvp-La7A.js";
|
|
7
|
+
import { CallableList as qt, ReliabilityList as _t, EmptyState as Re, DataTable as Pe, RowActionsMenu as Vt, ListItem as Le, HealthStatusPill as ve, HistoryTimeline as Wt, useW6WApi as Ze, connectionAppIdsToLookUp as Xe, ConnectionList as Bt, AddConnectionModal as Ut, EditConnectionModal as et, Modal as Ht, resolveConnectionAppMeta as Yt, ConnectionHeader as zt, EditButton as Jt, IconButton as Gt, AuthGuide as Zt, ConnectionKeepAlive as Xt, secretClipboard as tt, locateDataStoreError as en, tableSchemaOf as tn, draftFromEntry as ye, CsvPanel as nn, DataTableGrid as an, NEW_ROW_ID as ie, newRowDraft as je, kvValueTypeOf as sn, DataEntryList as ln, DataEntryEditor as rn, dirtyColumns as on, csvFilenameOf as cn, csvImportMessage as Qe, buildRowValue as dn, rowWriteOf as un, remainingTtlSeconds as nt, isVersionConflict as at, cellErrorsOf as mn, parseDocText as hn, kvValueOf as wn, serializeCell as pn, DataStoreList as fn, DATA_STORE_KINDS as yn, DATA_STORE_KIND_LABEL as gn, SCALAR_TYPES as vn, ColumnsEditor as bn, errorPlacement as Nn } from "@w6w/ui";
|
|
8
|
+
import { I as kn } from "./ImportSpecModal-DoxsVxru.js";
|
|
9
|
+
import { i as Cn } from "./import-bindings-EUtxZ9Ti.js";
|
|
10
|
+
import { a3 as Tn, a1 as st, T as En, E as In } from "./workflows-Dz8LMjnt.js";
|
|
11
|
+
import { n as An, b as Dn } from "./workflow-blank-BJFLdGyE.js";
|
|
12
|
+
import { f as $n, e as qe, g as Ln, b as Sn, h as Mn, i as xn } from "./api-calls--JHyif6a.js";
|
|
13
|
+
import { a as Rn, C as Ne, M as Pn } from "./ConfirmModal-WqBfWftD.js";
|
|
14
|
+
import { D as Kn } from "./DocumentFormModal-CCIgA7pR.js";
|
|
15
|
+
import { k as On, i as Fn } from "./spec-import-0B6oUewa.js";
|
|
16
|
+
import { H as jn, a as it } from "./editor-apps-HEOclsxL.js";
|
|
17
|
+
import { ApiError as lt } from "@w6w/sdk";
|
|
18
|
+
import { useQueryClient as fe, useQuery as Ke, useInfiniteQuery as rt } from "@tanstack/react-query";
|
|
19
|
+
import { u as ot, o as ct, k as dt, c as de, b as Se, m as Qn, p as ut, e as _e, q as qn } from "./connections-CzsCyIxY.js";
|
|
20
|
+
import { M as _n } from "./ModelRoutesManager-DqeY1mdP.js";
|
|
21
|
+
import { j as Vn } from "./apps-FMcQfyL2.js";
|
|
22
|
+
import { u as me } from "./client-context-CX61Bgw-.js";
|
|
23
|
+
import { v as Wn, A as Bn, s as Un, E as Hn, c as Yn } from "./models-CI0vLJ6o.js";
|
|
24
|
+
import { x as mt, w as ke, a as ht, p as zn, g as ue, v as Jn, q as Gn, z as wt, A as pt, B as Zn, y as ft, o as ae, c as Xn, i as ea, h as ta } from "./credentials-4Nf2GfMc.js";
|
|
25
|
+
import { u as yt, b as na, d as aa, c as sa } from "./ai-keys-D676ly41.js";
|
|
26
|
+
import { h as ia, k as gt, p as vt, o as la, j as bt, n as ra, m as oa, g as Nt, i as ca, u as da, f as ua } from "./data-stores-UeQvwVCa.js";
|
|
27
|
+
function Oe(e) {
|
|
28
|
+
const { kind: n } = e, a = Kt(n), [s, i] = p(!1), o = (e.rows ?? []).map((r) => ({
|
|
29
29
|
...e.toRow(r),
|
|
30
30
|
id: r.id,
|
|
31
|
-
archived:
|
|
31
|
+
archived: Cn(r)
|
|
32
32
|
}));
|
|
33
33
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
34
34
|
/* @__PURE__ */ t(
|
|
@@ -56,14 +56,14 @@ function Pe(e) {
|
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
58
|
s && /* @__PURE__ */ t(
|
|
59
|
-
|
|
59
|
+
kn,
|
|
60
60
|
{
|
|
61
61
|
kind: n,
|
|
62
62
|
project: e.project ?? void 0,
|
|
63
|
-
listKeys: { functionsKey: Ft, endpointsKey:
|
|
64
|
-
onOpenImported: (r,
|
|
65
|
-
var
|
|
66
|
-
return (
|
|
63
|
+
listKeys: { functionsKey: Ft, endpointsKey: Ot, workflowsKey: Tn },
|
|
64
|
+
onOpenImported: (r, d) => {
|
|
65
|
+
var u;
|
|
66
|
+
return (u = e.onOpen) == null ? void 0 : u.call(e, d);
|
|
67
67
|
},
|
|
68
68
|
onClose: () => i(!1)
|
|
69
69
|
}
|
|
@@ -74,10 +74,10 @@ function Pe(e) {
|
|
|
74
74
|
function kt({ tags: e }) {
|
|
75
75
|
return !e || e.length === 0 ? null : /* @__PURE__ */ t("span", { className: "wf-row-tags", "data-testid": "callable-row-tags", children: e.map((n) => /* @__PURE__ */ t("span", { className: "tag", children: n }, n)) });
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
const n =
|
|
77
|
+
function Us(e) {
|
|
78
|
+
const n = Ge(), a = ne(e.project), [s, i] = p(null);
|
|
79
79
|
return /* @__PURE__ */ t(
|
|
80
|
-
|
|
80
|
+
Oe,
|
|
81
81
|
{
|
|
82
82
|
kind: "function",
|
|
83
83
|
rows: n.data,
|
|
@@ -97,7 +97,7 @@ function Vs(e) {
|
|
|
97
97
|
},
|
|
98
98
|
onOpen: e.onOpen,
|
|
99
99
|
getHref: e.getHref,
|
|
100
|
-
onCreate: () => i(
|
|
100
|
+
onCreate: () => i(Me("function")),
|
|
101
101
|
slots: e.slots,
|
|
102
102
|
children: s !== null && /* @__PURE__ */ t(
|
|
103
103
|
Rt,
|
|
@@ -114,10 +114,10 @@ function Vs(e) {
|
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const n = jt(), a =
|
|
117
|
+
function Hs(e) {
|
|
118
|
+
const n = jt(), a = ne(e.project), [s, i] = p(null);
|
|
119
119
|
return /* @__PURE__ */ t(
|
|
120
|
-
|
|
120
|
+
Oe,
|
|
121
121
|
{
|
|
122
122
|
kind: "endpoint",
|
|
123
123
|
rows: n.data,
|
|
@@ -147,7 +147,7 @@ function Ws(e) {
|
|
|
147
147
|
},
|
|
148
148
|
onOpen: e.onOpen,
|
|
149
149
|
getHref: e.getHref,
|
|
150
|
-
onCreate: () => i(
|
|
150
|
+
onCreate: () => i(Me("endpoint")),
|
|
151
151
|
slots: e.slots,
|
|
152
152
|
children: s !== null && /* @__PURE__ */ t(
|
|
153
153
|
Pt,
|
|
@@ -164,10 +164,10 @@ function Ws(e) {
|
|
|
164
164
|
}
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
const n =
|
|
167
|
+
function Ys(e) {
|
|
168
|
+
const n = ne(e.project), a = st(n ?? void 0, n != null), s = En(n ?? void 0), [i, o] = p(null);
|
|
169
169
|
return /* @__PURE__ */ t(
|
|
170
|
-
|
|
170
|
+
Oe,
|
|
171
171
|
{
|
|
172
172
|
kind: "workflow",
|
|
173
173
|
rows: a.data,
|
|
@@ -178,7 +178,7 @@ function Bs(e) {
|
|
|
178
178
|
title: r.displayName || r.name,
|
|
179
179
|
description: r.description,
|
|
180
180
|
badges: /* @__PURE__ */ l(q, { children: [
|
|
181
|
-
r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((
|
|
181
|
+
r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((d) => /* @__PURE__ */ t("span", { className: "tag", children: d }, d)) }),
|
|
182
182
|
r.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${r.status}`, children: r.status })
|
|
183
183
|
] }),
|
|
184
184
|
trailing: /* @__PURE__ */ l("span", { className: "wf-col wf-col-stats muted small", children: [
|
|
@@ -191,13 +191,13 @@ function Bs(e) {
|
|
|
191
191
|
getHref: e.getHref,
|
|
192
192
|
onCreate: () => {
|
|
193
193
|
o(null);
|
|
194
|
-
const r =
|
|
195
|
-
s.mutate(
|
|
196
|
-
onSuccess: (
|
|
197
|
-
var
|
|
198
|
-
return (
|
|
194
|
+
const r = An((a.data ?? []).map((d) => d.displayName || d.name));
|
|
195
|
+
s.mutate(Dn(Me("workflow"), r), {
|
|
196
|
+
onSuccess: (d) => {
|
|
197
|
+
var u;
|
|
198
|
+
return (u = e.onCreated) == null ? void 0 : u.call(e, d.workflow.id);
|
|
199
199
|
},
|
|
200
|
-
onError: (
|
|
200
|
+
onError: (d) => o(d instanceof Error ? d.message : String(d))
|
|
201
201
|
});
|
|
202
202
|
},
|
|
203
203
|
creating: s.isPending,
|
|
@@ -205,7 +205,7 @@ function Bs(e) {
|
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function zs({
|
|
209
209
|
project: e,
|
|
210
210
|
variant: n = "full",
|
|
211
211
|
limit: a,
|
|
@@ -213,62 +213,62 @@ function Us({
|
|
|
213
213
|
showChart: i,
|
|
214
214
|
getHref: o,
|
|
215
215
|
onOpen: r,
|
|
216
|
-
showAllHref:
|
|
217
|
-
onShowAll:
|
|
218
|
-
slots:
|
|
216
|
+
showAllHref: d,
|
|
217
|
+
onShowAll: u,
|
|
218
|
+
slots: m
|
|
219
219
|
}) {
|
|
220
|
-
var y,
|
|
221
|
-
const g =
|
|
222
|
-
let
|
|
223
|
-
return
|
|
220
|
+
var y, E;
|
|
221
|
+
const g = xe().project, h = e === void 0 ? g : e, k = h || null, w = $n(k ?? void 0, s);
|
|
222
|
+
let b = m == null ? void 0 : m.empty;
|
|
223
|
+
return k ? w.isLoading ? b = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : w.error && (b = /* @__PURE__ */ t("div", { className: "error", children: w.error.message })) : b = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
|
|
224
224
|
_t,
|
|
225
225
|
{
|
|
226
|
-
services:
|
|
227
|
-
window:
|
|
226
|
+
services: k ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
|
|
227
|
+
window: k ? (E = w.data) == null ? void 0 : E.window : void 0,
|
|
228
228
|
days: s,
|
|
229
229
|
compact: n === "compact",
|
|
230
230
|
showChart: i,
|
|
231
231
|
limit: a,
|
|
232
232
|
getHref: o,
|
|
233
233
|
onOpen: r,
|
|
234
|
-
showAllHref:
|
|
235
|
-
onShowAll:
|
|
236
|
-
slots: { ...
|
|
234
|
+
showAllHref: d,
|
|
235
|
+
onShowAll: u,
|
|
236
|
+
slots: { ...m, empty: b }
|
|
237
237
|
}
|
|
238
238
|
) });
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function ma(e) {
|
|
241
241
|
const n = e.replace(/\s+/g, " ").trim();
|
|
242
242
|
return n.length > 80 ? `${n.slice(0, 80)}…` : n;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
245
|
-
var
|
|
246
|
-
const o =
|
|
244
|
+
function Js({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
|
|
245
|
+
var I;
|
|
246
|
+
const o = ne(e), r = On(o ?? void 0, o != null), d = Fn(), [u, m] = p(null), [g, h] = p(null), [k, w] = p(null), b = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
|
|
247
247
|
/* @__PURE__ */ t("h3", { children: "Documents" }),
|
|
248
248
|
/* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
|
|
249
|
-
] }) : s.header,
|
|
249
|
+
] }) : s.header, y = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(Re, { testId: "document-list-empty", children: "No documents yet." }) : s.empty, E = [
|
|
250
250
|
{
|
|
251
251
|
key: "key",
|
|
252
252
|
header: "Document",
|
|
253
|
-
render: (
|
|
254
|
-
var
|
|
255
|
-
const
|
|
253
|
+
render: (v) => {
|
|
254
|
+
var T;
|
|
255
|
+
const f = (T = i == null ? void 0 : i.lead) == null ? void 0 : T.call(i, v);
|
|
256
256
|
return /* @__PURE__ */ l("span", { style: { display: "flex", alignItems: "center" }, children: [
|
|
257
|
-
|
|
257
|
+
f,
|
|
258
258
|
/* @__PURE__ */ l(
|
|
259
259
|
"span",
|
|
260
260
|
{
|
|
261
261
|
className: "list-main",
|
|
262
|
-
style: { marginLeft:
|
|
262
|
+
style: { marginLeft: f != null ? "var(--w6w-sp-2)" : 0 },
|
|
263
263
|
children: [
|
|
264
|
-
/* @__PURE__ */ t("strong", { className: "list-name", title:
|
|
264
|
+
/* @__PURE__ */ t("strong", { className: "list-name", title: v.key, children: v.key }),
|
|
265
265
|
" ",
|
|
266
|
-
/* @__PURE__ */ t("span", { className: "tag", children:
|
|
266
|
+
/* @__PURE__ */ t("span", { className: "tag", children: v.format }),
|
|
267
267
|
/* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
|
|
268
|
-
/* @__PURE__ */ t("code", { children:
|
|
269
|
-
|
|
268
|
+
/* @__PURE__ */ t("code", { children: ma(v.content) }),
|
|
269
|
+
v.description && /* @__PURE__ */ l(q, { children: [
|
|
270
270
|
" · ",
|
|
271
|
-
|
|
271
|
+
v.description
|
|
272
272
|
] })
|
|
273
273
|
] })
|
|
274
274
|
]
|
|
@@ -283,36 +283,46 @@ function Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
|
|
|
283
283
|
align: "right",
|
|
284
284
|
link: !1,
|
|
285
285
|
actions: !0,
|
|
286
|
-
render: (
|
|
287
|
-
var
|
|
288
|
-
const
|
|
286
|
+
render: (v) => {
|
|
287
|
+
var T, N;
|
|
288
|
+
const f = (T = i == null ? void 0 : i.footer) == null ? void 0 : T.call(i, v);
|
|
289
289
|
return (
|
|
290
290
|
// Clicks here must not reach the row's onOpen.
|
|
291
291
|
// biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the buttons inside are the controls.
|
|
292
|
-
/* @__PURE__ */ l("div", { onClick: (
|
|
292
|
+
/* @__PURE__ */ l("div", { onClick: (K) => K.stopPropagation(), children: [
|
|
293
293
|
/* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
{
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
294
|
+
v.shared && ((N = i == null ? void 0 : i.sharedActions) == null ? void 0 : N.call(i, v)),
|
|
295
|
+
/* @__PURE__ */ t(
|
|
296
|
+
Vt,
|
|
297
|
+
{
|
|
298
|
+
label: `Actions for ${v.key}`,
|
|
299
|
+
"data-testid": `document-actions-${v.id}`,
|
|
300
|
+
actions: [
|
|
301
|
+
{
|
|
302
|
+
label: "Call from code",
|
|
303
|
+
icon: "code",
|
|
304
|
+
onSelect: () => w(v.key),
|
|
305
|
+
"data-testid": `document-code-${v.id}`
|
|
306
|
+
},
|
|
307
|
+
!v.shared && {
|
|
308
|
+
label: "Edit",
|
|
309
|
+
icon: "edit",
|
|
310
|
+
onSelect: () => m({ mode: "edit", d: v }),
|
|
311
|
+
"data-testid": `document-edit-${v.id}`
|
|
312
|
+
},
|
|
313
|
+
!v.shared && {
|
|
314
|
+
label: "Delete",
|
|
315
|
+
icon: "delete",
|
|
316
|
+
danger: !0,
|
|
317
|
+
disabled: d.isPending,
|
|
318
|
+
onSelect: () => h(v),
|
|
319
|
+
"data-testid": `document-delete-${v.id}`
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
)
|
|
314
324
|
] }),
|
|
315
|
-
|
|
325
|
+
f != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: f })
|
|
316
326
|
] })
|
|
317
327
|
);
|
|
318
328
|
}
|
|
@@ -321,40 +331,47 @@ function Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
|
|
|
321
331
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
322
332
|
/* @__PURE__ */ l("section", { className: "section", children: [
|
|
323
333
|
/* @__PURE__ */ l("div", { className: "section-head", children: [
|
|
324
|
-
|
|
334
|
+
b,
|
|
325
335
|
/* @__PURE__ */ t(
|
|
326
336
|
"button",
|
|
327
337
|
{
|
|
328
338
|
type: "button",
|
|
329
339
|
className: "btn",
|
|
330
340
|
disabled: o == null,
|
|
331
|
-
onClick: () =>
|
|
341
|
+
onClick: () => m({ mode: "create" }),
|
|
332
342
|
children: "+ Add document"
|
|
333
343
|
}
|
|
334
344
|
)
|
|
335
345
|
] }),
|
|
336
346
|
/* @__PURE__ */ l("div", { children: [
|
|
337
347
|
r.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
338
|
-
((
|
|
348
|
+
((I = r.data) == null ? void 0 : I.length) === 0 && y,
|
|
339
349
|
r.data != null && r.data.length > 0 && /* @__PURE__ */ t(
|
|
340
|
-
|
|
350
|
+
Pe,
|
|
341
351
|
{
|
|
342
|
-
columns:
|
|
352
|
+
columns: E,
|
|
343
353
|
rows: r.data,
|
|
344
|
-
rowKey: (
|
|
345
|
-
getRowHref: a ? (
|
|
346
|
-
onRowClick: n ? (
|
|
354
|
+
rowKey: (v) => v.id,
|
|
355
|
+
getRowHref: a ? (v) => a(v.id) : void 0,
|
|
356
|
+
onRowClick: n ? (v, f) => n(v.id, f) : void 0
|
|
347
357
|
}
|
|
348
358
|
)
|
|
349
359
|
] })
|
|
350
360
|
] }),
|
|
351
|
-
|
|
352
|
-
|
|
361
|
+
u && /* @__PURE__ */ t(
|
|
362
|
+
Kn,
|
|
353
363
|
{
|
|
354
|
-
initial:
|
|
364
|
+
initial: u.mode === "edit" ? u.d : void 0,
|
|
355
365
|
project: o,
|
|
356
|
-
onClose: () =>
|
|
357
|
-
onSaved: () =>
|
|
366
|
+
onClose: () => m(null),
|
|
367
|
+
onSaved: () => m(null)
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
k != null && /* @__PURE__ */ t(
|
|
371
|
+
Rn,
|
|
372
|
+
{
|
|
373
|
+
resource: { kind: "document", key: k },
|
|
374
|
+
onClose: () => w(null)
|
|
358
375
|
}
|
|
359
376
|
),
|
|
360
377
|
g && /* @__PURE__ */ t(
|
|
@@ -364,14 +381,14 @@ function Hs({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
|
|
|
364
381
|
message: `Delete the document "${g.key}"? This cannot be undone.`,
|
|
365
382
|
confirmLabel: "Delete",
|
|
366
383
|
onConfirm: () => {
|
|
367
|
-
o != null &&
|
|
384
|
+
o != null && d.mutate({ id: g.id, project: o }), h(null);
|
|
368
385
|
},
|
|
369
386
|
onClose: () => h(null)
|
|
370
387
|
}
|
|
371
388
|
)
|
|
372
389
|
] });
|
|
373
390
|
}
|
|
374
|
-
const
|
|
391
|
+
const ha = {
|
|
375
392
|
workflow: "Workflow run",
|
|
376
393
|
workflow_step: "Workflow step",
|
|
377
394
|
connection_test: "Connection test",
|
|
@@ -383,7 +400,7 @@ const da = {
|
|
|
383
400
|
action: "App action"
|
|
384
401
|
};
|
|
385
402
|
function be(e) {
|
|
386
|
-
return
|
|
403
|
+
return ha[e] ?? e;
|
|
387
404
|
}
|
|
388
405
|
const Ct = {
|
|
389
406
|
workflow: "workflow",
|
|
@@ -394,13 +411,13 @@ const Ct = {
|
|
|
394
411
|
endpoint: "base",
|
|
395
412
|
action: "base"
|
|
396
413
|
};
|
|
397
|
-
function
|
|
414
|
+
function wa(e) {
|
|
398
415
|
return Object.hasOwn(Ct, e);
|
|
399
416
|
}
|
|
400
417
|
function Tt(e) {
|
|
401
|
-
return
|
|
418
|
+
return wa(e) ? Ct[e] : "base";
|
|
402
419
|
}
|
|
403
|
-
function
|
|
420
|
+
function pa(e, n) {
|
|
404
421
|
const a = /* @__PURE__ */ new Map();
|
|
405
422
|
for (const i of e ?? []) {
|
|
406
423
|
const o = i.displayName || i.key;
|
|
@@ -413,7 +430,7 @@ function ma(e, n) {
|
|
|
413
430
|
}
|
|
414
431
|
return { functions: a, workflows: s };
|
|
415
432
|
}
|
|
416
|
-
function
|
|
433
|
+
function fa(e, n) {
|
|
417
434
|
const a = e.summary ?? be(e.kind), s = Tt(e.kind);
|
|
418
435
|
if (s === "function" && e.functionId !== null) {
|
|
419
436
|
const i = n.functions.get(e.functionId);
|
|
@@ -426,42 +443,42 @@ function ha(e, n) {
|
|
|
426
443
|
return { text: i, target: { kind: "workflow", id: e.workflowId } };
|
|
427
444
|
}
|
|
428
445
|
if (s === "workflow_step") {
|
|
429
|
-
const i = e.workflowId, o = i !== null ? n.workflows.get(i) : void 0, r = o ?? i ?? e.summary ?? "Unknown workflow",
|
|
446
|
+
const i = e.workflowId, o = i !== null ? n.workflows.get(i) : void 0, r = o ?? i ?? e.summary ?? "Unknown workflow", d = o !== void 0 && i !== null;
|
|
430
447
|
return {
|
|
431
448
|
text: e.stepId ? `${r} - ${e.stepId}` : r,
|
|
432
|
-
target:
|
|
449
|
+
target: d ? { kind: "workflow", id: i } : null
|
|
433
450
|
};
|
|
434
451
|
}
|
|
435
452
|
return { text: a, target: null };
|
|
436
453
|
}
|
|
437
|
-
const
|
|
454
|
+
const we = (e) => String(e).padStart(2, "0");
|
|
438
455
|
function Et(e) {
|
|
439
456
|
const n = new Date(e);
|
|
440
|
-
return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${
|
|
457
|
+
return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${we(n.getMonth() + 1)}-${we(n.getDate())}`} ${we(n.getHours())}:${we(n.getMinutes())}:${we(n.getSeconds())}`;
|
|
441
458
|
}
|
|
442
459
|
function It(e) {
|
|
443
460
|
return e == null || !Number.isFinite(e) || e < 0 ? null : e < 1e3 ? `${Math.round(e)} ms` : e < 6e4 ? `${(Math.floor(e / 100) / 10).toFixed(1)} s` : `${Math.floor(e / 6e4)}m ${Math.floor(e % 6e4 / 1e3)}s`;
|
|
444
461
|
}
|
|
445
|
-
function
|
|
462
|
+
function ya() {
|
|
446
463
|
const e = /* @__PURE__ */ new Date();
|
|
447
464
|
return e.setHours(0, 0, 0, 0), e.toISOString();
|
|
448
465
|
}
|
|
449
|
-
function
|
|
466
|
+
function ga(e, n) {
|
|
450
467
|
const a = new Date(e);
|
|
451
468
|
if (Number.isNaN(a.getTime())) return e;
|
|
452
469
|
const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
453
470
|
return n === "week" ? `Week of ${s}` : s;
|
|
454
471
|
}
|
|
455
|
-
function
|
|
472
|
+
function At({ ok: e }) {
|
|
456
473
|
return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
|
|
457
474
|
}
|
|
458
|
-
function
|
|
475
|
+
function Ae({ label: e, value: n }) {
|
|
459
476
|
return /* @__PURE__ */ l("div", { className: "w6w-activity-card w6w-activity-stat", children: [
|
|
460
477
|
/* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
|
|
461
478
|
/* @__PURE__ */ t("div", { className: "muted small", children: e })
|
|
462
479
|
] });
|
|
463
480
|
}
|
|
464
|
-
function
|
|
481
|
+
function Ve({
|
|
465
482
|
title: e,
|
|
466
483
|
headline: n,
|
|
467
484
|
loading: a
|
|
@@ -470,131 +487,131 @@ function qe({
|
|
|
470
487
|
return /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
|
|
471
488
|
/* @__PURE__ */ t("h3", { children: e }),
|
|
472
489
|
a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ l("div", { className: "w6w-activity-stats", children: [
|
|
473
|
-
/* @__PURE__ */ t(
|
|
474
|
-
/* @__PURE__ */ t(
|
|
475
|
-
/* @__PURE__ */ t(
|
|
490
|
+
/* @__PURE__ */ t(Ae, { label: "Workflow runs", value: s.workflowRuns }),
|
|
491
|
+
/* @__PURE__ */ t(Ae, { label: "Succeeded", value: s.succeeded }),
|
|
492
|
+
/* @__PURE__ */ t(Ae, { label: "Failed", value: s.failed })
|
|
476
493
|
] })
|
|
477
494
|
] });
|
|
478
495
|
}
|
|
479
|
-
function
|
|
496
|
+
function va({
|
|
480
497
|
entry: e,
|
|
481
498
|
names: n,
|
|
482
499
|
getHref: a,
|
|
483
500
|
onOpen: s
|
|
484
501
|
}) {
|
|
485
|
-
const { text: i, target: o } =
|
|
502
|
+
const { text: i, target: o } = fa(e, n);
|
|
486
503
|
if (o === null) return /* @__PURE__ */ t(q, { children: i });
|
|
487
|
-
const r = s ? (
|
|
504
|
+
const r = s ? (d) => s(o, d) : void 0;
|
|
488
505
|
return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: r, children: i }) : r ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: r, children: i }) : /* @__PURE__ */ t(q, { children: i });
|
|
489
506
|
}
|
|
490
|
-
function
|
|
507
|
+
function Dt({ entry: e, title: n }) {
|
|
491
508
|
const a = It(e.durationMs);
|
|
492
509
|
return /* @__PURE__ */ t(
|
|
493
510
|
Le,
|
|
494
511
|
{
|
|
495
|
-
icon: /* @__PURE__ */ t(
|
|
512
|
+
icon: /* @__PURE__ */ t(At, { ok: e.ok }),
|
|
496
513
|
title: n ?? e.summary ?? be(e.kind),
|
|
497
514
|
subtitle: `${be(e.kind)} · ${Et(e.occurredAt)}`,
|
|
498
515
|
trailing: a === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: a })
|
|
499
516
|
}
|
|
500
517
|
);
|
|
501
518
|
}
|
|
502
|
-
function
|
|
503
|
-
return /* @__PURE__ */ t(
|
|
519
|
+
function De(e) {
|
|
520
|
+
return /* @__PURE__ */ t(Dt, { entry: e.entry, title: /* @__PURE__ */ t(va, { ...e }) });
|
|
504
521
|
}
|
|
505
|
-
const
|
|
506
|
-
base: (e) => /* @__PURE__ */ t(
|
|
507
|
-
function:
|
|
508
|
-
workflow:
|
|
509
|
-
workflow_step:
|
|
522
|
+
const ba = {
|
|
523
|
+
base: (e) => /* @__PURE__ */ t(Dt, { entry: e.entry }),
|
|
524
|
+
function: De,
|
|
525
|
+
workflow: De,
|
|
526
|
+
workflow_step: De
|
|
510
527
|
};
|
|
511
|
-
function
|
|
512
|
-
const n =
|
|
528
|
+
function Na(e) {
|
|
529
|
+
const n = ba[Tt(e.entry.kind)];
|
|
513
530
|
return /* @__PURE__ */ t(n, { ...e });
|
|
514
531
|
}
|
|
515
|
-
function
|
|
516
|
-
var
|
|
517
|
-
const s =
|
|
518
|
-
() =>
|
|
532
|
+
function Gs({ getHref: e, onOpen: n, slots: a }) {
|
|
533
|
+
var b, y, E, I, v, f;
|
|
534
|
+
const s = qe("today", { from: ya(), bucket: "day" }), i = qe("week", { bucket: "week" }), o = Ge(), r = st(), d = oe(
|
|
535
|
+
() => pa(o.data, r.data),
|
|
519
536
|
[o.data, r.data]
|
|
520
|
-
),
|
|
537
|
+
), u = s.error ?? i.error, m = u ? u.message : null, g = ((b = i.data) == null ? void 0 : b.recent) ?? [], h = ((y = i.data) == null ? void 0 : y.series) ?? [], k = ((E = i.data) == null ? void 0 : E.range.bucket) ?? "week", w = !i.isLoading && g.length === 0 && (((I = i.data) == null ? void 0 : I.headline.workflowRuns) ?? 0) === 0;
|
|
521
538
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
522
|
-
|
|
539
|
+
m && /* @__PURE__ */ t("div", { className: "error", children: m }),
|
|
523
540
|
a == null ? void 0 : a.header,
|
|
524
541
|
a == null ? void 0 : a.actions,
|
|
525
542
|
/* @__PURE__ */ t(
|
|
526
|
-
|
|
543
|
+
Ve,
|
|
527
544
|
{
|
|
528
545
|
title: "Today",
|
|
529
|
-
headline: (
|
|
546
|
+
headline: (v = s.data) == null ? void 0 : v.headline,
|
|
530
547
|
loading: s.isLoading
|
|
531
548
|
}
|
|
532
549
|
),
|
|
533
550
|
/* @__PURE__ */ t(
|
|
534
|
-
|
|
551
|
+
Ve,
|
|
535
552
|
{
|
|
536
553
|
title: "Last 7 days",
|
|
537
|
-
headline: (
|
|
554
|
+
headline: (f = i.data) == null ? void 0 : f.headline,
|
|
538
555
|
loading: i.isLoading
|
|
539
556
|
}
|
|
540
557
|
),
|
|
541
558
|
a == null ? void 0 : a.betweenHeadlineAndSeries,
|
|
542
559
|
/* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
|
|
543
560
|
/* @__PURE__ */ t("h3", { children: "Activity over time" }),
|
|
544
|
-
/* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: h.map((
|
|
561
|
+
/* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : h.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: h.map((T) => /* @__PURE__ */ l("li", { children: [
|
|
545
562
|
/* @__PURE__ */ l("span", { className: "list-main", children: [
|
|
546
|
-
/* @__PURE__ */ t("strong", { children:
|
|
563
|
+
/* @__PURE__ */ t("strong", { children: ga(T.bucket, k) }),
|
|
547
564
|
" ",
|
|
548
|
-
/* @__PURE__ */ t("span", { className: "muted small", children: be(
|
|
565
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: be(T.kind) })
|
|
549
566
|
] }),
|
|
550
567
|
" ",
|
|
551
|
-
/* @__PURE__ */ t(
|
|
568
|
+
/* @__PURE__ */ t(At, { ok: T.ok }),
|
|
552
569
|
" ",
|
|
553
|
-
/* @__PURE__ */ t("span", { className: "muted small", children:
|
|
554
|
-
] }, `${
|
|
570
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: T.count })
|
|
571
|
+
] }, `${T.bucket}-${T.kind}-${String(T.ok)}`)) }) })
|
|
555
572
|
] }),
|
|
556
573
|
/* @__PURE__ */ l("section", { children: [
|
|
557
574
|
/* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
|
|
558
|
-
/* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : w ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : g.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: g.map((
|
|
559
|
-
|
|
575
|
+
/* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : w ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : g.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: g.map((T) => /* @__PURE__ */ t(
|
|
576
|
+
Na,
|
|
560
577
|
{
|
|
561
|
-
entry:
|
|
562
|
-
names:
|
|
578
|
+
entry: T,
|
|
579
|
+
names: d,
|
|
563
580
|
getHref: e,
|
|
564
581
|
onOpen: n
|
|
565
582
|
},
|
|
566
|
-
|
|
583
|
+
T.id
|
|
567
584
|
)) }) })
|
|
568
585
|
] })
|
|
569
586
|
] });
|
|
570
587
|
}
|
|
571
|
-
function
|
|
588
|
+
function ka(e) {
|
|
572
589
|
return e !== null && "project" in e;
|
|
573
590
|
}
|
|
574
|
-
function
|
|
575
|
-
const n =
|
|
576
|
-
var
|
|
577
|
-
o || s(
|
|
591
|
+
function Ca(e) {
|
|
592
|
+
const n = xe().project, [a, s] = p(In), i = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, r = e.filters ?? a, d = (u) => {
|
|
593
|
+
var m;
|
|
594
|
+
o || s(u), (m = e.onFiltersChange) == null || m.call(e, u);
|
|
578
595
|
};
|
|
579
596
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
|
|
580
|
-
|
|
597
|
+
jn,
|
|
581
598
|
{
|
|
582
599
|
scope: i,
|
|
583
|
-
showKind: e.showKind ??
|
|
600
|
+
showKind: e.showKind ?? ka(i),
|
|
584
601
|
filters: r,
|
|
585
|
-
onFiltersChange:
|
|
602
|
+
onFiltersChange: d,
|
|
586
603
|
onOpenInEditor: e.onOpenInEditor
|
|
587
604
|
}
|
|
588
605
|
) });
|
|
589
606
|
}
|
|
590
|
-
function
|
|
607
|
+
function Ta({ title: e = "Logs", ...n }) {
|
|
591
608
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-logs", children: [
|
|
592
609
|
e !== null && /* @__PURE__ */ t("h2", { children: e }),
|
|
593
|
-
/* @__PURE__ */ t(
|
|
610
|
+
/* @__PURE__ */ t(Ca, { ...n })
|
|
594
611
|
] });
|
|
595
612
|
}
|
|
596
|
-
const
|
|
597
|
-
function
|
|
613
|
+
const Zs = Ta, Ea = 1440 * 60 * 1e3;
|
|
614
|
+
function Ia(e) {
|
|
598
615
|
if (!(e === null || e.timeline === null))
|
|
599
616
|
return e.timeline.map((n) => ({
|
|
600
617
|
id: n.id,
|
|
@@ -607,29 +624,29 @@ function Ca(e) {
|
|
|
607
624
|
link: n.link
|
|
608
625
|
}));
|
|
609
626
|
}
|
|
610
|
-
function
|
|
627
|
+
function $t(e) {
|
|
611
628
|
return e.startedAt !== void 0 && e.resolvedAt === void 0;
|
|
612
629
|
}
|
|
613
|
-
function
|
|
630
|
+
function We(e) {
|
|
614
631
|
const n = new Date(e);
|
|
615
632
|
return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
|
|
616
633
|
}
|
|
617
|
-
function
|
|
634
|
+
function Be(e, n) {
|
|
618
635
|
const a = new Date(e).getTime();
|
|
619
|
-
return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) /
|
|
636
|
+
return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / Ea));
|
|
620
637
|
}
|
|
621
|
-
function
|
|
622
|
-
if (
|
|
623
|
-
const a =
|
|
624
|
-
return `${i} · ${
|
|
638
|
+
function Aa(e, n) {
|
|
639
|
+
if (!$t(e) || e.startedAt === void 0) return null;
|
|
640
|
+
const a = Be(e.startedAt, n), s = We(e.startedAt), i = a === 0 ? `open since ${s} (today)` : `open ${a}d (since ${s})`, o = e.updatedAt ?? e.startedAt, r = Be(o, n), d = We(o), u = r === 0 ? `last update ${d} (today)` : `last update ${d} (${r}d ago)`;
|
|
641
|
+
return `${i} · ${u}`;
|
|
625
642
|
}
|
|
626
|
-
function
|
|
643
|
+
function Da(e) {
|
|
627
644
|
return e ? Object.entries(e) : [];
|
|
628
645
|
}
|
|
629
|
-
function
|
|
646
|
+
function $a(e) {
|
|
630
647
|
return e.uptime.map((n) => ({ day: n.day, state: n.state }));
|
|
631
648
|
}
|
|
632
|
-
const
|
|
649
|
+
const ce = [
|
|
633
650
|
["e4xx", "4xx"],
|
|
634
651
|
["e429", "429 rate-limited"],
|
|
635
652
|
["eAuth", "auth (401/403)"],
|
|
@@ -639,7 +656,7 @@ function Lt(e) {
|
|
|
639
656
|
const n = new Date(e);
|
|
640
657
|
return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
641
658
|
}
|
|
642
|
-
function
|
|
659
|
+
function Fe(e) {
|
|
643
660
|
if (!e) return "—";
|
|
644
661
|
const n = new Date(e);
|
|
645
662
|
return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
|
|
@@ -656,7 +673,7 @@ function ge({ label: e, value: n, hint: a }) {
|
|
|
656
673
|
a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
|
|
657
674
|
] });
|
|
658
675
|
}
|
|
659
|
-
function
|
|
676
|
+
function La({
|
|
660
677
|
vendor: e,
|
|
661
678
|
displayName: n
|
|
662
679
|
}) {
|
|
@@ -673,7 +690,7 @@ function Da({
|
|
|
673
690
|
", not a gap in the data above."
|
|
674
691
|
] })
|
|
675
692
|
] });
|
|
676
|
-
const a = e.state === "unknown", s =
|
|
693
|
+
const a = e.state === "unknown", s = Da(e.components), i = (e.timeline ?? []).filter($t), o = Date.now();
|
|
677
694
|
return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
|
|
678
695
|
/* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
|
|
679
696
|
n,
|
|
@@ -699,7 +716,7 @@ function Da({
|
|
|
699
716
|
n,
|
|
700
717
|
" says about itself, not what your calls did · last checked",
|
|
701
718
|
" ",
|
|
702
|
-
|
|
719
|
+
Fe(e.checkedAt),
|
|
703
720
|
e.attributedTo.length > 0 && /* @__PURE__ */ l(q, { children: [
|
|
704
721
|
" ",
|
|
705
722
|
"· decided by",
|
|
@@ -707,16 +724,16 @@ function Da({
|
|
|
707
724
|
e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
|
|
708
725
|
] })
|
|
709
726
|
] }),
|
|
710
|
-
s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map(([r,
|
|
727
|
+
s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map(([r, d]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
|
|
711
728
|
r,
|
|
712
729
|
": ",
|
|
713
|
-
|
|
730
|
+
d.state
|
|
714
731
|
] }, r)) }),
|
|
715
732
|
i.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("div", { className: "list-main", children: [
|
|
716
733
|
/* @__PURE__ */ t("strong", { children: r.title }),
|
|
717
734
|
" ",
|
|
718
735
|
/* @__PURE__ */ t(ve, { state: r.state }),
|
|
719
|
-
/* @__PURE__ */ t("div", { className: "muted small", children:
|
|
736
|
+
/* @__PURE__ */ t("div", { className: "muted small", children: Aa(r, o) })
|
|
720
737
|
] }) }, r.id ?? r.title)) }),
|
|
721
738
|
e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ l("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
722
739
|
n,
|
|
@@ -724,7 +741,7 @@ function Da({
|
|
|
724
741
|
] }) })
|
|
725
742
|
] });
|
|
726
743
|
}
|
|
727
|
-
function
|
|
744
|
+
function Sa({ service: e }) {
|
|
728
745
|
if (e.calls === 0)
|
|
729
746
|
return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
|
|
730
747
|
const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
|
|
@@ -749,17 +766,17 @@ function $a({ service: e }) {
|
|
|
749
766
|
/* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: "Calls per day, oldest first. Bar colour is that day's own state." })
|
|
750
767
|
] });
|
|
751
768
|
}
|
|
752
|
-
function
|
|
769
|
+
function Ma({
|
|
753
770
|
service: e,
|
|
754
771
|
window: n
|
|
755
772
|
}) {
|
|
756
|
-
const a = [...e.uptime].reverse().filter((r) => r.calls > 0), s = e.vendorStatus, i =
|
|
773
|
+
const a = [...e.uptime].reverse().filter((r) => r.calls > 0), s = e.vendorStatus, i = Ia(s), o = i === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
|
|
757
774
|
return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
|
|
758
775
|
/* @__PURE__ */ t(
|
|
759
776
|
Wt,
|
|
760
777
|
{
|
|
761
778
|
window: n,
|
|
762
|
-
days:
|
|
779
|
+
days: $a(e),
|
|
763
780
|
incidents: i,
|
|
764
781
|
vendorEmptyLabel: o,
|
|
765
782
|
ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
|
|
@@ -777,19 +794,19 @@ function Aa({
|
|
|
777
794
|
r.calls,
|
|
778
795
|
" calls"
|
|
779
796
|
] }),
|
|
780
|
-
/* @__PURE__ */ t("span", { className: "rel-errors", children:
|
|
781
|
-
|
|
797
|
+
/* @__PURE__ */ t("span", { className: "rel-errors", children: ce.filter(([d]) => r.errors[d] > 0).map(([d, u]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
|
|
798
|
+
u,
|
|
782
799
|
" ×",
|
|
783
|
-
r.errors[
|
|
784
|
-
] },
|
|
800
|
+
r.errors[d]
|
|
801
|
+
] }, d)) })
|
|
785
802
|
] }, r.day)) })
|
|
786
803
|
] });
|
|
787
804
|
}
|
|
788
|
-
function
|
|
789
|
-
if (
|
|
805
|
+
function xa({ errors: e }) {
|
|
806
|
+
if (ce.reduce((s, [i]) => s + e[i], 0) === 0)
|
|
790
807
|
return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
|
|
791
|
-
const a = Math.max(1, ...
|
|
792
|
-
return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children:
|
|
808
|
+
const a = Math.max(1, ...ce.map(([s]) => e[s]));
|
|
809
|
+
return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: ce.map(([s, i]) => /* @__PURE__ */ l("div", { className: "rel-errormix-row", children: [
|
|
793
810
|
/* @__PURE__ */ t("span", { className: "muted small", children: i }),
|
|
794
811
|
/* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
|
|
795
812
|
"span",
|
|
@@ -801,12 +818,12 @@ function La({ errors: e }) {
|
|
|
801
818
|
/* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
|
|
802
819
|
] }, s)) });
|
|
803
820
|
}
|
|
804
|
-
function
|
|
805
|
-
const a =
|
|
821
|
+
function Ra({ project: e, appId: n }) {
|
|
822
|
+
const a = Sn(e, n, { limit: 50 });
|
|
806
823
|
if (a.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
|
|
807
824
|
if (a.error) {
|
|
808
825
|
const i = a.error;
|
|
809
|
-
return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof
|
|
826
|
+
return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof lt, i.message) });
|
|
810
827
|
}
|
|
811
828
|
const s = a.data ?? [];
|
|
812
829
|
return s.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No calls captured for this service. Calls appear here once a workflow, function or ad-hoc invoke reaches it." }) : /* @__PURE__ */ l("div", { className: "rel-calls", children: [
|
|
@@ -818,7 +835,7 @@ function Sa({ project: e, appId: n }) {
|
|
|
818
835
|
/* @__PURE__ */ t("span", { children: "Took" })
|
|
819
836
|
] }),
|
|
820
837
|
s.map((i, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
|
|
821
|
-
/* @__PURE__ */ t("span", { className: "muted small", children:
|
|
838
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: Fe(i.createdAt) }),
|
|
822
839
|
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
|
|
823
840
|
/* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
|
|
824
841
|
/* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
|
|
@@ -826,13 +843,13 @@ function Sa({ project: e, appId: n }) {
|
|
|
826
843
|
] }, i.id ?? `${i.createdAt}-${o}`))
|
|
827
844
|
] });
|
|
828
845
|
}
|
|
829
|
-
function
|
|
846
|
+
function Pa({
|
|
830
847
|
backHref: e,
|
|
831
848
|
onBack: n
|
|
832
849
|
}) {
|
|
833
850
|
return e !== void 0 ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("a", { href: e, onClick: n, children: "← Back to all services" }) }) : n ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("button", { type: "button", className: "list-link", onClick: n, children: "← Back to all services" }) }) : null;
|
|
834
851
|
}
|
|
835
|
-
function
|
|
852
|
+
function Xs({
|
|
836
853
|
appId: e,
|
|
837
854
|
project: n,
|
|
838
855
|
days: a = 30,
|
|
@@ -840,22 +857,22 @@ function Js({
|
|
|
840
857
|
onBack: i,
|
|
841
858
|
slots: o
|
|
842
859
|
}) {
|
|
843
|
-
var
|
|
844
|
-
const r =
|
|
860
|
+
var k, w, b, y;
|
|
861
|
+
const r = xe().project, d = (n === void 0 ? r : n) || void 0, u = Ln(d, [e], a), m = u.error, g = m ? (m instanceof lt, m.message) : null, h = (k = u.data) == null ? void 0 : k.services.find((E) => E.appId === e);
|
|
845
862
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
846
863
|
o == null ? void 0 : o.header,
|
|
847
864
|
o == null ? void 0 : o.actions,
|
|
848
|
-
!
|
|
865
|
+
!d && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
|
|
849
866
|
g && /* @__PURE__ */ t("div", { className: "error", children: g }),
|
|
850
|
-
|
|
851
|
-
|
|
867
|
+
d && u.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
868
|
+
u.data && !h && /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
|
|
852
869
|
(o == null ? void 0 : o.empty) ?? /* @__PURE__ */ l("p", { className: "muted", children: [
|
|
853
870
|
/* @__PURE__ */ t("code", { children: e }),
|
|
854
871
|
" is not used by this project's definitions and has no calls in the last ",
|
|
855
872
|
a,
|
|
856
873
|
" days."
|
|
857
874
|
] }),
|
|
858
|
-
/* @__PURE__ */ t(
|
|
875
|
+
/* @__PURE__ */ t(Pa, { backHref: s, onBack: i })
|
|
859
876
|
] }),
|
|
860
877
|
h && /* @__PURE__ */ l(q, { children: [
|
|
861
878
|
/* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
|
|
@@ -886,38 +903,38 @@ function Js({
|
|
|
886
903
|
hint: h.p95Ms === null ? "no timed calls" : void 0
|
|
887
904
|
}
|
|
888
905
|
),
|
|
889
|
-
/* @__PURE__ */ t(ge, { label: "Last call", value:
|
|
906
|
+
/* @__PURE__ */ t(ge, { label: "Last call", value: Fe(h.lastCallAt) }),
|
|
890
907
|
/* @__PURE__ */ t(
|
|
891
908
|
ge,
|
|
892
909
|
{
|
|
893
910
|
label: "Errors",
|
|
894
|
-
value: String(
|
|
895
|
-
hint:
|
|
911
|
+
value: String(ce.reduce((E, [I]) => E + h.errors[I], 0)),
|
|
912
|
+
hint: ce.filter(([E]) => h.errors[E] > 0).map(([E, I]) => `${I} ×${h.errors[E]}`).join(" · ") || "none"
|
|
896
913
|
}
|
|
897
914
|
)
|
|
898
915
|
] })
|
|
899
916
|
] }),
|
|
900
917
|
/* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
|
|
901
918
|
/* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
|
|
902
|
-
/* @__PURE__ */ t(
|
|
919
|
+
/* @__PURE__ */ t(xa, { errors: h.errors })
|
|
903
920
|
] }),
|
|
904
921
|
/* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
|
|
905
922
|
/* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
|
|
906
|
-
/* @__PURE__ */ t(
|
|
923
|
+
/* @__PURE__ */ t(La, { vendor: h.vendorStatus, displayName: h.displayName })
|
|
907
924
|
] }),
|
|
908
925
|
/* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
|
|
909
926
|
/* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
|
|
910
927
|
"Last ",
|
|
911
|
-
((w =
|
|
928
|
+
((w = u.data) == null ? void 0 : w.window.days) ?? a,
|
|
912
929
|
" days",
|
|
913
930
|
" ",
|
|
914
931
|
/* @__PURE__ */ l("span", { className: "muted small", children: [
|
|
915
932
|
"uptime means ",
|
|
916
|
-
(
|
|
933
|
+
(b = u.data) == null ? void 0 : b.uptimeMeans
|
|
917
934
|
] })
|
|
918
935
|
] }),
|
|
919
|
-
/* @__PURE__ */ t(
|
|
920
|
-
/* @__PURE__ */ t(
|
|
936
|
+
/* @__PURE__ */ t(Ma, { service: h, window: ((y = u.data) == null ? void 0 : y.window) ?? { from: "", to: "" } }),
|
|
937
|
+
/* @__PURE__ */ t(Sa, { service: h })
|
|
921
938
|
] }),
|
|
922
939
|
/* @__PURE__ */ l("section", { children: [
|
|
923
940
|
/* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
|
|
@@ -925,12 +942,12 @@ function Js({
|
|
|
925
942
|
" ",
|
|
926
943
|
/* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
|
|
927
944
|
] }),
|
|
928
|
-
/* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(
|
|
945
|
+
/* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(Ra, { project: d, appId: h.appId }) })
|
|
929
946
|
] })
|
|
930
947
|
] })
|
|
931
948
|
] });
|
|
932
949
|
}
|
|
933
|
-
function
|
|
950
|
+
function Ka(e) {
|
|
934
951
|
if (typeof e == "string") return e;
|
|
935
952
|
if (e && typeof e == "object") {
|
|
936
953
|
const n = e;
|
|
@@ -939,11 +956,11 @@ function xa(e) {
|
|
|
939
956
|
}
|
|
940
957
|
return String(e);
|
|
941
958
|
}
|
|
942
|
-
function
|
|
959
|
+
function Oa({
|
|
943
960
|
routes: e,
|
|
944
961
|
projectId: n
|
|
945
962
|
}) {
|
|
946
|
-
const [a, s] =
|
|
963
|
+
const [a, s] = p(null), i = e.find((o) => o.id === a);
|
|
947
964
|
return e.length === 0 ? null : /* @__PURE__ */ l(q, { children: [
|
|
948
965
|
/* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((o) => /* @__PURE__ */ l("li", { "data-testid": `connection-dependent-route-${o.id}`, children: [
|
|
949
966
|
/* @__PURE__ */ t("span", { className: "badge", children: "route" }),
|
|
@@ -966,7 +983,7 @@ function Ra({
|
|
|
966
983
|
] })
|
|
967
984
|
] }, o.id)) }),
|
|
968
985
|
i != null && /* @__PURE__ */ t(
|
|
969
|
-
|
|
986
|
+
Fa,
|
|
970
987
|
{
|
|
971
988
|
routeId: i.id,
|
|
972
989
|
projectId: i.project ?? n,
|
|
@@ -975,9 +992,9 @@ function Ra({
|
|
|
975
992
|
)
|
|
976
993
|
] });
|
|
977
994
|
}
|
|
978
|
-
function
|
|
995
|
+
function Fa(e) {
|
|
979
996
|
return /* @__PURE__ */ l("div", { "data-testid": "connection-route-reconnect-host", children: [
|
|
980
|
-
/* @__PURE__ */ t(
|
|
997
|
+
/* @__PURE__ */ t(_n, { projectId: e.projectId, initialEditRouteId: e.routeId }),
|
|
981
998
|
/* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
|
|
982
999
|
] });
|
|
983
1000
|
}
|
|
@@ -988,16 +1005,16 @@ function St({
|
|
|
988
1005
|
projectId: s
|
|
989
1006
|
}) {
|
|
990
1007
|
return /* @__PURE__ */ l(q, { children: [
|
|
991
|
-
/* @__PURE__ */ t(
|
|
992
|
-
/* @__PURE__ */ t(
|
|
1008
|
+
/* @__PURE__ */ t(Oa, { routes: a ?? [], projectId: s }),
|
|
1009
|
+
/* @__PURE__ */ t(ja, { callables: e, onOpenCallable: n })
|
|
993
1010
|
] });
|
|
994
1011
|
}
|
|
995
|
-
function
|
|
1012
|
+
function ja({
|
|
996
1013
|
callables: e,
|
|
997
1014
|
onOpenCallable: n
|
|
998
1015
|
}) {
|
|
999
1016
|
return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((a) => {
|
|
1000
|
-
const s = a.displayName || a.key || a.id, i = a.sites.map(
|
|
1017
|
+
const s = a.displayName || a.key || a.id, i = a.sites.map(Ka);
|
|
1001
1018
|
return /* @__PURE__ */ l("li", { children: [
|
|
1002
1019
|
/* @__PURE__ */ t("span", { className: "badge", children: a.kind }),
|
|
1003
1020
|
" ",
|
|
@@ -1018,8 +1035,8 @@ function Oa({
|
|
|
1018
1035
|
] }, `${a.kind}:${a.id}`);
|
|
1019
1036
|
}) });
|
|
1020
1037
|
}
|
|
1021
|
-
const
|
|
1022
|
-
function
|
|
1038
|
+
const Qa = [];
|
|
1039
|
+
function ei({
|
|
1023
1040
|
onOpen: e,
|
|
1024
1041
|
getHref: n,
|
|
1025
1042
|
addLabel: a,
|
|
@@ -1027,64 +1044,64 @@ function Gs({
|
|
|
1027
1044
|
onOpenCallable: i,
|
|
1028
1045
|
onCreateSharedCredential: o
|
|
1029
1046
|
}) {
|
|
1030
|
-
var R,
|
|
1031
|
-
const r =
|
|
1047
|
+
var R, F;
|
|
1048
|
+
const r = Ze(), d = fe(), u = ot(), g = u.data ?? Qa, h = oe(() => Xe(g), [g]), { byId: k } = it(h), w = ct(), [b, y] = p(!1), [E, I] = p(null), [v, f] = p(null), T = ne(void 0), N = dt((v == null ? void 0 : v.id) ?? "", v !== null), K = typeof r.updateConnection == "function", M = s && "actions" in s ? s.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => y(!0), children: a ?? "+ Add connection" });
|
|
1032
1049
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
1033
1050
|
/* @__PURE__ */ t(
|
|
1034
1051
|
Bt,
|
|
1035
1052
|
{
|
|
1036
1053
|
connections: g,
|
|
1037
|
-
appsById:
|
|
1038
|
-
loading:
|
|
1039
|
-
error:
|
|
1054
|
+
appsById: k,
|
|
1055
|
+
loading: u.isLoading,
|
|
1056
|
+
error: u.error ? u.error.message : null,
|
|
1040
1057
|
onOpen: e,
|
|
1041
1058
|
getHref: n,
|
|
1042
|
-
onEdit:
|
|
1043
|
-
onDelete:
|
|
1059
|
+
onEdit: K ? I : void 0,
|
|
1060
|
+
onDelete: f,
|
|
1044
1061
|
busy: w.isPending,
|
|
1045
1062
|
slots: { ...s, actions: M }
|
|
1046
1063
|
}
|
|
1047
1064
|
),
|
|
1048
|
-
|
|
1065
|
+
b && /* @__PURE__ */ t(
|
|
1049
1066
|
Ut,
|
|
1050
1067
|
{
|
|
1051
1068
|
onCreateSharedCredential: o,
|
|
1052
1069
|
onClose: () => y(!1),
|
|
1053
1070
|
onCreated: () => {
|
|
1054
|
-
y(!1),
|
|
1071
|
+
y(!1), d.invalidateQueries({ queryKey: de });
|
|
1055
1072
|
}
|
|
1056
1073
|
}
|
|
1057
1074
|
),
|
|
1058
|
-
|
|
1059
|
-
|
|
1075
|
+
E && /* @__PURE__ */ t(
|
|
1076
|
+
et,
|
|
1060
1077
|
{
|
|
1061
|
-
connection:
|
|
1062
|
-
onClose: () =>
|
|
1078
|
+
connection: E,
|
|
1079
|
+
onClose: () => I(null),
|
|
1063
1080
|
onSaved: () => {
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1081
|
+
const O = E.id;
|
|
1082
|
+
I(null), d.invalidateQueries({ queryKey: de }), d.invalidateQueries({ queryKey: Se(O) });
|
|
1066
1083
|
}
|
|
1067
1084
|
}
|
|
1068
1085
|
),
|
|
1069
|
-
|
|
1070
|
-
|
|
1086
|
+
v && /* @__PURE__ */ t(
|
|
1087
|
+
qa,
|
|
1071
1088
|
{
|
|
1072
|
-
name:
|
|
1089
|
+
name: v.displayName || v.id,
|
|
1073
1090
|
loading: N.isLoading,
|
|
1074
1091
|
callables: N.isError ? [] : ((R = N.data) == null ? void 0 : R.callables) ?? [],
|
|
1075
|
-
routes: N.isError ? [] : ((
|
|
1076
|
-
projectId:
|
|
1092
|
+
routes: N.isError ? [] : ((F = N.data) == null ? void 0 : F.routes) ?? [],
|
|
1093
|
+
projectId: T,
|
|
1077
1094
|
onOpenCallable: i,
|
|
1078
|
-
onClose: () =>
|
|
1095
|
+
onClose: () => f(null),
|
|
1079
1096
|
onConfirm: () => {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1097
|
+
const O = v.id;
|
|
1098
|
+
f(null), w.mutate({ id: O, force: !0 });
|
|
1082
1099
|
}
|
|
1083
1100
|
}
|
|
1084
1101
|
)
|
|
1085
1102
|
] });
|
|
1086
1103
|
}
|
|
1087
|
-
function
|
|
1104
|
+
function qa({
|
|
1088
1105
|
name: e,
|
|
1089
1106
|
loading: n,
|
|
1090
1107
|
callables: a,
|
|
@@ -1092,14 +1109,14 @@ function Fa({
|
|
|
1092
1109
|
projectId: i,
|
|
1093
1110
|
onOpenCallable: o,
|
|
1094
1111
|
onClose: r,
|
|
1095
|
-
onConfirm:
|
|
1112
|
+
onConfirm: d
|
|
1096
1113
|
}) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
].filter(Boolean).join(" and "),
|
|
1101
|
-
|
|
1102
|
-
|
|
1114
|
+
const u = a.length, m = s.length, g = u + m, h = `Delete the connection "${e}"? This cannot be undone.`, k = (y, E, I) => `${y} ${y === 1 ? E : I}`, w = [
|
|
1115
|
+
u > 0 ? k(u, "callable", "callables") : null,
|
|
1116
|
+
m > 0 ? k(m, "model route", "model routes") : null
|
|
1117
|
+
].filter(Boolean).join(" and "), b = [
|
|
1118
|
+
u > 0 ? `Deleting disables ${u === 1 ? "this callable" : `these ${u} callables`} until you reconnect ${u === 1 ? "it" : "them"}.` : null,
|
|
1119
|
+
m > 0 ? `${m === 1 ? "The model route becomes" : `The ${m} model routes become`} broken until ${m === 1 ? "it is" : "they are"} pointed at another connection.` : null
|
|
1103
1120
|
].filter((y) => y != null);
|
|
1104
1121
|
return /* @__PURE__ */ l(Ht, { title: "Delete connection", onClose: r, children: [
|
|
1105
1122
|
/* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
|
|
@@ -1114,7 +1131,7 @@ function Fa({
|
|
|
1114
1131
|
onOpenCallable: o
|
|
1115
1132
|
}
|
|
1116
1133
|
),
|
|
1117
|
-
/* @__PURE__ */ t("p", { className: "w6w-small", children:
|
|
1134
|
+
/* @__PURE__ */ t("p", { className: "w6w-small", children: b.join(" ") })
|
|
1118
1135
|
] })
|
|
1119
1136
|
] }),
|
|
1120
1137
|
/* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
|
|
@@ -1125,14 +1142,14 @@ function Fa({
|
|
|
1125
1142
|
type: "button",
|
|
1126
1143
|
className: "w6w-btn w6w-btn-danger",
|
|
1127
1144
|
disabled: n,
|
|
1128
|
-
onClick:
|
|
1145
|
+
onClick: d,
|
|
1129
1146
|
children: "Delete"
|
|
1130
1147
|
}
|
|
1131
1148
|
)
|
|
1132
1149
|
] })
|
|
1133
1150
|
] });
|
|
1134
1151
|
}
|
|
1135
|
-
function
|
|
1152
|
+
function $e(e) {
|
|
1136
1153
|
const n = new Date(e).getTime();
|
|
1137
1154
|
if (Number.isNaN(n)) return "recently";
|
|
1138
1155
|
const a = Math.max(0, Math.round((Date.now() - n) / 1e3));
|
|
@@ -1144,259 +1161,278 @@ function Ae(e) {
|
|
|
1144
1161
|
const o = Math.round(i / 24);
|
|
1145
1162
|
return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
|
|
1146
1163
|
}
|
|
1147
|
-
const
|
|
1164
|
+
const _a = {
|
|
1148
1165
|
ok: 6e3,
|
|
1149
1166
|
warn: 1e4,
|
|
1150
1167
|
error: 15e3
|
|
1151
|
-
},
|
|
1152
|
-
function
|
|
1168
|
+
}, Va = { ok: "✓", warn: "!", error: "✕" };
|
|
1169
|
+
function ti({
|
|
1153
1170
|
connectionId: e,
|
|
1154
1171
|
onOpenAction: n,
|
|
1155
1172
|
onBack: a,
|
|
1156
1173
|
onOpenCallable: s,
|
|
1157
1174
|
slots: i
|
|
1158
1175
|
}) {
|
|
1159
|
-
var
|
|
1160
|
-
const o =
|
|
1161
|
-
() =>
|
|
1162
|
-
[
|
|
1163
|
-
), { byId: g } =
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1176
|
+
var ee, $, j, H, Z;
|
|
1177
|
+
const o = Ze(), r = fe(), d = Qn(e), u = (ee = d.data) == null ? void 0 : ee.appId, m = oe(
|
|
1178
|
+
() => Xe(d.data ? [d.data] : []),
|
|
1179
|
+
[d.data]
|
|
1180
|
+
), { byId: g } = it(m), h = d.data ? Yt(d.data, g) : void 0, k = Vn(u, !!u), w = ($ = d.data) == null ? void 0 : $.authKey, y = (j = Ke({
|
|
1181
|
+
queryKey: ["app-auth", u ?? ""],
|
|
1182
|
+
queryFn: () => o.getAppAuth(u),
|
|
1183
|
+
enabled: !!u && typeof o.getAppAuth == "function",
|
|
1184
|
+
retry: !1
|
|
1185
|
+
}).data) == null ? void 0 : j.find((C) => C.key === w), E = !!y && (!!y.description || (((H = y.setup) == null ? void 0 : H.length) ?? 0) > 0 || (((Z = y.serviceAccount) == null ? void 0 : Z.scopes.length) ?? 0) > 0), I = Mn(e), v = oe(() => {
|
|
1186
|
+
const C = /* @__PURE__ */ new Map();
|
|
1187
|
+
for (const Q of I.data ?? []) {
|
|
1188
|
+
const c = C.get(Q.actionKey) ?? [];
|
|
1189
|
+
c.push(Q), C.set(Q.actionKey, c);
|
|
1168
1190
|
}
|
|
1169
|
-
return
|
|
1170
|
-
}, [
|
|
1191
|
+
return C;
|
|
1192
|
+
}, [I.data]), f = dt(e).data, T = ne(void 0), N = (f == null ? void 0 : f.callables) ?? [], K = (f == null ? void 0 : f.routes) ?? [], M = xn(e).data ?? [], [R, F] = p(!1), [O, _] = p(""), A = ut(e), [P, x] = p(null);
|
|
1171
1193
|
xt(() => {
|
|
1172
|
-
if (!
|
|
1173
|
-
const
|
|
1174
|
-
return () => clearTimeout(
|
|
1175
|
-
}, [
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
onSuccess: (
|
|
1179
|
-
var
|
|
1180
|
-
if (!
|
|
1181
|
-
|
|
1194
|
+
if (!P) return;
|
|
1195
|
+
const C = setTimeout(() => x(null), _a[P.kind]);
|
|
1196
|
+
return () => clearTimeout(C);
|
|
1197
|
+
}, [P]);
|
|
1198
|
+
const D = () => {
|
|
1199
|
+
x(null), A.mutate(void 0, {
|
|
1200
|
+
onSuccess: (C) => {
|
|
1201
|
+
var Q;
|
|
1202
|
+
if (!C.ok) {
|
|
1203
|
+
x({
|
|
1182
1204
|
kind: "error",
|
|
1183
|
-
text: `Connection test failed${(
|
|
1205
|
+
text: `Connection test failed${(Q = C.error) != null && Q.message ? `: ${C.error.message}` : "."}`
|
|
1184
1206
|
});
|
|
1185
1207
|
return;
|
|
1186
1208
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1209
|
+
x(
|
|
1210
|
+
C.untested ? { kind: "warn", text: `Connection stored. ${C.message ?? ""}`.trim() } : {
|
|
1189
1211
|
kind: "ok",
|
|
1190
|
-
text: `Connection is valid${
|
|
1212
|
+
text: `Connection is valid${C.actionKey ? ` — probed ${C.actionKey}` : ""}.`
|
|
1191
1213
|
}
|
|
1192
1214
|
);
|
|
1193
1215
|
},
|
|
1194
|
-
onError: (
|
|
1216
|
+
onError: (C) => x({ kind: "error", text: (C == null ? void 0 : C.message) ?? "Test failed." })
|
|
1195
1217
|
});
|
|
1196
|
-
},
|
|
1197
|
-
var
|
|
1198
|
-
const
|
|
1199
|
-
return
|
|
1200
|
-
}, [
|
|
1201
|
-
const
|
|
1202
|
-
return
|
|
1203
|
-
(
|
|
1204
|
-
) :
|
|
1205
|
-
}, [
|
|
1206
|
-
if (
|
|
1218
|
+
}, S = oe(() => {
|
|
1219
|
+
var Q;
|
|
1220
|
+
const C = [...((Q = k.data) == null ? void 0 : Q.actions) ?? []];
|
|
1221
|
+
return C.sort((c, L) => (c.title || c.key).localeCompare(L.title || L.key)), C;
|
|
1222
|
+
}, [k.data]), V = oe(() => {
|
|
1223
|
+
const C = O.trim().toLowerCase();
|
|
1224
|
+
return C ? S.filter(
|
|
1225
|
+
(Q) => (Q.title || "").toLowerCase().includes(C) || Q.key.toLowerCase().includes(C) || (Q.description || "").toLowerCase().includes(C)
|
|
1226
|
+
) : S;
|
|
1227
|
+
}, [S, O]);
|
|
1228
|
+
if (d.isLoading || k.isLoading)
|
|
1207
1229
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
|
|
1208
|
-
if (!
|
|
1230
|
+
if (!d.data)
|
|
1209
1231
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
|
|
1210
1232
|
(i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
|
|
1211
1233
|
a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "Back to integrations" })
|
|
1212
1234
|
] });
|
|
1213
|
-
const
|
|
1235
|
+
const U = d.data, W = k.data, J = !U.builtIn && typeof o.updateConnection == "function";
|
|
1214
1236
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
|
|
1215
|
-
(i == null ? void 0 : i.header) ?? /* @__PURE__ */ l(zt, { conn:
|
|
1237
|
+
(i == null ? void 0 : i.header) ?? /* @__PURE__ */ l(zt, { conn: U, app: h, children: [
|
|
1216
1238
|
/* @__PURE__ */ t(
|
|
1217
1239
|
"button",
|
|
1218
1240
|
{
|
|
1219
1241
|
type: "button",
|
|
1220
1242
|
className: "w6w-btn w6w-btn-ghost",
|
|
1221
|
-
disabled:
|
|
1222
|
-
onClick:
|
|
1223
|
-
children:
|
|
1243
|
+
disabled: A.isPending,
|
|
1244
|
+
onClick: D,
|
|
1245
|
+
children: A.isPending ? "Testing…" : "Test connection"
|
|
1224
1246
|
}
|
|
1225
1247
|
),
|
|
1226
|
-
|
|
1227
|
-
|
|
1248
|
+
J && /* @__PURE__ */ t(
|
|
1249
|
+
Jt,
|
|
1228
1250
|
{
|
|
1229
1251
|
label: "Edit",
|
|
1230
|
-
onClick: () =>
|
|
1252
|
+
onClick: () => F(!0),
|
|
1231
1253
|
"data-testid": "connection-detail-edit"
|
|
1232
1254
|
}
|
|
1233
1255
|
),
|
|
1234
1256
|
i == null ? void 0 : i.actions
|
|
1235
1257
|
] }),
|
|
1236
|
-
|
|
1258
|
+
P && /* @__PURE__ */ l(
|
|
1237
1259
|
"div",
|
|
1238
1260
|
{
|
|
1239
|
-
className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${
|
|
1240
|
-
role:
|
|
1241
|
-
"aria-live":
|
|
1261
|
+
className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${P.kind}`,
|
|
1262
|
+
role: P.kind === "error" ? "alert" : "status",
|
|
1263
|
+
"aria-live": P.kind === "error" ? "assertive" : "polite",
|
|
1242
1264
|
"data-testid": "connection-test-notice",
|
|
1243
1265
|
children: [
|
|
1244
|
-
/* @__PURE__ */ t("span", { "aria-hidden": "true", children:
|
|
1245
|
-
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children:
|
|
1246
|
-
/* @__PURE__ */ t(
|
|
1266
|
+
/* @__PURE__ */ t("span", { "aria-hidden": "true", children: Va[P.kind] }),
|
|
1267
|
+
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: P.text }),
|
|
1268
|
+
/* @__PURE__ */ t(Gt, { icon: "close", label: "Dismiss", onClick: () => x(null) })
|
|
1247
1269
|
]
|
|
1248
1270
|
}
|
|
1249
1271
|
),
|
|
1250
1272
|
/* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
|
|
1251
1273
|
/* @__PURE__ */ l("h3", { children: [
|
|
1252
1274
|
"App: ",
|
|
1253
|
-
(h == null ? void 0 : h.displayName) ??
|
|
1275
|
+
(h == null ? void 0 : h.displayName) ?? U.appId
|
|
1254
1276
|
] }),
|
|
1255
|
-
|
|
1277
|
+
W && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
|
|
1256
1278
|
"Version ",
|
|
1257
1279
|
/* @__PURE__ */ l("code", { children: [
|
|
1258
1280
|
"v",
|
|
1259
|
-
|
|
1281
|
+
W.version ?? "?"
|
|
1260
1282
|
] }),
|
|
1261
1283
|
" · source ",
|
|
1262
|
-
/* @__PURE__ */ t("code", { children:
|
|
1284
|
+
/* @__PURE__ */ t("code", { children: W.sourceRef })
|
|
1263
1285
|
] }),
|
|
1264
1286
|
a && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "← Integrations" }) })
|
|
1265
1287
|
] }),
|
|
1288
|
+
E && y && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-auth-guide", children: [
|
|
1289
|
+
/* @__PURE__ */ t("h3", { children: "How to connect" }),
|
|
1290
|
+
/* @__PURE__ */ t(Zt, { auth: y })
|
|
1291
|
+
] }),
|
|
1292
|
+
/* @__PURE__ */ t(
|
|
1293
|
+
Xt,
|
|
1294
|
+
{
|
|
1295
|
+
conn: U,
|
|
1296
|
+
className: "w6w-embed-conn-card",
|
|
1297
|
+
onChanged: () => {
|
|
1298
|
+
r.invalidateQueries({ queryKey: Se(e) }), r.invalidateQueries({ queryKey: de });
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
),
|
|
1266
1302
|
/* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
|
|
1267
1303
|
/* @__PURE__ */ t("h3", { children: "Actions" }),
|
|
1268
|
-
|
|
1269
|
-
|
|
1304
|
+
S.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
|
|
1305
|
+
S.length > 10 && /* @__PURE__ */ t(
|
|
1270
1306
|
"input",
|
|
1271
1307
|
{
|
|
1272
1308
|
type: "search",
|
|
1273
|
-
value:
|
|
1274
|
-
placeholder: `Search ${
|
|
1275
|
-
onChange: (
|
|
1309
|
+
value: O,
|
|
1310
|
+
placeholder: `Search ${S.length} actions…`,
|
|
1311
|
+
onChange: (C) => _(C.target.value),
|
|
1276
1312
|
"aria-label": "Filter actions",
|
|
1277
1313
|
className: "w6w-embed-conn-filter"
|
|
1278
1314
|
}
|
|
1279
1315
|
),
|
|
1280
|
-
|
|
1316
|
+
S.length > 0 && V.length === 0 && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
|
|
1281
1317
|
"No actions match “",
|
|
1282
|
-
|
|
1318
|
+
O,
|
|
1283
1319
|
"”."
|
|
1284
1320
|
] }),
|
|
1285
|
-
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children:
|
|
1286
|
-
const
|
|
1321
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: V.map((C) => {
|
|
1322
|
+
const Q = v.get(C.key) ?? [];
|
|
1287
1323
|
return /* @__PURE__ */ l("li", { children: [
|
|
1288
1324
|
/* @__PURE__ */ l(
|
|
1289
1325
|
"button",
|
|
1290
1326
|
{
|
|
1291
1327
|
type: "button",
|
|
1292
1328
|
className: "w6w-embed-conn-action",
|
|
1293
|
-
"data-testid": `connection-action-${
|
|
1294
|
-
onClick: () => n(
|
|
1329
|
+
"data-testid": `connection-action-${C.key}`,
|
|
1330
|
+
onClick: () => n(C.key),
|
|
1295
1331
|
children: [
|
|
1296
|
-
/* @__PURE__ */ t("strong", { children:
|
|
1332
|
+
/* @__PURE__ */ t("strong", { children: C.title }),
|
|
1297
1333
|
" ",
|
|
1298
|
-
/* @__PURE__ */ t("code", { className: "w6w-muted", children:
|
|
1334
|
+
/* @__PURE__ */ t("code", { className: "w6w-muted", children: C.key }),
|
|
1299
1335
|
" ",
|
|
1300
|
-
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children:
|
|
1301
|
-
|
|
1336
|
+
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: C.type }),
|
|
1337
|
+
C.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: C.description })
|
|
1302
1338
|
]
|
|
1303
1339
|
}
|
|
1304
1340
|
),
|
|
1305
|
-
|
|
1341
|
+
Q.length > 0 && /* @__PURE__ */ t(
|
|
1306
1342
|
"ul",
|
|
1307
1343
|
{
|
|
1308
1344
|
className: "w6w-embed-conn-list w6w-embed-conn-tests",
|
|
1309
|
-
"aria-label": `Saved tests for ${
|
|
1310
|
-
children:
|
|
1345
|
+
"aria-label": `Saved tests for ${C.title || C.key}`,
|
|
1346
|
+
children: Q.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
1311
1347
|
Le,
|
|
1312
1348
|
{
|
|
1313
|
-
title:
|
|
1314
|
-
subtitle:
|
|
1349
|
+
title: c.name,
|
|
1350
|
+
subtitle: c.lastRunAt ? /* @__PURE__ */ l("span", { children: [
|
|
1315
1351
|
/* @__PURE__ */ t(
|
|
1316
1352
|
"span",
|
|
1317
1353
|
{
|
|
1318
|
-
className:
|
|
1319
|
-
children:
|
|
1354
|
+
className: c.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
|
|
1355
|
+
children: c.lastRunOk ? "✓" : "✗"
|
|
1320
1356
|
}
|
|
1321
1357
|
),
|
|
1322
1358
|
" ",
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
] }) : `saved ${
|
|
1326
|
-
onClick: () => n(
|
|
1359
|
+
c.lastRunSummary ? `${c.lastRunSummary} · ` : "",
|
|
1360
|
+
$e(c.lastRunAt)
|
|
1361
|
+
] }) : `saved ${$e(c.updatedAt)}`,
|
|
1362
|
+
onClick: () => n(C.key, c.id)
|
|
1327
1363
|
}
|
|
1328
|
-
) },
|
|
1364
|
+
) }, c.id))
|
|
1329
1365
|
}
|
|
1330
1366
|
)
|
|
1331
|
-
] },
|
|
1367
|
+
] }, C.key);
|
|
1332
1368
|
}) })
|
|
1333
1369
|
] }),
|
|
1334
|
-
|
|
1370
|
+
f && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
|
|
1335
1371
|
/* @__PURE__ */ t("h3", { children: "Used by" }),
|
|
1336
|
-
|
|
1372
|
+
N.length === 0 && K.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
|
|
1337
1373
|
St,
|
|
1338
1374
|
{
|
|
1339
|
-
callables:
|
|
1340
|
-
routes:
|
|
1341
|
-
projectId:
|
|
1375
|
+
callables: N,
|
|
1376
|
+
routes: K,
|
|
1377
|
+
projectId: T,
|
|
1342
1378
|
onOpenCallable: s
|
|
1343
1379
|
}
|
|
1344
1380
|
)
|
|
1345
1381
|
] }),
|
|
1346
|
-
|
|
1382
|
+
M.length > 0 && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
|
|
1347
1383
|
/* @__PURE__ */ t("h3", { children: "Recent runs" }),
|
|
1348
1384
|
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
|
|
1349
|
-
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children:
|
|
1385
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: M.map((C) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
1350
1386
|
Le,
|
|
1351
1387
|
{
|
|
1352
|
-
title:
|
|
1388
|
+
title: C.actionKey,
|
|
1353
1389
|
subtitle: /* @__PURE__ */ l("span", { children: [
|
|
1354
|
-
/* @__PURE__ */ t("span", { className:
|
|
1390
|
+
/* @__PURE__ */ t("span", { className: C.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: C.ok ? "✓" : "✗" }),
|
|
1355
1391
|
" ",
|
|
1356
|
-
|
|
1357
|
-
|
|
1392
|
+
C.summary ? `${C.summary} · ` : "",
|
|
1393
|
+
$e(C.occurredAt)
|
|
1358
1394
|
] })
|
|
1359
1395
|
}
|
|
1360
|
-
) },
|
|
1396
|
+
) }, C.id)) })
|
|
1361
1397
|
] }),
|
|
1362
|
-
|
|
1363
|
-
|
|
1398
|
+
R && /* @__PURE__ */ t(
|
|
1399
|
+
et,
|
|
1364
1400
|
{
|
|
1365
|
-
connection:
|
|
1366
|
-
onClose: () =>
|
|
1401
|
+
connection: U,
|
|
1402
|
+
onClose: () => F(!1),
|
|
1367
1403
|
onSaved: () => {
|
|
1368
|
-
|
|
1404
|
+
F(!1), r.invalidateQueries({ queryKey: Se(e) }), r.invalidateQueries({ queryKey: de });
|
|
1369
1405
|
}
|
|
1370
1406
|
}
|
|
1371
1407
|
)
|
|
1372
1408
|
] });
|
|
1373
1409
|
}
|
|
1374
|
-
const
|
|
1375
|
-
function
|
|
1410
|
+
const Wa = {};
|
|
1411
|
+
function Ue(e) {
|
|
1376
1412
|
return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1377
1413
|
}
|
|
1378
|
-
function
|
|
1414
|
+
function pe(e) {
|
|
1379
1415
|
return (e / 100).toFixed(2);
|
|
1380
1416
|
}
|
|
1381
|
-
function
|
|
1417
|
+
function Ba(e) {
|
|
1382
1418
|
if (e == null) return null;
|
|
1383
1419
|
const n = e.rates, a = [];
|
|
1384
|
-
return n.input != null && a.push(`in ${
|
|
1420
|
+
return n.input != null && a.push(`in ${pe(n.input)}`), n.output != null && a.push(`out ${pe(n.output)}`), n.cachedInput != null && a.push(`cached ${pe(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${pe(n.cacheWrite)}`), n.perRequest != null && a.push(`${pe(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
|
|
1385
1421
|
}
|
|
1386
|
-
function
|
|
1422
|
+
function Ua(e) {
|
|
1387
1423
|
const { maxInputTokens: n, maxOutputTokens: a } = e.limits ?? {};
|
|
1388
1424
|
return n == null && a == null ? "—" : /* @__PURE__ */ l("div", { className: "model-catalog-limits", children: [
|
|
1389
1425
|
n != null && /* @__PURE__ */ l("span", { children: [
|
|
1390
|
-
|
|
1426
|
+
Ue(n),
|
|
1391
1427
|
" input"
|
|
1392
1428
|
] }),
|
|
1393
1429
|
a != null && /* @__PURE__ */ l("span", { children: [
|
|
1394
|
-
|
|
1430
|
+
Ue(a),
|
|
1395
1431
|
" output"
|
|
1396
1432
|
] })
|
|
1397
1433
|
] });
|
|
1398
1434
|
}
|
|
1399
|
-
const
|
|
1435
|
+
const Ha = [
|
|
1400
1436
|
{
|
|
1401
1437
|
key: "model",
|
|
1402
1438
|
header: "Model",
|
|
@@ -1418,7 +1454,7 @@ const Wa = [
|
|
|
1418
1454
|
header: "Price / 1M tokens",
|
|
1419
1455
|
width: "28%",
|
|
1420
1456
|
render: (e) => {
|
|
1421
|
-
const n =
|
|
1457
|
+
const n = Ba(e.currentRate);
|
|
1422
1458
|
return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "Not configured" }) : /* @__PURE__ */ t(
|
|
1423
1459
|
"span",
|
|
1424
1460
|
{
|
|
@@ -1433,16 +1469,16 @@ const Wa = [
|
|
|
1433
1469
|
key: "limits",
|
|
1434
1470
|
header: "Token limits",
|
|
1435
1471
|
width: "24%",
|
|
1436
|
-
render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children:
|
|
1472
|
+
render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: Ua(e) })
|
|
1437
1473
|
}
|
|
1438
1474
|
];
|
|
1439
|
-
function
|
|
1475
|
+
function ni(e) {
|
|
1440
1476
|
var o;
|
|
1441
|
-
const n =
|
|
1442
|
-
queryKey:
|
|
1477
|
+
const n = me(), a = e.filter ?? Wa, s = rt({
|
|
1478
|
+
queryKey: Bn(a),
|
|
1443
1479
|
initialPageParam: void 0,
|
|
1444
1480
|
getNextPageParam: (r) => r.nextCursor ?? void 0,
|
|
1445
|
-
queryFn: ({ pageParam: r }) =>
|
|
1481
|
+
queryFn: ({ pageParam: r }) => Wn(n, r ? { ...a, cursor: r } : a)
|
|
1446
1482
|
}), i = ((o = s.data) == null ? void 0 : o.pages.flatMap((r) => r.models)) ?? [];
|
|
1447
1483
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
1448
1484
|
/* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
|
|
@@ -1452,11 +1488,11 @@ function Xs(e) {
|
|
|
1452
1488
|
/* @__PURE__ */ l("div", { children: [
|
|
1453
1489
|
s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
1454
1490
|
s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
|
|
1455
|
-
s.isSuccess && i.length === 0 && /* @__PURE__ */ t(
|
|
1491
|
+
s.isSuccess && i.length === 0 && /* @__PURE__ */ t(Re, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
|
|
1456
1492
|
i.length > 0 && /* @__PURE__ */ t(
|
|
1457
|
-
|
|
1493
|
+
Pe,
|
|
1458
1494
|
{
|
|
1459
|
-
columns:
|
|
1495
|
+
columns: Ha,
|
|
1460
1496
|
className: "model-catalog-table",
|
|
1461
1497
|
rows: i,
|
|
1462
1498
|
rowKey: (r) => r.id,
|
|
@@ -1478,23 +1514,23 @@ function Xs(e) {
|
|
|
1478
1514
|
) })
|
|
1479
1515
|
] }) });
|
|
1480
1516
|
}
|
|
1481
|
-
const
|
|
1482
|
-
function
|
|
1517
|
+
const Ya = {};
|
|
1518
|
+
function z(e) {
|
|
1483
1519
|
return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1484
1520
|
}
|
|
1485
|
-
function
|
|
1521
|
+
function za(e) {
|
|
1486
1522
|
return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
|
|
1487
1523
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return e.length > 0 ? e.map(
|
|
1524
|
+
function Ja(e, n) {
|
|
1525
|
+
return e.length > 0 ? e.map(za).join(" · ") : n > 0 ? "unpriced" : "—";
|
|
1490
1526
|
}
|
|
1491
|
-
function
|
|
1527
|
+
function Ga(e) {
|
|
1492
1528
|
return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
|
|
1493
1529
|
}
|
|
1494
|
-
function
|
|
1530
|
+
function Za(e) {
|
|
1495
1531
|
return e.totalsTruncated === !0;
|
|
1496
1532
|
}
|
|
1497
|
-
const
|
|
1533
|
+
const Xa = [
|
|
1498
1534
|
{
|
|
1499
1535
|
key: "occurredAt",
|
|
1500
1536
|
header: "When",
|
|
@@ -1525,8 +1561,8 @@ const Ja = [
|
|
|
1525
1561
|
"span",
|
|
1526
1562
|
{
|
|
1527
1563
|
className: "muted small",
|
|
1528
|
-
title: `${
|
|
1529
|
-
children:
|
|
1564
|
+
title: `${z(e.inputTokens)} in · ${z(e.outputTokens)} out · ${z(e.cachedInputTokens)} cached input · ${z(e.cacheWriteTokens)} cache write`,
|
|
1565
|
+
children: z(e.totalTokens)
|
|
1530
1566
|
}
|
|
1531
1567
|
)
|
|
1532
1568
|
},
|
|
@@ -1535,7 +1571,7 @@ const Ja = [
|
|
|
1535
1571
|
header: "Cost",
|
|
1536
1572
|
align: "right",
|
|
1537
1573
|
render: (e) => {
|
|
1538
|
-
const n =
|
|
1574
|
+
const n = Ga(e);
|
|
1539
1575
|
return n == null ? /* @__PURE__ */ t("span", { className: "tag warn", "data-testid": "model-usage-unpriced", title: "no usable rate", children: "unpriced" }) : /* @__PURE__ */ t("span", { className: "muted small", children: n });
|
|
1540
1576
|
}
|
|
1541
1577
|
},
|
|
@@ -1554,19 +1590,19 @@ const Ja = [
|
|
|
1554
1590
|
}
|
|
1555
1591
|
}
|
|
1556
1592
|
];
|
|
1557
|
-
function
|
|
1558
|
-
var
|
|
1559
|
-
const n =
|
|
1560
|
-
queryKey:
|
|
1593
|
+
function ai(e) {
|
|
1594
|
+
var m, g;
|
|
1595
|
+
const n = ne(e.projectId), a = me(), s = e.filter ?? Ya, i = rt({
|
|
1596
|
+
queryKey: Hn(n ?? void 0, s),
|
|
1561
1597
|
enabled: n != null,
|
|
1562
1598
|
initialPageParam: void 0,
|
|
1563
1599
|
getNextPageParam: (h) => h.nextCursor ?? void 0,
|
|
1564
|
-
queryFn: ({ pageParam: h }) =>
|
|
1600
|
+
queryFn: ({ pageParam: h }) => Un(
|
|
1565
1601
|
a,
|
|
1566
1602
|
n,
|
|
1567
1603
|
h ? { ...s, cursor: h } : s
|
|
1568
1604
|
)
|
|
1569
|
-
}), o = ((
|
|
1605
|
+
}), o = ((m = i.data) == null ? void 0 : m.pages) ?? [], r = (g = o[0]) == null ? void 0 : g.totals, d = o.flatMap((h) => h.items), u = o.length > 0 && Za(o[0]);
|
|
1570
1606
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
1571
1607
|
/* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
|
|
1572
1608
|
/* @__PURE__ */ t("h3", { children: "Model usage" }),
|
|
@@ -1574,31 +1610,31 @@ function ei(e) {
|
|
|
1574
1610
|
] }) }),
|
|
1575
1611
|
n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ l(q, { children: [
|
|
1576
1612
|
/* @__PURE__ */ l("div", { className: "card", "data-testid": "model-usage-totals", children: [
|
|
1577
|
-
|
|
1613
|
+
u && /* @__PURE__ */ t("p", { className: "result warn", "data-testid": "model-usage-totals-partial", children: "Totals are partial: they cover a bounded scan of this window, not every matching call. Narrow the range for exact totals." }),
|
|
1578
1614
|
r == null ? (
|
|
1579
1615
|
// A failed query is reported once, below — never as a perpetual "loading".
|
|
1580
1616
|
i.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
|
|
1581
1617
|
) : /* @__PURE__ */ l("p", { className: "muted small", children: [
|
|
1582
1618
|
/* @__PURE__ */ l("span", { "data-testid": "model-usage-total-requests", children: [
|
|
1583
|
-
|
|
1619
|
+
z(r.requests),
|
|
1584
1620
|
" requests"
|
|
1585
1621
|
] }),
|
|
1586
1622
|
" · ",
|
|
1587
1623
|
/* @__PURE__ */ l("span", { "data-testid": "model-usage-total-tokens", children: [
|
|
1588
|
-
|
|
1624
|
+
z(r.totalTokens),
|
|
1589
1625
|
" tokens (",
|
|
1590
|
-
|
|
1626
|
+
z(r.inputTokens),
|
|
1591
1627
|
" in /",
|
|
1592
1628
|
" ",
|
|
1593
|
-
|
|
1629
|
+
z(r.outputTokens),
|
|
1594
1630
|
" out / ",
|
|
1595
|
-
|
|
1631
|
+
z(r.cachedInputTokens),
|
|
1596
1632
|
" cached / ",
|
|
1597
|
-
|
|
1633
|
+
z(r.cacheWriteTokens),
|
|
1598
1634
|
" cache write)"
|
|
1599
1635
|
] }),
|
|
1600
1636
|
" · ",
|
|
1601
|
-
/* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children:
|
|
1637
|
+
/* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ja(r.cost, r.unpriced) }),
|
|
1602
1638
|
r.unpriced > 0 && /* @__PURE__ */ l(q, { children: [
|
|
1603
1639
|
" · ",
|
|
1604
1640
|
/* @__PURE__ */ l(
|
|
@@ -1608,7 +1644,7 @@ function ei(e) {
|
|
|
1608
1644
|
"data-testid": "model-usage-unpriced-total",
|
|
1609
1645
|
title: "calls with no usable rate — not included in any cost total",
|
|
1610
1646
|
children: [
|
|
1611
|
-
|
|
1647
|
+
z(r.unpriced),
|
|
1612
1648
|
" unpriced"
|
|
1613
1649
|
]
|
|
1614
1650
|
}
|
|
@@ -1619,12 +1655,12 @@ function ei(e) {
|
|
|
1619
1655
|
i.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: i.error.message }),
|
|
1620
1656
|
/* @__PURE__ */ l("div", { children: [
|
|
1621
1657
|
i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
1622
|
-
i.isSuccess &&
|
|
1623
|
-
|
|
1624
|
-
|
|
1658
|
+
i.isSuccess && d.length === 0 && /* @__PURE__ */ t(Re, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
|
|
1659
|
+
d.length > 0 && /* @__PURE__ */ t(
|
|
1660
|
+
Pe,
|
|
1625
1661
|
{
|
|
1626
|
-
columns:
|
|
1627
|
-
rows:
|
|
1662
|
+
columns: Xa,
|
|
1663
|
+
rows: d,
|
|
1628
1664
|
rowKey: (h) => h.id,
|
|
1629
1665
|
testId: "model-usage-table",
|
|
1630
1666
|
rowTestId: (h) => `model-usage-${h.id}`
|
|
@@ -1645,44 +1681,44 @@ function ei(e) {
|
|
|
1645
1681
|
] })
|
|
1646
1682
|
] }) });
|
|
1647
1683
|
}
|
|
1648
|
-
const
|
|
1649
|
-
function
|
|
1650
|
-
const i = mt(e ? { contract: e } : void 0), o = ke(), r = (i.data ?? []).filter((
|
|
1684
|
+
const es = (e) => `${e} connection${e === 1 ? "" : "s"}`;
|
|
1685
|
+
function si({ contract: e, onOpen: n, onCreate: a, slots: s }) {
|
|
1686
|
+
const i = mt(e ? { contract: e } : void 0), o = ke(), r = (i.data ?? []).filter((m) => !m.private), d = (m) => {
|
|
1651
1687
|
var g, h;
|
|
1652
|
-
return ((h = (g = o.data) == null ? void 0 : g.find((
|
|
1653
|
-
},
|
|
1688
|
+
return ((h = (g = o.data) == null ? void 0 : g.find((k) => k.id === m)) == null ? void 0 : h.label) ?? m;
|
|
1689
|
+
}, u = a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: a, children: "Add credential" });
|
|
1654
1690
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
|
|
1655
1691
|
/* @__PURE__ */ l("div", { className: "w6w-connection-list-head", "data-testid": "credential-list-header", children: [
|
|
1656
1692
|
/* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (s == null ? void 0 : s.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
|
|
1657
|
-
|
|
1693
|
+
u && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: u })
|
|
1658
1694
|
] }),
|
|
1659
1695
|
i.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
1660
1696
|
i.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: i.error.message }),
|
|
1661
1697
|
!i.isLoading && !i.error && r.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ l(q, { children: [
|
|
1662
1698
|
/* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }),
|
|
1663
|
-
|
|
1699
|
+
u
|
|
1664
1700
|
] }) }),
|
|
1665
|
-
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: r.map((
|
|
1666
|
-
const g = Object.values(
|
|
1701
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: r.map((m) => {
|
|
1702
|
+
const g = Object.values(m.display)[0];
|
|
1667
1703
|
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
|
|
1668
1704
|
"button",
|
|
1669
1705
|
{
|
|
1670
1706
|
type: "button",
|
|
1671
1707
|
className: "w6w-embed-conn-action",
|
|
1672
|
-
"data-testid": `credential-row-${
|
|
1673
|
-
onClick: () => n == null ? void 0 : n(
|
|
1708
|
+
"data-testid": `credential-row-${m.id}`,
|
|
1709
|
+
onClick: () => n == null ? void 0 : n(m.id),
|
|
1674
1710
|
children: [
|
|
1675
|
-
/* @__PURE__ */ t("strong", { children:
|
|
1711
|
+
/* @__PURE__ */ t("strong", { children: m.name }),
|
|
1676
1712
|
" ",
|
|
1677
|
-
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children:
|
|
1678
|
-
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${
|
|
1713
|
+
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: m.status }),
|
|
1714
|
+
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${m.id}`, children: [
|
|
1679
1715
|
" ",
|
|
1680
|
-
|
|
1716
|
+
d(m.contract)
|
|
1681
1717
|
] }),
|
|
1682
|
-
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${
|
|
1718
|
+
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${m.id}`, children: [
|
|
1683
1719
|
" ",
|
|
1684
1720
|
"· ",
|
|
1685
|
-
ht(
|
|
1721
|
+
ht(m.accessScope)
|
|
1686
1722
|
] }),
|
|
1687
1723
|
g !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
|
|
1688
1724
|
" ",
|
|
@@ -1690,11 +1726,11 @@ function ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
|
|
|
1690
1726
|
] }),
|
|
1691
1727
|
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
|
|
1692
1728
|
" · ",
|
|
1693
|
-
|
|
1729
|
+
es(m.connectionCount)
|
|
1694
1730
|
] })
|
|
1695
1731
|
]
|
|
1696
1732
|
}
|
|
1697
|
-
) },
|
|
1733
|
+
) }, m.id);
|
|
1698
1734
|
}) })
|
|
1699
1735
|
] });
|
|
1700
1736
|
}
|
|
@@ -1716,7 +1752,9 @@ function Ce({
|
|
|
1716
1752
|
"data-1p-ignore": "true",
|
|
1717
1753
|
"data-lpignore": "true",
|
|
1718
1754
|
"data-bwignore": "true",
|
|
1719
|
-
"data-form-type": "other"
|
|
1755
|
+
"data-form-type": "other",
|
|
1756
|
+
// A masked field copies its dots, not the text, unless told otherwise.
|
|
1757
|
+
...i.secret ? tt : {}
|
|
1720
1758
|
};
|
|
1721
1759
|
return i.multiline ? /* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
1722
1760
|
/* @__PURE__ */ t("span", { children: i.label }),
|
|
@@ -1727,7 +1765,7 @@ function Ce({
|
|
|
1727
1765
|
] }, i.key);
|
|
1728
1766
|
}) });
|
|
1729
1767
|
}
|
|
1730
|
-
const Te = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), Ee = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""])),
|
|
1768
|
+
const Te = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), Ee = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""])), ts = [
|
|
1731
1769
|
{
|
|
1732
1770
|
value: "account",
|
|
1733
1771
|
label: "This account",
|
|
@@ -1735,32 +1773,32 @@ const Te = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), Ee = (e, n) =>
|
|
|
1735
1773
|
},
|
|
1736
1774
|
{ value: "user", label: "Only me", hint: "Only you can use it. Others in the account cannot." }
|
|
1737
1775
|
];
|
|
1738
|
-
function
|
|
1739
|
-
const a = yt(), [s, i] =
|
|
1740
|
-
|
|
1741
|
-
},
|
|
1742
|
-
if (!
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1776
|
+
function ii({ onCreated: e, onCancel: n }) {
|
|
1777
|
+
const a = yt(), [s, i] = p("account"), o = ke(), r = zn(), [d, u] = p(null), [m, g] = p(""), [h, k] = p({}), [w, b] = p(null), y = o.data ?? [], E = y.find((f) => f.id === d) ?? y[0], I = (f) => {
|
|
1778
|
+
u(f), k({}), b(null);
|
|
1779
|
+
}, v = () => {
|
|
1780
|
+
if (!E || r.isPending) return;
|
|
1781
|
+
if (m.trim() === "") {
|
|
1782
|
+
b("Give the credential a name.");
|
|
1745
1783
|
return;
|
|
1746
1784
|
}
|
|
1747
|
-
if (!Te(
|
|
1748
|
-
|
|
1785
|
+
if (!Te(E.fields, h)) {
|
|
1786
|
+
b("Fill in every field.");
|
|
1749
1787
|
return;
|
|
1750
1788
|
}
|
|
1751
|
-
|
|
1752
|
-
const
|
|
1753
|
-
name:
|
|
1754
|
-
contract:
|
|
1755
|
-
source: Ee(
|
|
1789
|
+
b(null);
|
|
1790
|
+
const f = {
|
|
1791
|
+
name: m.trim(),
|
|
1792
|
+
contract: E.id,
|
|
1793
|
+
source: Ee(E.fields, h),
|
|
1756
1794
|
...a && s === "user" ? { accessScope: "user" } : {}
|
|
1757
1795
|
};
|
|
1758
|
-
|
|
1759
|
-
onSuccess: (
|
|
1760
|
-
r.reset(), e == null || e(
|
|
1796
|
+
k({}), r.mutate(f, {
|
|
1797
|
+
onSuccess: (T) => {
|
|
1798
|
+
r.reset(), e == null || e(T.id);
|
|
1761
1799
|
},
|
|
1762
|
-
onError: (
|
|
1763
|
-
r.reset(),
|
|
1800
|
+
onError: (T) => {
|
|
1801
|
+
r.reset(), b(ue(T, "create"));
|
|
1764
1802
|
}
|
|
1765
1803
|
});
|
|
1766
1804
|
};
|
|
@@ -1768,12 +1806,12 @@ function ni({ onCreated: e, onCancel: n }) {
|
|
|
1768
1806
|
/* @__PURE__ */ t("h2", { children: "Add credential" }),
|
|
1769
1807
|
o.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
1770
1808
|
o.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
|
|
1771
|
-
|
|
1809
|
+
E && /* @__PURE__ */ l(
|
|
1772
1810
|
"form",
|
|
1773
1811
|
{
|
|
1774
1812
|
className: "w6w-card-stack",
|
|
1775
|
-
onSubmit: (
|
|
1776
|
-
|
|
1813
|
+
onSubmit: (f) => {
|
|
1814
|
+
f.preventDefault(), v();
|
|
1777
1815
|
},
|
|
1778
1816
|
children: [
|
|
1779
1817
|
/* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
@@ -1781,10 +1819,10 @@ function ni({ onCreated: e, onCancel: n }) {
|
|
|
1781
1819
|
/* @__PURE__ */ t(
|
|
1782
1820
|
"select",
|
|
1783
1821
|
{
|
|
1784
|
-
value:
|
|
1822
|
+
value: E.id,
|
|
1785
1823
|
"aria-label": "Credential type",
|
|
1786
|
-
onChange: (
|
|
1787
|
-
children: y.map((
|
|
1824
|
+
onChange: (f) => I(f.target.value),
|
|
1825
|
+
children: y.map((f) => /* @__PURE__ */ t("option", { value: f.id, children: f.label }, f.id))
|
|
1788
1826
|
}
|
|
1789
1827
|
)
|
|
1790
1828
|
] }),
|
|
@@ -1795,8 +1833,8 @@ function ni({ onCreated: e, onCancel: n }) {
|
|
|
1795
1833
|
{
|
|
1796
1834
|
type: "text",
|
|
1797
1835
|
className: "w6w-input",
|
|
1798
|
-
value:
|
|
1799
|
-
onChange: (
|
|
1836
|
+
value: m,
|
|
1837
|
+
onChange: (f) => g(f.target.value),
|
|
1800
1838
|
maxLength: 120,
|
|
1801
1839
|
autoComplete: "off"
|
|
1802
1840
|
}
|
|
@@ -1811,33 +1849,33 @@ function ni({ onCreated: e, onCancel: n }) {
|
|
|
1811
1849
|
"data-testid": "credential-owner",
|
|
1812
1850
|
children: [
|
|
1813
1851
|
/* @__PURE__ */ t("span", { children: "Who can use it" }),
|
|
1814
|
-
|
|
1852
|
+
ts.map((f) => /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
|
|
1815
1853
|
/* @__PURE__ */ t(
|
|
1816
1854
|
"input",
|
|
1817
1855
|
{
|
|
1818
1856
|
type: "radio",
|
|
1819
1857
|
name: "w6w-cred-create-owner",
|
|
1820
|
-
value:
|
|
1821
|
-
checked: s ===
|
|
1822
|
-
onChange: () => i(
|
|
1858
|
+
value: f.value,
|
|
1859
|
+
checked: s === f.value,
|
|
1860
|
+
onChange: () => i(f.value)
|
|
1823
1861
|
}
|
|
1824
1862
|
),
|
|
1825
1863
|
" ",
|
|
1826
|
-
/* @__PURE__ */ t("strong", { children:
|
|
1864
|
+
/* @__PURE__ */ t("strong", { children: f.label }),
|
|
1827
1865
|
/* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
|
|
1828
1866
|
" ",
|
|
1829
|
-
|
|
1867
|
+
f.hint
|
|
1830
1868
|
] })
|
|
1831
|
-
] },
|
|
1869
|
+
] }, f.value))
|
|
1832
1870
|
]
|
|
1833
1871
|
}
|
|
1834
1872
|
),
|
|
1835
1873
|
/* @__PURE__ */ t(
|
|
1836
1874
|
Ce,
|
|
1837
1875
|
{
|
|
1838
|
-
fields:
|
|
1876
|
+
fields: E.fields,
|
|
1839
1877
|
values: h,
|
|
1840
|
-
onChange: (
|
|
1878
|
+
onChange: (f, T) => k((N) => ({ ...N, [f]: T })),
|
|
1841
1879
|
idPrefix: "w6w-cred-create"
|
|
1842
1880
|
}
|
|
1843
1881
|
),
|
|
@@ -1851,8 +1889,8 @@ function ni({ onCreated: e, onCancel: n }) {
|
|
|
1851
1889
|
)
|
|
1852
1890
|
] });
|
|
1853
1891
|
}
|
|
1854
|
-
const
|
|
1855
|
-
function
|
|
1892
|
+
const He = "google-service-account.v1";
|
|
1893
|
+
function ns(e) {
|
|
1856
1894
|
try {
|
|
1857
1895
|
const n = JSON.parse(e);
|
|
1858
1896
|
return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
|
|
@@ -1860,73 +1898,73 @@ function Xa(e) {
|
|
|
1860
1898
|
return null;
|
|
1861
1899
|
}
|
|
1862
1900
|
}
|
|
1863
|
-
const
|
|
1864
|
-
function
|
|
1865
|
-
return /* @__PURE__ */ t(
|
|
1901
|
+
const Ye = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
|
|
1902
|
+
function li(e) {
|
|
1903
|
+
return /* @__PURE__ */ t(as, { ...e }, e.credentialId);
|
|
1866
1904
|
}
|
|
1867
|
-
function
|
|
1905
|
+
function as({
|
|
1868
1906
|
credentialId: e,
|
|
1869
1907
|
onOpenConnection: n,
|
|
1870
1908
|
onDeleted: a,
|
|
1871
1909
|
onBack: s,
|
|
1872
1910
|
slots: i
|
|
1873
1911
|
}) {
|
|
1874
|
-
var
|
|
1875
|
-
const o =
|
|
1912
|
+
var Z, C, Q;
|
|
1913
|
+
const o = Jn(e), r = Gn(e), d = wt(e), u = pt(e), m = Zn(e), g = ft(), h = ke(), [k, w] = p(""), [b, y] = p({}), [E, I] = p(null), [v, f] = p(!1), [T, N] = p(null), [K, M] = p(null), [R, F] = p(!1), [O, _] = p(null), [A, P] = p(null), x = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Credentials" });
|
|
1876
1914
|
if (o.isLoading)
|
|
1877
1915
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
|
|
1878
1916
|
const D = o.data;
|
|
1879
1917
|
if (!D)
|
|
1880
1918
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
|
|
1881
1919
|
(i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
|
|
1882
|
-
|
|
1920
|
+
x
|
|
1883
1921
|
] });
|
|
1884
|
-
const
|
|
1885
|
-
if (!
|
|
1886
|
-
if (
|
|
1887
|
-
|
|
1922
|
+
const S = ((Z = r.data) == null ? void 0 : Z.connections) ?? [], V = D.connectionCount, U = D.status === "disabled", W = D.contract === He || (C = h.data) == null ? void 0 : C.find((c) => c.id === D.contract), J = D.contract !== He && h.isLoading, ee = () => {
|
|
1923
|
+
if (!W) return;
|
|
1924
|
+
if (f(!1), !Te(W.fields, b)) {
|
|
1925
|
+
I("Fill in every field.");
|
|
1888
1926
|
return;
|
|
1889
1927
|
}
|
|
1890
|
-
|
|
1891
|
-
const
|
|
1892
|
-
y({}),
|
|
1893
|
-
{ source:
|
|
1928
|
+
I(null);
|
|
1929
|
+
const c = Ee(W.fields, b);
|
|
1930
|
+
y({}), d.mutate(
|
|
1931
|
+
{ source: c },
|
|
1894
1932
|
{
|
|
1895
1933
|
onSuccess: () => {
|
|
1896
|
-
|
|
1934
|
+
d.reset(), f(!0);
|
|
1897
1935
|
},
|
|
1898
1936
|
onError: (L) => {
|
|
1899
|
-
|
|
1937
|
+
d.reset(), I(ue(L, "rotate"));
|
|
1900
1938
|
}
|
|
1901
1939
|
}
|
|
1902
1940
|
);
|
|
1903
|
-
},
|
|
1904
|
-
|
|
1905
|
-
const
|
|
1906
|
-
if (!
|
|
1907
|
-
|
|
1941
|
+
}, $ = () => {
|
|
1942
|
+
f(!1);
|
|
1943
|
+
const c = ns(k);
|
|
1944
|
+
if (!c) {
|
|
1945
|
+
I("Enter the new secret as a JSON object.");
|
|
1908
1946
|
return;
|
|
1909
1947
|
}
|
|
1910
|
-
|
|
1911
|
-
{ source:
|
|
1948
|
+
I(null), d.mutate(
|
|
1949
|
+
{ source: c },
|
|
1912
1950
|
{
|
|
1913
1951
|
onSuccess: () => {
|
|
1914
|
-
w(""),
|
|
1952
|
+
w(""), f(!0);
|
|
1915
1953
|
},
|
|
1916
|
-
onError: (L) =>
|
|
1954
|
+
onError: (L) => I(ae(L) ?? (L == null ? void 0 : L.message) ?? "Rotate failed.")
|
|
1917
1955
|
}
|
|
1918
1956
|
);
|
|
1919
|
-
},
|
|
1920
|
-
N(null), M(null),
|
|
1957
|
+
}, j = () => {
|
|
1958
|
+
N(null), M(null), m.mutate(void 0, {
|
|
1921
1959
|
onSuccess: N,
|
|
1922
|
-
onError: (
|
|
1960
|
+
onError: (c) => M(ae(c) ?? (c == null ? void 0 : c.message) ?? "Test failed.")
|
|
1923
1961
|
});
|
|
1924
|
-
},
|
|
1925
|
-
|
|
1926
|
-
onSuccess: (
|
|
1927
|
-
|
|
1962
|
+
}, H = () => {
|
|
1963
|
+
P(null), g.mutate(e, {
|
|
1964
|
+
onSuccess: (c) => {
|
|
1965
|
+
F(!1), c.ok ? a == null || a() : _(c.dependents.connections);
|
|
1928
1966
|
},
|
|
1929
|
-
onError: (
|
|
1967
|
+
onError: (c) => P(ae(c) ?? (c == null ? void 0 : c.message) ?? "Delete failed.")
|
|
1930
1968
|
});
|
|
1931
1969
|
};
|
|
1932
1970
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
|
|
@@ -1941,60 +1979,61 @@ function es({
|
|
|
1941
1979
|
/* @__PURE__ */ t("span", { "data-testid": "credential-scope", children: ht(D.accessScope) }),
|
|
1942
1980
|
/* @__PURE__ */ t("span", { className: "w6w-muted", children: " · Reusable credential" })
|
|
1943
1981
|
] }),
|
|
1944
|
-
/* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(D.display).map(([
|
|
1945
|
-
/* @__PURE__ */ t("dt", { className: "w6w-muted", children:
|
|
1982
|
+
/* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(D.display).map(([c, L]) => /* @__PURE__ */ l("div", { children: [
|
|
1983
|
+
/* @__PURE__ */ t("dt", { className: "w6w-muted", children: c }),
|
|
1946
1984
|
/* @__PURE__ */ t("dd", { children: L })
|
|
1947
|
-
] },
|
|
1985
|
+
] }, c)) }),
|
|
1948
1986
|
/* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
|
|
1949
|
-
|
|
1987
|
+
V,
|
|
1950
1988
|
" connection",
|
|
1951
|
-
|
|
1989
|
+
V === 1 ? "" : "s",
|
|
1952
1990
|
" · created ",
|
|
1953
|
-
|
|
1991
|
+
Ye(D.createdAt),
|
|
1954
1992
|
" · updated",
|
|
1955
1993
|
" ",
|
|
1956
|
-
|
|
1994
|
+
Ye(D.updatedAt)
|
|
1957
1995
|
] }),
|
|
1958
|
-
|
|
1996
|
+
x
|
|
1959
1997
|
] }),
|
|
1960
1998
|
/* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
|
|
1961
1999
|
/* @__PURE__ */ t("h3", { children: "Connected apps" }),
|
|
1962
|
-
|
|
2000
|
+
S.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any connection." }) : /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Connected apps", children: S.map((c) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
|
|
1963
2001
|
"button",
|
|
1964
2002
|
{
|
|
1965
2003
|
type: "button",
|
|
1966
2004
|
className: "w6w-embed-conn-action",
|
|
1967
|
-
onClick: () => n(
|
|
1968
|
-
children:
|
|
2005
|
+
onClick: () => n(c.id),
|
|
2006
|
+
children: c.displayName || c.appId
|
|
1969
2007
|
}
|
|
1970
|
-
) : /* @__PURE__ */ t("span", { children:
|
|
2008
|
+
) : /* @__PURE__ */ t("span", { children: c.displayName || c.appId }) }, c.id)) })
|
|
1971
2009
|
] }),
|
|
1972
2010
|
/* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
|
|
1973
2011
|
/* @__PURE__ */ t("h3", { children: "Rotate secret" }),
|
|
1974
2012
|
/* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
|
|
1975
|
-
|
|
2013
|
+
V,
|
|
1976
2014
|
" connection",
|
|
1977
|
-
|
|
2015
|
+
V === 1 ? "" : "s",
|
|
1978
2016
|
" will be marked untested"
|
|
1979
2017
|
] }),
|
|
1980
|
-
|
|
1981
|
-
|
|
2018
|
+
J && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
2019
|
+
W && /* @__PURE__ */ t(
|
|
1982
2020
|
Ce,
|
|
1983
2021
|
{
|
|
1984
|
-
fields:
|
|
1985
|
-
values:
|
|
1986
|
-
onChange: (
|
|
2022
|
+
fields: W.fields,
|
|
2023
|
+
values: b,
|
|
2024
|
+
onChange: (c, L) => y((B) => ({ ...B, [c]: L })),
|
|
1987
2025
|
idPrefix: "w6w-cred-rotate"
|
|
1988
2026
|
}
|
|
1989
2027
|
),
|
|
1990
|
-
!
|
|
2028
|
+
!J && !W && /* @__PURE__ */ t(
|
|
1991
2029
|
"textarea",
|
|
1992
2030
|
{
|
|
1993
2031
|
className: "w6w-input w6w-secret-input",
|
|
2032
|
+
...tt,
|
|
1994
2033
|
"aria-label": "New secret (JSON object)",
|
|
1995
2034
|
rows: 5,
|
|
1996
|
-
value:
|
|
1997
|
-
onChange: (
|
|
2035
|
+
value: k,
|
|
2036
|
+
onChange: (c) => w(c.target.value),
|
|
1998
2037
|
name: "w6w-cred-rotate",
|
|
1999
2038
|
autoComplete: "off",
|
|
2000
2039
|
autoCapitalize: "off",
|
|
@@ -2006,16 +2045,16 @@ function es({
|
|
|
2006
2045
|
"data-form-type": "other"
|
|
2007
2046
|
}
|
|
2008
2047
|
),
|
|
2009
|
-
|
|
2010
|
-
|
|
2048
|
+
E && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: E }),
|
|
2049
|
+
v && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
|
|
2011
2050
|
/* @__PURE__ */ t(
|
|
2012
2051
|
"button",
|
|
2013
2052
|
{
|
|
2014
2053
|
type: "button",
|
|
2015
2054
|
className: "w6w-btn",
|
|
2016
|
-
disabled:
|
|
2017
|
-
onClick:
|
|
2018
|
-
children:
|
|
2055
|
+
disabled: d.isPending || J,
|
|
2056
|
+
onClick: W ? ee : $,
|
|
2057
|
+
children: d.isPending ? "Rotating…" : "Rotate"
|
|
2019
2058
|
}
|
|
2020
2059
|
)
|
|
2021
2060
|
] }),
|
|
@@ -2027,9 +2066,9 @@ function es({
|
|
|
2027
2066
|
{
|
|
2028
2067
|
type: "button",
|
|
2029
2068
|
className: "w6w-btn w6w-btn-ghost",
|
|
2030
|
-
disabled:
|
|
2031
|
-
onClick: () =>
|
|
2032
|
-
children:
|
|
2069
|
+
disabled: u.isPending,
|
|
2070
|
+
onClick: () => u.mutate(U ? "active" : "disabled"),
|
|
2071
|
+
children: U ? "Enable" : "Disable"
|
|
2033
2072
|
}
|
|
2034
2073
|
),
|
|
2035
2074
|
/* @__PURE__ */ t(
|
|
@@ -2037,9 +2076,9 @@ function es({
|
|
|
2037
2076
|
{
|
|
2038
2077
|
type: "button",
|
|
2039
2078
|
className: "w6w-btn w6w-btn-ghost",
|
|
2040
|
-
disabled:
|
|
2041
|
-
onClick:
|
|
2042
|
-
children:
|
|
2079
|
+
disabled: m.isPending,
|
|
2080
|
+
onClick: j,
|
|
2081
|
+
children: m.isPending ? "Testing…" : "Test credential"
|
|
2043
2082
|
}
|
|
2044
2083
|
),
|
|
2045
2084
|
/* @__PURE__ */ t(
|
|
@@ -2048,15 +2087,15 @@ function es({
|
|
|
2048
2087
|
type: "button",
|
|
2049
2088
|
className: "w6w-btn w6w-btn-danger",
|
|
2050
2089
|
onClick: () => {
|
|
2051
|
-
|
|
2090
|
+
_(null), F(!0);
|
|
2052
2091
|
},
|
|
2053
2092
|
children: "Delete"
|
|
2054
2093
|
}
|
|
2055
2094
|
)
|
|
2056
2095
|
] }),
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2096
|
+
T && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: T.ok ? "ok" : T.code ?? "failed" }),
|
|
2097
|
+
K && /* @__PURE__ */ t("p", { role: "alert", children: K }),
|
|
2098
|
+
u.isError && /* @__PURE__ */ t("p", { role: "alert", children: ae(u.error) ?? ((Q = u.error) == null ? void 0 : Q.message) ?? "Update failed." }),
|
|
2060
2099
|
R && /* @__PURE__ */ l("div", { "data-testid": "credential-delete-confirm", children: [
|
|
2061
2100
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
2062
2101
|
'Delete the credential "',
|
|
@@ -2069,7 +2108,7 @@ function es({
|
|
|
2069
2108
|
type: "button",
|
|
2070
2109
|
className: "w6w-btn w6w-btn-danger",
|
|
2071
2110
|
disabled: g.isPending,
|
|
2072
|
-
onClick:
|
|
2111
|
+
onClick: H,
|
|
2073
2112
|
children: "Confirm delete"
|
|
2074
2113
|
}
|
|
2075
2114
|
),
|
|
@@ -2079,36 +2118,36 @@ function es({
|
|
|
2079
2118
|
{
|
|
2080
2119
|
type: "button",
|
|
2081
2120
|
className: "w6w-btn w6w-btn-ghost",
|
|
2082
|
-
onClick: () =>
|
|
2121
|
+
onClick: () => F(!1),
|
|
2083
2122
|
children: "Cancel"
|
|
2084
2123
|
}
|
|
2085
2124
|
)
|
|
2086
2125
|
] }),
|
|
2087
|
-
|
|
2126
|
+
O && /* @__PURE__ */ l("div", { role: "alert", "data-testid": "credential-in-use", children: [
|
|
2088
2127
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
2089
2128
|
"This credential is still used by ",
|
|
2090
|
-
|
|
2129
|
+
O.length,
|
|
2091
2130
|
" connection",
|
|
2092
|
-
|
|
2131
|
+
O.length === 1 ? "" : "s",
|
|
2093
2132
|
". Delete those integrations first, or rotate this credential instead of deleting it."
|
|
2094
2133
|
] }),
|
|
2095
|
-
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children:
|
|
2134
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: O.map((c) => /* @__PURE__ */ t("li", { children: c.displayName || c.appId }, c.id)) })
|
|
2096
2135
|
] }),
|
|
2097
|
-
|
|
2136
|
+
A && /* @__PURE__ */ t("p", { role: "alert", children: A })
|
|
2098
2137
|
] })
|
|
2099
2138
|
] });
|
|
2100
2139
|
}
|
|
2101
|
-
const
|
|
2102
|
-
function
|
|
2140
|
+
const ss = "Keys that only you can use are not turned on for this account.", is = "Models that only your personal key can see are not added to the account's catalog.", ls = "This provider is not supported for personal keys.", rs = "Could not save the key. Nothing was kept.", os = "Could not save the key, and a partial copy could not be removed. Remove it under Shared credentials.", ze = "The key was removed, but its stored copy was not.";
|
|
2141
|
+
function cs(e) {
|
|
2103
2142
|
var s;
|
|
2104
2143
|
const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (s = n.serviceAccount) == null ? void 0 : s.accepts;
|
|
2105
2144
|
return Array.isArray(a) ? a.filter((i) => typeof i == "string") : [];
|
|
2106
2145
|
}
|
|
2107
|
-
function
|
|
2146
|
+
function ds(e, n) {
|
|
2108
2147
|
for (const a of e ?? []) {
|
|
2109
2148
|
const s = a;
|
|
2110
2149
|
if (s.type === "oauth2" || typeof s.key != "string") continue;
|
|
2111
|
-
const i =
|
|
2150
|
+
const i = cs(a).find((o) => n.some((r) => r.id === o));
|
|
2112
2151
|
if (i) return { authKey: s.key, contract: i };
|
|
2113
2152
|
}
|
|
2114
2153
|
return null;
|
|
@@ -2125,15 +2164,15 @@ function Mt(e) {
|
|
|
2125
2164
|
}));
|
|
2126
2165
|
return a.length > 0 ? a : null;
|
|
2127
2166
|
}
|
|
2128
|
-
function
|
|
2167
|
+
function us(e) {
|
|
2129
2168
|
for (const n of e ?? []) {
|
|
2130
2169
|
const a = n.key, s = Mt(n);
|
|
2131
2170
|
if (typeof a == "string" && s) return { authKey: a, fields: s };
|
|
2132
2171
|
}
|
|
2133
2172
|
return null;
|
|
2134
2173
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const s =
|
|
2174
|
+
function ms(e, n, a) {
|
|
2175
|
+
const s = me(), i = Ke({
|
|
2137
2176
|
queryKey: ["app-auth", e],
|
|
2138
2177
|
queryFn: () => s.console.apps.getAuth(e),
|
|
2139
2178
|
enabled: a,
|
|
@@ -2141,99 +2180,99 @@ function cs(e, n, a) {
|
|
|
2141
2180
|
});
|
|
2142
2181
|
return Mt((i.data ?? []).find((o) => o.key === n));
|
|
2143
2182
|
}
|
|
2144
|
-
const
|
|
2145
|
-
function
|
|
2146
|
-
const n = yt(), a =
|
|
2147
|
-
(w) => w.accessScope === "user" && w.credentialId && (
|
|
2148
|
-
), g = o.data ?? [], [h,
|
|
2183
|
+
const re = (e) => e.provider ?? e.appId;
|
|
2184
|
+
function ri({ providerAppId: e }) {
|
|
2185
|
+
const n = yt(), a = Yn(), s = ot(), i = mt({ accessScope: "user" }), o = na(n), r = ke(), d = (a.data ?? []).filter((w) => w.designation), u = new Map((i.data ?? []).map((w) => [w.id, w])), m = (s.data ?? []).filter(
|
|
2186
|
+
(w) => w.accessScope === "user" && w.credentialId && (u.has(w.credentialId) || i.data !== void 0)
|
|
2187
|
+
), g = o.data ?? [], [h, k] = p(null);
|
|
2149
2188
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
|
|
2150
2189
|
/* @__PURE__ */ t("h2", { children: "My AI keys" }),
|
|
2151
2190
|
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Keys that only you can use. They are never shown again after you save them." }),
|
|
2152
|
-
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children:
|
|
2153
|
-
!n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children:
|
|
2191
|
+
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: is }),
|
|
2192
|
+
!n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: ss }),
|
|
2154
2193
|
(a.isLoading || s.isLoading || i.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
2155
2194
|
a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
|
|
2156
|
-
n &&
|
|
2157
|
-
!a.isLoading && !a.error &&
|
|
2195
|
+
n && d.length > 0 && /* @__PURE__ */ t(hs, { providers: d, initial: e, types: r.data ?? [] }),
|
|
2196
|
+
!a.isLoading && !a.error && d.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
|
|
2158
2197
|
h && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: h }),
|
|
2159
|
-
|
|
2160
|
-
const
|
|
2161
|
-
return
|
|
2162
|
-
|
|
2198
|
+
d.map((w) => {
|
|
2199
|
+
const b = m.filter((y) => y.appId === w.appId);
|
|
2200
|
+
return b.length === 0 ? null : /* @__PURE__ */ t(
|
|
2201
|
+
ws,
|
|
2163
2202
|
{
|
|
2164
2203
|
provider: w,
|
|
2165
|
-
keys:
|
|
2166
|
-
creds:
|
|
2204
|
+
keys: b,
|
|
2205
|
+
creds: u,
|
|
2167
2206
|
current: g.find((y) => y.providerAppId === w.appId),
|
|
2168
2207
|
types: r.data ?? [],
|
|
2169
|
-
onNotice:
|
|
2208
|
+
onNotice: k
|
|
2170
2209
|
},
|
|
2171
2210
|
w.appId
|
|
2172
2211
|
);
|
|
2173
2212
|
})
|
|
2174
2213
|
] });
|
|
2175
2214
|
}
|
|
2176
|
-
function
|
|
2215
|
+
function hs({
|
|
2177
2216
|
providers: e,
|
|
2178
2217
|
initial: n,
|
|
2179
2218
|
types: a
|
|
2180
2219
|
}) {
|
|
2181
|
-
var
|
|
2182
|
-
const s =
|
|
2183
|
-
queryKey: ["app-auth",
|
|
2184
|
-
queryFn: () => s.console.apps.getAuth(
|
|
2185
|
-
enabled:
|
|
2220
|
+
var O, _;
|
|
2221
|
+
const s = me(), i = fe(), [o, r] = p(n), d = ((O = e.find((A) => A.appId === o)) == null ? void 0 : O.appId) ?? ((_ = e[0]) == null ? void 0 : _.appId) ?? "", u = e.find((A) => A.appId === d), [m, g] = p(""), [h, k] = p({}), [w, b] = p(null), [y, E] = p(!1), [I, v] = p(!1), f = Ke({
|
|
2222
|
+
queryKey: ["app-auth", d],
|
|
2223
|
+
queryFn: () => s.console.apps.getAuth(d),
|
|
2224
|
+
enabled: d !== "",
|
|
2186
2225
|
retry: !1
|
|
2187
|
-
}),
|
|
2188
|
-
r(
|
|
2189
|
-
},
|
|
2190
|
-
if (!
|
|
2226
|
+
}), T = ds(f.data, a), N = T ? a.find((A) => A.id === T.contract) : void 0, K = N ? null : us(f.data), M = (N == null ? void 0 : N.fields) ?? (K == null ? void 0 : K.fields), R = (A) => {
|
|
2227
|
+
r(A), k({}), b(null), v(!1);
|
|
2228
|
+
}, F = async () => {
|
|
2229
|
+
if (!u || !M || y) return;
|
|
2191
2230
|
if (!Te(M, h)) {
|
|
2192
|
-
|
|
2231
|
+
b("Fill in every field.");
|
|
2193
2232
|
return;
|
|
2194
2233
|
}
|
|
2195
|
-
|
|
2196
|
-
const
|
|
2197
|
-
if (
|
|
2198
|
-
if (!
|
|
2234
|
+
b(null), v(!1);
|
|
2235
|
+
const A = Ee(M, h);
|
|
2236
|
+
if (k({}), E(!0), !T || !N) {
|
|
2237
|
+
if (!K) return E(!1);
|
|
2199
2238
|
try {
|
|
2200
|
-
await
|
|
2201
|
-
authKey:
|
|
2202
|
-
credential:
|
|
2203
|
-
displayName:
|
|
2239
|
+
await _e(s, d, {
|
|
2240
|
+
authKey: K.authKey,
|
|
2241
|
+
credential: A,
|
|
2242
|
+
displayName: m.trim() || `My ${re(u)} key`,
|
|
2204
2243
|
accessScope: "user"
|
|
2205
|
-
}), g(""),
|
|
2206
|
-
} catch (
|
|
2207
|
-
|
|
2244
|
+
}), g(""), v(!0);
|
|
2245
|
+
} catch (x) {
|
|
2246
|
+
b(ue(x, "create"));
|
|
2208
2247
|
} finally {
|
|
2209
|
-
|
|
2248
|
+
E(!1), i.invalidateQueries({ queryKey: de });
|
|
2210
2249
|
}
|
|
2211
2250
|
return;
|
|
2212
2251
|
}
|
|
2213
|
-
let
|
|
2252
|
+
let P = null;
|
|
2214
2253
|
try {
|
|
2215
|
-
const
|
|
2216
|
-
name:
|
|
2217
|
-
contract:
|
|
2218
|
-
source:
|
|
2254
|
+
const x = await Xn(s, {
|
|
2255
|
+
name: m.trim() || `My ${re(u)} key`,
|
|
2256
|
+
contract: T.contract,
|
|
2257
|
+
source: A,
|
|
2219
2258
|
accessScope: "user"
|
|
2220
2259
|
});
|
|
2221
|
-
|
|
2222
|
-
authKey:
|
|
2223
|
-
credentialId:
|
|
2260
|
+
P = x.id, await _e(s, d, {
|
|
2261
|
+
authKey: T.authKey,
|
|
2262
|
+
credentialId: x.id,
|
|
2224
2263
|
accessScope: "user"
|
|
2225
|
-
}), g(""),
|
|
2226
|
-
} catch (
|
|
2227
|
-
if (
|
|
2228
|
-
const D = await
|
|
2229
|
-
(
|
|
2264
|
+
}), g(""), v(!0);
|
|
2265
|
+
} catch (x) {
|
|
2266
|
+
if (P) {
|
|
2267
|
+
const D = await ea(s, P).then(
|
|
2268
|
+
(S) => S.ok,
|
|
2230
2269
|
() => !1
|
|
2231
2270
|
);
|
|
2232
|
-
|
|
2271
|
+
b(D ? ae(x) ?? rs : os);
|
|
2233
2272
|
} else
|
|
2234
|
-
|
|
2273
|
+
b(ue(x, "create"));
|
|
2235
2274
|
} finally {
|
|
2236
|
-
|
|
2275
|
+
E(!1), i.invalidateQueries({ queryKey: ta }), i.invalidateQueries({ queryKey: de });
|
|
2237
2276
|
}
|
|
2238
2277
|
};
|
|
2239
2278
|
return /* @__PURE__ */ l(
|
|
@@ -2241,17 +2280,17 @@ function ds({
|
|
|
2241
2280
|
{
|
|
2242
2281
|
className: "w6w-embed-conn-card w6w-card-stack",
|
|
2243
2282
|
"data-testid": "ai-key-add",
|
|
2244
|
-
onSubmit: (
|
|
2245
|
-
|
|
2283
|
+
onSubmit: (A) => {
|
|
2284
|
+
A.preventDefault(), F();
|
|
2246
2285
|
},
|
|
2247
2286
|
children: [
|
|
2248
2287
|
/* @__PURE__ */ t("h3", { children: "Add a key" }),
|
|
2249
2288
|
/* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
2250
2289
|
/* @__PURE__ */ t("span", { children: "Provider" }),
|
|
2251
|
-
/* @__PURE__ */ t("select", { value:
|
|
2290
|
+
/* @__PURE__ */ t("select", { value: d, "aria-label": "Provider", onChange: (A) => R(A.target.value), children: e.map((A) => /* @__PURE__ */ t("option", { value: A.appId, children: re(A) }, A.appId)) })
|
|
2252
2291
|
] }),
|
|
2253
|
-
|
|
2254
|
-
!
|
|
2292
|
+
f.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
2293
|
+
!f.isLoading && !M && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: ls }),
|
|
2255
2294
|
M && /* @__PURE__ */ l(q, { children: [
|
|
2256
2295
|
/* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
2257
2296
|
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
@@ -2260,9 +2299,9 @@ function ds({
|
|
|
2260
2299
|
{
|
|
2261
2300
|
type: "text",
|
|
2262
2301
|
className: "w6w-input",
|
|
2263
|
-
value:
|
|
2264
|
-
placeholder:
|
|
2265
|
-
onChange: (
|
|
2302
|
+
value: m,
|
|
2303
|
+
placeholder: u ? `My ${re(u)} key` : "",
|
|
2304
|
+
onChange: (A) => g(A.target.value),
|
|
2266
2305
|
maxLength: 120,
|
|
2267
2306
|
autoComplete: "off"
|
|
2268
2307
|
}
|
|
@@ -2273,19 +2312,19 @@ function ds({
|
|
|
2273
2312
|
{
|
|
2274
2313
|
fields: M,
|
|
2275
2314
|
values: h,
|
|
2276
|
-
onChange: (
|
|
2315
|
+
onChange: (A, P) => k((x) => ({ ...x, [A]: P })),
|
|
2277
2316
|
idPrefix: "w6w-ai-key-add"
|
|
2278
2317
|
}
|
|
2279
2318
|
),
|
|
2280
2319
|
w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: w }),
|
|
2281
|
-
|
|
2320
|
+
I && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
|
|
2282
2321
|
/* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: y, children: y ? "Saving…" : "Save key" }) })
|
|
2283
2322
|
] })
|
|
2284
2323
|
]
|
|
2285
2324
|
}
|
|
2286
2325
|
);
|
|
2287
2326
|
}
|
|
2288
|
-
function
|
|
2327
|
+
function ws({
|
|
2289
2328
|
provider: e,
|
|
2290
2329
|
keys: n,
|
|
2291
2330
|
creds: a,
|
|
@@ -2293,29 +2332,29 @@ function us({
|
|
|
2293
2332
|
types: i,
|
|
2294
2333
|
onNotice: o
|
|
2295
2334
|
}) {
|
|
2296
|
-
const r =
|
|
2297
|
-
|
|
2298
|
-
const
|
|
2299
|
-
onError: (y) =>
|
|
2335
|
+
const r = aa(), d = sa(), [u, m] = p(null), g = e.appId, h = s && n.some((w) => w.id === s.connectionId) ? s : void 0, k = (w) => {
|
|
2336
|
+
m(null);
|
|
2337
|
+
const b = {
|
|
2338
|
+
onError: (y) => m(ae(y) ?? "Could not change the default key.")
|
|
2300
2339
|
};
|
|
2301
|
-
w === null ?
|
|
2340
|
+
w === null ? d.mutate(g, b) : r.mutate({ providerAppId: g, connectionId: w }, b);
|
|
2302
2341
|
};
|
|
2303
2342
|
return /* @__PURE__ */ l("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${g}`, children: [
|
|
2304
|
-
/* @__PURE__ */ t("h3", { children:
|
|
2305
|
-
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${
|
|
2306
|
-
const
|
|
2343
|
+
/* @__PURE__ */ t("h3", { children: re(e) }),
|
|
2344
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${re(e)} keys`, children: n.map((w) => {
|
|
2345
|
+
const b = a.get(w.credentialId);
|
|
2307
2346
|
return /* @__PURE__ */ t(
|
|
2308
|
-
|
|
2347
|
+
ps,
|
|
2309
2348
|
{
|
|
2310
2349
|
connection: w,
|
|
2311
|
-
credential:
|
|
2312
|
-
descriptor:
|
|
2350
|
+
credential: b,
|
|
2351
|
+
descriptor: b ? i.find((y) => y.id === b.contract) : void 0,
|
|
2313
2352
|
onNotice: o
|
|
2314
2353
|
},
|
|
2315
2354
|
w.id
|
|
2316
2355
|
);
|
|
2317
2356
|
}) }),
|
|
2318
|
-
/* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${
|
|
2357
|
+
/* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${re(e)}`, children: [
|
|
2319
2358
|
/* @__PURE__ */ t("span", { className: "w6w-small", children: "Default key" }),
|
|
2320
2359
|
/* @__PURE__ */ l("label", { className: "w6w-radio", children: [
|
|
2321
2360
|
/* @__PURE__ */ t(
|
|
@@ -2325,7 +2364,7 @@ function us({
|
|
|
2325
2364
|
name: `ai-default-${g}`,
|
|
2326
2365
|
checked: !h,
|
|
2327
2366
|
onChange: () => {
|
|
2328
|
-
h &&
|
|
2367
|
+
h && k(null);
|
|
2329
2368
|
}
|
|
2330
2369
|
}
|
|
2331
2370
|
),
|
|
@@ -2340,7 +2379,7 @@ function us({
|
|
|
2340
2379
|
name: `ai-default-${g}`,
|
|
2341
2380
|
"data-testid": `ai-default-${w.id}`,
|
|
2342
2381
|
checked: (h == null ? void 0 : h.connectionId) === w.id,
|
|
2343
|
-
onChange: () =>
|
|
2382
|
+
onChange: () => k(w.id)
|
|
2344
2383
|
}
|
|
2345
2384
|
),
|
|
2346
2385
|
" ",
|
|
@@ -2348,37 +2387,37 @@ function us({
|
|
|
2348
2387
|
] }, w.id))
|
|
2349
2388
|
] }),
|
|
2350
2389
|
(s == null ? void 0 : s.status) === "unavailable" && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": `ai-default-warning-${g}`, children: "Your default key for this provider is not available. Enable it, replace it or pick another." }),
|
|
2351
|
-
|
|
2390
|
+
u && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: u })
|
|
2352
2391
|
] });
|
|
2353
2392
|
}
|
|
2354
|
-
function
|
|
2393
|
+
function ps({
|
|
2355
2394
|
connection: e,
|
|
2356
2395
|
credential: n,
|
|
2357
2396
|
descriptor: a,
|
|
2358
2397
|
onNotice: s
|
|
2359
2398
|
}) {
|
|
2360
|
-
const i = ut(e.id), o = wt((n == null ? void 0 : n.id) ?? ""), r = pt((n == null ? void 0 : n.id) ?? ""),
|
|
2399
|
+
const i = ut(e.id), o = wt((n == null ? void 0 : n.id) ?? ""), r = pt((n == null ? void 0 : n.id) ?? ""), d = qn(e.id), u = ms(e.appId, e.authKey, !n), m = n ? a == null ? void 0 : a.fields : u ?? void 0, g = ct(), h = ft(), [k, w] = p(!1), [b, y] = p({}), [E, I] = p(!1), [v, f] = p(null), [T, N] = p(null), [K, M] = p(null), R = (n == null ? void 0 : n.status) === "disabled", F = n ? Object.values(n.display)[0] : void 0, O = n ? o.isPending : d.isPending, _ = (D, S) => N(ae(D) ?? S), A = () => {
|
|
2361
2400
|
M(null), N(null), i.mutate(void 0, {
|
|
2362
2401
|
onSuccess: (D) => M(D.ok ? "ok" : "failed"),
|
|
2363
|
-
onError: (D) =>
|
|
2402
|
+
onError: (D) => _(D, "Could not test the key.")
|
|
2364
2403
|
});
|
|
2365
|
-
},
|
|
2366
|
-
if (!
|
|
2367
|
-
if (
|
|
2404
|
+
}, P = () => {
|
|
2405
|
+
if (!m) return;
|
|
2406
|
+
if (f(null), !Te(m, b)) {
|
|
2368
2407
|
N("Fill in every field.");
|
|
2369
2408
|
return;
|
|
2370
2409
|
}
|
|
2371
2410
|
N(null);
|
|
2372
|
-
const D = Ee(
|
|
2411
|
+
const D = Ee(m, b);
|
|
2373
2412
|
if (y({}), !n) {
|
|
2374
|
-
|
|
2413
|
+
d.mutate(
|
|
2375
2414
|
{ credential: D },
|
|
2376
2415
|
{
|
|
2377
2416
|
onSuccess: () => {
|
|
2378
|
-
|
|
2417
|
+
d.reset(), w(!1), f("Key replaced.");
|
|
2379
2418
|
},
|
|
2380
|
-
onError: (
|
|
2381
|
-
|
|
2419
|
+
onError: (S) => {
|
|
2420
|
+
d.reset(), N(ue(S, "rotate"));
|
|
2382
2421
|
}
|
|
2383
2422
|
}
|
|
2384
2423
|
);
|
|
@@ -2388,31 +2427,31 @@ function ms({
|
|
|
2388
2427
|
{ source: D },
|
|
2389
2428
|
{
|
|
2390
2429
|
onSuccess: () => {
|
|
2391
|
-
o.reset(), w(!1),
|
|
2430
|
+
o.reset(), w(!1), f("Key replaced.");
|
|
2392
2431
|
},
|
|
2393
|
-
onError: (
|
|
2394
|
-
o.reset(), N(
|
|
2432
|
+
onError: (S) => {
|
|
2433
|
+
o.reset(), N(ue(S, "rotate"));
|
|
2395
2434
|
}
|
|
2396
2435
|
}
|
|
2397
2436
|
);
|
|
2398
|
-
},
|
|
2437
|
+
}, x = () => {
|
|
2399
2438
|
N(null), s(null), g.mutate(
|
|
2400
2439
|
{ id: e.id },
|
|
2401
2440
|
{
|
|
2402
2441
|
onSuccess: (D) => {
|
|
2403
2442
|
if (!D.ok) {
|
|
2404
|
-
|
|
2443
|
+
I(!1), N("This key is still in use. Remove what uses it first.");
|
|
2405
2444
|
return;
|
|
2406
2445
|
}
|
|
2407
2446
|
n && h.mutate(n.id, {
|
|
2408
|
-
onSuccess: (
|
|
2409
|
-
|
|
2447
|
+
onSuccess: (S) => {
|
|
2448
|
+
S.ok || s(ze);
|
|
2410
2449
|
},
|
|
2411
|
-
onError: (
|
|
2450
|
+
onError: (S) => s(ae(S) ?? ze)
|
|
2412
2451
|
});
|
|
2413
2452
|
},
|
|
2414
2453
|
onError: (D) => {
|
|
2415
|
-
|
|
2454
|
+
I(!1), _(D, "Could not remove the key.");
|
|
2416
2455
|
}
|
|
2417
2456
|
}
|
|
2418
2457
|
);
|
|
@@ -2422,9 +2461,9 @@ function ms({
|
|
|
2422
2461
|
/* @__PURE__ */ t("strong", { children: e.displayName }),
|
|
2423
2462
|
" ",
|
|
2424
2463
|
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", "data-testid": `ai-key-status-${e.id}`, children: (n == null ? void 0 : n.status) ?? e.state }),
|
|
2425
|
-
|
|
2464
|
+
F !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
|
|
2426
2465
|
" ",
|
|
2427
|
-
|
|
2466
|
+
F
|
|
2428
2467
|
] })
|
|
2429
2468
|
] }),
|
|
2430
2469
|
/* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
|
|
@@ -2434,11 +2473,11 @@ function ms({
|
|
|
2434
2473
|
type: "button",
|
|
2435
2474
|
className: "w6w-btn w6w-btn-ghost",
|
|
2436
2475
|
disabled: i.isPending,
|
|
2437
|
-
onClick:
|
|
2476
|
+
onClick: A,
|
|
2438
2477
|
children: i.isPending ? "Testing…" : "Test"
|
|
2439
2478
|
}
|
|
2440
2479
|
),
|
|
2441
|
-
|
|
2480
|
+
m && /* @__PURE__ */ t(
|
|
2442
2481
|
"button",
|
|
2443
2482
|
{
|
|
2444
2483
|
type: "button",
|
|
@@ -2454,7 +2493,7 @@ function ms({
|
|
|
2454
2493
|
className: "w6w-btn w6w-btn-ghost",
|
|
2455
2494
|
disabled: r.isPending,
|
|
2456
2495
|
onClick: () => r.mutate(R ? "active" : "disabled", {
|
|
2457
|
-
onError: (D) =>
|
|
2496
|
+
onError: (D) => _(D, "Could not change the key's status.")
|
|
2458
2497
|
}),
|
|
2459
2498
|
children: R ? "Enable" : "Disable"
|
|
2460
2499
|
}
|
|
@@ -2464,25 +2503,25 @@ function ms({
|
|
|
2464
2503
|
{
|
|
2465
2504
|
type: "button",
|
|
2466
2505
|
className: "w6w-btn w6w-btn-danger",
|
|
2467
|
-
onClick: () =>
|
|
2506
|
+
onClick: () => I(!0),
|
|
2468
2507
|
children: "Remove"
|
|
2469
2508
|
}
|
|
2470
2509
|
)
|
|
2471
2510
|
] }),
|
|
2472
|
-
|
|
2473
|
-
|
|
2511
|
+
K && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: K === "ok" ? "Test passed" : "Test failed" }),
|
|
2512
|
+
k && m && /* @__PURE__ */ l("div", { className: "w6w-card-stack", "data-testid": `ai-key-replace-${e.id}`, children: [
|
|
2474
2513
|
/* @__PURE__ */ t(
|
|
2475
2514
|
Ce,
|
|
2476
2515
|
{
|
|
2477
|
-
fields:
|
|
2478
|
-
values:
|
|
2479
|
-
onChange: (D,
|
|
2516
|
+
fields: m,
|
|
2517
|
+
values: b,
|
|
2518
|
+
onChange: (D, S) => y((V) => ({ ...V, [D]: S })),
|
|
2480
2519
|
idPrefix: `w6w-ai-key-replace-${e.id}`
|
|
2481
2520
|
}
|
|
2482
2521
|
),
|
|
2483
|
-
/* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled:
|
|
2522
|
+
/* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: O, onClick: P, children: O ? "Replacing…" : "Save new key" })
|
|
2484
2523
|
] }),
|
|
2485
|
-
|
|
2524
|
+
E && /* @__PURE__ */ l("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
|
|
2486
2525
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
2487
2526
|
'Remove "',
|
|
2488
2527
|
e.displayName,
|
|
@@ -2494,7 +2533,7 @@ function ms({
|
|
|
2494
2533
|
type: "button",
|
|
2495
2534
|
className: "w6w-btn w6w-btn-danger",
|
|
2496
2535
|
disabled: g.isPending,
|
|
2497
|
-
onClick:
|
|
2536
|
+
onClick: x,
|
|
2498
2537
|
children: "Confirm remove"
|
|
2499
2538
|
}
|
|
2500
2539
|
),
|
|
@@ -2504,145 +2543,145 @@ function ms({
|
|
|
2504
2543
|
{
|
|
2505
2544
|
type: "button",
|
|
2506
2545
|
className: "w6w-btn w6w-btn-ghost",
|
|
2507
|
-
onClick: () =>
|
|
2546
|
+
onClick: () => I(!1),
|
|
2508
2547
|
children: "Cancel"
|
|
2509
2548
|
}
|
|
2510
2549
|
)
|
|
2511
2550
|
] }),
|
|
2512
|
-
|
|
2513
|
-
|
|
2551
|
+
v && /* @__PURE__ */ t("output", { children: v }),
|
|
2552
|
+
T && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: T })
|
|
2514
2553
|
] });
|
|
2515
2554
|
}
|
|
2516
|
-
function
|
|
2517
|
-
const n =
|
|
2555
|
+
function G(e) {
|
|
2556
|
+
const n = en(e), a = e == null ? void 0 : e.code;
|
|
2518
2557
|
return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
|
|
2519
2558
|
}
|
|
2520
|
-
const
|
|
2521
|
-
function
|
|
2559
|
+
const Je = 80;
|
|
2560
|
+
function fs(e, n) {
|
|
2522
2561
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
|
|
2523
2562
|
const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
|
|
2524
2563
|
s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
|
|
2525
2564
|
}
|
|
2526
|
-
function
|
|
2527
|
-
var
|
|
2528
|
-
const a =
|
|
2529
|
-
(
|
|
2530
|
-
),
|
|
2531
|
-
const
|
|
2565
|
+
function ys({ store: e, project: n }) {
|
|
2566
|
+
var Q;
|
|
2567
|
+
const a = tn(e), s = (a == null ? void 0 : a.columns) ?? [], i = (a == null ? void 0 : a.key) ?? "", [o, r] = p(""), [d, u] = p({}), [m, g] = p({}), [h, k] = p({}), [w, b] = p({}), [y, E] = p(null), [I, v] = p(null), [f, T] = p(null), N = me(), K = fe(), M = gt(e.id, n, o), R = vt(), F = la(), O = bt(), _ = ra(), A = oa(), P = (((Q = M.data) == null ? void 0 : Q.pages.flatMap((c) => c.items)) ?? []).map(
|
|
2568
|
+
(c) => w[c.key] ?? c
|
|
2569
|
+
), x = new Map(P.map((c) => [c.key, c])), D = [], S = (c) => d[c], V = S(ie), U = (c, L, B) => {
|
|
2570
|
+
const te = B === void 0 ? null : ye(B, s);
|
|
2532
2571
|
D.push({
|
|
2533
|
-
id:
|
|
2534
|
-
isNew:
|
|
2572
|
+
id: c,
|
|
2573
|
+
isNew: c === ie,
|
|
2535
2574
|
cells: L.cells,
|
|
2536
2575
|
version: L.version,
|
|
2537
|
-
dirty:
|
|
2538
|
-
conflict: h[
|
|
2539
|
-
cellErrors:
|
|
2576
|
+
dirty: te === null ? !0 : on(L, te, s).length > 0,
|
|
2577
|
+
conflict: h[c] === !0,
|
|
2578
|
+
cellErrors: m[c]
|
|
2540
2579
|
});
|
|
2541
2580
|
};
|
|
2542
|
-
|
|
2543
|
-
for (const
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
g((L) =>
|
|
2547
|
-
},
|
|
2548
|
-
|
|
2581
|
+
V !== void 0 && U(ie, V, void 0);
|
|
2582
|
+
for (const c of P)
|
|
2583
|
+
U(c.key, S(c.key) ?? ye(c, s), c);
|
|
2584
|
+
const W = (c) => {
|
|
2585
|
+
g((L) => le(L, c)), k((L) => le(L, c));
|
|
2586
|
+
}, J = (c) => {
|
|
2587
|
+
u((L) => le(L, c)), W(c);
|
|
2549
2588
|
};
|
|
2550
|
-
function
|
|
2551
|
-
const
|
|
2552
|
-
|
|
2553
|
-
const
|
|
2554
|
-
if (
|
|
2555
|
-
const
|
|
2556
|
-
return Object.keys(
|
|
2589
|
+
function ee(c, L, B) {
|
|
2590
|
+
const te = x.get(c), X = S(c) ?? (te ? ye(te, s) : je(s));
|
|
2591
|
+
u((Y) => ({ ...Y, [c]: { ...X, cells: { ...X.cells, [L]: B } } })), g((Y) => {
|
|
2592
|
+
const se = Y[c];
|
|
2593
|
+
if (se === void 0 || !(L in se)) return Y;
|
|
2594
|
+
const he = le(se, L);
|
|
2595
|
+
return Object.keys(he).length === 0 ? le(Y, c) : { ...Y, [c]: he };
|
|
2557
2596
|
});
|
|
2558
2597
|
}
|
|
2559
|
-
async function
|
|
2560
|
-
const L =
|
|
2598
|
+
async function $(c) {
|
|
2599
|
+
const L = x.get(c), B = S(c) ?? (L ? ye(L, s) : void 0);
|
|
2561
2600
|
if (B === void 0) return;
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
if (!
|
|
2565
|
-
g((
|
|
2601
|
+
E(null), W(c);
|
|
2602
|
+
const te = dn(B, s);
|
|
2603
|
+
if (!te.ok) {
|
|
2604
|
+
g((Y) => ({ ...Y, [c]: te.errors }));
|
|
2566
2605
|
return;
|
|
2567
2606
|
}
|
|
2568
|
-
const
|
|
2607
|
+
const X = un(
|
|
2569
2608
|
B,
|
|
2570
|
-
|
|
2571
|
-
|
|
2609
|
+
te.value,
|
|
2610
|
+
nt((L == null ? void 0 : L.expiresAt) ?? null, Date.now())
|
|
2572
2611
|
);
|
|
2573
2612
|
try {
|
|
2574
|
-
|
|
2613
|
+
X.kind === "insert" ? await F.mutateAsync({
|
|
2575
2614
|
id: e.id,
|
|
2576
|
-
row:
|
|
2577
|
-
ttlSeconds:
|
|
2615
|
+
row: X.value,
|
|
2616
|
+
ttlSeconds: X.ttlSeconds,
|
|
2578
2617
|
project: n
|
|
2579
2618
|
}) : await R.mutateAsync({
|
|
2580
2619
|
id: e.id,
|
|
2581
|
-
key:
|
|
2582
|
-
value:
|
|
2583
|
-
ifVersion:
|
|
2584
|
-
ttlSeconds:
|
|
2620
|
+
key: X.key,
|
|
2621
|
+
value: X.value,
|
|
2622
|
+
ifVersion: X.ifVersion,
|
|
2623
|
+
ttlSeconds: X.ttlSeconds,
|
|
2585
2624
|
project: n
|
|
2586
|
-
}),
|
|
2587
|
-
} catch (
|
|
2588
|
-
const
|
|
2589
|
-
if (
|
|
2590
|
-
|
|
2625
|
+
}), b((Y) => le(Y, c)), J(c);
|
|
2626
|
+
} catch (Y) {
|
|
2627
|
+
const se = G(Y);
|
|
2628
|
+
if (at(se)) {
|
|
2629
|
+
k((Ie) => ({ ...Ie, [c]: !0 }));
|
|
2591
2630
|
return;
|
|
2592
2631
|
}
|
|
2593
|
-
const
|
|
2594
|
-
if (
|
|
2595
|
-
g((Ie) => ({ ...Ie, [
|
|
2632
|
+
const he = mn(se, s);
|
|
2633
|
+
if (he !== null) {
|
|
2634
|
+
g((Ie) => ({ ...Ie, [c]: he }));
|
|
2596
2635
|
return;
|
|
2597
2636
|
}
|
|
2598
|
-
|
|
2637
|
+
E(se.message);
|
|
2599
2638
|
}
|
|
2600
2639
|
}
|
|
2601
|
-
async function
|
|
2640
|
+
async function j(c) {
|
|
2602
2641
|
try {
|
|
2603
|
-
const L = await Nt(N, e.id,
|
|
2604
|
-
|
|
2642
|
+
const L = await Nt(N, e.id, c, n);
|
|
2643
|
+
b((B) => ({ ...B, [c]: L })), J(c), await K.invalidateQueries({ queryKey: ["data-stores"] });
|
|
2605
2644
|
} catch (L) {
|
|
2606
|
-
|
|
2645
|
+
E(G(L).message);
|
|
2607
2646
|
}
|
|
2608
2647
|
}
|
|
2609
|
-
function
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2648
|
+
function H() {
|
|
2649
|
+
const c = I;
|
|
2650
|
+
v(null), c !== null && (c !== ie && O.mutate({ id: e.id, key: c, project: n }), J(c));
|
|
2612
2651
|
}
|
|
2613
|
-
async function
|
|
2614
|
-
|
|
2652
|
+
async function Z(c) {
|
|
2653
|
+
T(null);
|
|
2615
2654
|
try {
|
|
2616
|
-
const L = await
|
|
2617
|
-
|
|
2655
|
+
const L = await _.mutateAsync({ id: e.id, csv: await c.text(), project: n });
|
|
2656
|
+
T(Qe({ status: 200, text: JSON.stringify(L) }));
|
|
2618
2657
|
} catch (L) {
|
|
2619
2658
|
const B = L;
|
|
2620
|
-
|
|
2621
|
-
typeof B.status == "number" ?
|
|
2659
|
+
T(
|
|
2660
|
+
typeof B.status == "number" ? Qe({ status: B.status, text: JSON.stringify(B.raw ?? null) }) : { ok: !1, message: G(L).message }
|
|
2622
2661
|
);
|
|
2623
2662
|
}
|
|
2624
2663
|
}
|
|
2625
|
-
async function
|
|
2664
|
+
async function C() {
|
|
2626
2665
|
try {
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2629
|
-
} catch (
|
|
2630
|
-
|
|
2666
|
+
const c = await A.mutateAsync({ id: e.id, project: n });
|
|
2667
|
+
fs(cn(null, e.name), c), T(null);
|
|
2668
|
+
} catch (c) {
|
|
2669
|
+
T({ ok: !1, message: G(c).message });
|
|
2631
2670
|
}
|
|
2632
2671
|
}
|
|
2633
2672
|
return /* @__PURE__ */ l("div", { children: [
|
|
2634
2673
|
/* @__PURE__ */ t(
|
|
2635
|
-
|
|
2674
|
+
nn,
|
|
2636
2675
|
{
|
|
2637
|
-
result:
|
|
2638
|
-
busy:
|
|
2639
|
-
onImport:
|
|
2640
|
-
onRefuse: (
|
|
2641
|
-
onExport:
|
|
2676
|
+
result: f,
|
|
2677
|
+
busy: A.isPending,
|
|
2678
|
+
onImport: Z,
|
|
2679
|
+
onRefuse: (c) => T({ ok: !1, message: c }),
|
|
2680
|
+
onExport: C
|
|
2642
2681
|
}
|
|
2643
2682
|
),
|
|
2644
2683
|
/* @__PURE__ */ t(
|
|
2645
|
-
|
|
2684
|
+
an,
|
|
2646
2685
|
{
|
|
2647
2686
|
columns: s,
|
|
2648
2687
|
keyColumn: i,
|
|
@@ -2651,152 +2690,152 @@ function ws({ store: e, project: n }) {
|
|
|
2651
2690
|
loading: M.isPending,
|
|
2652
2691
|
hasMore: M.hasNextPage,
|
|
2653
2692
|
empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
|
|
2654
|
-
onCellChange:
|
|
2655
|
-
onSave: (
|
|
2656
|
-
onDelete:
|
|
2657
|
-
onReload: (
|
|
2693
|
+
onCellChange: ee,
|
|
2694
|
+
onSave: (c) => void $(c),
|
|
2695
|
+
onDelete: v,
|
|
2696
|
+
onReload: (c) => void j(c),
|
|
2658
2697
|
onAddRow: () => {
|
|
2659
|
-
|
|
2698
|
+
ie in d || (u((c) => ({ ...c, [ie]: je(s) })), E(null));
|
|
2660
2699
|
},
|
|
2661
2700
|
onLoadMore: () => void M.fetchNextPage(),
|
|
2662
2701
|
onSearch: r
|
|
2663
2702
|
}
|
|
2664
2703
|
),
|
|
2665
|
-
|
|
2704
|
+
I !== null && /* @__PURE__ */ t(
|
|
2666
2705
|
Ne,
|
|
2667
2706
|
{
|
|
2668
2707
|
title: "Delete entry",
|
|
2669
|
-
message:
|
|
2708
|
+
message: I === ie ? "Discard this unsaved row?" : `Delete "${I}"? This cannot be undone.`,
|
|
2670
2709
|
confirmLabel: "Delete",
|
|
2671
|
-
onConfirm:
|
|
2672
|
-
onClose: () =>
|
|
2710
|
+
onConfirm: H,
|
|
2711
|
+
onClose: () => v(null)
|
|
2673
2712
|
}
|
|
2674
2713
|
)
|
|
2675
2714
|
] });
|
|
2676
2715
|
}
|
|
2677
|
-
function
|
|
2678
|
-
var
|
|
2679
|
-
const a = e.kind === "doc", s =
|
|
2680
|
-
(
|
|
2681
|
-
),
|
|
2682
|
-
const
|
|
2683
|
-
return
|
|
2716
|
+
function gs({ store: e, project: n }) {
|
|
2717
|
+
var ee;
|
|
2718
|
+
const a = e.kind === "doc", s = sn(e), [i, o] = p(""), [r, d] = p(null), [u, m] = p(!1), [g, h] = p(""), [k, w] = p(""), [b, y] = p(null), [E, I] = p(!1), [v, f] = p({}), [T, N] = p(null), K = me(), M = fe(), R = gt(e.id, n, i), F = vt(), O = bt(), _ = (((ee = R.data) == null ? void 0 : ee.pages.flatMap(($) => $.items)) ?? []).map(
|
|
2719
|
+
($) => v[$.key] ?? $
|
|
2720
|
+
), A = r === null ? void 0 : _.find(($) => $.key === r), P = u || r !== null, x = ($) => a ? JSON.stringify($.value ?? null, null, 2) : pn(s, $.value), D = ($) => {
|
|
2721
|
+
const j = x($).replace(/\s+/g, " ");
|
|
2722
|
+
return j.length > Je ? `${j.slice(0, Je)}…` : j;
|
|
2684
2723
|
};
|
|
2685
|
-
function
|
|
2686
|
-
|
|
2724
|
+
function S($) {
|
|
2725
|
+
d($.key), m(!1), w(x($)), y(null), I(!1);
|
|
2687
2726
|
}
|
|
2688
|
-
function
|
|
2689
|
-
|
|
2727
|
+
function V() {
|
|
2728
|
+
d(null), m(!1), h(""), w(""), y(null), I(!1);
|
|
2690
2729
|
}
|
|
2691
|
-
async function
|
|
2692
|
-
y(null),
|
|
2693
|
-
const
|
|
2694
|
-
if (
|
|
2695
|
-
y(
|
|
2730
|
+
async function U() {
|
|
2731
|
+
y(null), I(!1);
|
|
2732
|
+
const $ = a ? hn(k) : wn(s, k);
|
|
2733
|
+
if (!$.ok) {
|
|
2734
|
+
y($.message);
|
|
2696
2735
|
return;
|
|
2697
2736
|
}
|
|
2698
|
-
const
|
|
2699
|
-
if (
|
|
2737
|
+
const j = u ? g.trim() : r;
|
|
2738
|
+
if (j === null || j === "") {
|
|
2700
2739
|
y("Enter a key.");
|
|
2701
2740
|
return;
|
|
2702
2741
|
}
|
|
2703
2742
|
try {
|
|
2704
|
-
await
|
|
2743
|
+
await F.mutateAsync({
|
|
2705
2744
|
id: e.id,
|
|
2706
|
-
key:
|
|
2707
|
-
value:
|
|
2745
|
+
key: j,
|
|
2746
|
+
value: $.value,
|
|
2708
2747
|
// A new entry must not exist yet; an existing one is guarded by the version loaded.
|
|
2709
|
-
ifVersion:
|
|
2710
|
-
ttlSeconds:
|
|
2748
|
+
ifVersion: u ? 0 : (A == null ? void 0 : A.version) ?? 0,
|
|
2749
|
+
ttlSeconds: u ? void 0 : nt((A == null ? void 0 : A.expiresAt) ?? null, Date.now()),
|
|
2711
2750
|
project: n
|
|
2712
|
-
}),
|
|
2713
|
-
} catch (
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2751
|
+
}), f((H) => le(H, j)), V();
|
|
2752
|
+
} catch (H) {
|
|
2753
|
+
const Z = G(H);
|
|
2754
|
+
at(Z) ? I(!0) : y(Z.message);
|
|
2716
2755
|
}
|
|
2717
2756
|
}
|
|
2718
|
-
async function
|
|
2757
|
+
async function W() {
|
|
2719
2758
|
if (r !== null)
|
|
2720
2759
|
try {
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2723
|
-
} catch (
|
|
2724
|
-
y(
|
|
2760
|
+
const $ = await Nt(K, e.id, r, n);
|
|
2761
|
+
f((j) => ({ ...j, [r]: $ })), w(x($)), I(!1), y(null), await M.invalidateQueries({ queryKey: ["data-stores"] });
|
|
2762
|
+
} catch ($) {
|
|
2763
|
+
y(G($).message);
|
|
2725
2764
|
}
|
|
2726
2765
|
}
|
|
2727
|
-
async function
|
|
2728
|
-
const
|
|
2729
|
-
if (N(null),
|
|
2766
|
+
async function J() {
|
|
2767
|
+
const $ = T;
|
|
2768
|
+
if (N(null), $ !== null)
|
|
2730
2769
|
try {
|
|
2731
|
-
await
|
|
2732
|
-
} catch (
|
|
2733
|
-
y(
|
|
2770
|
+
await O.mutateAsync({ id: e.id, key: $, project: n }), $ === r && V();
|
|
2771
|
+
} catch (j) {
|
|
2772
|
+
y(G(j).message);
|
|
2734
2773
|
}
|
|
2735
2774
|
}
|
|
2736
2775
|
return /* @__PURE__ */ l("div", { children: [
|
|
2737
2776
|
/* @__PURE__ */ t(
|
|
2738
|
-
|
|
2777
|
+
ln,
|
|
2739
2778
|
{
|
|
2740
|
-
rows:
|
|
2779
|
+
rows: _.map(($) => ({ key: $.key, version: $.version, preview: D($) })),
|
|
2741
2780
|
loading: R.isPending,
|
|
2742
2781
|
empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
|
|
2743
2782
|
hasMore: R.hasNextPage,
|
|
2744
|
-
onOpen: (
|
|
2745
|
-
const
|
|
2746
|
-
|
|
2783
|
+
onOpen: ($) => {
|
|
2784
|
+
const j = _.find((H) => H.key === $);
|
|
2785
|
+
j && S(j);
|
|
2747
2786
|
},
|
|
2748
2787
|
onSearch: o,
|
|
2749
2788
|
onNew: () => {
|
|
2750
|
-
|
|
2789
|
+
d(null), m(!0), h(""), w(""), y(null), I(!1);
|
|
2751
2790
|
},
|
|
2752
2791
|
onLoadMore: () => void R.fetchNextPage()
|
|
2753
2792
|
}
|
|
2754
2793
|
),
|
|
2755
|
-
|
|
2756
|
-
|
|
2794
|
+
P && /* @__PURE__ */ t(
|
|
2795
|
+
rn,
|
|
2757
2796
|
{
|
|
2758
2797
|
kind: a ? "doc" : "kv",
|
|
2759
|
-
isNew:
|
|
2798
|
+
isNew: u,
|
|
2760
2799
|
entryKey: r ?? void 0,
|
|
2761
2800
|
newKey: g,
|
|
2762
|
-
version: (
|
|
2763
|
-
expiresAt: (
|
|
2764
|
-
text:
|
|
2765
|
-
error:
|
|
2766
|
-
conflict:
|
|
2767
|
-
saving:
|
|
2768
|
-
onDelete:
|
|
2769
|
-
onTextChange: (
|
|
2770
|
-
w(
|
|
2801
|
+
version: (A == null ? void 0 : A.version) ?? null,
|
|
2802
|
+
expiresAt: (A == null ? void 0 : A.expiresAt) ?? null,
|
|
2803
|
+
text: k,
|
|
2804
|
+
error: b,
|
|
2805
|
+
conflict: E,
|
|
2806
|
+
saving: F.isPending || O.isPending,
|
|
2807
|
+
onDelete: u ? void 0 : () => N(r),
|
|
2808
|
+
onTextChange: ($) => {
|
|
2809
|
+
w($), y(null);
|
|
2771
2810
|
},
|
|
2772
2811
|
onKeyChange: h,
|
|
2773
|
-
onSave: () => void
|
|
2774
|
-
onCancel:
|
|
2775
|
-
onReload: () => void
|
|
2812
|
+
onSave: () => void U(),
|
|
2813
|
+
onCancel: V,
|
|
2814
|
+
onReload: () => void W()
|
|
2776
2815
|
}
|
|
2777
2816
|
),
|
|
2778
|
-
|
|
2817
|
+
T !== null && /* @__PURE__ */ t(
|
|
2779
2818
|
Ne,
|
|
2780
2819
|
{
|
|
2781
2820
|
title: "Delete entry",
|
|
2782
|
-
message: `Delete "${
|
|
2821
|
+
message: `Delete "${T}"? This cannot be undone.`,
|
|
2783
2822
|
confirmLabel: "Delete",
|
|
2784
|
-
onConfirm:
|
|
2823
|
+
onConfirm: J,
|
|
2785
2824
|
onClose: () => N(null)
|
|
2786
2825
|
}
|
|
2787
2826
|
)
|
|
2788
2827
|
] });
|
|
2789
2828
|
}
|
|
2790
|
-
function
|
|
2829
|
+
function le(e, n) {
|
|
2791
2830
|
if (!(n in e)) return e;
|
|
2792
2831
|
const a = { ...e };
|
|
2793
2832
|
return delete a[n], a;
|
|
2794
2833
|
}
|
|
2795
|
-
function
|
|
2796
|
-
const s =
|
|
2834
|
+
function oi({ id: e, project: n, slots: a }) {
|
|
2835
|
+
const s = ne(n), i = ia(e, s ?? void 0), o = i.data;
|
|
2797
2836
|
let r;
|
|
2798
|
-
s == null ? r = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? r = /* @__PURE__ */ t("p", { className: "result error", children:
|
|
2799
|
-
const
|
|
2837
|
+
s == null ? r = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? r = /* @__PURE__ */ t("p", { className: "result error", children: G(i.error).message }) : o === void 0 ? r = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? r = /* @__PURE__ */ t(ys, { store: o, project: s }, o.id) : r = /* @__PURE__ */ t(gs, { store: o, project: s }, o.id);
|
|
2838
|
+
const d = (a == null ? void 0 : a.header) === void 0 ? o && /* @__PURE__ */ l("div", { children: [
|
|
2800
2839
|
/* @__PURE__ */ t("h3", { children: o.name }),
|
|
2801
2840
|
/* @__PURE__ */ l("p", { className: "muted small", children: [
|
|
2802
2841
|
o.kind,
|
|
@@ -2807,41 +2846,41 @@ function ii({ id: e, project: n, slots: a }) {
|
|
|
2807
2846
|
] })
|
|
2808
2847
|
] }) : a.header;
|
|
2809
2848
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
2810
|
-
|
|
2849
|
+
d,
|
|
2811
2850
|
r
|
|
2812
2851
|
] }) });
|
|
2813
2852
|
}
|
|
2814
|
-
const
|
|
2815
|
-
function
|
|
2816
|
-
const [n, a] =
|
|
2817
|
-
function
|
|
2818
|
-
|
|
2853
|
+
const vs = ["name", "kind", "description", "schema"];
|
|
2854
|
+
function bs(e) {
|
|
2855
|
+
const [n, a] = p(""), [s, i] = p(""), [o, r] = p("kv"), [d, u] = p("string"), [m, g] = p([]), [h, k] = p(""), [w, b] = p({}), [y, E] = p({}), [I, v] = p(null), f = ua();
|
|
2856
|
+
function T() {
|
|
2857
|
+
b({}), E({}), v(null);
|
|
2819
2858
|
const N = {
|
|
2820
2859
|
kind: o,
|
|
2821
2860
|
name: n
|
|
2822
2861
|
};
|
|
2823
|
-
o === "kv" && (N.schema = { valueType:
|
|
2862
|
+
o === "kv" && (N.schema = { valueType: d }), o === "table" && (N.schema = h === "" ? { columns: m } : { columns: m, key: h }), s !== "" && (N.description = s), f.mutate(
|
|
2824
2863
|
// The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
|
|
2825
2864
|
// per kind, so the kv `{valueType}` schema is passed through as the host defines it.
|
|
2826
2865
|
{ input: N, project: e.project },
|
|
2827
2866
|
{
|
|
2828
2867
|
onSuccess: () => e.onClose(),
|
|
2829
|
-
onError: (
|
|
2830
|
-
const M =
|
|
2831
|
-
if (R.kind === "cell" &&
|
|
2832
|
-
|
|
2868
|
+
onError: (K) => {
|
|
2869
|
+
const M = G(K), R = Nn(M);
|
|
2870
|
+
if (R.kind === "cell" && m.some((F) => F.name === R.column)) {
|
|
2871
|
+
E({ [R.column]: M.message });
|
|
2833
2872
|
return;
|
|
2834
2873
|
}
|
|
2835
|
-
if (R.kind === "field" &&
|
|
2836
|
-
|
|
2874
|
+
if (R.kind === "field" && vs.includes(R.field)) {
|
|
2875
|
+
b({ [R.field]: M.message });
|
|
2837
2876
|
return;
|
|
2838
2877
|
}
|
|
2839
|
-
|
|
2878
|
+
v(M.message);
|
|
2840
2879
|
}
|
|
2841
2880
|
}
|
|
2842
2881
|
);
|
|
2843
2882
|
}
|
|
2844
|
-
return /* @__PURE__ */ l(
|
|
2883
|
+
return /* @__PURE__ */ l(Pn, { title: "New data store", onClose: e.onClose, children: [
|
|
2845
2884
|
/* @__PURE__ */ l("div", { className: "modal-body", children: [
|
|
2846
2885
|
/* @__PURE__ */ l("label", { className: "field", children: [
|
|
2847
2886
|
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
@@ -2877,9 +2916,9 @@ function ys(e) {
|
|
|
2877
2916
|
"data-testid": "data-store-kind",
|
|
2878
2917
|
value: o,
|
|
2879
2918
|
onChange: (N) => {
|
|
2880
|
-
r(N.target.value),
|
|
2919
|
+
r(N.target.value), k("");
|
|
2881
2920
|
},
|
|
2882
|
-
children:
|
|
2921
|
+
children: yn.map((N) => /* @__PURE__ */ t("option", { value: N, children: gn[N] }, N))
|
|
2883
2922
|
}
|
|
2884
2923
|
),
|
|
2885
2924
|
/* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
|
|
@@ -2887,20 +2926,20 @@ function ys(e) {
|
|
|
2887
2926
|
w.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.kind }),
|
|
2888
2927
|
o === "kv" && /* @__PURE__ */ l("label", { className: "field", children: [
|
|
2889
2928
|
/* @__PURE__ */ t("span", { children: "Value type" }),
|
|
2890
|
-
/* @__PURE__ */ t("select", { value:
|
|
2929
|
+
/* @__PURE__ */ t("select", { value: d, onChange: (N) => u(N.target.value), children: vn.map((N) => /* @__PURE__ */ t("option", { value: N, children: N }, N)) })
|
|
2891
2930
|
] }),
|
|
2892
2931
|
o === "table" && /* @__PURE__ */ t(
|
|
2893
|
-
|
|
2932
|
+
bn,
|
|
2894
2933
|
{
|
|
2895
|
-
columns:
|
|
2934
|
+
columns: m,
|
|
2896
2935
|
onChange: g,
|
|
2897
2936
|
keyColumn: h,
|
|
2898
|
-
onKeyColumnChange:
|
|
2937
|
+
onKeyColumnChange: k,
|
|
2899
2938
|
columnErrors: y
|
|
2900
2939
|
}
|
|
2901
2940
|
),
|
|
2902
2941
|
w.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.schema }),
|
|
2903
|
-
|
|
2942
|
+
I !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: I })
|
|
2904
2943
|
] }),
|
|
2905
2944
|
/* @__PURE__ */ l("div", { className: "modal-actions", children: [
|
|
2906
2945
|
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
|
|
@@ -2910,30 +2949,30 @@ function ys(e) {
|
|
|
2910
2949
|
type: "button",
|
|
2911
2950
|
className: "btn",
|
|
2912
2951
|
"data-testid": "data-store-create",
|
|
2913
|
-
disabled:
|
|
2914
|
-
onClick:
|
|
2915
|
-
children:
|
|
2952
|
+
disabled: f.isPending,
|
|
2953
|
+
onClick: T,
|
|
2954
|
+
children: f.isPending ? "Creating…" : "Create"
|
|
2916
2955
|
}
|
|
2917
2956
|
)
|
|
2918
2957
|
] })
|
|
2919
2958
|
] });
|
|
2920
2959
|
}
|
|
2921
|
-
function
|
|
2922
|
-
const i =
|
|
2960
|
+
function ci({ project: e, onOpen: n, getHref: a, slots: s }) {
|
|
2961
|
+
const i = ne(e), o = ca(i ?? void 0), r = da(), [d, u] = p(!1), [m, g] = p(null), [h, k] = p(null), w = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
|
|
2923
2962
|
/* @__PURE__ */ t("h3", { children: "Data stores" }),
|
|
2924
2963
|
/* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
|
|
2925
2964
|
] }) : s.header;
|
|
2926
2965
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
2927
2966
|
/* @__PURE__ */ t(
|
|
2928
|
-
|
|
2967
|
+
fn,
|
|
2929
2968
|
{
|
|
2930
2969
|
stores: o.data ?? [],
|
|
2931
2970
|
loading: o.isLoading,
|
|
2932
|
-
error: h ?? (o.error != null ?
|
|
2971
|
+
error: h ?? (o.error != null ? G(o.error).message : null),
|
|
2933
2972
|
onOpen: n,
|
|
2934
2973
|
getHref: a,
|
|
2935
|
-
onArchive: (
|
|
2936
|
-
|
|
2974
|
+
onArchive: (b) => {
|
|
2975
|
+
k(null), g(b);
|
|
2937
2976
|
},
|
|
2938
2977
|
busy: r.isPending,
|
|
2939
2978
|
slots: {
|
|
@@ -2945,7 +2984,7 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
|
|
|
2945
2984
|
className: "btn",
|
|
2946
2985
|
"data-testid": "data-store-new",
|
|
2947
2986
|
disabled: i == null,
|
|
2948
|
-
onClick: () =>
|
|
2987
|
+
onClick: () => u(!0),
|
|
2949
2988
|
children: "+ New data store"
|
|
2950
2989
|
}
|
|
2951
2990
|
),
|
|
@@ -2953,18 +2992,18 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
|
|
|
2953
2992
|
}
|
|
2954
2993
|
}
|
|
2955
2994
|
),
|
|
2956
|
-
|
|
2957
|
-
|
|
2995
|
+
d && i != null && /* @__PURE__ */ t(bs, { project: i, onClose: () => u(!1) }),
|
|
2996
|
+
m && /* @__PURE__ */ t(
|
|
2958
2997
|
Ne,
|
|
2959
2998
|
{
|
|
2960
2999
|
title: "Archive data store",
|
|
2961
|
-
message: `Archive "${
|
|
3000
|
+
message: `Archive "${m.name}" and its ${m.entryCount} ${m.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
|
|
2962
3001
|
confirmLabel: "Archive",
|
|
2963
3002
|
onConfirm: () => {
|
|
2964
|
-
const
|
|
3003
|
+
const b = m;
|
|
2965
3004
|
g(null), i != null && r.mutate(
|
|
2966
|
-
{ id:
|
|
2967
|
-
{ onError: (y) =>
|
|
3005
|
+
{ id: b.id, project: i },
|
|
3006
|
+
{ onError: (y) => k(G(y).message) }
|
|
2968
3007
|
);
|
|
2969
3008
|
},
|
|
2970
3009
|
onClose: () => g(null)
|
|
@@ -2973,25 +3012,25 @@ function li({ project: e, onOpen: n, getHref: a, slots: s }) {
|
|
|
2973
3012
|
] });
|
|
2974
3013
|
}
|
|
2975
3014
|
export {
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
3015
|
+
Gs as ActivitySummary,
|
|
3016
|
+
ti as ConnectionDetail,
|
|
3017
|
+
ei as ConnectionList,
|
|
3018
|
+
ii as CredentialCreate,
|
|
3019
|
+
li as CredentialDetail,
|
|
3020
|
+
si as CredentialList,
|
|
3021
|
+
ci as DataStoreList,
|
|
3022
|
+
oi as DataStoreView,
|
|
3023
|
+
Js as DocumentList,
|
|
3024
|
+
Hs as EndpointList,
|
|
3025
|
+
Us as FunctionList,
|
|
3026
|
+
Ta as Logs,
|
|
3027
|
+
Zs as LogsView,
|
|
3028
|
+
ni as ModelCatalog,
|
|
3029
|
+
ai as ModelUsage,
|
|
3030
|
+
ri as MyAiKeys,
|
|
3031
|
+
zs as ReliabilityBoard,
|
|
3032
|
+
Ca as RunHistory,
|
|
3033
|
+
Xs as ServiceDetail,
|
|
3034
|
+
Ys as WorkflowList
|
|
2996
3035
|
};
|
|
2997
3036
|
//# sourceMappingURL=lists.mjs.map
|