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