@hansenexus/hud 0.3.0 → 0.5.0
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/README.md +782 -6
- package/dist/a11y-B5DUaiCs.js +246 -0
- package/dist/a11y-panel-p_t4eD7p.js +207 -0
- package/dist/access-C7zlaqj6.js +100 -0
- package/dist/access-D_ewAEJG.d.ts +61 -0
- package/dist/access-panel-CEfTr9ZI.js +123 -0
- package/dist/adapter-BYoxPYTI.d.ts +33 -0
- package/dist/adapter-hcwmJtNx.js +65 -0
- package/dist/auto/runtime.d.ts +65 -0
- package/dist/auto/runtime.js +50 -0
- package/dist/auto.d.ts +15 -0
- package/dist/auto.js +33 -0
- package/dist/capabilities-rDSKjXpq.js +110 -0
- package/dist/capture-CwrIwLqi.js +300 -0
- package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +275 -0
- package/dist/data-panel-DhxAmP91.js +817 -0
- package/dist/data-store-ChF1td_P.js +164 -0
- package/dist/define-hud-CHPedaQ5.d.ts +50 -0
- package/dist/design-D0kGgPoP.js +87 -0
- package/dist/detect-BxHZ0pxW.d.ts +25 -0
- package/dist/detect-CHZiSeZs.js +63 -0
- package/dist/dispatch-panel-B-xr_Giy.js +279 -0
- package/dist/env-CApnbI0r.d.ts +19 -0
- package/dist/env-CaiFPIhF.js +31 -0
- package/dist/file-xdSaQ2uR.js +103 -0
- package/dist/flags-DVtaJ8pQ.d.ts +58 -0
- package/dist/flags.d.ts +2 -0
- package/dist/flags.js +82 -0
- package/dist/force-state-BaqWsmrf.js +153 -0
- package/dist/force-state-CCqoTfVB.d.ts +23 -0
- package/dist/force-state-panel-_otVYh9i.js +97 -0
- package/dist/generate-C8lQl3Eh.js +53 -0
- package/dist/handler-BpVhxEmU.js +106 -0
- package/dist/handler-DtYVCZY6.d.ts +39 -0
- package/dist/index-BAV_1W8a.d.ts +43 -0
- package/dist/index-BJ26pse9.d.ts +70 -0
- package/dist/index-BnQ0dTZf.d.ts +19 -0
- package/dist/index-CwfX-W87.d.ts +72 -0
- package/dist/index-DcH9V3cU.d.ts +48 -0
- package/dist/index-DqOyNf1u.d.ts +65 -0
- package/dist/index-DstI_ike.d.ts +66 -0
- package/dist/index-Dxz4fn4j.d.ts +42 -0
- package/dist/index-Hhh7OXzU.d.ts +129 -0
- package/dist/index-ReFbhQ9p.d.ts +25 -0
- package/dist/index-RgXfMBuW.d.ts +48 -0
- package/dist/index-gCZBO53s.d.ts +73 -0
- package/dist/index.d.ts +6 -36
- package/dist/index.js +798 -240
- package/dist/inspect-C9Ft8fqn.js +142 -0
- package/dist/inspect-root-BkaupBMp.js +429 -0
- package/dist/marker-C66LxOhJ.d.ts +9 -0
- package/dist/marker-CMrvxPmS.d.ts +12 -0
- package/dist/marker-DjeGvL-F.js +9 -0
- package/dist/marker-uZYPOJ4M.js +12 -0
- package/dist/markers.d.ts +3 -0
- package/dist/markers.js +3 -0
- package/dist/meta-Bv0sEao3.js +6 -0
- package/dist/meta-C_G7MB5w.d.ts +49 -0
- package/dist/mocks-CA-wM2SB.d.ts +109 -0
- package/dist/mocks-ESiRqk9o.js +150 -0
- package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
- package/dist/next/config.d.ts +52 -0
- package/dist/next/config.js +78 -0
- package/dist/next.d.ts +14 -19
- package/dist/next.js +7 -30
- package/dist/observe-CdDnDBRP.js +89 -0
- package/dist/observe-panel-Cgp1M8oT.js +347 -0
- package/dist/ops-panel-CEqDe_UT.js +234 -0
- package/dist/payload-MUQ9ciER.d.ts +92 -0
- package/dist/plugins/a11y.d.ts +2 -0
- package/dist/plugins/a11y.js +2 -0
- package/dist/plugins/access/server.d.ts +122 -0
- package/dist/plugins/access/server.js +340 -0
- package/dist/plugins/access.d.ts +41 -0
- package/dist/plugins/access.js +51 -0
- package/dist/plugins/agent/server.d.ts +94 -0
- package/dist/plugins/agent/server.js +455 -0
- package/dist/plugins/agent.d.ts +37 -0
- package/dist/plugins/agent.js +69 -0
- package/dist/plugins/capture/server.d.ts +92 -0
- package/dist/plugins/capture/server.js +248 -0
- package/dist/plugins/capture.d.ts +24 -0
- package/dist/plugins/capture.js +70 -0
- package/dist/plugins/data/msw-browser.d.ts +2 -0
- package/dist/plugins/data/msw-browser.js +39 -0
- package/dist/plugins/data/msw-node.d.ts +36 -0
- package/dist/plugins/data/msw-node.js +68 -0
- package/dist/plugins/data/server.d.ts +257 -0
- package/dist/plugins/data/server.js +717 -0
- package/dist/plugins/data.d.ts +6 -0
- package/dist/plugins/data.js +51 -0
- package/dist/plugins/design/server.d.ts +54 -0
- package/dist/plugins/design/server.js +198 -0
- package/dist/plugins/design.d.ts +5 -0
- package/dist/plugins/design.js +4 -0
- package/dist/plugins/inspect/convex.d.ts +2 -0
- package/dist/plugins/inspect/convex.js +486 -0
- package/dist/plugins/inspect/react-query.d.ts +2 -0
- package/dist/plugins/inspect/react-query.js +225 -0
- package/dist/plugins/inspect/sockets.d.ts +51 -0
- package/dist/plugins/inspect/sockets.js +397 -0
- package/dist/plugins/inspect/swr.d.ts +2 -0
- package/dist/plugins/inspect/swr.js +218 -0
- package/dist/plugins/inspect.d.ts +4 -0
- package/dist/plugins/inspect.js +3 -0
- package/dist/plugins/observe.d.ts +4 -0
- package/dist/plugins/observe.js +2 -0
- package/dist/plugins/ops/server.d.ts +82 -0
- package/dist/plugins/ops/server.js +381 -0
- package/dist/plugins/ops.d.ts +27 -0
- package/dist/plugins/ops.js +41 -0
- package/dist/plugins/routes/server.d.ts +88 -0
- package/dist/plugins/routes/server.js +62 -0
- package/dist/plugins/routes.d.ts +3 -0
- package/dist/plugins/routes.js +216 -0
- package/dist/plugins/seo.d.ts +2 -0
- package/dist/plugins/seo.js +2 -0
- package/dist/plugins/vitals.d.ts +2 -25
- package/dist/plugins/vitals.js +4 -86
- package/dist/plugins-BZvDqGx5.d.ts +144 -0
- package/dist/{plugins-CzUiTn_r.js → plugins-DVy_vaYr.js} +3 -1
- package/dist/poll-CjKsWZi8.js +89 -0
- package/dist/requests-BwD6MKEq.js +282 -0
- package/dist/requests-CJrUf465.d.ts +50 -0
- package/dist/review.d.ts +181 -0
- package/dist/review.js +1017 -0
- package/dist/same-origin-BGet22CC.js +21 -0
- package/dist/scan-DzJNXqOk.js +165 -0
- package/dist/selector-NSYSe7AZ.js +28 -0
- package/dist/seo-Dq9q_QkO.js +551 -0
- package/dist/seo-panel-CfiY-TnT.js +124 -0
- package/dist/server.d.ts +3 -39
- package/dist/server.js +2 -105
- package/dist/sessions-panel-COvhPAzv.js +98 -0
- package/dist/shortcut-s_mjGeU8.js +179 -0
- package/dist/state-CjjZPjPJ.js +40 -0
- package/dist/state-boundary.d.ts +26 -0
- package/dist/state-boundary.js +61 -0
- package/dist/store/convex.d.ts +33 -0
- package/dist/store/convex.js +52 -0
- package/dist/store-CQqIIKTc.js +59 -0
- package/dist/store-Ync9eb1G.js +67 -0
- package/dist/store.d.ts +76 -0
- package/dist/store.js +188 -0
- package/dist/styles-BA8ueHoV.js +342 -0
- package/dist/styles-DKU_P8MH.js +139 -0
- package/dist/styles-DPpDPmzi.js +68 -0
- package/dist/tokens-panel-CbMQfasZ.js +142 -0
- package/dist/types-B-ulf2Jp.js +8 -0
- package/dist/types-BIgGf-0C.d.ts +25 -0
- package/dist/types-BIkI-qN8.js +30 -0
- package/dist/types-Cxh4twqc.d.ts +50 -0
- package/dist/types-DIdPfjtV.js +6 -0
- package/dist/types-DaJcsEjO.d.ts +44 -0
- package/dist/types-Dn68psVz.d.ts +118 -0
- package/dist/types-f3jlNxzw.d.ts +92 -0
- package/dist/types-szkr2QOF.d.ts +39 -0
- package/dist/unlock-store-4V3vR4Eg.js +96 -0
- package/dist/variant-groups-TIfO3NIj.js +137 -0
- package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
- package/dist/variants-panel-BDoSkwBJ.js +457 -0
- package/dist/variants-types-CcRf119M.d.ts +63 -0
- package/dist/variants.d.ts +43 -0
- package/dist/variants.js +83 -0
- package/dist/vitals-panel-BCmMUntW.js +30 -0
- package/dist/vite.d.ts +37 -0
- package/dist/vite.js +134 -0
- package/package.json +85 -5
- package/dist/define-hud-BHQR8Lbv.d.ts +0 -31
- package/dist/plugins-1QmTmZyL.d.ts +0 -76
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { a as preview, i as prettyPreview, o as useNow, r as oneLine, t as ago } from "../../adapter-hcwmJtNx.js";
|
|
2
|
+
import { useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/plugins/inspect/swr/index.tsx
|
|
5
|
+
const MAX_ROWS = 100;
|
|
6
|
+
/** SWR's own bookkeeping keys (infinite pages, subscriptions). */
|
|
7
|
+
const INTERNAL_KEY = /^\$(inf|sub)\$/;
|
|
8
|
+
/**
|
|
9
|
+
* SWR tab for the inspect plugin: every cache key with its data (redacted),
|
|
10
|
+
* error, validation state and age, and Revalidate per key. Wraps the cache's
|
|
11
|
+
* `set` and `delete` when called, so writes are timestamped and the tab
|
|
12
|
+
* re-renders; `dispose()` restores the cache.
|
|
13
|
+
*/
|
|
14
|
+
function inspectSwr({ cache, mutate }) {
|
|
15
|
+
const stamps = /* @__PURE__ */ new Map();
|
|
16
|
+
let version = 0;
|
|
17
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
18
|
+
const notify = () => {
|
|
19
|
+
version++;
|
|
20
|
+
for (const listener of listeners) listener();
|
|
21
|
+
};
|
|
22
|
+
const subscribe = (listener) => {
|
|
23
|
+
listeners.add(listener);
|
|
24
|
+
return () => listeners.delete(listener);
|
|
25
|
+
};
|
|
26
|
+
const getVersion = () => version;
|
|
27
|
+
const originalSet = cache.set;
|
|
28
|
+
const originalDelete = cache.delete;
|
|
29
|
+
cache.set = (key, value) => {
|
|
30
|
+
const previous = cache.get(key);
|
|
31
|
+
originalSet.call(cache, key, value);
|
|
32
|
+
if (!INTERNAL_KEY.test(key)) {
|
|
33
|
+
const stamp = stamps.get(key) ?? {};
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
if (value.isValidating && !previous?.isValidating) stamp.validatingSince = now;
|
|
36
|
+
if (previous?.isValidating && !value.isValidating || value.data !== void 0 && value.data !== previous?.data) stamp.updatedAt = now;
|
|
37
|
+
stamps.set(key, stamp);
|
|
38
|
+
}
|
|
39
|
+
notify();
|
|
40
|
+
};
|
|
41
|
+
cache.delete = (key) => {
|
|
42
|
+
originalDelete.call(cache, key);
|
|
43
|
+
stamps.delete(key);
|
|
44
|
+
notify();
|
|
45
|
+
};
|
|
46
|
+
const useEntries = () => {
|
|
47
|
+
useSyncExternalStore(subscribe, getVersion, getVersion);
|
|
48
|
+
const entries = [];
|
|
49
|
+
for (const key of cache.keys()) {
|
|
50
|
+
if (INTERNAL_KEY.test(key)) continue;
|
|
51
|
+
const state = cache.get(key);
|
|
52
|
+
if (state) entries.push({
|
|
53
|
+
key,
|
|
54
|
+
state,
|
|
55
|
+
stamp: stamps.get(key) ?? {}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return entries;
|
|
59
|
+
};
|
|
60
|
+
const revalidate = (entry) => {
|
|
61
|
+
mutate(entry.state._k ?? entry.key).catch(() => {});
|
|
62
|
+
};
|
|
63
|
+
function Panel() {
|
|
64
|
+
const entries = useEntries();
|
|
65
|
+
const now = useNow();
|
|
66
|
+
const [selected, setSelected] = useState(null);
|
|
67
|
+
const rows = [...entries].sort((a, b) => (b.stamp.updatedAt ?? 0) - (a.stamp.updatedAt ?? 0)).slice(0, MAX_ROWS);
|
|
68
|
+
const current = selected === null ? void 0 : entries.find((e) => e.key === selected);
|
|
69
|
+
const validating = entries.filter((e) => e.state.isValidating).length;
|
|
70
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "insp-toolbar",
|
|
73
|
+
role: "toolbar",
|
|
74
|
+
"aria-label": "SWR",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", {
|
|
77
|
+
className: "insp-chip",
|
|
78
|
+
children: entries.length === 1 ? "1 key" : `${entries.length} keys`
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ jsxs("span", {
|
|
81
|
+
className: "insp-chip",
|
|
82
|
+
children: [validating, " validating"]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
className: "insp-chip insp-clear",
|
|
87
|
+
onClick: () => {
|
|
88
|
+
for (const entry of entries) revalidate(entry);
|
|
89
|
+
},
|
|
90
|
+
children: "revalidate all"
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsx("div", {
|
|
95
|
+
className: "insp-log",
|
|
96
|
+
role: "listbox",
|
|
97
|
+
"aria-label": "SWR cache",
|
|
98
|
+
children: rows.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
99
|
+
className: "empty",
|
|
100
|
+
children: "No SWR keys in the cache yet."
|
|
101
|
+
}) : rows.map((entry) => /* @__PURE__ */ jsx(SwrRow, {
|
|
102
|
+
entry,
|
|
103
|
+
now,
|
|
104
|
+
selected: entry.key === selected,
|
|
105
|
+
onClick: () => setSelected((value) => value === entry.key ? null : entry.key)
|
|
106
|
+
}, entry.key))
|
|
107
|
+
}),
|
|
108
|
+
current && /* @__PURE__ */ jsx(SwrDetail, {
|
|
109
|
+
entry: current,
|
|
110
|
+
now,
|
|
111
|
+
onRevalidate: () => revalidate(current)
|
|
112
|
+
})
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
id: "swr",
|
|
117
|
+
title: "SWR",
|
|
118
|
+
Panel,
|
|
119
|
+
useCount: () => useEntries().length,
|
|
120
|
+
dispose: () => {
|
|
121
|
+
cache.set = originalSet;
|
|
122
|
+
cache.delete = originalDelete;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function level(state) {
|
|
127
|
+
if (state.error !== void 0 && state.error !== null) return "error";
|
|
128
|
+
return state.data === void 0 ? "pending" : "ok";
|
|
129
|
+
}
|
|
130
|
+
function phase(state) {
|
|
131
|
+
if (state.isLoading) return "loading";
|
|
132
|
+
if (state.isValidating) return "validating";
|
|
133
|
+
return "settled";
|
|
134
|
+
}
|
|
135
|
+
function SwrRow({ entry, now, selected, onClick }) {
|
|
136
|
+
const { state, stamp } = entry;
|
|
137
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
138
|
+
type: "button",
|
|
139
|
+
role: "option",
|
|
140
|
+
className: "insp-row",
|
|
141
|
+
"aria-selected": selected,
|
|
142
|
+
onClick,
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: "insp-method",
|
|
146
|
+
children: state.isValidating ? "fetch" : "cache"
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: "insp-url",
|
|
150
|
+
title: entry.key,
|
|
151
|
+
children: entry.key
|
|
152
|
+
}),
|
|
153
|
+
state.isValidating && /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "insp-badge",
|
|
155
|
+
"data-kind": "replay",
|
|
156
|
+
children: phase(state)
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx("span", {
|
|
159
|
+
className: "insp-status",
|
|
160
|
+
"data-level": level(state),
|
|
161
|
+
children: level(state) === "error" ? "ERR" : level(state) === "ok" ? "ok" : "…"
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsxs("span", {
|
|
164
|
+
className: "insp-sub",
|
|
165
|
+
children: [
|
|
166
|
+
phase(state),
|
|
167
|
+
" · updated ",
|
|
168
|
+
ago(stamp.updatedAt, now)
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function SwrDetail({ entry, now, onRevalidate }) {
|
|
175
|
+
const { state, stamp } = entry;
|
|
176
|
+
const error = state.error;
|
|
177
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
178
|
+
className: "insp-detail",
|
|
179
|
+
"aria-label": "Key detail",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx("div", {
|
|
182
|
+
className: "insp-actions",
|
|
183
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
184
|
+
type: "button",
|
|
185
|
+
className: "insp-action",
|
|
186
|
+
onClick: onRevalidate,
|
|
187
|
+
children: "Revalidate"
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ jsxs("dl", {
|
|
191
|
+
className: "insp-kv",
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ jsx("dt", { children: "key" }),
|
|
194
|
+
/* @__PURE__ */ jsx("dd", { children: entry.key }),
|
|
195
|
+
/* @__PURE__ */ jsx("dt", { children: "state" }),
|
|
196
|
+
/* @__PURE__ */ jsx("dd", { children: phase(state) }),
|
|
197
|
+
/* @__PURE__ */ jsx("dt", { children: "updated" }),
|
|
198
|
+
/* @__PURE__ */ jsx("dd", { children: ago(stamp.updatedAt, now) }),
|
|
199
|
+
error !== void 0 && error !== null && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: "error" }), /* @__PURE__ */ jsx("dd", {
|
|
200
|
+
className: "insp-error",
|
|
201
|
+
children: oneLine(error instanceof Error ? error.message : error, 200)
|
|
202
|
+
})] })
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
state.data !== void 0 && /* @__PURE__ */ jsxs("details", {
|
|
206
|
+
className: "insp-section",
|
|
207
|
+
open: true,
|
|
208
|
+
children: [/* @__PURE__ */ jsx("summary", { children: "Data" }), /* @__PURE__ */ jsx("pre", {
|
|
209
|
+
className: "insp-body",
|
|
210
|
+
"data-section": "data",
|
|
211
|
+
children: prettyPreview(preview(state.data))
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
export { inspectSwr };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { i as requestBuffer, n as RequestPayload, r as RequestTransport, t as InspectRequest } from "../requests-CJrUf465.js";
|
|
2
|
+
import { t as InspectAdapter } from "../adapter-BYoxPYTI.js";
|
|
3
|
+
import { a as replay, c as isSensitiveKey, d as redactUrl, i as InspectFilter, l as redactBody, n as InspectOptions, o as replayBlocker, r as inspect, s as REDACTED, t as INSPECT_CAPABILITY, u as redactHeaders } from "../index-CwfX-W87.js";
|
|
4
|
+
export { INSPECT_CAPABILITY, type InspectAdapter, type InspectFilter, InspectOptions, type InspectRequest, REDACTED, type RequestPayload, type RequestTransport, inspect, isSensitiveKey, redactBody, redactHeaders, redactUrl, replay, replayBlocker, requestBuffer };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { d as REDACTED, f as isSensitiveKey, h as redactUrl, l as requestBuffer, m as redactHeaders, p as redactBody } from "../requests-BwD6MKEq.js";
|
|
2
|
+
import { i as replayBlocker, n as inspect, r as replay, t as INSPECT_CAPABILITY } from "../inspect-C9Ft8fqn.js";
|
|
3
|
+
export { INSPECT_CAPABILITY, REDACTED, inspect, isSensitiveKey, redactBody, redactHeaders, redactUrl, replay, replayBlocker, requestBuffer };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as CaptureOptions, n as RequestPayload, r as RequestTransport, t as InspectRequest } from "../requests-CJrUf465.js";
|
|
2
|
+
import { n as CaptureKind, t as CaptureEntry } from "../capture-buffer-Bbbo6omF.js";
|
|
3
|
+
import { n as observe, r as HudUserInfo, t as ObserveOptions } from "../index-BAV_1W8a.js";
|
|
4
|
+
export { type CaptureEntry, type CaptureKind, type CaptureOptions, type HudUserInfo, type InspectRequest, ObserveOptions, type RequestPayload, type RequestTransport, observe };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { d as HudRoutes } from "../../plugins-BZvDqGx5.js";
|
|
2
|
+
import { a as CiSnapshot, c as TelemetryRange, i as CiRun, l as TelemetryResponse, n as CiProvider, o as CiState, r as CiResponse, s as TelemetryProvider, t as CiDeployment, u as TelemetrySnapshot } from "../../types-f3jlNxzw.js";
|
|
3
|
+
//#region src/plugins/ops/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A provider failure whose message is safe to send to the client (it names
|
|
6
|
+
* the upstream and its status, never a URL with credentials or a token).
|
|
7
|
+
* The routes answer 502 with it; any other error becomes a generic 502.
|
|
8
|
+
*/
|
|
9
|
+
export declare class OpsProviderError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/plugins/ops/github-actions.d.ts
|
|
14
|
+
interface GithubActionsOptions {
|
|
15
|
+
/** `owner/name`. */
|
|
16
|
+
repo: string;
|
|
17
|
+
/**
|
|
18
|
+
* Branch whose runs the pill shows. Default: the first of `HUD_GIT_BRANCH`,
|
|
19
|
+
* `VERCEL_GIT_COMMIT_REF`, `GITHUB_HEAD_REF`, `GITHUB_REF_NAME`, then the
|
|
20
|
+
* branch checked out where the server runs (`.git/HEAD`). With no branch
|
|
21
|
+
* the panel lists the repo's latest runs and the pill shows no state.
|
|
22
|
+
*/
|
|
23
|
+
branch?: string | (() => string | null | Promise<string | null>);
|
|
24
|
+
/** Env var holding the token, read on each request. Default `GITHUB_TOKEN`. */
|
|
25
|
+
tokenEnv?: string;
|
|
26
|
+
/** Runs listed in the panel. Default 10. */
|
|
27
|
+
limit?: number;
|
|
28
|
+
/** Seconds a GitHub answer is reused, to stay inside the rate limit. Default 15. */
|
|
29
|
+
cacheSeconds?: number;
|
|
30
|
+
/** API root, for GitHub Enterprise Server. Default `https://api.github.com`. */
|
|
31
|
+
apiUrl?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* GitHub Actions as the `ops` plugin's CI provider. Server only: the token is
|
|
35
|
+
* read from env on each request and only ever sent to GitHub.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* ops({ ci: githubActions({ repo: "hansenexus/hud" }) })
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function githubActions(options: GithubActionsOptions): CiProvider;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/plugins/ops/signoz.d.ts
|
|
44
|
+
interface SignozOptions {
|
|
45
|
+
/** OpenTelemetry `service.name` of the app. */
|
|
46
|
+
service: string;
|
|
47
|
+
/** Env var holding the SigNoz query URL, read on each request. Default `SIGNOZ_QUERY_URL`. */
|
|
48
|
+
urlEnv?: string;
|
|
49
|
+
/** Env var holding an API key, sent as `SIGNOZ-API-KEY` when set. Default `SIGNOZ_API_KEY`. */
|
|
50
|
+
apiKeyEnv?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* SigNoz as the `ops` plugin's telemetry provider: error rate, p95 latency and
|
|
54
|
+
* request rate of one service over its PromQL `query_range` API. Server only:
|
|
55
|
+
* the URL and API key come from env on each request.
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* ops({ telemetry: signoz({ service: "hansenexus" }) })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function signoz(options: SignozOptions): TelemetryProvider;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/plugins/ops/server.d.ts
|
|
64
|
+
export interface OpsServerOptions {
|
|
65
|
+
/** CI provider behind `GET /ops/ci`, such as `githubActions({ repo })`. */
|
|
66
|
+
ci?: CiProvider;
|
|
67
|
+
/** Telemetry provider behind `GET /ops/telemetry`, such as `signoz({ service })`. */
|
|
68
|
+
telemetry?: TelemetryProvider;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Server half of the `ops` plugin. Pass it to `createHudHandler`; each
|
|
72
|
+
* provider adds its route, so an app without telemetry serves no
|
|
73
|
+
* `/telemetry`. Tokens and keys stay in the providers: responses carry
|
|
74
|
+
* run data, numbers and the name of a missing env var, never a secret.
|
|
75
|
+
*/
|
|
76
|
+
export declare function ops({ ci, telemetry }?: OpsServerOptions): {
|
|
77
|
+
readonly id: "ops";
|
|
78
|
+
readonly capability: "cicd.read";
|
|
79
|
+
readonly routes: HudRoutes;
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export type { CiDeployment, CiProvider, CiResponse, CiRun, CiSnapshot, CiState, GithubActionsOptions, SignozOptions, TelemetryProvider, TelemetryRange, TelemetryResponse, TelemetrySnapshot };
|