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