@tgoliveira/outpost 1.1.0 → 1.2.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.
Files changed (166) hide show
  1. package/dist/adapters/drizzle/index.cjs +57 -0
  2. package/dist/adapters/drizzle/index.cjs.map +1 -1
  3. package/dist/adapters/drizzle/index.d.cts +165 -3
  4. package/dist/adapters/drizzle/index.d.ts +165 -3
  5. package/dist/adapters/drizzle/index.js +57 -2
  6. package/dist/adapters/drizzle/index.js.map +1 -1
  7. package/dist/admin/index.cjs +585 -0
  8. package/dist/admin/index.cjs.map +1 -0
  9. package/dist/admin/index.d.cts +116 -0
  10. package/dist/admin/index.d.ts +116 -0
  11. package/dist/admin/index.js +582 -0
  12. package/dist/admin/index.js.map +1 -0
  13. package/dist/config-override-repository-BHIGX3DJ.d.cts +14 -0
  14. package/dist/config-override-repository-BHIGX3DJ.d.ts +14 -0
  15. package/dist/http/index.d.cts +3 -3
  16. package/dist/http/index.d.ts +3 -3
  17. package/dist/{index-Dmt-aLH2.d.cts → index-BO0GiZmP.d.cts} +1 -1
  18. package/dist/{index-CVUvaJms.d.ts → index-c6caPsUG.d.ts} +1 -1
  19. package/dist/index.d.cts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/modules/ui/index.cjs +775 -0
  22. package/dist/modules/ui/index.cjs.map +1 -0
  23. package/dist/modules/ui/index.d.cts +17 -0
  24. package/dist/modules/ui/index.d.ts +17 -0
  25. package/dist/modules/ui/index.js +718 -0
  26. package/dist/modules/ui/index.js.map +1 -0
  27. package/dist/modules/ui/layouts/page-shell.cjs +58 -0
  28. package/dist/modules/ui/layouts/page-shell.cjs.map +1 -0
  29. package/dist/modules/ui/layouts/page-shell.d.cts +13 -0
  30. package/dist/modules/ui/layouts/page-shell.d.ts +13 -0
  31. package/dist/modules/ui/layouts/page-shell.js +32 -0
  32. package/dist/modules/ui/layouts/page-shell.js.map +1 -0
  33. package/dist/modules/ui/lib/cn.cjs +33 -0
  34. package/dist/modules/ui/lib/cn.cjs.map +1 -0
  35. package/dist/modules/ui/lib/cn.d.cts +3 -0
  36. package/dist/modules/ui/lib/cn.d.ts +3 -0
  37. package/dist/modules/ui/lib/cn.js +8 -0
  38. package/dist/modules/ui/lib/cn.js.map +1 -0
  39. package/dist/modules/ui/lib/main-content.cjs +31 -0
  40. package/dist/modules/ui/lib/main-content.cjs.map +1 -0
  41. package/dist/modules/ui/lib/main-content.d.cts +3 -0
  42. package/dist/modules/ui/lib/main-content.d.ts +3 -0
  43. package/dist/modules/ui/lib/main-content.js +6 -0
  44. package/dist/modules/ui/lib/main-content.js.map +1 -0
  45. package/dist/modules/ui/outpost-ui-provider.cjs +52 -0
  46. package/dist/modules/ui/outpost-ui-provider.cjs.map +1 -0
  47. package/dist/modules/ui/outpost-ui-provider.d.cts +15 -0
  48. package/dist/modules/ui/outpost-ui-provider.d.ts +15 -0
  49. package/dist/modules/ui/outpost-ui-provider.js +27 -0
  50. package/dist/modules/ui/outpost-ui-provider.js.map +1 -0
  51. package/dist/modules/ui/pages/admin/admin-config-page.cjs +429 -0
  52. package/dist/modules/ui/pages/admin/admin-config-page.cjs.map +1 -0
  53. package/dist/modules/ui/pages/admin/admin-config-page.d.cts +8 -0
  54. package/dist/modules/ui/pages/admin/admin-config-page.d.ts +8 -0
  55. package/dist/modules/ui/pages/admin/admin-config-page.js +395 -0
  56. package/dist/modules/ui/pages/admin/admin-config-page.js.map +1 -0
  57. package/dist/modules/ui/pages/admin/admin-observability-page.cjs +344 -0
  58. package/dist/modules/ui/pages/admin/admin-observability-page.cjs.map +1 -0
  59. package/dist/modules/ui/pages/admin/admin-observability-page.d.cts +8 -0
  60. package/dist/modules/ui/pages/admin/admin-observability-page.d.ts +8 -0
  61. package/dist/modules/ui/pages/admin/admin-observability-page.js +310 -0
  62. package/dist/modules/ui/pages/admin/admin-observability-page.js.map +1 -0
  63. package/dist/modules/ui/pages/admin/admin-panel-page.cjs +160 -0
  64. package/dist/modules/ui/pages/admin/admin-panel-page.cjs.map +1 -0
  65. package/dist/modules/ui/pages/admin/admin-panel-page.d.cts +9 -0
  66. package/dist/modules/ui/pages/admin/admin-panel-page.d.ts +9 -0
  67. package/dist/modules/ui/pages/admin/admin-panel-page.js +126 -0
  68. package/dist/modules/ui/pages/admin/admin-panel-page.js.map +1 -0
  69. package/dist/modules/ui/pages/admin/admin-queue-page.cjs +398 -0
  70. package/dist/modules/ui/pages/admin/admin-queue-page.cjs.map +1 -0
  71. package/dist/modules/ui/pages/admin/admin-queue-page.d.cts +8 -0
  72. package/dist/modules/ui/pages/admin/admin-queue-page.d.ts +8 -0
  73. package/dist/modules/ui/pages/admin/admin-queue-page.js +364 -0
  74. package/dist/modules/ui/pages/admin/admin-queue-page.js.map +1 -0
  75. package/dist/modules/ui/pages/index.cjs +742 -0
  76. package/dist/modules/ui/pages/index.cjs.map +1 -0
  77. package/dist/modules/ui/pages/index.d.cts +6 -0
  78. package/dist/modules/ui/pages/index.d.ts +6 -0
  79. package/dist/modules/ui/pages/index.js +702 -0
  80. package/dist/modules/ui/pages/index.js.map +1 -0
  81. package/dist/modules/ui/pages/types.cjs +38 -0
  82. package/dist/modules/ui/pages/types.cjs.map +1 -0
  83. package/dist/modules/ui/pages/types.d.cts +9 -0
  84. package/dist/modules/ui/pages/types.d.ts +9 -0
  85. package/dist/modules/ui/pages/types.js +12 -0
  86. package/dist/modules/ui/pages/types.js.map +1 -0
  87. package/dist/modules/ui/pages/use-page-ui.cjs +55 -0
  88. package/dist/modules/ui/pages/use-page-ui.cjs.map +1 -0
  89. package/dist/modules/ui/pages/use-page-ui.d.cts +6 -0
  90. package/dist/modules/ui/pages/use-page-ui.d.ts +6 -0
  91. package/dist/modules/ui/pages/use-page-ui.js +29 -0
  92. package/dist/modules/ui/pages/use-page-ui.js.map +1 -0
  93. package/dist/modules/ui/primitives/alert.cjs +63 -0
  94. package/dist/modules/ui/primitives/alert.cjs.map +1 -0
  95. package/dist/modules/ui/primitives/alert.d.cts +10 -0
  96. package/dist/modules/ui/primitives/alert.d.ts +10 -0
  97. package/dist/modules/ui/primitives/alert.js +36 -0
  98. package/dist/modules/ui/primitives/alert.js.map +1 -0
  99. package/dist/modules/ui/primitives/badge.cjs +60 -0
  100. package/dist/modules/ui/primitives/badge.cjs.map +1 -0
  101. package/dist/modules/ui/primitives/badge.d.cts +9 -0
  102. package/dist/modules/ui/primitives/badge.d.ts +9 -0
  103. package/dist/modules/ui/primitives/badge.js +33 -0
  104. package/dist/modules/ui/primitives/badge.js.map +1 -0
  105. package/dist/modules/ui/primitives/button.cjs +61 -0
  106. package/dist/modules/ui/primitives/button.cjs.map +1 -0
  107. package/dist/modules/ui/primitives/button.d.cts +9 -0
  108. package/dist/modules/ui/primitives/button.d.ts +9 -0
  109. package/dist/modules/ui/primitives/button.js +37 -0
  110. package/dist/modules/ui/primitives/button.js.map +1 -0
  111. package/dist/modules/ui/primitives/card.cjs +71 -0
  112. package/dist/modules/ui/primitives/card.cjs.map +1 -0
  113. package/dist/modules/ui/primitives/card.d.cts +11 -0
  114. package/dist/modules/ui/primitives/card.d.ts +11 -0
  115. package/dist/modules/ui/primitives/card.js +41 -0
  116. package/dist/modules/ui/primitives/card.js.map +1 -0
  117. package/dist/modules/ui/primitives/empty-state.cjs +37 -0
  118. package/dist/modules/ui/primitives/empty-state.cjs.map +1 -0
  119. package/dist/modules/ui/primitives/empty-state.d.cts +9 -0
  120. package/dist/modules/ui/primitives/empty-state.d.ts +9 -0
  121. package/dist/modules/ui/primitives/empty-state.js +12 -0
  122. package/dist/modules/ui/primitives/empty-state.js.map +1 -0
  123. package/dist/modules/ui/primitives/input.cjs +55 -0
  124. package/dist/modules/ui/primitives/input.cjs.map +1 -0
  125. package/dist/modules/ui/primitives/input.d.cts +6 -0
  126. package/dist/modules/ui/primitives/input.d.ts +6 -0
  127. package/dist/modules/ui/primitives/input.js +30 -0
  128. package/dist/modules/ui/primitives/input.js.map +1 -0
  129. package/dist/modules/ui/primitives/loading-state.cjs +55 -0
  130. package/dist/modules/ui/primitives/loading-state.cjs.map +1 -0
  131. package/dist/modules/ui/primitives/loading-state.d.cts +8 -0
  132. package/dist/modules/ui/primitives/loading-state.d.ts +8 -0
  133. package/dist/modules/ui/primitives/loading-state.js +30 -0
  134. package/dist/modules/ui/primitives/loading-state.js.map +1 -0
  135. package/dist/modules/ui/primitives/page-header.cjs +40 -0
  136. package/dist/modules/ui/primitives/page-header.cjs.map +1 -0
  137. package/dist/modules/ui/primitives/page-header.d.cts +10 -0
  138. package/dist/modules/ui/primitives/page-header.d.ts +10 -0
  139. package/dist/modules/ui/primitives/page-header.js +15 -0
  140. package/dist/modules/ui/primitives/page-header.js.map +1 -0
  141. package/dist/{outpost-client-ymTJISpu.d.ts → outpost-client-BItbgqIo.d.ts} +2 -2
  142. package/dist/{outpost-client-yUijE00q.d.cts → outpost-client-BlVf4gjo.d.cts} +2 -2
  143. package/dist/react/client.cjs +14 -0
  144. package/dist/react/client.cjs.map +1 -0
  145. package/dist/react/client.d.cts +5 -0
  146. package/dist/react/client.d.ts +5 -0
  147. package/dist/react/client.js +11 -0
  148. package/dist/react/client.js.map +1 -0
  149. package/dist/react/index.cjs +776 -0
  150. package/dist/react/index.cjs.map +1 -0
  151. package/dist/react/index.d.cts +17 -0
  152. package/dist/react/index.d.ts +17 -0
  153. package/dist/react/index.js +720 -0
  154. package/dist/react/index.js.map +1 -0
  155. package/dist/{repositories-DhUe8f2R.d.cts → repositories-CHIOFGn3.d.cts} +2 -0
  156. package/dist/{repositories-Bck6wJNS.d.ts → repositories-WyhvxzyY.d.ts} +2 -0
  157. package/dist/testing/index.cjs +41 -0
  158. package/dist/testing/index.cjs.map +1 -1
  159. package/dist/testing/index.d.cts +13 -3
  160. package/dist/testing/index.d.ts +13 -3
  161. package/dist/testing/index.js +41 -1
  162. package/dist/testing/index.js.map +1 -1
  163. package/dist/workers/index.d.cts +2 -2
  164. package/dist/workers/index.d.ts +2 -2
  165. package/package.json +45 -3
  166. package/styles.css +4 -0
