@w6w/embed 0.2.27 → 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 +1236 -1140
- 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,38 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as l, jsx as t, Fragment as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { F as
|
|
5
|
-
import { d as
|
|
6
|
-
import { u as
|
|
7
|
-
import { CallableList 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
|
|
25
|
-
import { u as
|
|
26
|
-
import { h as
|
|
27
|
-
function
|
|
28
|
-
const { kind: n } = e, a =
|
|
2
|
+
import { jsxs as l, jsx as t, Fragment as q } from "react/jsx-runtime";
|
|
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(
|
|
35
|
-
|
|
35
|
+
qt,
|
|
36
36
|
{
|
|
37
37
|
rows: o,
|
|
38
38
|
title: a.listTitle,
|
|
@@ -49,35 +49,35 @@ function Pe(e) {
|
|
|
49
49
|
error: e.error,
|
|
50
50
|
onCreate: e.onCreate,
|
|
51
51
|
creating: e.creating,
|
|
52
|
-
onImport: () =>
|
|
52
|
+
onImport: () => i(!0),
|
|
53
53
|
onOpen: e.onOpen,
|
|
54
54
|
getHref: e.getHref,
|
|
55
55
|
slots: e.slots
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
s && /* @__PURE__ */ t(
|
|
59
|
+
kn,
|
|
60
60
|
{
|
|
61
61
|
kind: n,
|
|
62
62
|
project: e.project ?? void 0,
|
|
63
|
-
listKeys: { functionsKey:
|
|
64
|
-
onOpenImported: (r,
|
|
63
|
+
listKeys: { functionsKey: Ft, endpointsKey: Ot, workflowsKey: Tn },
|
|
64
|
+
onOpenImported: (r, d) => {
|
|
65
65
|
var u;
|
|
66
|
-
return (u = e.onOpen) == null ? void 0 : u.call(e,
|
|
66
|
+
return (u = e.onOpen) == null ? void 0 : u.call(e, d);
|
|
67
67
|
},
|
|
68
|
-
onClose: () =>
|
|
68
|
+
onClose: () => i(!1)
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
71
|
e.children
|
|
72
72
|
] });
|
|
73
73
|
}
|
|
74
|
-
function
|
|
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,
|
|
@@ -89,35 +89,35 @@ function Fs(e) {
|
|
|
89
89
|
return {
|
|
90
90
|
title: o.displayName || o.key,
|
|
91
91
|
description: o.description,
|
|
92
|
-
badges: (r = o.tags) != null && r.length || !o.valid ? /* @__PURE__ */ l(
|
|
93
|
-
/* @__PURE__ */ t(
|
|
92
|
+
badges: (r = o.tags) != null && r.length || !o.valid ? /* @__PURE__ */ l(q, { children: [
|
|
93
|
+
/* @__PURE__ */ t(kt, { tags: o.tags }),
|
|
94
94
|
o.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
|
|
95
95
|
] }) : null
|
|
96
96
|
};
|
|
97
97
|
},
|
|
98
98
|
onOpen: e.onOpen,
|
|
99
99
|
getHref: e.getHref,
|
|
100
|
-
onCreate: () =>
|
|
100
|
+
onCreate: () => i(Me("function")),
|
|
101
101
|
slots: e.slots,
|
|
102
|
-
children:
|
|
103
|
-
|
|
102
|
+
children: s !== null && /* @__PURE__ */ t(
|
|
103
|
+
Rt,
|
|
104
104
|
{
|
|
105
|
-
newId:
|
|
105
|
+
newId: s,
|
|
106
106
|
takenKeys: (n.data ?? []).map((o) => o.key),
|
|
107
|
-
onClose: () =>
|
|
107
|
+
onClose: () => i(null),
|
|
108
108
|
onCreated: (o) => {
|
|
109
109
|
var r;
|
|
110
|
-
|
|
110
|
+
i(null), (r = e.onCreated) == null || r.call(e, o);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
)
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const n =
|
|
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,
|
|
@@ -129,9 +129,9 @@ function Qs(e) {
|
|
|
129
129
|
return {
|
|
130
130
|
// The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
|
|
131
131
|
// a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
|
|
132
|
-
title: /* @__PURE__ */ l(
|
|
132
|
+
title: /* @__PURE__ */ l(q, { children: [
|
|
133
133
|
/* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
|
|
134
|
-
|
|
134
|
+
Qt(o) ? /* @__PURE__ */ t(
|
|
135
135
|
"span",
|
|
136
136
|
{
|
|
137
137
|
className: "tag warn",
|
|
@@ -142,43 +142,43 @@ function Qs(e) {
|
|
|
142
142
|
) : null
|
|
143
143
|
] }),
|
|
144
144
|
description: o.description,
|
|
145
|
-
badges: (r = o.tags) != null && r.length ? /* @__PURE__ */ t(
|
|
145
|
+
badges: (r = o.tags) != null && r.length ? /* @__PURE__ */ t(kt, { tags: o.tags }) : null
|
|
146
146
|
};
|
|
147
147
|
},
|
|
148
148
|
onOpen: e.onOpen,
|
|
149
149
|
getHref: e.getHref,
|
|
150
|
-
onCreate: () =>
|
|
150
|
+
onCreate: () => i(Me("endpoint")),
|
|
151
151
|
slots: e.slots,
|
|
152
|
-
children:
|
|
153
|
-
|
|
152
|
+
children: s !== null && /* @__PURE__ */ t(
|
|
153
|
+
Pt,
|
|
154
154
|
{
|
|
155
|
-
newId:
|
|
155
|
+
newId: s,
|
|
156
156
|
takenKeys: (n.data ?? []).map((o) => o.key),
|
|
157
|
-
onClose: () =>
|
|
157
|
+
onClose: () => i(null),
|
|
158
158
|
onCreated: (o) => {
|
|
159
159
|
var r;
|
|
160
|
-
|
|
160
|
+
i(null), (r = e.onCreated) == null || r.call(e, o);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
)
|
|
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,
|
|
174
174
|
loading: a.isLoading,
|
|
175
|
-
error:
|
|
175
|
+
error: i ?? (a.error ? String(a.error) : null),
|
|
176
176
|
project: n,
|
|
177
177
|
toRow: (r) => ({
|
|
178
178
|
title: r.displayName || r.name,
|
|
179
179
|
description: r.description,
|
|
180
|
-
badges: /* @__PURE__ */ l(
|
|
181
|
-
r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((
|
|
180
|
+
badges: /* @__PURE__ */ l(q, { children: [
|
|
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,84 +191,84 @@ function _s(e) {
|
|
|
191
191
|
getHref: e.getHref,
|
|
192
192
|
onCreate: () => {
|
|
193
193
|
o(null);
|
|
194
|
-
const r =
|
|
195
|
-
|
|
196
|
-
onSuccess: (
|
|
194
|
+
const r = An((a.data ?? []).map((d) => d.displayName || d.name));
|
|
195
|
+
s.mutate(Dn(Me("workflow"), r), {
|
|
196
|
+
onSuccess: (d) => {
|
|
197
197
|
var u;
|
|
198
|
-
return (u = e.onCreated) == null ? void 0 : u.call(e,
|
|
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
|
-
creating:
|
|
203
|
+
creating: s.isPending,
|
|
204
204
|
slots: e.slots
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function zs({
|
|
209
209
|
project: e,
|
|
210
210
|
variant: n = "full",
|
|
211
211
|
limit: a,
|
|
212
|
-
days:
|
|
213
|
-
showChart:
|
|
212
|
+
days: s = 30,
|
|
213
|
+
showChart: i,
|
|
214
214
|
getHref: o,
|
|
215
215
|
onOpen: r,
|
|
216
|
-
showAllHref:
|
|
216
|
+
showAllHref: d,
|
|
217
217
|
onShowAll: u,
|
|
218
|
-
slots:
|
|
218
|
+
slots: m
|
|
219
219
|
}) {
|
|
220
|
-
var y,
|
|
221
|
-
const g =
|
|
222
|
-
let
|
|
223
|
-
return k ? w.isLoading ?
|
|
224
|
-
|
|
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
|
+
_t,
|
|
225
225
|
{
|
|
226
226
|
services: k ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
|
|
227
|
-
window: k ? (
|
|
228
|
-
days:
|
|
227
|
+
window: k ? (E = w.data) == null ? void 0 : E.window : void 0,
|
|
228
|
+
days: s,
|
|
229
229
|
compact: n === "compact",
|
|
230
|
-
showChart:
|
|
230
|
+
showChart: i,
|
|
231
231
|
limit: a,
|
|
232
232
|
getHref: o,
|
|
233
233
|
onOpen: r,
|
|
234
|
-
showAllHref:
|
|
234
|
+
showAllHref: d,
|
|
235
235
|
onShowAll: u,
|
|
236
|
-
slots: { ...
|
|
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
|
-
] }) :
|
|
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 Vs({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
|
|
|
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,57 +331,64 @@ function Vs({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
|
|
|
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
361
|
u && /* @__PURE__ */ t(
|
|
352
|
-
|
|
362
|
+
Kn,
|
|
353
363
|
{
|
|
354
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(
|
|
361
|
-
|
|
378
|
+
Ne,
|
|
362
379
|
{
|
|
363
380
|
title: "Delete document",
|
|
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
|
-
onClose: () =>
|
|
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",
|
|
@@ -382,10 +399,10 @@ const oa = {
|
|
|
382
399
|
endpoint: "Endpoint call",
|
|
383
400
|
action: "App action"
|
|
384
401
|
};
|
|
385
|
-
function
|
|
386
|
-
return
|
|
402
|
+
function be(e) {
|
|
403
|
+
return ha[e] ?? e;
|
|
387
404
|
}
|
|
388
|
-
const
|
|
405
|
+
const Ct = {
|
|
389
406
|
workflow: "workflow",
|
|
390
407
|
workflow_step: "workflow_step",
|
|
391
408
|
connection_test: "base",
|
|
@@ -394,207 +411,207 @@ const Nt = {
|
|
|
394
411
|
endpoint: "base",
|
|
395
412
|
action: "base"
|
|
396
413
|
};
|
|
397
|
-
function
|
|
398
|
-
return Object.hasOwn(
|
|
414
|
+
function wa(e) {
|
|
415
|
+
return Object.hasOwn(Ct, e);
|
|
399
416
|
}
|
|
400
|
-
function
|
|
401
|
-
return
|
|
417
|
+
function Tt(e) {
|
|
418
|
+
return wa(e) ? Ct[e] : "base";
|
|
402
419
|
}
|
|
403
|
-
function
|
|
420
|
+
function pa(e, n) {
|
|
404
421
|
const a = /* @__PURE__ */ new Map();
|
|
405
|
-
for (const
|
|
406
|
-
const o =
|
|
407
|
-
o && a.set(
|
|
422
|
+
for (const i of e ?? []) {
|
|
423
|
+
const o = i.displayName || i.key;
|
|
424
|
+
o && a.set(i.id, o);
|
|
408
425
|
}
|
|
409
|
-
const
|
|
410
|
-
for (const
|
|
411
|
-
const o =
|
|
412
|
-
o &&
|
|
426
|
+
const s = /* @__PURE__ */ new Map();
|
|
427
|
+
for (const i of n ?? []) {
|
|
428
|
+
const o = i.displayName || i.name;
|
|
429
|
+
o && s.set(i.id, o);
|
|
413
430
|
}
|
|
414
|
-
return { functions: a, workflows:
|
|
415
|
-
}
|
|
416
|
-
function
|
|
417
|
-
const a = e.summary ??
|
|
418
|
-
if (
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
return { text:
|
|
431
|
+
return { functions: a, workflows: s };
|
|
432
|
+
}
|
|
433
|
+
function fa(e, n) {
|
|
434
|
+
const a = e.summary ?? be(e.kind), s = Tt(e.kind);
|
|
435
|
+
if (s === "function" && e.functionId !== null) {
|
|
436
|
+
const i = n.functions.get(e.functionId);
|
|
437
|
+
if (i !== void 0)
|
|
438
|
+
return { text: i, target: { kind: "function", id: e.functionId } };
|
|
422
439
|
}
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
return { text:
|
|
440
|
+
if (s === "workflow" && e.workflowId !== null) {
|
|
441
|
+
const i = n.workflows.get(e.workflowId);
|
|
442
|
+
if (i !== void 0)
|
|
443
|
+
return { text: i, target: { kind: "workflow", id: e.workflowId } };
|
|
427
444
|
}
|
|
428
|
-
if (
|
|
429
|
-
const
|
|
445
|
+
if (s === "workflow_step") {
|
|
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
|
|
438
|
-
function
|
|
454
|
+
const we = (e) => String(e).padStart(2, "0");
|
|
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
|
-
function
|
|
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
|
-
const
|
|
453
|
-
return n === "week" ? `Week of ${
|
|
469
|
+
const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
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
|
|
468
485
|
}) {
|
|
469
|
-
const
|
|
486
|
+
const s = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
|
|
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
|
-
onOpen:
|
|
500
|
+
onOpen: s
|
|
484
501
|
}) {
|
|
485
|
-
const { text:
|
|
486
|
-
if (o === null) return /* @__PURE__ */ t(
|
|
487
|
-
const r =
|
|
488
|
-
return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: r, children:
|
|
502
|
+
const { text: i, target: o } = fa(e, n);
|
|
503
|
+
if (o === null) return /* @__PURE__ */ t(q, { children: i });
|
|
504
|
+
const r = s ? (d) => s(o, d) : void 0;
|
|
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
|
|
491
|
-
const a =
|
|
507
|
+
function Dt({ entry: e, title: n }) {
|
|
508
|
+
const a = It(e.durationMs);
|
|
492
509
|
return /* @__PURE__ */ t(
|
|
493
|
-
|
|
510
|
+
Le,
|
|
494
511
|
{
|
|
495
|
-
icon: /* @__PURE__ */ t(
|
|
496
|
-
title: n ?? e.summary ??
|
|
497
|
-
subtitle: `${
|
|
512
|
+
icon: /* @__PURE__ */ t(At, { ok: e.ok }),
|
|
513
|
+
title: n ?? e.summary ?? be(e.kind),
|
|
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
|
|
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
|
-
), u =
|
|
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: (
|
|
530
|
-
loading:
|
|
546
|
+
headline: (v = s.data) == null ? void 0 : v.headline,
|
|
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: (
|
|
538
|
-
loading:
|
|
554
|
+
headline: (f = i.data) == null ? void 0 : f.headline,
|
|
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:
|
|
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:
|
|
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:
|
|
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 ||
|
|
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
|
-
scope:
|
|
583
|
-
showKind: e.showKind ??
|
|
599
|
+
scope: i,
|
|
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,39 +624,39 @@ function Na(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 `${
|
|
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)"],
|
|
636
653
|
["e5xx", "5xx"]
|
|
637
654
|
];
|
|
638
|
-
function
|
|
655
|
+
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, {
|
|
@@ -649,14 +666,14 @@ function Oe(e) {
|
|
|
649
666
|
minute: "2-digit"
|
|
650
667
|
});
|
|
651
668
|
}
|
|
652
|
-
function
|
|
669
|
+
function ge({ label: e, value: n, hint: a }) {
|
|
653
670
|
return /* @__PURE__ */ l("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
|
|
654
671
|
/* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
|
|
655
672
|
/* @__PURE__ */ t("div", { className: "muted small", children: e }),
|
|
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,13 +690,13 @@ function Ea({
|
|
|
673
690
|
", not a gap in the data above."
|
|
674
691
|
] })
|
|
675
692
|
] });
|
|
676
|
-
const a = e.state === "unknown",
|
|
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,
|
|
680
697
|
" status",
|
|
681
698
|
" ",
|
|
682
|
-
/* @__PURE__ */ t(
|
|
699
|
+
/* @__PURE__ */ t(ve, { state: e.state, label: a ? "Unavailable" : void 0 })
|
|
683
700
|
] }),
|
|
684
701
|
a && /* @__PURE__ */ t("p", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "We could not get a status from this API, so we cannot say whether it is up. That is separate from your own calls above, which are measured here regardless." }),
|
|
685
702
|
e.message && /* @__PURE__ */ t(
|
|
@@ -699,24 +716,24 @@ function Ea({
|
|
|
699
716
|
n,
|
|
700
717
|
" says about itself, not what your calls did · last checked",
|
|
701
718
|
" ",
|
|
702
|
-
|
|
703
|
-
e.attributedTo.length > 0 && /* @__PURE__ */ l(
|
|
719
|
+
Fe(e.checkedAt),
|
|
720
|
+
e.attributedTo.length > 0 && /* @__PURE__ */ l(q, { children: [
|
|
704
721
|
" ",
|
|
705
722
|
"· decided by",
|
|
706
723
|
" ",
|
|
707
724
|
e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
|
|
708
725
|
] })
|
|
709
726
|
] }),
|
|
710
|
-
|
|
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
|
-
/* @__PURE__ */ t(
|
|
719
|
-
/* @__PURE__ */ t("div", { className: "muted small", children:
|
|
735
|
+
/* @__PURE__ */ t(ve, { state: r.state }),
|
|
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,10 +741,10 @@ function Ea({
|
|
|
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
|
-
const n = e.uptime, a = Math.max(1, ...n.map((
|
|
747
|
+
const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
|
|
731
748
|
return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
|
|
732
749
|
/* @__PURE__ */ t(
|
|
733
750
|
"div",
|
|
@@ -735,32 +752,32 @@ function Ia({ service: e }) {
|
|
|
735
752
|
className: "rel-daily-chart",
|
|
736
753
|
role: "img",
|
|
737
754
|
"aria-label": `${e.displayName}, calls per day, oldest first`,
|
|
738
|
-
children: n.map((
|
|
755
|
+
children: n.map((s) => /* @__PURE__ */ t(
|
|
739
756
|
"span",
|
|
740
757
|
{
|
|
741
|
-
className: `rel-daily-bar rel-daily-bar-${
|
|
742
|
-
style: { height: `${
|
|
743
|
-
title: `${
|
|
758
|
+
className: `rel-daily-bar rel-daily-bar-${s.state}`,
|
|
759
|
+
style: { height: `${s.calls > 0 ? Math.max(s.calls / a * 100, 4) : 2}%` },
|
|
760
|
+
title: `${Lt(`${s.day}T00:00:00.000Z`)} — ${s.calls} calls, ${s.state}`
|
|
744
761
|
},
|
|
745
|
-
|
|
762
|
+
s.day
|
|
746
763
|
))
|
|
747
764
|
}
|
|
748
765
|
),
|
|
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),
|
|
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:
|
|
763
|
-
incidents:
|
|
779
|
+
days: $a(e),
|
|
780
|
+
incidents: i,
|
|
764
781
|
vendorEmptyLabel: o,
|
|
765
782
|
ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
|
|
766
783
|
}
|
|
@@ -771,45 +788,45 @@ function Da({
|
|
|
771
788
|
" — never a quiet green."
|
|
772
789
|
] }),
|
|
773
790
|
a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((r) => /* @__PURE__ */ l("div", { className: "rel-day-row", children: [
|
|
774
|
-
/* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children:
|
|
775
|
-
/* @__PURE__ */ t(
|
|
791
|
+
/* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: Lt(`${r.day}T00:00:00.000Z`) }) }),
|
|
792
|
+
/* @__PURE__ */ t(ve, { state: r.state }),
|
|
776
793
|
/* @__PURE__ */ l("span", { className: "muted small", children: [
|
|
777
794
|
r.calls,
|
|
778
795
|
" calls"
|
|
779
796
|
] }),
|
|
780
|
-
/* @__PURE__ */ t("span", { className: "rel-errors", children:
|
|
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: [
|
|
781
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:
|
|
793
|
-
/* @__PURE__ */ t("span", { className: "muted small", 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: [
|
|
810
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: i }),
|
|
794
811
|
/* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
|
|
795
812
|
"span",
|
|
796
813
|
{
|
|
797
814
|
className: "rel-errormix-bar",
|
|
798
|
-
style: { width: `${Math.max(e[
|
|
815
|
+
style: { width: `${Math.max(e[s] / a * 100, e[s] > 0 ? 2 : 0)}%` }
|
|
799
816
|
}
|
|
800
817
|
) }),
|
|
801
|
-
/* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[
|
|
802
|
-
] },
|
|
818
|
+
/* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
|
|
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
|
-
const
|
|
809
|
-
return /* @__PURE__ */ t("div", { className: "error", children: (
|
|
825
|
+
const i = a.error;
|
|
826
|
+
return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof lt, i.message) });
|
|
810
827
|
}
|
|
811
|
-
const
|
|
812
|
-
return
|
|
828
|
+
const s = a.data ?? [];
|
|
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: [
|
|
813
830
|
/* @__PURE__ */ l("div", { className: "rel-call rel-call-head", children: [
|
|
814
831
|
/* @__PURE__ */ t("span", { children: "When" }),
|
|
815
832
|
/* @__PURE__ */ t("span", { children: "Action" }),
|
|
@@ -817,47 +834,47 @@ function La({ project: e, appId: n }) {
|
|
|
817
834
|
/* @__PURE__ */ t("span", { children: "Status" }),
|
|
818
835
|
/* @__PURE__ */ t("span", { children: "Took" })
|
|
819
836
|
] }),
|
|
820
|
-
|
|
821
|
-
/* @__PURE__ */ t("span", { className: "muted small", children:
|
|
822
|
-
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children:
|
|
823
|
-
/* @__PURE__ */ t("span", { className: "muted small", children:
|
|
824
|
-
/* @__PURE__ */ t("span", { className:
|
|
825
|
-
/* @__PURE__ */ t("span", { className: "muted small", children:
|
|
826
|
-
] },
|
|
837
|
+
s.map((i, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
|
|
838
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: Fe(i.createdAt) }),
|
|
839
|
+
/* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
|
|
840
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
|
|
841
|
+
/* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
|
|
842
|
+
/* @__PURE__ */ t("span", { className: "muted small", children: i.durationMs != null ? `${i.durationMs} ms` : "—" })
|
|
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,
|
|
839
|
-
backHref:
|
|
840
|
-
onBack:
|
|
856
|
+
backHref: s,
|
|
857
|
+
onBack: i,
|
|
841
858
|
slots: o
|
|
842
859
|
}) {
|
|
843
|
-
var k, w,
|
|
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
|
-
u.data && !
|
|
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: [
|
|
862
879
|
/* @__PURE__ */ l(
|
|
863
880
|
"div",
|
|
@@ -869,41 +886,41 @@ function Us({
|
|
|
869
886
|
marginBottom: "var(--w6w-sp-3)"
|
|
870
887
|
},
|
|
871
888
|
children: [
|
|
872
|
-
/* @__PURE__ */ t(
|
|
889
|
+
/* @__PURE__ */ t(ve, { state: h.state }),
|
|
873
890
|
/* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
|
|
874
|
-
/* @__PURE__ */ t("code", { className: "muted small", children:
|
|
875
|
-
|
|
891
|
+
/* @__PURE__ */ t("code", { className: "muted small", children: h.appId }),
|
|
892
|
+
h.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
|
|
876
893
|
]
|
|
877
894
|
}
|
|
878
895
|
),
|
|
879
896
|
/* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
|
|
880
|
-
/* @__PURE__ */ t(
|
|
897
|
+
/* @__PURE__ */ t(ge, { label: "Calls in window", value: String(h.calls) }),
|
|
881
898
|
/* @__PURE__ */ t(
|
|
882
|
-
|
|
899
|
+
ge,
|
|
883
900
|
{
|
|
884
901
|
label: "p95 latency",
|
|
885
|
-
value:
|
|
886
|
-
hint:
|
|
902
|
+
value: h.p95Ms === null ? "—" : `${h.p95Ms} ms`,
|
|
903
|
+
hint: h.p95Ms === null ? "no timed calls" : void 0
|
|
887
904
|
}
|
|
888
905
|
),
|
|
889
|
-
/* @__PURE__ */ t(
|
|
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: [
|
|
@@ -913,11 +930,11 @@ function Us({
|
|
|
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 Us({
|
|
|
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,18 +956,18 @@ function Sa(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,
|
|
947
|
-
return e.length === 0 ? null : /* @__PURE__ */ l(
|
|
963
|
+
const [a, s] = p(null), i = e.find((o) => o.id === a);
|
|
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" }),
|
|
950
967
|
" ",
|
|
951
968
|
/* @__PURE__ */ t("span", { children: o.name }),
|
|
952
969
|
" ",
|
|
953
|
-
o.status === "broken" && /* @__PURE__ */ l(
|
|
970
|
+
o.status === "broken" && /* @__PURE__ */ l(q, { children: [
|
|
954
971
|
/* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
|
|
955
972
|
" ",
|
|
956
973
|
/* @__PURE__ */ t(
|
|
@@ -959,45 +976,45 @@ function Ma({
|
|
|
959
976
|
type: "button",
|
|
960
977
|
className: "btn link",
|
|
961
978
|
"data-testid": `connection-route-reconnect-${o.id}`,
|
|
962
|
-
onClick: () =>
|
|
979
|
+
onClick: () => s(o.id),
|
|
963
980
|
children: "Reconnect"
|
|
964
981
|
}
|
|
965
982
|
)
|
|
966
983
|
] })
|
|
967
984
|
] }, o.id)) }),
|
|
968
|
-
|
|
969
|
-
|
|
985
|
+
i != null && /* @__PURE__ */ t(
|
|
986
|
+
Fa,
|
|
970
987
|
{
|
|
971
|
-
routeId:
|
|
972
|
-
projectId:
|
|
973
|
-
onDone: () =>
|
|
988
|
+
routeId: i.id,
|
|
989
|
+
projectId: i.project ?? n,
|
|
990
|
+
onDone: () => s(null)
|
|
974
991
|
}
|
|
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
|
}
|
|
984
|
-
function
|
|
1001
|
+
function St({
|
|
985
1002
|
callables: e,
|
|
986
1003
|
onOpenCallable: n,
|
|
987
1004
|
routes: a,
|
|
988
|
-
projectId:
|
|
1005
|
+
projectId: s
|
|
989
1006
|
}) {
|
|
990
|
-
return /* @__PURE__ */ l(
|
|
991
|
-
/* @__PURE__ */ t(
|
|
992
|
-
/* @__PURE__ */ t(
|
|
1007
|
+
return /* @__PURE__ */ l(q, { children: [
|
|
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
|
|
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
|
" ",
|
|
@@ -1007,31 +1024,31 @@ function Ra({
|
|
|
1007
1024
|
type: "button",
|
|
1008
1025
|
className: "btn link",
|
|
1009
1026
|
onClick: () => n(a.kind, a.id),
|
|
1010
|
-
children:
|
|
1027
|
+
children: s
|
|
1011
1028
|
}
|
|
1012
|
-
) : /* @__PURE__ */ t("span", { children:
|
|
1029
|
+
) : /* @__PURE__ */ t("span", { children: s }),
|
|
1013
1030
|
!a.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
|
|
1014
|
-
|
|
1031
|
+
i.length > 0 && /* @__PURE__ */ l("span", { className: "muted", children: [
|
|
1015
1032
|
" · ",
|
|
1016
|
-
|
|
1033
|
+
i.join(", ")
|
|
1017
1034
|
] })
|
|
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,
|
|
1026
|
-
slots:
|
|
1027
|
-
onOpenCallable:
|
|
1043
|
+
slots: s,
|
|
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
1054
|
appsById: k,
|
|
@@ -1039,82 +1056,82 @@ function Hs({
|
|
|
1039
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
|
-
slots: { ...
|
|
1062
|
+
slots: { ...s, actions: M }
|
|
1046
1063
|
}
|
|
1047
1064
|
),
|
|
1048
|
-
|
|
1049
|
-
|
|
1065
|
+
b && /* @__PURE__ */ t(
|
|
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:
|
|
1073
|
-
loading:
|
|
1074
|
-
callables:
|
|
1075
|
-
routes:
|
|
1076
|
-
projectId:
|
|
1077
|
-
onOpenCallable:
|
|
1078
|
-
onClose: () =>
|
|
1089
|
+
name: v.displayName || v.id,
|
|
1090
|
+
loading: N.isLoading,
|
|
1091
|
+
callables: N.isError ? [] : ((R = N.data) == null ? void 0 : R.callables) ?? [],
|
|
1092
|
+
routes: N.isError ? [] : ((F = N.data) == null ? void 0 : F.routes) ?? [],
|
|
1093
|
+
projectId: T,
|
|
1094
|
+
onOpenCallable: i,
|
|
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,
|
|
1091
|
-
routes:
|
|
1092
|
-
projectId:
|
|
1108
|
+
routes: s,
|
|
1109
|
+
projectId: i,
|
|
1093
1110
|
onOpenCallable: o,
|
|
1094
1111
|
onClose: r,
|
|
1095
|
-
onConfirm:
|
|
1112
|
+
onConfirm: d
|
|
1096
1113
|
}) {
|
|
1097
|
-
const u = a.length,
|
|
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 = [
|
|
1098
1115
|
u > 0 ? k(u, "callable", "callables") : null,
|
|
1099
|
-
|
|
1100
|
-
].filter(Boolean).join(" and "),
|
|
1116
|
+
m > 0 ? k(m, "model route", "model routes") : null
|
|
1117
|
+
].filter(Boolean).join(" and "), b = [
|
|
1101
1118
|
u > 0 ? `Deleting disables ${u === 1 ? "this callable" : `these ${u} callables`} until you reconnect ${u === 1 ? "it" : "them"}.` : null,
|
|
1102
|
-
|
|
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
|
-
return /* @__PURE__ */ l(
|
|
1121
|
+
return /* @__PURE__ */ l(Ht, { title: "Delete connection", onClose: r, children: [
|
|
1105
1122
|
/* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
|
|
1106
|
-
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: g === 0 ?
|
|
1107
|
-
g > 0 && /* @__PURE__ */ l(
|
|
1123
|
+
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: g === 0 ? h : `Delete the connection "${e}"? Used by ${w}.` }),
|
|
1124
|
+
g > 0 && /* @__PURE__ */ l(q, { children: [
|
|
1108
1125
|
/* @__PURE__ */ t(
|
|
1109
|
-
|
|
1126
|
+
St,
|
|
1110
1127
|
{
|
|
1111
1128
|
callables: a,
|
|
1112
|
-
routes:
|
|
1113
|
-
projectId:
|
|
1129
|
+
routes: s,
|
|
1130
|
+
projectId: i,
|
|
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,278 +1142,297 @@ function Oa({
|
|
|
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));
|
|
1139
1156
|
if (a < 45) return "just now";
|
|
1140
|
-
const
|
|
1141
|
-
if (
|
|
1142
|
-
const
|
|
1143
|
-
if (
|
|
1144
|
-
const o = Math.round(
|
|
1157
|
+
const s = Math.round(a / 60);
|
|
1158
|
+
if (s < 60) return `${s}m ago`;
|
|
1159
|
+
const i = Math.round(s / 60);
|
|
1160
|
+
if (i < 24) return `${i}h ago`;
|
|
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
|
-
onOpenCallable:
|
|
1157
|
-
slots:
|
|
1173
|
+
onOpenCallable: s,
|
|
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
|
-
}, [
|
|
1171
|
-
|
|
1172
|
-
if (!
|
|
1173
|
-
const
|
|
1174
|
-
return () => clearTimeout(
|
|
1175
|
-
}, [
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
onSuccess: (
|
|
1179
|
-
var
|
|
1180
|
-
if (!
|
|
1181
|
-
|
|
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);
|
|
1193
|
+
xt(() => {
|
|
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
|
-
}, [k.data]), V =
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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: V.map((
|
|
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:
|
|
1311
|
-
|
|
1345
|
+
"aria-label": `Saved tests for ${C.title || C.key}`,
|
|
1346
|
+
children: Q.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
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
|
-
|
|
1337
|
-
|
|
1372
|
+
N.length === 0 && K.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
|
|
1373
|
+
St,
|
|
1338
1374
|
{
|
|
1339
|
-
callables:
|
|
1340
|
-
routes:
|
|
1341
|
-
projectId:
|
|
1342
|
-
onOpenCallable:
|
|
1375
|
+
callables: N,
|
|
1376
|
+
routes: K,
|
|
1377
|
+
projectId: T,
|
|
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:
|
|
1350
|
-
|
|
1385
|
+
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: M.map((C) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
|
|
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 qa = [
|
|
|
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,72 +1469,72 @@ const qa = [
|
|
|
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 }) =>
|
|
1446
|
-
}),
|
|
1481
|
+
queryFn: ({ pageParam: r }) => Wn(n, r ? { ...a, cursor: r } : a)
|
|
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: [
|
|
1449
1485
|
/* @__PURE__ */ t("h3", { children: "Available models" }),
|
|
1450
1486
|
/* @__PURE__ */ t("p", { className: "muted small", children: "Models available through your tenant's integrations. Choose one when creating a model route. Prices shown here are used to calculate usage costs." })
|
|
1451
1487
|
] }) }),
|
|
1452
1488
|
/* @__PURE__ */ l("div", { children: [
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1489
|
+
s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
1490
|
+
s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
|
|
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." }),
|
|
1492
|
+
i.length > 0 && /* @__PURE__ */ t(
|
|
1493
|
+
Pe,
|
|
1458
1494
|
{
|
|
1459
|
-
columns:
|
|
1495
|
+
columns: Ha,
|
|
1460
1496
|
className: "model-catalog-table",
|
|
1461
|
-
rows:
|
|
1497
|
+
rows: i,
|
|
1462
1498
|
rowKey: (r) => r.id,
|
|
1463
1499
|
testId: "model-catalog-table",
|
|
1464
1500
|
rowTestId: (r) => `model-catalog-${r.id}`
|
|
1465
1501
|
}
|
|
1466
1502
|
)
|
|
1467
1503
|
] }),
|
|
1468
|
-
|
|
1504
|
+
s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
|
|
1469
1505
|
"button",
|
|
1470
1506
|
{
|
|
1471
1507
|
type: "button",
|
|
1472
1508
|
className: "btn ghost",
|
|
1473
|
-
disabled:
|
|
1474
|
-
onClick: () => void
|
|
1509
|
+
disabled: s.isFetchingNextPage,
|
|
1510
|
+
onClick: () => void s.fetchNextPage(),
|
|
1475
1511
|
"data-testid": "model-catalog-load-more",
|
|
1476
|
-
children:
|
|
1512
|
+
children: s.isFetchingNextPage ? "Loading…" : "Load more"
|
|
1477
1513
|
}
|
|
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",
|
|
1501
|
-
render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children:
|
|
1537
|
+
render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: Et(e.occurredAt) })
|
|
1502
1538
|
},
|
|
1503
1539
|
{
|
|
1504
1540
|
key: "model",
|
|
@@ -1525,8 +1561,8 @@ const Ya = [
|
|
|
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 Ya = [
|
|
|
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
|
},
|
|
@@ -1543,10 +1579,10 @@ const Ya = [
|
|
|
1543
1579
|
key: "result",
|
|
1544
1580
|
header: "Result",
|
|
1545
1581
|
render: (e) => {
|
|
1546
|
-
const n =
|
|
1582
|
+
const n = It(e.durationMs);
|
|
1547
1583
|
return /* @__PURE__ */ l("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
|
|
1548
1584
|
/* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
|
|
1549
|
-
n != null && /* @__PURE__ */ l(
|
|
1585
|
+
n != null && /* @__PURE__ */ l(q, { children: [
|
|
1550
1586
|
" · ",
|
|
1551
1587
|
n
|
|
1552
1588
|
] })
|
|
@@ -1554,52 +1590,52 @@ const Ya = [
|
|
|
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
|
-
getNextPageParam: (
|
|
1564
|
-
queryFn: ({ pageParam:
|
|
1599
|
+
getNextPageParam: (h) => h.nextCursor ?? void 0,
|
|
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" }),
|
|
1573
1609
|
/* @__PURE__ */ t("p", { className: "muted small", children: "Every model call this project paid for, priced with the rate card in force when it ran. A call with no usable rate counts as unpriced, not as free." })
|
|
1574
1610
|
] }) }),
|
|
1575
|
-
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(
|
|
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:
|
|
1602
|
-
r.unpriced > 0 && /* @__PURE__ */ l(
|
|
1637
|
+
/* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ja(r.cost, r.unpriced) }),
|
|
1638
|
+
r.unpriced > 0 && /* @__PURE__ */ l(q, { children: [
|
|
1603
1639
|
" · ",
|
|
1604
1640
|
/* @__PURE__ */ l(
|
|
1605
1641
|
"span",
|
|
@@ -1608,7 +1644,7 @@ function Js(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
|
}
|
|
@@ -1616,73 +1652,73 @@ function Js(e) {
|
|
|
1616
1652
|
] })
|
|
1617
1653
|
] })
|
|
1618
1654
|
] }),
|
|
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
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1657
|
+
i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
|
|
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:
|
|
1628
|
-
rowKey: (
|
|
1662
|
+
columns: Xa,
|
|
1663
|
+
rows: d,
|
|
1664
|
+
rowKey: (h) => h.id,
|
|
1629
1665
|
testId: "model-usage-table",
|
|
1630
|
-
rowTestId: (
|
|
1666
|
+
rowTestId: (h) => `model-usage-${h.id}`
|
|
1631
1667
|
}
|
|
1632
1668
|
)
|
|
1633
1669
|
] }),
|
|
1634
|
-
|
|
1670
|
+
i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
|
|
1635
1671
|
"button",
|
|
1636
1672
|
{
|
|
1637
1673
|
type: "button",
|
|
1638
1674
|
className: "btn ghost",
|
|
1639
|
-
disabled:
|
|
1640
|
-
onClick: () => void
|
|
1675
|
+
disabled: i.isFetchingNextPage,
|
|
1676
|
+
onClick: () => void i.fetchNextPage(),
|
|
1641
1677
|
"data-testid": "model-usage-load-more",
|
|
1642
|
-
children:
|
|
1678
|
+
children: i.isFetchingNextPage ? "Loading…" : "Load more"
|
|
1643
1679
|
}
|
|
1644
1680
|
) })
|
|
1645
1681
|
] })
|
|
1646
1682
|
] }) });
|
|
1647
1683
|
}
|
|
1648
|
-
const
|
|
1649
|
-
function
|
|
1650
|
-
const
|
|
1651
|
-
var g,
|
|
1652
|
-
return ((
|
|
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) => {
|
|
1687
|
+
var g, h;
|
|
1688
|
+
return ((h = (g = o.data) == null ? void 0 : g.find((k) => k.id === m)) == null ? void 0 : h.label) ?? m;
|
|
1653
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
|
-
/* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (
|
|
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
|
-
|
|
1660
|
-
|
|
1661
|
-
!
|
|
1695
|
+
i.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
1696
|
+
i.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: i.error.message }),
|
|
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
|
-
|
|
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 Gs({ contract: e, onOpen: n, onCreate: a, slots: i }) {
|
|
|
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
|
}
|
|
@@ -1702,13 +1738,13 @@ function Ce({
|
|
|
1702
1738
|
fields: e,
|
|
1703
1739
|
values: n,
|
|
1704
1740
|
onChange: a,
|
|
1705
|
-
idPrefix:
|
|
1741
|
+
idPrefix: s
|
|
1706
1742
|
}) {
|
|
1707
|
-
return /* @__PURE__ */ t(
|
|
1743
|
+
return /* @__PURE__ */ t(q, { children: e.map((i) => {
|
|
1708
1744
|
const o = {
|
|
1709
|
-
className:
|
|
1710
|
-
value: n[
|
|
1711
|
-
name: `${
|
|
1745
|
+
className: i.secret ? "w6w-input w6w-secret-input" : "w6w-input",
|
|
1746
|
+
value: n[i.key] ?? "",
|
|
1747
|
+
name: `${s}-${i.key}`,
|
|
1712
1748
|
autoComplete: "off",
|
|
1713
1749
|
autoCapitalize: "off",
|
|
1714
1750
|
autoCorrect: "off",
|
|
@@ -1716,18 +1752,20 @@ 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
|
-
return
|
|
1722
|
-
/* @__PURE__ */ t("span", { children:
|
|
1723
|
-
/* @__PURE__ */ t("textarea", { rows: 5, ...o, onChange: (r) => a(
|
|
1724
|
-
] },
|
|
1725
|
-
/* @__PURE__ */ t("span", { children:
|
|
1726
|
-
/* @__PURE__ */ t("input", { type: "text", ...o, onChange: (r) => a(
|
|
1727
|
-
] },
|
|
1759
|
+
return i.multiline ? /* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
1760
|
+
/* @__PURE__ */ t("span", { children: i.label }),
|
|
1761
|
+
/* @__PURE__ */ t("textarea", { rows: 5, ...o, onChange: (r) => a(i.key, r.target.value) })
|
|
1762
|
+
] }, i.key) : /* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
1763
|
+
/* @__PURE__ */ t("span", { children: i.label }),
|
|
1764
|
+
/* @__PURE__ */ t("input", { type: "text", ...o, onChange: (r) => a(i.key, r.target.value) })
|
|
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 =
|
|
1740
|
-
u(
|
|
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(
|
|
1756
|
-
...a &&
|
|
1789
|
+
b(null);
|
|
1790
|
+
const f = {
|
|
1791
|
+
name: m.trim(),
|
|
1792
|
+
contract: E.id,
|
|
1793
|
+
source: Ee(E.fields, h),
|
|
1794
|
+
...a && s === "user" ? { accessScope: "user" } : {}
|
|
1757
1795
|
};
|
|
1758
|
-
k({}), r.mutate(
|
|
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 Zs({ 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 Zs({ 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 Zs({ 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 Zs({ 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:
|
|
1822
|
-
onChange: () =>
|
|
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:
|
|
1839
|
-
values:
|
|
1840
|
-
onChange: (
|
|
1876
|
+
fields: E.fields,
|
|
1877
|
+
values: h,
|
|
1878
|
+
onChange: (f, T) => k((N) => ({ ...N, [f]: T })),
|
|
1841
1879
|
idPrefix: "w6w-cred-create"
|
|
1842
1880
|
}
|
|
1843
1881
|
),
|
|
@@ -1851,8 +1889,8 @@ function Zs({ 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,141 +1898,142 @@ function Ga(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
|
-
onBack:
|
|
1872
|
-
slots:
|
|
1909
|
+
onBack: s,
|
|
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
|
-
const
|
|
1879
|
-
if (!
|
|
1916
|
+
const D = o.data;
|
|
1917
|
+
if (!D)
|
|
1880
1918
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
|
|
1881
|
-
(
|
|
1882
|
-
|
|
1919
|
+
(i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
|
|
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
|
-
onError: (
|
|
1899
|
-
|
|
1936
|
+
onError: (L) => {
|
|
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: (
|
|
1954
|
+
onError: (L) => I(ae(L) ?? (L == null ? void 0 : L.message) ?? "Rotate failed.")
|
|
1917
1955
|
}
|
|
1918
1956
|
);
|
|
1919
|
-
},
|
|
1920
|
-
|
|
1921
|
-
onSuccess:
|
|
1922
|
-
onError: (
|
|
1957
|
+
}, j = () => {
|
|
1958
|
+
N(null), M(null), m.mutate(void 0, {
|
|
1959
|
+
onSuccess: N,
|
|
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: [
|
|
1933
1971
|
/* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
|
|
1934
|
-
/* @__PURE__ */ t("h2", { children:
|
|
1972
|
+
/* @__PURE__ */ t("h2", { children: D.name }),
|
|
1935
1973
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
1936
|
-
/* @__PURE__ */ t("code", { children:
|
|
1974
|
+
/* @__PURE__ */ t("code", { children: D.contract }),
|
|
1937
1975
|
" ",
|
|
1938
|
-
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children:
|
|
1976
|
+
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: D.status })
|
|
1939
1977
|
] }),
|
|
1940
1978
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
1941
|
-
/* @__PURE__ */ t("span", { "data-testid": "credential-scope", children:
|
|
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(
|
|
1945
|
-
/* @__PURE__ */ t("dt", { className: "w6w-muted", children:
|
|
1946
|
-
/* @__PURE__ */ t("dd", { children:
|
|
1947
|
-
] },
|
|
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 }),
|
|
1984
|
+
/* @__PURE__ */ t("dd", { children: L })
|
|
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
2035
|
value: k,
|
|
1997
|
-
onChange: (
|
|
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 Za({
|
|
|
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
|
] }),
|
|
@@ -2028,8 +2067,8 @@ function Za({
|
|
|
2028
2067
|
type: "button",
|
|
2029
2068
|
className: "w6w-btn w6w-btn-ghost",
|
|
2030
2069
|
disabled: u.isPending,
|
|
2031
|
-
onClick: () => u.mutate(
|
|
2032
|
-
children:
|
|
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 Za({
|
|
|
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,19 +2087,19 @@ function Za({
|
|
|
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
|
-
u.isError && /* @__PURE__ */ t("p", { role: "alert", children:
|
|
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 "',
|
|
2063
|
-
|
|
2102
|
+
D.name,
|
|
2064
2103
|
'"? This cannot be undone.'
|
|
2065
2104
|
] }),
|
|
2066
2105
|
/* @__PURE__ */ t(
|
|
@@ -2069,7 +2108,7 @@ function Za({
|
|
|
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,62 +2118,90 @@ function Za({
|
|
|
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
|
|
2103
|
-
var
|
|
2104
|
-
const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (
|
|
2105
|
-
return Array.isArray(a) ? a.filter((
|
|
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) {
|
|
2142
|
+
var s;
|
|
2143
|
+
const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (s = n.serviceAccount) == null ? void 0 : s.accepts;
|
|
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
|
-
const
|
|
2110
|
-
if (
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2148
|
+
const s = a;
|
|
2149
|
+
if (s.type === "oauth2" || typeof s.key != "string") continue;
|
|
2150
|
+
const i = cs(a).find((o) => n.some((r) => r.id === o));
|
|
2151
|
+
if (i) return { authKey: s.key, contract: i };
|
|
2113
2152
|
}
|
|
2114
2153
|
return null;
|
|
2115
2154
|
}
|
|
2155
|
+
function Mt(e) {
|
|
2156
|
+
const n = e ?? {};
|
|
2157
|
+
if (n.type === "oauth2" || n.userScope !== !0 || !Array.isArray(n.fields)) return null;
|
|
2158
|
+
const a = n.fields.map((s) => s ?? {}).filter(
|
|
2159
|
+
(s) => typeof s.key == "string"
|
|
2160
|
+
).map((s) => ({
|
|
2161
|
+
key: s.key,
|
|
2162
|
+
label: typeof s.label == "string" ? s.label : s.key,
|
|
2163
|
+
secret: s.type === "secret" || s.secret === !0
|
|
2164
|
+
}));
|
|
2165
|
+
return a.length > 0 ? a : null;
|
|
2166
|
+
}
|
|
2167
|
+
function us(e) {
|
|
2168
|
+
for (const n of e ?? []) {
|
|
2169
|
+
const a = n.key, s = Mt(n);
|
|
2170
|
+
if (typeof a == "string" && s) return { authKey: a, fields: s };
|
|
2171
|
+
}
|
|
2172
|
+
return null;
|
|
2173
|
+
}
|
|
2174
|
+
function ms(e, n, a) {
|
|
2175
|
+
const s = me(), i = Ke({
|
|
2176
|
+
queryKey: ["app-auth", e],
|
|
2177
|
+
queryFn: () => s.console.apps.getAuth(e),
|
|
2178
|
+
enabled: a,
|
|
2179
|
+
retry: !1
|
|
2180
|
+
});
|
|
2181
|
+
return Mt((i.data ?? []).find((o) => o.key === n));
|
|
2182
|
+
}
|
|
2116
2183
|
const re = (e) => e.provider ?? e.appId;
|
|
2117
|
-
function
|
|
2118
|
-
const n =
|
|
2119
|
-
(w) => w.accessScope === "user" && w.credentialId && u.has(w.credentialId)
|
|
2120
|
-
), g = o.data ?? [], [
|
|
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);
|
|
2121
2188
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
|
|
2122
2189
|
/* @__PURE__ */ t("h2", { children: "My AI keys" }),
|
|
2123
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." }),
|
|
2124
|
-
/* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children:
|
|
2125
|
-
!n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children:
|
|
2126
|
-
(a.isLoading ||
|
|
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 }),
|
|
2193
|
+
(a.isLoading || s.isLoading || i.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
|
|
2127
2194
|
a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
|
|
2128
|
-
n &&
|
|
2129
|
-
!a.isLoading && !a.error &&
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
return
|
|
2134
|
-
|
|
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." }),
|
|
2197
|
+
h && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: h }),
|
|
2198
|
+
d.map((w) => {
|
|
2199
|
+
const b = m.filter((y) => y.appId === w.appId);
|
|
2200
|
+
return b.length === 0 ? null : /* @__PURE__ */ t(
|
|
2201
|
+
ws,
|
|
2135
2202
|
{
|
|
2136
2203
|
provider: w,
|
|
2137
|
-
keys:
|
|
2204
|
+
keys: b,
|
|
2138
2205
|
creds: u,
|
|
2139
2206
|
current: g.find((y) => y.providerAppId === w.appId),
|
|
2140
2207
|
types: r.data ?? [],
|
|
@@ -2145,52 +2212,67 @@ function ei({ providerAppId: e }) {
|
|
|
2145
2212
|
})
|
|
2146
2213
|
] });
|
|
2147
2214
|
}
|
|
2148
|
-
function
|
|
2215
|
+
function hs({
|
|
2149
2216
|
providers: e,
|
|
2150
2217
|
initial: n,
|
|
2151
2218
|
types: a
|
|
2152
2219
|
}) {
|
|
2153
|
-
var
|
|
2154
|
-
const
|
|
2155
|
-
queryKey: ["app-auth",
|
|
2156
|
-
queryFn: () =>
|
|
2157
|
-
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 !== "",
|
|
2158
2225
|
retry: !1
|
|
2159
|
-
}),
|
|
2160
|
-
r(
|
|
2161
|
-
},
|
|
2162
|
-
if (!u || !
|
|
2163
|
-
if (!Te(
|
|
2164
|
-
|
|
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;
|
|
2230
|
+
if (!Te(M, h)) {
|
|
2231
|
+
b("Fill in every field.");
|
|
2165
2232
|
return;
|
|
2166
2233
|
}
|
|
2167
|
-
|
|
2168
|
-
const
|
|
2169
|
-
k({}),
|
|
2170
|
-
|
|
2234
|
+
b(null), v(!1);
|
|
2235
|
+
const A = Ee(M, h);
|
|
2236
|
+
if (k({}), E(!0), !T || !N) {
|
|
2237
|
+
if (!K) return E(!1);
|
|
2238
|
+
try {
|
|
2239
|
+
await _e(s, d, {
|
|
2240
|
+
authKey: K.authKey,
|
|
2241
|
+
credential: A,
|
|
2242
|
+
displayName: m.trim() || `My ${re(u)} key`,
|
|
2243
|
+
accessScope: "user"
|
|
2244
|
+
}), g(""), v(!0);
|
|
2245
|
+
} catch (x) {
|
|
2246
|
+
b(ue(x, "create"));
|
|
2247
|
+
} finally {
|
|
2248
|
+
E(!1), i.invalidateQueries({ queryKey: de });
|
|
2249
|
+
}
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
let P = null;
|
|
2171
2253
|
try {
|
|
2172
|
-
const
|
|
2173
|
-
name:
|
|
2174
|
-
contract:
|
|
2175
|
-
source:
|
|
2254
|
+
const x = await Xn(s, {
|
|
2255
|
+
name: m.trim() || `My ${re(u)} key`,
|
|
2256
|
+
contract: T.contract,
|
|
2257
|
+
source: A,
|
|
2176
2258
|
accessScope: "user"
|
|
2177
2259
|
});
|
|
2178
|
-
|
|
2179
|
-
authKey:
|
|
2180
|
-
credentialId:
|
|
2260
|
+
P = x.id, await _e(s, d, {
|
|
2261
|
+
authKey: T.authKey,
|
|
2262
|
+
credentialId: x.id,
|
|
2181
2263
|
accessScope: "user"
|
|
2182
|
-
}), g(""),
|
|
2183
|
-
} catch (
|
|
2184
|
-
if (
|
|
2185
|
-
const
|
|
2186
|
-
(
|
|
2264
|
+
}), g(""), v(!0);
|
|
2265
|
+
} catch (x) {
|
|
2266
|
+
if (P) {
|
|
2267
|
+
const D = await ea(s, P).then(
|
|
2268
|
+
(S) => S.ok,
|
|
2187
2269
|
() => !1
|
|
2188
2270
|
);
|
|
2189
|
-
|
|
2271
|
+
b(D ? ae(x) ?? rs : os);
|
|
2190
2272
|
} else
|
|
2191
|
-
|
|
2273
|
+
b(ue(x, "create"));
|
|
2192
2274
|
} finally {
|
|
2193
|
-
|
|
2275
|
+
E(!1), i.invalidateQueries({ queryKey: ta }), i.invalidateQueries({ queryKey: de });
|
|
2194
2276
|
}
|
|
2195
2277
|
};
|
|
2196
2278
|
return /* @__PURE__ */ l(
|
|
@@ -2198,18 +2280,18 @@ function ls({
|
|
|
2198
2280
|
{
|
|
2199
2281
|
className: "w6w-embed-conn-card w6w-card-stack",
|
|
2200
2282
|
"data-testid": "ai-key-add",
|
|
2201
|
-
onSubmit: (
|
|
2202
|
-
|
|
2283
|
+
onSubmit: (A) => {
|
|
2284
|
+
A.preventDefault(), F();
|
|
2203
2285
|
},
|
|
2204
2286
|
children: [
|
|
2205
2287
|
/* @__PURE__ */ t("h3", { children: "Add a key" }),
|
|
2206
2288
|
/* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
2207
2289
|
/* @__PURE__ */ t("span", { children: "Provider" }),
|
|
2208
|
-
/* @__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)) })
|
|
2209
2291
|
] }),
|
|
2210
|
-
|
|
2211
|
-
!
|
|
2212
|
-
|
|
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 }),
|
|
2294
|
+
M && /* @__PURE__ */ l(q, { children: [
|
|
2213
2295
|
/* @__PURE__ */ l("label", { className: "w6w-field", children: [
|
|
2214
2296
|
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
2215
2297
|
/* @__PURE__ */ t(
|
|
@@ -2217,9 +2299,9 @@ function ls({
|
|
|
2217
2299
|
{
|
|
2218
2300
|
type: "text",
|
|
2219
2301
|
className: "w6w-input",
|
|
2220
|
-
value:
|
|
2302
|
+
value: m,
|
|
2221
2303
|
placeholder: u ? `My ${re(u)} key` : "",
|
|
2222
|
-
onChange: (
|
|
2304
|
+
onChange: (A) => g(A.target.value),
|
|
2223
2305
|
maxLength: 120,
|
|
2224
2306
|
autoComplete: "off"
|
|
2225
2307
|
}
|
|
@@ -2228,45 +2310,45 @@ function ls({
|
|
|
2228
2310
|
/* @__PURE__ */ t(
|
|
2229
2311
|
Ce,
|
|
2230
2312
|
{
|
|
2231
|
-
fields:
|
|
2232
|
-
values:
|
|
2233
|
-
onChange: (
|
|
2313
|
+
fields: M,
|
|
2314
|
+
values: h,
|
|
2315
|
+
onChange: (A, P) => k((x) => ({ ...x, [A]: P })),
|
|
2234
2316
|
idPrefix: "w6w-ai-key-add"
|
|
2235
2317
|
}
|
|
2236
2318
|
),
|
|
2237
2319
|
w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: w }),
|
|
2238
|
-
|
|
2320
|
+
I && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
|
|
2239
2321
|
/* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: y, children: y ? "Saving…" : "Save key" }) })
|
|
2240
2322
|
] })
|
|
2241
2323
|
]
|
|
2242
2324
|
}
|
|
2243
2325
|
);
|
|
2244
2326
|
}
|
|
2245
|
-
function
|
|
2327
|
+
function ws({
|
|
2246
2328
|
provider: e,
|
|
2247
2329
|
keys: n,
|
|
2248
2330
|
creds: a,
|
|
2249
|
-
current:
|
|
2250
|
-
types:
|
|
2331
|
+
current: s,
|
|
2332
|
+
types: i,
|
|
2251
2333
|
onNotice: o
|
|
2252
2334
|
}) {
|
|
2253
|
-
const r =
|
|
2254
|
-
|
|
2255
|
-
const
|
|
2256
|
-
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.")
|
|
2257
2339
|
};
|
|
2258
|
-
w === null ?
|
|
2340
|
+
w === null ? d.mutate(g, b) : r.mutate({ providerAppId: g, connectionId: w }, b);
|
|
2259
2341
|
};
|
|
2260
2342
|
return /* @__PURE__ */ l("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${g}`, children: [
|
|
2261
2343
|
/* @__PURE__ */ t("h3", { children: re(e) }),
|
|
2262
2344
|
/* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${re(e)} keys`, children: n.map((w) => {
|
|
2263
|
-
const
|
|
2345
|
+
const b = a.get(w.credentialId);
|
|
2264
2346
|
return /* @__PURE__ */ t(
|
|
2265
|
-
|
|
2347
|
+
ps,
|
|
2266
2348
|
{
|
|
2267
2349
|
connection: w,
|
|
2268
|
-
credential:
|
|
2269
|
-
descriptor:
|
|
2350
|
+
credential: b,
|
|
2351
|
+
descriptor: b ? i.find((y) => y.id === b.contract) : void 0,
|
|
2270
2352
|
onNotice: o
|
|
2271
2353
|
},
|
|
2272
2354
|
w.id
|
|
@@ -2280,9 +2362,9 @@ function rs({
|
|
|
2280
2362
|
{
|
|
2281
2363
|
type: "radio",
|
|
2282
2364
|
name: `ai-default-${g}`,
|
|
2283
|
-
checked: !
|
|
2365
|
+
checked: !h,
|
|
2284
2366
|
onChange: () => {
|
|
2285
|
-
|
|
2367
|
+
h && k(null);
|
|
2286
2368
|
}
|
|
2287
2369
|
}
|
|
2288
2370
|
),
|
|
@@ -2296,7 +2378,7 @@ function rs({
|
|
|
2296
2378
|
type: "radio",
|
|
2297
2379
|
name: `ai-default-${g}`,
|
|
2298
2380
|
"data-testid": `ai-default-${w.id}`,
|
|
2299
|
-
checked: (
|
|
2381
|
+
checked: (h == null ? void 0 : h.connectionId) === w.id,
|
|
2300
2382
|
onChange: () => k(w.id)
|
|
2301
2383
|
}
|
|
2302
2384
|
),
|
|
@@ -2304,58 +2386,72 @@ function rs({
|
|
|
2304
2386
|
w.displayName
|
|
2305
2387
|
] }, w.id))
|
|
2306
2388
|
] }),
|
|
2307
|
-
(
|
|
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." }),
|
|
2308
2390
|
u && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: u })
|
|
2309
2391
|
] });
|
|
2310
2392
|
}
|
|
2311
|
-
function
|
|
2393
|
+
function ps({
|
|
2312
2394
|
connection: e,
|
|
2313
2395
|
credential: n,
|
|
2314
2396
|
descriptor: a,
|
|
2315
|
-
onNotice:
|
|
2397
|
+
onNotice: s
|
|
2316
2398
|
}) {
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2319
|
-
onSuccess: (
|
|
2320
|
-
onError: (
|
|
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 = () => {
|
|
2400
|
+
M(null), N(null), i.mutate(void 0, {
|
|
2401
|
+
onSuccess: (D) => M(D.ok ? "ok" : "failed"),
|
|
2402
|
+
onError: (D) => _(D, "Could not test the key.")
|
|
2321
2403
|
});
|
|
2322
|
-
},
|
|
2323
|
-
if (!
|
|
2324
|
-
if (
|
|
2325
|
-
|
|
2404
|
+
}, P = () => {
|
|
2405
|
+
if (!m) return;
|
|
2406
|
+
if (f(null), !Te(m, b)) {
|
|
2407
|
+
N("Fill in every field.");
|
|
2326
2408
|
return;
|
|
2327
2409
|
}
|
|
2328
|
-
|
|
2329
|
-
const
|
|
2330
|
-
|
|
2331
|
-
|
|
2410
|
+
N(null);
|
|
2411
|
+
const D = Ee(m, b);
|
|
2412
|
+
if (y({}), !n) {
|
|
2413
|
+
d.mutate(
|
|
2414
|
+
{ credential: D },
|
|
2415
|
+
{
|
|
2416
|
+
onSuccess: () => {
|
|
2417
|
+
d.reset(), w(!1), f("Key replaced.");
|
|
2418
|
+
},
|
|
2419
|
+
onError: (S) => {
|
|
2420
|
+
d.reset(), N(ue(S, "rotate"));
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
);
|
|
2424
|
+
return;
|
|
2425
|
+
}
|
|
2426
|
+
o.mutate(
|
|
2427
|
+
{ source: D },
|
|
2332
2428
|
{
|
|
2333
2429
|
onSuccess: () => {
|
|
2334
|
-
o.reset(),
|
|
2430
|
+
o.reset(), w(!1), f("Key replaced.");
|
|
2335
2431
|
},
|
|
2336
|
-
onError: (
|
|
2337
|
-
o.reset(),
|
|
2432
|
+
onError: (S) => {
|
|
2433
|
+
o.reset(), N(ue(S, "rotate"));
|
|
2338
2434
|
}
|
|
2339
2435
|
}
|
|
2340
2436
|
);
|
|
2341
|
-
},
|
|
2342
|
-
|
|
2437
|
+
}, x = () => {
|
|
2438
|
+
N(null), s(null), g.mutate(
|
|
2343
2439
|
{ id: e.id },
|
|
2344
2440
|
{
|
|
2345
|
-
onSuccess: (
|
|
2346
|
-
if (!
|
|
2347
|
-
|
|
2441
|
+
onSuccess: (D) => {
|
|
2442
|
+
if (!D.ok) {
|
|
2443
|
+
I(!1), N("This key is still in use. Remove what uses it first.");
|
|
2348
2444
|
return;
|
|
2349
2445
|
}
|
|
2350
|
-
|
|
2351
|
-
onSuccess: (
|
|
2352
|
-
|
|
2446
|
+
n && h.mutate(n.id, {
|
|
2447
|
+
onSuccess: (S) => {
|
|
2448
|
+
S.ok || s(ze);
|
|
2353
2449
|
},
|
|
2354
|
-
onError: (
|
|
2450
|
+
onError: (S) => s(ae(S) ?? ze)
|
|
2355
2451
|
});
|
|
2356
2452
|
},
|
|
2357
|
-
onError: (
|
|
2358
|
-
|
|
2453
|
+
onError: (D) => {
|
|
2454
|
+
I(!1), _(D, "Could not remove the key.");
|
|
2359
2455
|
}
|
|
2360
2456
|
}
|
|
2361
2457
|
);
|
|
@@ -2364,10 +2460,10 @@ function os({
|
|
|
2364
2460
|
/* @__PURE__ */ l("div", { children: [
|
|
2365
2461
|
/* @__PURE__ */ t("strong", { children: e.displayName }),
|
|
2366
2462
|
" ",
|
|
2367
|
-
/* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", "data-testid": `ai-key-status-${e.id}`, children: n.status }),
|
|
2368
|
-
|
|
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 }),
|
|
2464
|
+
F !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
|
|
2369
2465
|
" ",
|
|
2370
|
-
|
|
2466
|
+
F
|
|
2371
2467
|
] })
|
|
2372
2468
|
] }),
|
|
2373
2469
|
/* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
|
|
@@ -2376,30 +2472,30 @@ function os({
|
|
|
2376
2472
|
{
|
|
2377
2473
|
type: "button",
|
|
2378
2474
|
className: "w6w-btn w6w-btn-ghost",
|
|
2379
|
-
disabled:
|
|
2380
|
-
onClick:
|
|
2381
|
-
children:
|
|
2475
|
+
disabled: i.isPending,
|
|
2476
|
+
onClick: A,
|
|
2477
|
+
children: i.isPending ? "Testing…" : "Test"
|
|
2382
2478
|
}
|
|
2383
2479
|
),
|
|
2384
|
-
|
|
2480
|
+
m && /* @__PURE__ */ t(
|
|
2385
2481
|
"button",
|
|
2386
2482
|
{
|
|
2387
2483
|
type: "button",
|
|
2388
2484
|
className: "w6w-btn w6w-btn-ghost",
|
|
2389
|
-
onClick: () =>
|
|
2485
|
+
onClick: () => w((D) => !D),
|
|
2390
2486
|
children: "Replace key"
|
|
2391
2487
|
}
|
|
2392
2488
|
),
|
|
2393
|
-
/* @__PURE__ */ t(
|
|
2489
|
+
n && /* @__PURE__ */ t(
|
|
2394
2490
|
"button",
|
|
2395
2491
|
{
|
|
2396
2492
|
type: "button",
|
|
2397
2493
|
className: "w6w-btn w6w-btn-ghost",
|
|
2398
2494
|
disabled: r.isPending,
|
|
2399
|
-
onClick: () => r.mutate(
|
|
2400
|
-
onError: (
|
|
2495
|
+
onClick: () => r.mutate(R ? "active" : "disabled", {
|
|
2496
|
+
onError: (D) => _(D, "Could not change the key's status.")
|
|
2401
2497
|
}),
|
|
2402
|
-
children:
|
|
2498
|
+
children: R ? "Enable" : "Disable"
|
|
2403
2499
|
}
|
|
2404
2500
|
),
|
|
2405
2501
|
/* @__PURE__ */ t(
|
|
@@ -2407,25 +2503,25 @@ function os({
|
|
|
2407
2503
|
{
|
|
2408
2504
|
type: "button",
|
|
2409
2505
|
className: "w6w-btn w6w-btn-danger",
|
|
2410
|
-
onClick: () =>
|
|
2506
|
+
onClick: () => I(!0),
|
|
2411
2507
|
children: "Remove"
|
|
2412
2508
|
}
|
|
2413
2509
|
)
|
|
2414
2510
|
] }),
|
|
2415
|
-
|
|
2416
|
-
|
|
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: [
|
|
2417
2513
|
/* @__PURE__ */ t(
|
|
2418
2514
|
Ce,
|
|
2419
2515
|
{
|
|
2420
|
-
fields:
|
|
2421
|
-
values:
|
|
2422
|
-
onChange: (
|
|
2516
|
+
fields: m,
|
|
2517
|
+
values: b,
|
|
2518
|
+
onChange: (D, S) => y((V) => ({ ...V, [D]: S })),
|
|
2423
2519
|
idPrefix: `w6w-ai-key-replace-${e.id}`
|
|
2424
2520
|
}
|
|
2425
2521
|
),
|
|
2426
|
-
/* @__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" })
|
|
2427
2523
|
] }),
|
|
2428
|
-
|
|
2524
|
+
E && /* @__PURE__ */ l("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
|
|
2429
2525
|
/* @__PURE__ */ l("p", { className: "w6w-small", children: [
|
|
2430
2526
|
'Remove "',
|
|
2431
2527
|
e.displayName,
|
|
@@ -2436,8 +2532,8 @@ function os({
|
|
|
2436
2532
|
{
|
|
2437
2533
|
type: "button",
|
|
2438
2534
|
className: "w6w-btn w6w-btn-danger",
|
|
2439
|
-
disabled:
|
|
2440
|
-
onClick:
|
|
2535
|
+
disabled: g.isPending,
|
|
2536
|
+
onClick: x,
|
|
2441
2537
|
children: "Confirm remove"
|
|
2442
2538
|
}
|
|
2443
2539
|
),
|
|
@@ -2447,299 +2543,299 @@ function os({
|
|
|
2447
2543
|
{
|
|
2448
2544
|
type: "button",
|
|
2449
2545
|
className: "w6w-btn w6w-btn-ghost",
|
|
2450
|
-
onClick: () =>
|
|
2546
|
+
onClick: () => I(!1),
|
|
2451
2547
|
children: "Cancel"
|
|
2452
2548
|
}
|
|
2453
2549
|
)
|
|
2454
2550
|
] }),
|
|
2455
|
-
|
|
2456
|
-
|
|
2551
|
+
v && /* @__PURE__ */ t("output", { children: v }),
|
|
2552
|
+
T && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: T })
|
|
2457
2553
|
] });
|
|
2458
2554
|
}
|
|
2459
|
-
function
|
|
2460
|
-
const n =
|
|
2555
|
+
function G(e) {
|
|
2556
|
+
const n = en(e), a = e == null ? void 0 : e.code;
|
|
2461
2557
|
return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
|
|
2462
2558
|
}
|
|
2463
|
-
const
|
|
2464
|
-
function
|
|
2559
|
+
const Je = 80;
|
|
2560
|
+
function fs(e, n) {
|
|
2465
2561
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
|
|
2466
|
-
const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })),
|
|
2467
|
-
|
|
2468
|
-
}
|
|
2469
|
-
function
|
|
2470
|
-
var
|
|
2471
|
-
const a =
|
|
2472
|
-
(
|
|
2473
|
-
),
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2476
|
-
id:
|
|
2477
|
-
isNew:
|
|
2478
|
-
cells:
|
|
2479
|
-
version:
|
|
2480
|
-
dirty:
|
|
2481
|
-
conflict:
|
|
2482
|
-
cellErrors:
|
|
2562
|
+
const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
|
|
2563
|
+
s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
|
|
2564
|
+
}
|
|
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);
|
|
2571
|
+
D.push({
|
|
2572
|
+
id: c,
|
|
2573
|
+
isNew: c === ie,
|
|
2574
|
+
cells: L.cells,
|
|
2575
|
+
version: L.version,
|
|
2576
|
+
dirty: te === null ? !0 : on(L, te, s).length > 0,
|
|
2577
|
+
conflict: h[c] === !0,
|
|
2578
|
+
cellErrors: m[c]
|
|
2483
2579
|
});
|
|
2484
2580
|
};
|
|
2485
|
-
|
|
2486
|
-
for (const
|
|
2487
|
-
|
|
2488
|
-
const
|
|
2489
|
-
g((
|
|
2490
|
-
},
|
|
2491
|
-
u((
|
|
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);
|
|
2492
2588
|
};
|
|
2493
|
-
function
|
|
2494
|
-
const
|
|
2495
|
-
u((
|
|
2496
|
-
const
|
|
2497
|
-
if (
|
|
2498
|
-
const
|
|
2499
|
-
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 };
|
|
2500
2596
|
});
|
|
2501
2597
|
}
|
|
2502
|
-
async function
|
|
2503
|
-
const
|
|
2504
|
-
if (
|
|
2505
|
-
|
|
2506
|
-
const
|
|
2507
|
-
if (!
|
|
2508
|
-
g((
|
|
2598
|
+
async function $(c) {
|
|
2599
|
+
const L = x.get(c), B = S(c) ?? (L ? ye(L, s) : void 0);
|
|
2600
|
+
if (B === void 0) return;
|
|
2601
|
+
E(null), W(c);
|
|
2602
|
+
const te = dn(B, s);
|
|
2603
|
+
if (!te.ok) {
|
|
2604
|
+
g((Y) => ({ ...Y, [c]: te.errors }));
|
|
2509
2605
|
return;
|
|
2510
2606
|
}
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2607
|
+
const X = un(
|
|
2608
|
+
B,
|
|
2609
|
+
te.value,
|
|
2610
|
+
nt((L == null ? void 0 : L.expiresAt) ?? null, Date.now())
|
|
2515
2611
|
);
|
|
2516
2612
|
try {
|
|
2517
|
-
|
|
2613
|
+
X.kind === "insert" ? await F.mutateAsync({
|
|
2518
2614
|
id: e.id,
|
|
2519
|
-
row:
|
|
2520
|
-
ttlSeconds:
|
|
2615
|
+
row: X.value,
|
|
2616
|
+
ttlSeconds: X.ttlSeconds,
|
|
2521
2617
|
project: n
|
|
2522
2618
|
}) : await R.mutateAsync({
|
|
2523
2619
|
id: e.id,
|
|
2524
|
-
key:
|
|
2525
|
-
value:
|
|
2526
|
-
ifVersion:
|
|
2527
|
-
ttlSeconds:
|
|
2620
|
+
key: X.key,
|
|
2621
|
+
value: X.value,
|
|
2622
|
+
ifVersion: X.ifVersion,
|
|
2623
|
+
ttlSeconds: X.ttlSeconds,
|
|
2528
2624
|
project: n
|
|
2529
|
-
}),
|
|
2530
|
-
} catch (
|
|
2531
|
-
const
|
|
2532
|
-
if (
|
|
2533
|
-
k((Ie) => ({ ...Ie, [
|
|
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 }));
|
|
2534
2630
|
return;
|
|
2535
2631
|
}
|
|
2536
|
-
const
|
|
2537
|
-
if (
|
|
2538
|
-
g((Ie) => ({ ...Ie, [
|
|
2632
|
+
const he = mn(se, s);
|
|
2633
|
+
if (he !== null) {
|
|
2634
|
+
g((Ie) => ({ ...Ie, [c]: he }));
|
|
2539
2635
|
return;
|
|
2540
2636
|
}
|
|
2541
|
-
|
|
2637
|
+
E(se.message);
|
|
2542
2638
|
}
|
|
2543
2639
|
}
|
|
2544
|
-
async function
|
|
2640
|
+
async function j(c) {
|
|
2545
2641
|
try {
|
|
2546
|
-
const
|
|
2547
|
-
|
|
2548
|
-
} catch (
|
|
2549
|
-
|
|
2642
|
+
const L = await Nt(N, e.id, c, n);
|
|
2643
|
+
b((B) => ({ ...B, [c]: L })), J(c), await K.invalidateQueries({ queryKey: ["data-stores"] });
|
|
2644
|
+
} catch (L) {
|
|
2645
|
+
E(G(L).message);
|
|
2550
2646
|
}
|
|
2551
2647
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const
|
|
2554
|
-
|
|
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));
|
|
2555
2651
|
}
|
|
2556
|
-
async function
|
|
2557
|
-
|
|
2652
|
+
async function Z(c) {
|
|
2653
|
+
T(null);
|
|
2558
2654
|
try {
|
|
2559
|
-
const
|
|
2560
|
-
|
|
2561
|
-
} catch (
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2564
|
-
typeof
|
|
2655
|
+
const L = await _.mutateAsync({ id: e.id, csv: await c.text(), project: n });
|
|
2656
|
+
T(Qe({ status: 200, text: JSON.stringify(L) }));
|
|
2657
|
+
} catch (L) {
|
|
2658
|
+
const B = L;
|
|
2659
|
+
T(
|
|
2660
|
+
typeof B.status == "number" ? Qe({ status: B.status, text: JSON.stringify(B.raw ?? null) }) : { ok: !1, message: G(L).message }
|
|
2565
2661
|
);
|
|
2566
2662
|
}
|
|
2567
2663
|
}
|
|
2568
|
-
async function
|
|
2664
|
+
async function C() {
|
|
2569
2665
|
try {
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2572
|
-
} catch (
|
|
2573
|
-
|
|
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 });
|
|
2574
2670
|
}
|
|
2575
2671
|
}
|
|
2576
2672
|
return /* @__PURE__ */ l("div", { children: [
|
|
2577
2673
|
/* @__PURE__ */ t(
|
|
2578
|
-
|
|
2674
|
+
nn,
|
|
2579
2675
|
{
|
|
2580
|
-
result:
|
|
2581
|
-
busy:
|
|
2582
|
-
onImport:
|
|
2583
|
-
onRefuse: (
|
|
2584
|
-
onExport:
|
|
2676
|
+
result: f,
|
|
2677
|
+
busy: A.isPending,
|
|
2678
|
+
onImport: Z,
|
|
2679
|
+
onRefuse: (c) => T({ ok: !1, message: c }),
|
|
2680
|
+
onExport: C
|
|
2585
2681
|
}
|
|
2586
2682
|
),
|
|
2587
2683
|
/* @__PURE__ */ t(
|
|
2588
|
-
|
|
2684
|
+
an,
|
|
2589
2685
|
{
|
|
2590
|
-
columns:
|
|
2591
|
-
keyColumn:
|
|
2592
|
-
rows:
|
|
2686
|
+
columns: s,
|
|
2687
|
+
keyColumn: i,
|
|
2688
|
+
rows: D,
|
|
2593
2689
|
error: y,
|
|
2594
|
-
loading:
|
|
2595
|
-
hasMore:
|
|
2690
|
+
loading: M.isPending,
|
|
2691
|
+
hasMore: M.hasNextPage,
|
|
2596
2692
|
empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
|
|
2597
|
-
onCellChange:
|
|
2598
|
-
onSave: (
|
|
2599
|
-
onDelete:
|
|
2600
|
-
onReload: (
|
|
2693
|
+
onCellChange: ee,
|
|
2694
|
+
onSave: (c) => void $(c),
|
|
2695
|
+
onDelete: v,
|
|
2696
|
+
onReload: (c) => void j(c),
|
|
2601
2697
|
onAddRow: () => {
|
|
2602
|
-
|
|
2698
|
+
ie in d || (u((c) => ({ ...c, [ie]: je(s) })), E(null));
|
|
2603
2699
|
},
|
|
2604
|
-
onLoadMore: () => void
|
|
2700
|
+
onLoadMore: () => void M.fetchNextPage(),
|
|
2605
2701
|
onSearch: r
|
|
2606
2702
|
}
|
|
2607
2703
|
),
|
|
2608
|
-
|
|
2609
|
-
|
|
2704
|
+
I !== null && /* @__PURE__ */ t(
|
|
2705
|
+
Ne,
|
|
2610
2706
|
{
|
|
2611
2707
|
title: "Delete entry",
|
|
2612
|
-
message:
|
|
2708
|
+
message: I === ie ? "Discard this unsaved row?" : `Delete "${I}"? This cannot be undone.`,
|
|
2613
2709
|
confirmLabel: "Delete",
|
|
2614
|
-
onConfirm:
|
|
2615
|
-
onClose: () =>
|
|
2710
|
+
onConfirm: H,
|
|
2711
|
+
onClose: () => v(null)
|
|
2616
2712
|
}
|
|
2617
2713
|
)
|
|
2618
2714
|
] });
|
|
2619
2715
|
}
|
|
2620
|
-
function
|
|
2621
|
-
var
|
|
2622
|
-
const a = e.kind === "doc",
|
|
2623
|
-
(
|
|
2624
|
-
),
|
|
2625
|
-
const
|
|
2626
|
-
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;
|
|
2627
2723
|
};
|
|
2628
|
-
function
|
|
2629
|
-
|
|
2724
|
+
function S($) {
|
|
2725
|
+
d($.key), m(!1), w(x($)), y(null), I(!1);
|
|
2630
2726
|
}
|
|
2631
|
-
function
|
|
2632
|
-
|
|
2727
|
+
function V() {
|
|
2728
|
+
d(null), m(!1), h(""), w(""), y(null), I(!1);
|
|
2633
2729
|
}
|
|
2634
|
-
async function
|
|
2635
|
-
y(null),
|
|
2636
|
-
const
|
|
2637
|
-
if (
|
|
2638
|
-
y(
|
|
2730
|
+
async function U() {
|
|
2731
|
+
y(null), I(!1);
|
|
2732
|
+
const $ = a ? hn(k) : wn(s, k);
|
|
2733
|
+
if (!$.ok) {
|
|
2734
|
+
y($.message);
|
|
2639
2735
|
return;
|
|
2640
2736
|
}
|
|
2641
|
-
const
|
|
2642
|
-
if (
|
|
2737
|
+
const j = u ? g.trim() : r;
|
|
2738
|
+
if (j === null || j === "") {
|
|
2643
2739
|
y("Enter a key.");
|
|
2644
2740
|
return;
|
|
2645
2741
|
}
|
|
2646
2742
|
try {
|
|
2647
|
-
await
|
|
2743
|
+
await F.mutateAsync({
|
|
2648
2744
|
id: e.id,
|
|
2649
|
-
key:
|
|
2650
|
-
value:
|
|
2745
|
+
key: j,
|
|
2746
|
+
value: $.value,
|
|
2651
2747
|
// A new entry must not exist yet; an existing one is guarded by the version loaded.
|
|
2652
|
-
ifVersion: u ? 0 : (
|
|
2653
|
-
ttlSeconds: u ? void 0 :
|
|
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()),
|
|
2654
2750
|
project: n
|
|
2655
|
-
}),
|
|
2656
|
-
} catch (
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2751
|
+
}), f((H) => le(H, j)), V();
|
|
2752
|
+
} catch (H) {
|
|
2753
|
+
const Z = G(H);
|
|
2754
|
+
at(Z) ? I(!0) : y(Z.message);
|
|
2659
2755
|
}
|
|
2660
2756
|
}
|
|
2661
|
-
async function
|
|
2757
|
+
async function W() {
|
|
2662
2758
|
if (r !== null)
|
|
2663
2759
|
try {
|
|
2664
|
-
const
|
|
2665
|
-
|
|
2666
|
-
} catch (
|
|
2667
|
-
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);
|
|
2668
2764
|
}
|
|
2669
2765
|
}
|
|
2670
|
-
async function
|
|
2671
|
-
const
|
|
2672
|
-
if (
|
|
2766
|
+
async function J() {
|
|
2767
|
+
const $ = T;
|
|
2768
|
+
if (N(null), $ !== null)
|
|
2673
2769
|
try {
|
|
2674
|
-
await
|
|
2675
|
-
} catch (
|
|
2676
|
-
y(
|
|
2770
|
+
await O.mutateAsync({ id: e.id, key: $, project: n }), $ === r && V();
|
|
2771
|
+
} catch (j) {
|
|
2772
|
+
y(G(j).message);
|
|
2677
2773
|
}
|
|
2678
2774
|
}
|
|
2679
2775
|
return /* @__PURE__ */ l("div", { children: [
|
|
2680
2776
|
/* @__PURE__ */ t(
|
|
2681
|
-
|
|
2777
|
+
ln,
|
|
2682
2778
|
{
|
|
2683
|
-
rows:
|
|
2779
|
+
rows: _.map(($) => ({ key: $.key, version: $.version, preview: D($) })),
|
|
2684
2780
|
loading: R.isPending,
|
|
2685
2781
|
empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
|
|
2686
2782
|
hasMore: R.hasNextPage,
|
|
2687
|
-
onOpen: (
|
|
2688
|
-
const
|
|
2689
|
-
|
|
2783
|
+
onOpen: ($) => {
|
|
2784
|
+
const j = _.find((H) => H.key === $);
|
|
2785
|
+
j && S(j);
|
|
2690
2786
|
},
|
|
2691
2787
|
onSearch: o,
|
|
2692
2788
|
onNew: () => {
|
|
2693
|
-
|
|
2789
|
+
d(null), m(!0), h(""), w(""), y(null), I(!1);
|
|
2694
2790
|
},
|
|
2695
2791
|
onLoadMore: () => void R.fetchNextPage()
|
|
2696
2792
|
}
|
|
2697
2793
|
),
|
|
2698
|
-
|
|
2699
|
-
|
|
2794
|
+
P && /* @__PURE__ */ t(
|
|
2795
|
+
rn,
|
|
2700
2796
|
{
|
|
2701
2797
|
kind: a ? "doc" : "kv",
|
|
2702
2798
|
isNew: u,
|
|
2703
2799
|
entryKey: r ?? void 0,
|
|
2704
2800
|
newKey: g,
|
|
2705
|
-
version: (
|
|
2706
|
-
expiresAt: (
|
|
2801
|
+
version: (A == null ? void 0 : A.version) ?? null,
|
|
2802
|
+
expiresAt: (A == null ? void 0 : A.expiresAt) ?? null,
|
|
2707
2803
|
text: k,
|
|
2708
|
-
error:
|
|
2709
|
-
conflict:
|
|
2710
|
-
saving:
|
|
2711
|
-
onDelete: u ? void 0 : () =>
|
|
2712
|
-
onTextChange: (
|
|
2713
|
-
w(
|
|
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);
|
|
2714
2810
|
},
|
|
2715
|
-
onKeyChange:
|
|
2716
|
-
onSave: () => void
|
|
2717
|
-
onCancel:
|
|
2718
|
-
onReload: () => void
|
|
2811
|
+
onKeyChange: h,
|
|
2812
|
+
onSave: () => void U(),
|
|
2813
|
+
onCancel: V,
|
|
2814
|
+
onReload: () => void W()
|
|
2719
2815
|
}
|
|
2720
2816
|
),
|
|
2721
|
-
|
|
2722
|
-
|
|
2817
|
+
T !== null && /* @__PURE__ */ t(
|
|
2818
|
+
Ne,
|
|
2723
2819
|
{
|
|
2724
2820
|
title: "Delete entry",
|
|
2725
|
-
message: `Delete "${
|
|
2821
|
+
message: `Delete "${T}"? This cannot be undone.`,
|
|
2726
2822
|
confirmLabel: "Delete",
|
|
2727
|
-
onConfirm:
|
|
2728
|
-
onClose: () =>
|
|
2823
|
+
onConfirm: J,
|
|
2824
|
+
onClose: () => N(null)
|
|
2729
2825
|
}
|
|
2730
2826
|
)
|
|
2731
2827
|
] });
|
|
2732
2828
|
}
|
|
2733
|
-
function
|
|
2829
|
+
function le(e, n) {
|
|
2734
2830
|
if (!(n in e)) return e;
|
|
2735
2831
|
const a = { ...e };
|
|
2736
2832
|
return delete a[n], a;
|
|
2737
2833
|
}
|
|
2738
|
-
function
|
|
2739
|
-
const
|
|
2834
|
+
function oi({ id: e, project: n, slots: a }) {
|
|
2835
|
+
const s = ne(n), i = ia(e, s ?? void 0), o = i.data;
|
|
2740
2836
|
let r;
|
|
2741
|
-
|
|
2742
|
-
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: [
|
|
2743
2839
|
/* @__PURE__ */ t("h3", { children: o.name }),
|
|
2744
2840
|
/* @__PURE__ */ l("p", { className: "muted small", children: [
|
|
2745
2841
|
o.kind,
|
|
@@ -2750,41 +2846,41 @@ function ti({ id: e, project: n, slots: a }) {
|
|
|
2750
2846
|
] })
|
|
2751
2847
|
] }) : a.header;
|
|
2752
2848
|
return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
|
|
2753
|
-
|
|
2849
|
+
d,
|
|
2754
2850
|
r
|
|
2755
2851
|
] }) });
|
|
2756
2852
|
}
|
|
2757
|
-
const
|
|
2758
|
-
function
|
|
2759
|
-
const [n, a] =
|
|
2760
|
-
function
|
|
2761
|
-
|
|
2762
|
-
const
|
|
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);
|
|
2858
|
+
const N = {
|
|
2763
2859
|
kind: o,
|
|
2764
2860
|
name: n
|
|
2765
2861
|
};
|
|
2766
|
-
o === "kv" && (
|
|
2862
|
+
o === "kv" && (N.schema = { valueType: d }), o === "table" && (N.schema = h === "" ? { columns: m } : { columns: m, key: h }), s !== "" && (N.description = s), f.mutate(
|
|
2767
2863
|
// The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
|
|
2768
2864
|
// per kind, so the kv `{valueType}` schema is passed through as the host defines it.
|
|
2769
|
-
{ input:
|
|
2865
|
+
{ input: N, project: e.project },
|
|
2770
2866
|
{
|
|
2771
2867
|
onSuccess: () => e.onClose(),
|
|
2772
|
-
onError: (
|
|
2773
|
-
const
|
|
2774
|
-
if (R.kind === "cell" &&
|
|
2775
|
-
|
|
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 });
|
|
2776
2872
|
return;
|
|
2777
2873
|
}
|
|
2778
|
-
if (R.kind === "field" &&
|
|
2779
|
-
|
|
2874
|
+
if (R.kind === "field" && vs.includes(R.field)) {
|
|
2875
|
+
b({ [R.field]: M.message });
|
|
2780
2876
|
return;
|
|
2781
2877
|
}
|
|
2782
|
-
|
|
2878
|
+
v(M.message);
|
|
2783
2879
|
}
|
|
2784
2880
|
}
|
|
2785
2881
|
);
|
|
2786
2882
|
}
|
|
2787
|
-
return /* @__PURE__ */ l(
|
|
2883
|
+
return /* @__PURE__ */ l(Pn, { title: "New data store", onClose: e.onClose, children: [
|
|
2788
2884
|
/* @__PURE__ */ l("div", { className: "modal-body", children: [
|
|
2789
2885
|
/* @__PURE__ */ l("label", { className: "field", children: [
|
|
2790
2886
|
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
@@ -2794,7 +2890,7 @@ function hs(e) {
|
|
|
2794
2890
|
type: "text",
|
|
2795
2891
|
"data-testid": "data-store-name",
|
|
2796
2892
|
value: n,
|
|
2797
|
-
onChange: (
|
|
2893
|
+
onChange: (N) => a(N.target.value),
|
|
2798
2894
|
placeholder: "e.g. counters"
|
|
2799
2895
|
}
|
|
2800
2896
|
)
|
|
@@ -2806,8 +2902,8 @@ function hs(e) {
|
|
|
2806
2902
|
"input",
|
|
2807
2903
|
{
|
|
2808
2904
|
type: "text",
|
|
2809
|
-
value:
|
|
2810
|
-
onChange: (
|
|
2905
|
+
value: s,
|
|
2906
|
+
onChange: (N) => i(N.target.value),
|
|
2811
2907
|
placeholder: "What this store holds"
|
|
2812
2908
|
}
|
|
2813
2909
|
)
|
|
@@ -2819,10 +2915,10 @@ function hs(e) {
|
|
|
2819
2915
|
{
|
|
2820
2916
|
"data-testid": "data-store-kind",
|
|
2821
2917
|
value: o,
|
|
2822
|
-
onChange: (
|
|
2823
|
-
r(
|
|
2918
|
+
onChange: (N) => {
|
|
2919
|
+
r(N.target.value), k("");
|
|
2824
2920
|
},
|
|
2825
|
-
children:
|
|
2921
|
+
children: yn.map((N) => /* @__PURE__ */ t("option", { value: N, children: gn[N] }, N))
|
|
2826
2922
|
}
|
|
2827
2923
|
),
|
|
2828
2924
|
/* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
|
|
@@ -2830,20 +2926,20 @@ function hs(e) {
|
|
|
2830
2926
|
w.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.kind }),
|
|
2831
2927
|
o === "kv" && /* @__PURE__ */ l("label", { className: "field", children: [
|
|
2832
2928
|
/* @__PURE__ */ t("span", { children: "Value type" }),
|
|
2833
|
-
/* @__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)) })
|
|
2834
2930
|
] }),
|
|
2835
2931
|
o === "table" && /* @__PURE__ */ t(
|
|
2836
|
-
|
|
2932
|
+
bn,
|
|
2837
2933
|
{
|
|
2838
|
-
columns:
|
|
2934
|
+
columns: m,
|
|
2839
2935
|
onChange: g,
|
|
2840
|
-
keyColumn:
|
|
2936
|
+
keyColumn: h,
|
|
2841
2937
|
onKeyColumnChange: k,
|
|
2842
2938
|
columnErrors: y
|
|
2843
2939
|
}
|
|
2844
2940
|
),
|
|
2845
2941
|
w.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.schema }),
|
|
2846
|
-
|
|
2942
|
+
I !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: I })
|
|
2847
2943
|
] }),
|
|
2848
2944
|
/* @__PURE__ */ l("div", { className: "modal-actions", children: [
|
|
2849
2945
|
/* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
|
|
@@ -2853,30 +2949,30 @@ function hs(e) {
|
|
|
2853
2949
|
type: "button",
|
|
2854
2950
|
className: "btn",
|
|
2855
2951
|
"data-testid": "data-store-create",
|
|
2856
|
-
disabled:
|
|
2857
|
-
onClick:
|
|
2858
|
-
children:
|
|
2952
|
+
disabled: f.isPending,
|
|
2953
|
+
onClick: T,
|
|
2954
|
+
children: f.isPending ? "Creating…" : "Create"
|
|
2859
2955
|
}
|
|
2860
2956
|
)
|
|
2861
2957
|
] })
|
|
2862
2958
|
] });
|
|
2863
2959
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const
|
|
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: [
|
|
2866
2962
|
/* @__PURE__ */ t("h3", { children: "Data stores" }),
|
|
2867
2963
|
/* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
|
|
2868
|
-
] }) :
|
|
2964
|
+
] }) : s.header;
|
|
2869
2965
|
return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
|
|
2870
2966
|
/* @__PURE__ */ t(
|
|
2871
|
-
|
|
2967
|
+
fn,
|
|
2872
2968
|
{
|
|
2873
2969
|
stores: o.data ?? [],
|
|
2874
2970
|
loading: o.isLoading,
|
|
2875
|
-
error:
|
|
2971
|
+
error: h ?? (o.error != null ? G(o.error).message : null),
|
|
2876
2972
|
onOpen: n,
|
|
2877
2973
|
getHref: a,
|
|
2878
|
-
onArchive: (
|
|
2879
|
-
k(null), g(
|
|
2974
|
+
onArchive: (b) => {
|
|
2975
|
+
k(null), g(b);
|
|
2880
2976
|
},
|
|
2881
2977
|
busy: r.isPending,
|
|
2882
2978
|
slots: {
|
|
@@ -2887,27 +2983,27 @@ function ni({ project: e, onOpen: n, getHref: a, slots: i }) {
|
|
|
2887
2983
|
type: "button",
|
|
2888
2984
|
className: "btn",
|
|
2889
2985
|
"data-testid": "data-store-new",
|
|
2890
|
-
disabled:
|
|
2986
|
+
disabled: i == null,
|
|
2891
2987
|
onClick: () => u(!0),
|
|
2892
2988
|
children: "+ New data store"
|
|
2893
2989
|
}
|
|
2894
2990
|
),
|
|
2895
|
-
empty:
|
|
2991
|
+
empty: s == null ? void 0 : s.empty
|
|
2896
2992
|
}
|
|
2897
2993
|
}
|
|
2898
2994
|
),
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2995
|
+
d && i != null && /* @__PURE__ */ t(bs, { project: i, onClose: () => u(!1) }),
|
|
2996
|
+
m && /* @__PURE__ */ t(
|
|
2997
|
+
Ne,
|
|
2902
2998
|
{
|
|
2903
2999
|
title: "Archive data store",
|
|
2904
|
-
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.`,
|
|
2905
3001
|
confirmLabel: "Archive",
|
|
2906
3002
|
onConfirm: () => {
|
|
2907
|
-
const
|
|
2908
|
-
g(null),
|
|
2909
|
-
{ id:
|
|
2910
|
-
{ onError: (y) => k(
|
|
3003
|
+
const b = m;
|
|
3004
|
+
g(null), i != null && r.mutate(
|
|
3005
|
+
{ id: b.id, project: i },
|
|
3006
|
+
{ onError: (y) => k(G(y).message) }
|
|
2911
3007
|
);
|
|
2912
3008
|
},
|
|
2913
3009
|
onClose: () => g(null)
|
|
@@ -2916,25 +3012,25 @@ function ni({ project: e, onOpen: n, getHref: a, slots: i }) {
|
|
|
2916
3012
|
] });
|
|
2917
3013
|
}
|
|
2918
3014
|
export {
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
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
|
|
2939
3035
|
};
|
|
2940
3036
|
//# sourceMappingURL=lists.mjs.map
|