@tgoliveira/outpost 1.1.0 → 1.2.1

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