@@ -0,0 +1,776 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/react/index.ts
32
+ var react_exports = {};
33
+ __export(react_exports, {
34
+ AdminConfigPage: () => AdminConfigPage,
35
+ AdminObservabilityPage: () => AdminObservabilityPage,
36
+ AdminPanelPage: () => AdminPanelPage,
37
+ AdminQueuePage: () => AdminQueuePage,
38
+ Alert: () => Alert,
39
+ Badge: () => Badge,
40
+ Button: () => Button,
41
+ Card: () => Card,
42
+ CardDescription: () => CardDescription,
43
+ CardHeader: () => CardHeader,
44
+ CardTitle: () => CardTitle,
45
+ DEFAULT_OUTPOST_PATHS: () => DEFAULT_OUTPOST_PATHS,
46
+ EmptyState: () => EmptyState,
47
+ Input: () => Input,
48
+ LoadingState: () => LoadingState,
49
+ OutpostUIProvider: () => OutpostUIProvider,
50
+ PageHeader: () => PageHeader,
51
+ PageShell: () => PageShell,
52
+ resolveOutpostPaths: () => resolveOutpostPaths,
53
+ useOutpostUi: () => useOutpostUi,
54
+ useUiPaths: () => useUiPaths
55
+ });
56
+ module.exports = __toCommonJS(react_exports);
57
+
58
+ // src/modules/ui/outpost-ui-provider.tsx
59
+ var import_react = require("react");
60
+
61
+ // src/modules/ui/pages/types.ts
62
+ var DEFAULT_OUTPOST_PATHS = {
63
+ adminPanel: "/admin"
64
+ };
65
+ function resolveOutpostPaths(overrides) {
66
+ return { ...DEFAULT_OUTPOST_PATHS, ...overrides };
67
+ }
68
+
69
+ // src/modules/ui/outpost-ui-provider.tsx
70
+ var import_jsx_runtime = require("react/jsx-runtime");
71
+ var OutpostUiContext = (0, import_react.createContext)(null);
72
+ function OutpostUIProvider({ children, paths }) {
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OutpostUiContext.Provider, { value: { paths: resolveOutpostPaths(paths) }, children });
74
+ }
75
+ function useOutpostUi() {
76
+ return (0, import_react.useContext)(OutpostUiContext);
77
+ }
78
+
79
+ // src/modules/ui/lib/cn.ts
80
+ function cn(...classes) {
81
+ return classes.filter(Boolean).join(" ");
82
+ }
83
+
84
+ // src/modules/ui/lib/main-content.ts
85
+ var MAIN_CONTENT_ID = "outpost-main-content";
86
+
87
+ // src/modules/ui/layouts/page-shell.tsx
88
+ var import_jsx_runtime2 = require("react/jsx-runtime");
89
+ var widthClass = {
90
+ narrow: "max-w-md",
91
+ medium: "max-w-xl",
92
+ wide: "max-w-6xl"
93
+ };
94
+ function PageShell({ children, width = "wide", className }) {
95
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
96
+ "main",
97
+ {
98
+ id: MAIN_CONTENT_ID,
99
+ tabIndex: -1,
100
+ className: cn("mx-auto px-4 py-8 md:py-10", widthClass[width], className),
101
+ children
102
+ }
103
+ );
104
+ }
105
+
106
+ // src/modules/ui/primitives/button.tsx
107
+ var import_react2 = require("react");
108
+ var import_jsx_runtime3 = require("react/jsx-runtime");
109
+ var Button = (0, import_react2.forwardRef)(function Button2({ variant = "primary", className, children, ...props }, ref) {
110
+ const variants = {
111
+ primary: "bg-[var(--primary)] text-white hover:bg-[var(--primary-hover)]",
112
+ secondary: "border border-[var(--border)] bg-[var(--card)] text-[var(--foreground)] hover:bg-[var(--card-muted)]",
113
+ danger: "bg-[var(--danger)] text-white hover:bg-red-800"
114
+ };
115
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
116
+ "button",
117
+ {
118
+ ref,
119
+ className: cn(
120
+ "min-h-11 rounded-[var(--radius)] px-4 py-2.5 text-sm font-medium transition-colors",
121
+ "disabled:cursor-not-allowed disabled:opacity-50",
122
+ variants[variant],
123
+ className
124
+ ),
125
+ ...props,
126
+ children
127
+ }
128
+ );
129
+ });
130
+
131
+ // src/modules/ui/primitives/alert.tsx
132
+ var import_jsx_runtime4 = require("react/jsx-runtime");
133
+ var variantStyles = {
134
+ info: "border-[var(--info-muted)] bg-[var(--info-muted)] text-[var(--info)]",
135
+ success: "border-[var(--success-muted)] bg-[var(--success-muted)] text-[var(--success)]",
136
+ warning: "border-[var(--warning-muted)] bg-[var(--warning-muted)] text-[var(--warning)]",
137
+ danger: "border-[var(--danger-muted)] bg-[var(--danger-muted)] text-[var(--danger)]",
138
+ muted: "border-[var(--border)] bg-[var(--card-muted)] text-[var(--muted)]"
139
+ };
140
+ function Alert({ variant = "muted", title, className, children, ...props }) {
141
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
142
+ "div",
143
+ {
144
+ role: "status",
145
+ className: cn(
146
+ "rounded-[var(--radius)] border px-4 py-3 text-sm leading-relaxed",
147
+ variantStyles[variant],
148
+ className
149
+ ),
150
+ ...props,
151
+ children: [
152
+ title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mb-1 font-medium", children: title }),
153
+ children
154
+ ]
155
+ }
156
+ );
157
+ }
158
+
159
+ // src/modules/ui/primitives/badge.tsx
160
+ var import_jsx_runtime5 = require("react/jsx-runtime");
161
+ var styles = {
162
+ default: "bg-[var(--accent-muted)] text-[var(--foreground)]",
163
+ success: "bg-[var(--success-muted)] text-[var(--success)]",
164
+ info: "bg-[var(--info-muted)] text-[var(--info)]",
165
+ danger: "bg-[var(--danger-muted)] text-[var(--danger)]",
166
+ muted: "bg-[var(--card-muted)] text-[var(--muted)]",
167
+ warning: "bg-[var(--warning-muted)] text-[var(--warning)]"
168
+ };
169
+ function Badge({ variant = "default", className, children, ...props }) {
170
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
171
+ "span",
172
+ {
173
+ className: cn(
174
+ "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",
175
+ styles[variant],
176
+ className
177
+ ),
178
+ ...props,
179
+ children
180
+ }
181
+ );
182
+ }
183
+
184
+ // src/modules/ui/primitives/card.tsx
185
+ var import_jsx_runtime6 = require("react/jsx-runtime");
186
+ function Card({ className, muted, children, ...props }) {
187
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
188
+ "div",
189
+ {
190
+ className: cn(
191
+ "rounded-[var(--radius)] border border-[var(--border)] p-5 shadow-[var(--shadow-sm)]",
192
+ muted ? "bg-[var(--card-muted)]" : "bg-[var(--card)]",
193
+ className
194
+ ),
195
+ ...props,
196
+ children
197
+ }
198
+ );
199
+ }
200
+ function CardHeader({ className, children, ...props }) {
201
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("mb-4 space-y-1", className), ...props, children });
202
+ }
203
+ function CardTitle({ className, children, ...props }) {
204
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: cn("text-lg font-medium text-[var(--foreground)]", className), ...props, children });
205
+ }
206
+ function CardDescription({
207
+ className,
208
+ children,
209
+ ...props
210
+ }) {
211
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: cn("text-sm leading-relaxed text-[var(--muted)]", className), ...props, children });
212
+ }
213
+
214
+ // src/modules/ui/primitives/page-header.tsx
215
+ var import_jsx_runtime7 = require("react/jsx-runtime");
216
+ function PageHeader({ title, description, action }) {
217
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-8 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
218
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
219
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: "text-2xl font-semibold tracking-tight text-[var(--foreground)]", children: title }),
220
+ description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "max-w-prose text-sm leading-relaxed text-[var(--muted)]", children: description })
221
+ ] }),
222
+ action && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "shrink-0", children: action })
223
+ ] });
224
+ }
225
+
226
+ // src/modules/ui/primitives/loading-state.tsx
227
+ var import_jsx_runtime8 = require("react/jsx-runtime");
228
+ function LoadingState({ label = "Loading" }) {
229
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
230
+ "div",
231
+ {
232
+ className: "flex flex-col items-center justify-center gap-3 py-16 text-center",
233
+ role: "status",
234
+ "aria-live": "polite",
235
+ "aria-busy": "true",
236
+ children: [
237
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
238
+ "div",
239
+ {
240
+ className: "h-8 w-8 animate-pulse rounded-full border-2 border-[var(--border)] border-t-[var(--primary)]",
241
+ "aria-hidden": "true"
242
+ }
243
+ ),
244
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-sm text-[var(--muted)]", children: [
245
+ label,
246
+ "\u2026"
247
+ ] })
248
+ ]
249
+ }
250
+ );
251
+ }
252
+
253
+ // src/modules/ui/primitives/empty-state.tsx
254
+ var import_jsx_runtime9 = require("react/jsx-runtime");
255
+ function EmptyState({ title, description }) {
256
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "py-8 text-center", children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--foreground)]", children: title }),
258
+ description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-1 text-sm text-[var(--muted)]", children: description })
259
+ ] });
260
+ }
261
+
262
+ // src/modules/ui/primitives/input.tsx
263
+ var import_react3 = require("react");
264
+ var import_jsx_runtime10 = require("react/jsx-runtime");
265
+ var Input = (0, import_react3.forwardRef)(
266
+ function Input2({ className, ...props }, ref) {
267
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
268
+ "input",
269
+ {
270
+ ref,
271
+ className: cn(
272
+ "w-full rounded-[var(--radius)] border border-[var(--border)] bg-[var(--card)] px-3 py-2 text-sm text-[var(--foreground)]",
273
+ "placeholder:text-[var(--muted)] focus:outline-none focus:ring-2 focus:ring-[var(--primary)]",
274
+ className
275
+ ),
276
+ ...props
277
+ }
278
+ );
279
+ }
280
+ );
281
+
282
+ // src/modules/ui/pages/admin/admin-panel-page.tsx
283
+ var import_link = __toESM(require("next/link"), 1);
284
+
285
+ // src/modules/ui/pages/use-page-ui.ts
286
+ function useUiPaths(overrides) {
287
+ const ui = useOutpostUi();
288
+ return resolveOutpostPaths({ ...ui?.paths, ...overrides });
289
+ }
290
+
291
+ // src/modules/ui/pages/admin/admin-panel-page.tsx
292
+ var import_jsx_runtime11 = require("react/jsx-runtime");
293
+ var SECTIONS = [
294
+ {
295
+ key: "adminQueue",
296
+ label: "Email Queue",
297
+ description: "Inspect queued messages and run the send worker manually.",
298
+ suffix: "/queue"
299
+ },
300
+ {
301
+ key: "adminConfig",
302
+ label: "Configuration",
303
+ description: "View and override vault/env settings. Admin overrides win over env.local.",
304
+ suffix: "/config"
305
+ },
306
+ {
307
+ key: "adminObservability",
308
+ label: "Observability",
309
+ description: "Queue depth, worker activity, and OpenTelemetry metric catalog.",
310
+ suffix: "/observability"
311
+ }
312
+ ];
313
+ function AdminPanelPage({ paths }) {
314
+ const resolved = useUiPaths(paths);
315
+ const base = resolved.adminPanel;
316
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(PageShell, { width: "wide", children: [
317
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-8", children: [
318
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "text-2xl font-semibold text-[var(--foreground)]", children: "Outpost Admin" }),
319
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-1 text-sm text-[var(--muted)]", children: "Operate the transactional email outbox \u2014 queue, configuration, and observability." })
320
+ ] }),
321
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: SECTIONS.map((section) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_link.default, { href: `${base}${section.suffix}`, className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Card, { className: "h-full cursor-pointer transition-shadow hover:shadow-md", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CardHeader, { children: [
322
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardTitle, { className: "text-base", children: section.label }),
323
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardDescription, { className: "text-sm", children: section.description })
324
+ ] }) }) }, section.key)) })
325
+ ] });
326
+ }
327
+
328
+ // src/modules/ui/pages/admin/admin-queue-page.tsx
329
+ var import_react4 = require("react");
330
+ var import_link2 = __toESM(require("next/link"), 1);
331
+ var import_jsx_runtime12 = require("react/jsx-runtime");
332
+ function stateBadge(state) {
333
+ if (state === "queued") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "info", children: "queued" });
334
+ if (state === "sending") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "warning", children: "sending" });
335
+ if (state === "failed") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "danger", children: "failed" });
336
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "muted", children: state });
337
+ }
338
+ function formatDate(d) {
339
+ if (!d) return "\u2014";
340
+ return new Date(d).toLocaleString();
341
+ }
342
+ function MessageTable({
343
+ title,
344
+ description,
345
+ rows
346
+ }) {
347
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { className: "overflow-hidden", children: [
348
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardHeader, { children: [
349
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardTitle, { children: title }),
350
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardDescription, { children: description })
351
+ ] }),
352
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EmptyState, { title: "No messages", description: "Nothing in this bucket right now." }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: "w-full text-sm", children: [
353
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { children: [
354
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "State" }),
355
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Subject" }),
356
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Provider" }),
357
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Attempts" }),
358
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Next attempt" }),
359
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Created" })
360
+ ] }) }),
361
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
362
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: stateBadge(row.state) }),
363
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("td", { className: "px-4 py-3", children: [
364
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-medium", children: row.subject }),
365
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-mono text-xs text-[var(--muted)]", children: row.id })
366
+ ] }),
367
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: row.provider }),
368
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: row.attempts }),
369
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: formatDate(row.nextAttemptAt) }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: formatDate(row.createdAt) })
371
+ ] }, row.id)) })
372
+ ] }) })
373
+ ] });
374
+ }
375
+ function AdminQueuePage({ apiBase = "/api/outpost" }) {
376
+ const resolved = useUiPaths();
377
+ const [data, setData] = (0, import_react4.useState)(null);
378
+ const [isLoading, setIsLoading] = (0, import_react4.useState)(true);
379
+ const [isRunningWorker, setIsRunningWorker] = (0, import_react4.useState)(false);
380
+ const [error, setError] = (0, import_react4.useState)("");
381
+ const [workerResult, setWorkerResult] = (0, import_react4.useState)("");
382
+ const load = (0, import_react4.useCallback)(async () => {
383
+ setIsLoading(true);
384
+ setError("");
385
+ try {
386
+ const res = await fetch(`${apiBase}/admin/queue`);
387
+ if (!res.ok) throw new Error("Failed to load");
388
+ setData(await res.json());
389
+ } catch {
390
+ setError("Failed to load the email queue. Please try again.");
391
+ } finally {
392
+ setIsLoading(false);
393
+ }
394
+ }, [apiBase]);
395
+ (0, import_react4.useEffect)(() => {
396
+ void load();
397
+ }, [load]);
398
+ async function runWorker() {
399
+ setIsRunningWorker(true);
400
+ setError("");
401
+ setWorkerResult("");
402
+ try {
403
+ const res = await fetch(`${apiBase}/admin/worker/send`, { method: "POST" });
404
+ if (!res.ok) throw new Error("Worker run failed");
405
+ const report = await res.json();
406
+ setWorkerResult(
407
+ `Worker finished: claimed ${report.claimed ?? 0} message(s).`
408
+ );
409
+ await load();
410
+ } catch {
411
+ setError("Failed to run the send worker. Please try again.");
412
+ } finally {
413
+ setIsRunningWorker(false);
414
+ }
415
+ }
416
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(PageShell, { width: "wide", children: [
417
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
418
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_link2.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
419
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mx-2", children: "/" }),
420
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[var(--foreground)]", children: "Email Queue" })
421
+ ] }),
422
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
423
+ PageHeader,
424
+ {
425
+ title: "Email Queue",
426
+ description: "Messages waiting to be sent. Run the send worker to process the next batch.",
427
+ action: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-2", children: [
428
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: isLoading ? "Loading\u2026" : "Refresh" }),
429
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "primary", onClick: runWorker, disabled: isRunningWorker, children: isRunningWorker ? "Running\u2026" : "Run send worker" })
430
+ ] })
431
+ }
432
+ ),
433
+ error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
434
+ workerResult && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "success", className: "mb-4", children: workerResult }),
435
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingState, { label: "Loading queue" }) : data ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-6", children: [
436
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid gap-3 sm:grid-cols-3", children: [
437
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
438
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Queued" }),
439
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.queued ?? 0 })
440
+ ] }),
441
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
442
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Sending" }),
443
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.sending ?? 0 })
444
+ ] }),
445
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
446
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Failed (DLQ)" }),
447
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.failed ?? 0 })
448
+ ] })
449
+ ] }),
450
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
451
+ MessageTable,
452
+ {
453
+ title: "Queued",
454
+ description: "Persisted and waiting for the send worker.",
455
+ rows: data.queued
456
+ }
457
+ ),
458
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
459
+ MessageTable,
460
+ {
461
+ title: "Sending",
462
+ description: "Claimed by a worker; will be reclaimed if the lease expires.",
463
+ rows: data.sending
464
+ }
465
+ ),
466
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
467
+ MessageTable,
468
+ {
469
+ title: "Failed",
470
+ description: "Dead-lettered after retries exhausted.",
471
+ rows: data.failed
472
+ }
473
+ )
474
+ ] }) : null
475
+ ] });
476
+ }
477
+
478
+ // src/modules/ui/pages/admin/admin-config-page.tsx
479
+ var import_react5 = require("react");
480
+ var import_link3 = __toESM(require("next/link"), 1);
481
+ var import_jsx_runtime13 = require("react/jsx-runtime");
482
+ function sourceBadge(source) {
483
+ if (source === "admin") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "info", children: "admin" });
484
+ if (source === "env") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "default", children: "env" });
485
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "muted", children: "default" });
486
+ }
487
+ function valueDisplay(value, secret) {
488
+ if (value === void 0 || value === null) return "\u2014";
489
+ if (secret && typeof value === "string") return value;
490
+ return String(value);
491
+ }
492
+ function AdminConfigPage({ apiBase = "/api/outpost" }) {
493
+ const resolved = useUiPaths();
494
+ const [configKeys, setConfigKeys] = (0, import_react5.useState)([]);
495
+ const [isLoading, setIsLoading] = (0, import_react5.useState)(true);
496
+ const [error, setError] = (0, import_react5.useState)("");
497
+ const [editingKey, setEditingKey] = (0, import_react5.useState)(null);
498
+ const [editValue, setEditValue] = (0, import_react5.useState)("");
499
+ const [saving, setSaving] = (0, import_react5.useState)(false);
500
+ const load = (0, import_react5.useCallback)(async () => {
501
+ setIsLoading(true);
502
+ setError("");
503
+ try {
504
+ const res = await fetch(`${apiBase}/admin/config`);
505
+ if (!res.ok) throw new Error("Failed to load");
506
+ const data = await res.json();
507
+ setConfigKeys(data.keys ?? []);
508
+ } catch {
509
+ setError("Failed to load configuration.");
510
+ } finally {
511
+ setIsLoading(false);
512
+ }
513
+ }, [apiBase]);
514
+ (0, import_react5.useEffect)(() => {
515
+ void load();
516
+ }, [load]);
517
+ function startEdit(ck) {
518
+ setEditingKey(ck.key);
519
+ setEditValue(ck.secret ? "" : valueDisplay(ck.value));
520
+ }
521
+ function parseEditValue(raw) {
522
+ if (raw === "true") return true;
523
+ if (raw === "false") return false;
524
+ const n = Number(raw);
525
+ if (!Number.isNaN(n) && raw.trim() !== "") return n;
526
+ return raw;
527
+ }
528
+ async function saveEdit(key) {
529
+ setSaving(true);
530
+ setError("");
531
+ try {
532
+ const res = await fetch(`${apiBase}/admin/config`, {
533
+ method: "POST",
534
+ headers: { "Content-Type": "application/json" },
535
+ body: JSON.stringify({ key, value: parseEditValue(editValue) })
536
+ });
537
+ if (!res.ok) {
538
+ const data = await res.json().catch(() => ({}));
539
+ throw new Error(data.error ?? "Save failed");
540
+ }
541
+ setEditingKey(null);
542
+ await load();
543
+ } catch (e) {
544
+ setError(e instanceof Error ? e.message : "Failed to save.");
545
+ } finally {
546
+ setSaving(false);
547
+ }
548
+ }
549
+ async function resetOverride(key) {
550
+ setSaving(true);
551
+ try {
552
+ await fetch(`${apiBase}/admin/config`, {
553
+ method: "DELETE",
554
+ headers: { "Content-Type": "application/json" },
555
+ body: JSON.stringify({ key })
556
+ });
557
+ await load();
558
+ } catch {
559
+ setError("Failed to reset override.");
560
+ } finally {
561
+ setSaving(false);
562
+ }
563
+ }
564
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(PageShell, { width: "wide", children: [
565
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
566
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_link3.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "mx-2", children: "/" }),
568
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[var(--foreground)]", children: "Configuration" })
569
+ ] }),
570
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
571
+ PageHeader,
572
+ {
573
+ title: "Configuration",
574
+ description: "Priority: admin override \u2192 env.local \u2192 package default. Secrets are masked in the UI.",
575
+ action: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: "Refresh" })
576
+ }
577
+ ),
578
+ error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
579
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingState, { label: "Loading config" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Card, { className: "overflow-hidden", children: [
580
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(CardHeader, { children: [
581
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardTitle, { children: "Vault & environment settings" }),
582
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardDescription, { children: "Keys mirror `.env.example` and `createOutpost` options. Admin overrides persist in the database." })
583
+ ] }),
584
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "w-full text-sm", children: [
585
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
586
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Key" }),
587
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Source" }),
588
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Value" }),
589
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2" })
590
+ ] }) }),
591
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: configKeys.map((ck) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
592
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3 font-mono text-xs", children: ck.key }),
593
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3", children: sourceBadge(ck.source) }),
594
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3", children: editingKey === ck.key ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
595
+ Input,
596
+ {
597
+ className: "h-7 text-xs",
598
+ type: ck.secret ? "password" : "text",
599
+ placeholder: ck.secret ? "Enter new value" : void 0,
600
+ value: editValue,
601
+ onChange: (e) => setEditValue(e.target.value),
602
+ onKeyDown: (e) => {
603
+ if (e.key === "Enter") void saveEdit(ck.key);
604
+ if (e.key === "Escape") setEditingKey(null);
605
+ },
606
+ autoFocus: true
607
+ }
608
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-mono text-xs", children: valueDisplay(ck.value, ck.secret) }) }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-end gap-2", children: editingKey === ck.key ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
610
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
611
+ Button,
612
+ {
613
+ variant: "primary",
614
+ className: "text-xs",
615
+ disabled: saving,
616
+ onClick: () => saveEdit(ck.key),
617
+ children: saving ? "Saving\u2026" : "Save"
618
+ }
619
+ ),
620
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
621
+ Button,
622
+ {
623
+ variant: "secondary",
624
+ className: "text-xs",
625
+ onClick: () => setEditingKey(null),
626
+ children: "Cancel"
627
+ }
628
+ )
629
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
630
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { variant: "secondary", className: "text-xs", onClick: () => startEdit(ck), children: "Edit" }),
631
+ ck.source === "admin" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
632
+ Button,
633
+ {
634
+ variant: "danger",
635
+ className: "text-xs",
636
+ disabled: saving,
637
+ onClick: () => resetOverride(ck.key),
638
+ children: "Reset"
639
+ }
640
+ )
641
+ ] }) }) })
642
+ ] }, ck.key)) })
643
+ ] }) })
644
+ ] })
645
+ ] });
646
+ }
647
+
648
+ // src/modules/ui/pages/admin/admin-observability-page.tsx
649
+ var import_react6 = require("react");
650
+ var import_link4 = __toESM(require("next/link"), 1);
651
+ var import_jsx_runtime14 = require("react/jsx-runtime");
652
+ function AdminObservabilityPage({ apiBase = "/api/outpost" }) {
653
+ const resolved = useUiPaths();
654
+ const [data, setData] = (0, import_react6.useState)(null);
655
+ const [isLoading, setIsLoading] = (0, import_react6.useState)(true);
656
+ const [error, setError] = (0, import_react6.useState)("");
657
+ const load = (0, import_react6.useCallback)(async () => {
658
+ setIsLoading(true);
659
+ setError("");
660
+ try {
661
+ const res = await fetch(`${apiBase}/admin/observability`);
662
+ if (!res.ok) throw new Error("Failed to load");
663
+ setData(await res.json());
664
+ } catch {
665
+ setError("Failed to load observability data.");
666
+ } finally {
667
+ setIsLoading(false);
668
+ }
669
+ }, [apiBase]);
670
+ (0, import_react6.useEffect)(() => {
671
+ void load();
672
+ }, [load]);
673
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(PageShell, { width: "wide", children: [
674
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
675
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_link4.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
676
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mx-2", children: "/" }),
677
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[var(--foreground)]", children: "Observability" })
678
+ ] }),
679
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
680
+ PageHeader,
681
+ {
682
+ title: "Observability",
683
+ description: "Operational snapshot from the outbox. Export OpenTelemetry metrics to your collector for dashboards.",
684
+ action: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: isLoading ? "Loading\u2026" : "Refresh" })
685
+ }
686
+ ),
687
+ error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
688
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingState, { label: "Loading observability" }) : data ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-6", children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [
690
+ Object.entries(data.countsByState).map(([state, count]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { muted: true, children: [
691
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: state }),
692
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: count })
693
+ ] }, state)),
694
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { muted: true, children: [
695
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "suppressions" }),
696
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.suppressionCount })
697
+ ] })
698
+ ] }),
699
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { children: [
700
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CardHeader, { children: [
701
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardTitle, { children: "Last send worker run" }),
702
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardDescription, { children: 'Updated when an operator clicks "Run send worker" on the queue page or a cron invokes the worker.' })
703
+ ] }),
704
+ data.lastWorkerRun ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3 text-sm", children: [
705
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
706
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "At" }),
707
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: new Date(data.lastWorkerRun.at).toLocaleString() })
708
+ ] }),
709
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
710
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Claimed" }),
711
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.claimed })
712
+ ] }),
713
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
714
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Sent" }),
715
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.sent })
716
+ ] }),
717
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
718
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Retried" }),
719
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.retried })
720
+ ] }),
721
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
722
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Rate limited" }),
723
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.rateLimited })
724
+ ] }),
725
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
726
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Failed (DLQ)" }),
727
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.failed })
728
+ ] })
729
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-[var(--muted)]", children: "No worker run recorded yet." })
730
+ ] }),
731
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { className: "overflow-hidden", children: [
732
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CardHeader, { children: [
733
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardTitle, { children: "OpenTelemetry metrics" }),
734
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardDescription, { children: "Emitted when `OtelTelemetry` is wired. Point your SDK exporter at these names." })
735
+ ] }),
736
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "w-full text-sm", children: [
737
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { children: [
738
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Name" }),
739
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Type" }),
740
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Description" })
741
+ ] }) }),
742
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: data.metrics.map((m) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
743
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3 font-mono text-xs", children: m.name }),
744
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge, { variant: m.type === "gauge" ? "info" : "default", children: m.type }) }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: m.description })
746
+ ] }, m.name)) })
747
+ ] }) })
748
+ ] })
749
+ ] }) : null
750
+ ] });
751
+ }
752
+ // Annotate the CommonJS export names for ESM import in node:
753
+ 0 && (module.exports = {
754
+ AdminConfigPage,
755
+ AdminObservabilityPage,
756
+ AdminPanelPage,
757
+ AdminQueuePage,
758
+ Alert,
759
+ Badge,
760
+ Button,
761
+ Card,
762
+ CardDescription,
763
+ CardHeader,
764
+ CardTitle,
765
+ DEFAULT_OUTPOST_PATHS,
766
+ EmptyState,
767
+ Input,
768
+ LoadingState,
769
+ OutpostUIProvider,
770
+ PageHeader,
771
+ PageShell,
772
+ resolveOutpostPaths,
773
+ useOutpostUi,
774
+ useUiPaths
775
+ });
776
+ //# sourceMappingURL=index.cjs.map