@lunora/studio 1.0.0-alpha.56 → 1.0.0-alpha.58

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 (147) hide show
  1. package/dist/index.d.ts +61 -4
  2. package/dist/index.js +13 -11
  3. package/dist/mount.d.ts +1 -1
  4. package/dist/mount.js +1 -1
  5. package/dist/packem_chunks/ApiTab.js +3 -3
  6. package/dist/packem_chunks/AuditPanel.js +4 -4
  7. package/dist/packem_chunks/DeploymentHealthPanel.js +664 -0
  8. package/dist/packem_chunks/ExportImportPanel.js +3 -3
  9. package/dist/packem_chunks/FileBrowser.js +3 -3
  10. package/dist/packem_chunks/FunctionRunner.js +2 -2
  11. package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
  12. package/dist/packem_chunks/HealthPanel.js +3 -3
  13. package/dist/packem_chunks/InsightsPanel.js +4 -4
  14. package/dist/packem_chunks/LogsPanel.js +537 -89
  15. package/dist/packem_chunks/MailPanel.js +4 -4
  16. package/dist/packem_chunks/MetricsPanel.js +475 -244
  17. package/dist/packem_chunks/MigrationsPanel.js +4 -4
  18. package/dist/packem_chunks/NotificationsPanel.js +306 -0
  19. package/dist/packem_chunks/PitrPanel.js +2 -2
  20. package/dist/packem_chunks/SchemaViewer.js +2 -2
  21. package/dist/packem_chunks/SecurityAdvisorPanel.js +3 -3
  22. package/dist/packem_chunks/SettingsPanel.js +3 -3
  23. package/dist/packem_chunks/SqlEditorPanel.js +5 -5
  24. package/dist/packem_chunks/TableEditor.js +3 -3
  25. package/dist/packem_chunks/agents-panel.js +4 -4
  26. package/dist/packem_chunks/analytics-panel.js +1 -1
  27. package/dist/packem_chunks/auth-audit-panel.js +247 -0
  28. package/dist/packem_chunks/auth-config-panel.js +1 -1
  29. package/dist/packem_chunks/auth-sessions-panel.js +2 -2
  30. package/dist/packem_chunks/containers-panel.js +2 -2
  31. package/dist/packem_chunks/dashboards-panel.js +3 -3
  32. package/dist/packem_chunks/fanout-panel.js +3 -3
  33. package/dist/packem_chunks/flags-panel.js +3 -3
  34. package/dist/packem_chunks/issues-panel.js +3 -3
  35. package/dist/packem_chunks/kv-browser.js +2 -2
  36. package/dist/packem_chunks/log-drains-panel.js +1 -1
  37. package/dist/packem_chunks/organizations-panel.js +3 -3
  38. package/dist/packem_chunks/payments-panel.js +31 -4
  39. package/dist/packem_chunks/permissions-panel.js +4 -4
  40. package/dist/packem_chunks/queues-panel.js +4 -4
  41. package/dist/packem_chunks/rls-panel.js +3 -3
  42. package/dist/packem_chunks/schedule-panel.js +3 -3
  43. package/dist/packem_chunks/storage-rules-panel.js +3 -3
  44. package/dist/packem_chunks/subscriptions-panel.js +3 -3
  45. package/dist/packem_chunks/traces-panel.js +128 -115
  46. package/dist/packem_chunks/users-panel.js +3 -3
  47. package/dist/packem_chunks/vector-browser.js +1 -1
  48. package/dist/packem_chunks/workflows-panel.js +3 -3
  49. package/dist/packem_shared/{ADMIN_FUNCTIONS-C1LXrovV.js → ADMIN_FUNCTIONS-P2UzJscH.js} +3 -0
  50. package/dist/packem_shared/{ApiDocsPanel-cYkYKjK3.js → ApiDocsPanel-DNDpeR5O.js} +2 -2
  51. package/dist/packem_shared/{ApiReferencePanel-Dd8pcswz.js → ApiReferencePanel-ChlRsAXU.js} +1 -1
  52. package/dist/packem_shared/{CommandPalette-BXV4eKf5.js → CommandPalette-BpkopP5f.js} +1 -1
  53. package/dist/packem_shared/{DataBrowser-CowupumK.js → DataBrowser-obTn4sKX.js} +6 -6
  54. package/dist/packem_shared/{GlobalDataBrowser-D8h1fTL1.js → GlobalDataBrowser-BCaohHZ5.js} +3 -3
  55. package/dist/packem_shared/{HomePanel-B12QgvIn.js → HomePanel-DCRj3hGB.js} +4 -4
  56. package/dist/packem_shared/{OpenRpcReferencePanel-CWaf0ZtX.js → OpenRpcReferencePanel-CIeQE1aE.js} +1 -1
  57. package/dist/packem_shared/{ScheduledJobs-Cz5Tr-M6.js → ScheduledJobs-BQzQo84k.js} +2 -2
  58. package/dist/packem_shared/{Studio-DV1PhCIl.js → Studio-DnlPCbID.js} +4 -4
  59. package/dist/packem_shared/{StudioApp-BF2rK77z.js → StudioApp-CzqlB4zO.js} +2 -2
  60. package/dist/packem_shared/{advisor-view-1RaDWED7.js → advisor-view-D95sN-wO.js} +1 -1
  61. package/dist/packem_shared/{app.d-C-kxb-1T.d.ts → app.d-bRPJhby-.d.ts} +1 -1
  62. package/dist/packem_shared/{data-grid-C9I16KWr.js → data-grid-BywzWfek.js} +1 -1
  63. package/dist/packem_shared/{error-alert-vIPQoN3Y.js → error-alert-D9uIFJUS.js} +1 -1
  64. package/dist/packem_shared/{grid-features-B_fZH4iQ.js → grid-features-ZOLhHKrR.js} +1 -1
  65. package/dist/packem_shared/{home-panel-DDo_fi19.js → home-panel-BRAA2UlM.js} +3 -3
  66. package/dist/packem_shared/{internal-zwBoOv24.js → internal-DzHCc2Rq.js} +10 -1
  67. package/dist/packem_shared/{reference-view-DUULLuOi.js → reference-view-DfXN7oWP.js} +1 -1
  68. package/dist/packem_shared/{result-chart-DZradBAS.js → result-chart-Bf9mbCIo.js} +1 -1
  69. package/dist/packem_shared/{studio-CuNuEnSJ.js → studio-8QSXbZ98.js} +684 -609
  70. package/dist/packem_shared/{table-list-sidebar-huX4VmgI.js → table-list-sidebar-gCE17v9B.js} +1 -1
  71. package/dist/packem_shared/trace-handoff-CGolF3KS.js +38 -0
  72. package/dist/packem_shared/{use-admin-query-BGJ010yZ.js → use-admin-query-C7JNuQp-.js} +1 -1
  73. package/dist/packem_shared/{use-async-submit-DGCtuDyz.js → use-async-submit-rnSk_jXl.js} +2 -2
  74. package/dist/standalone/{chunk-WOYQG5AM.js → chunk-2YTF6LJ6.js} +1 -1
  75. package/dist/standalone/chunk-3LJEGSMK.js +11 -0
  76. package/dist/standalone/{chunk-OOLK6C5I.js → chunk-56XQYNUJ.js} +1 -1
  77. package/dist/standalone/chunk-5QT5JRXD.js +3 -0
  78. package/dist/standalone/{chunk-VC2VDAUO.js → chunk-6RLPR7PL.js} +1 -1
  79. package/dist/standalone/{chunk-XFINDIAB.js → chunk-6V74EUPK.js} +1 -1
  80. package/dist/standalone/{chunk-RCSULEDU.js → chunk-7EE33WLB.js} +1 -1
  81. package/dist/standalone/{chunk-XCNYUUD6.js → chunk-AN4RKMKW.js} +1 -1
  82. package/dist/standalone/{chunk-S7BCXJWD.js → chunk-AXNGWSBM.js} +1 -1
  83. package/dist/standalone/{chunk-4A7VE2UO.js → chunk-AXZILWRM.js} +1 -1
  84. package/dist/standalone/{chunk-EGANQQLW.js → chunk-C7RHEBOH.js} +1 -1
  85. package/dist/standalone/chunk-CSWIYOB3.js +1 -0
  86. package/dist/standalone/{chunk-AL5UKM6M.js → chunk-D3VAON25.js} +1 -1
  87. package/dist/standalone/{chunk-HNIDN3RX.js → chunk-DDLQN67F.js} +1 -1
  88. package/dist/standalone/chunk-DGHW5JG5.js +1 -0
  89. package/dist/standalone/{chunk-6RW37KKD.js → chunk-DMCSOTAE.js} +1 -1
  90. package/dist/standalone/{chunk-E5Z2TAAR.js → chunk-E3BKETAS.js} +1 -1
  91. package/dist/standalone/{chunk-LJE6PGHD.js → chunk-E3OXNN6O.js} +1 -1
  92. package/dist/standalone/chunk-E6BOGDIS.js +1 -0
  93. package/dist/standalone/{chunk-FDWXYXOM.js → chunk-F2YMCQ6B.js} +1 -1
  94. package/dist/standalone/{chunk-D73WYMRU.js → chunk-F7GE4X2U.js} +1 -1
  95. package/dist/standalone/{chunk-3W4CSGDO.js → chunk-FAVUOGJR.js} +1 -1
  96. package/dist/standalone/{chunk-YS7NUMAN.js → chunk-FXP6256Q.js} +1 -1
  97. package/dist/standalone/{chunk-RVVADT2N.js → chunk-G6CTAYHJ.js} +1 -1
  98. package/dist/standalone/chunk-H42W62SE.js +1 -0
  99. package/dist/standalone/{chunk-5XO36X4C.js → chunk-HBGS4SEX.js} +8 -8
  100. package/dist/standalone/{chunk-25CDYYNE.js → chunk-HTF5ZX4I.js} +1 -1
  101. package/dist/standalone/{chunk-6ZGXWDSY.js → chunk-I2PS4L74.js} +1 -1
  102. package/dist/standalone/{chunk-LJ3KEIPO.js → chunk-J7OGP4NN.js} +1 -1
  103. package/dist/standalone/{chunk-3BYY75EO.js → chunk-L2LN3MK4.js} +1 -1
  104. package/dist/standalone/{chunk-2U3KE6IP.js → chunk-LT3FH6MW.js} +1 -1
  105. package/dist/standalone/{chunk-ZXLEXF4X.js → chunk-LXULVPEM.js} +3 -3
  106. package/dist/standalone/{chunk-XTOCLVRS.js → chunk-LZUWZBPE.js} +1 -1
  107. package/dist/standalone/{chunk-2DCA6LV7.js → chunk-M4JM3TOY.js} +1 -1
  108. package/dist/standalone/{chunk-OEIBZ5AI.js → chunk-MLA5ZAEB.js} +1 -1
  109. package/dist/standalone/{chunk-WQC5IIF7.js → chunk-MRBI5HNQ.js} +1 -1
  110. package/dist/standalone/{chunk-CHNXZYAC.js → chunk-N5XX4HOL.js} +1 -1
  111. package/dist/standalone/{chunk-SPACAIAR.js → chunk-NKFXMDOD.js} +1 -1
  112. package/dist/standalone/{chunk-D54HL2MW.js → chunk-NPSNKFHE.js} +1 -1
  113. package/dist/standalone/{chunk-WCLFE2ZB.js → chunk-O7FVPUCO.js} +1 -1
  114. package/dist/standalone/{chunk-GVFODXW2.js → chunk-OKQXTLFX.js} +1 -1
  115. package/dist/standalone/{chunk-G4GGGHEV.js → chunk-QAIM6KWT.js} +1 -1
  116. package/dist/standalone/{chunk-7YGTGBP7.js → chunk-QCPMTB6W.js} +1 -1
  117. package/dist/standalone/{chunk-LYAWJGSH.js → chunk-QQ2LOSZL.js} +1 -1
  118. package/dist/standalone/{chunk-XZWFP2GI.js → chunk-QVUQXJCT.js} +1 -1
  119. package/dist/standalone/{chunk-6LQ3FXP2.js → chunk-R2GMHLJY.js} +1 -1
  120. package/dist/standalone/{chunk-4F72YCTU.js → chunk-RD5UG2YL.js} +1 -1
  121. package/dist/standalone/chunk-RJTIP3WF.js +1 -0
  122. package/dist/standalone/chunk-SOC5CY3F.js +1 -0
  123. package/dist/standalone/{chunk-JWCCDDLY.js → chunk-SS7JLF2I.js} +1 -1
  124. package/dist/standalone/{chunk-VDOUWYIZ.js → chunk-SWWYUGPL.js} +1 -1
  125. package/dist/standalone/chunk-TEWVD66F.js +1 -0
  126. package/dist/standalone/{chunk-ULOBAURC.js → chunk-TTXRHJUP.js} +1 -1
  127. package/dist/standalone/{chunk-BZ5BHTVF.js → chunk-UKDHGVOC.js} +1 -1
  128. package/dist/standalone/{chunk-5IGHDPEP.js → chunk-UPNTMJFF.js} +1 -1
  129. package/dist/standalone/{chunk-FQUNSQLG.js → chunk-WMDH2CIZ.js} +1 -1
  130. package/dist/standalone/{chunk-DOLG4V3A.js → chunk-XN6QYJQ6.js} +1 -1
  131. package/dist/standalone/chunk-Y4U6CC22.js +1 -0
  132. package/dist/standalone/{chunk-SWMBBYJU.js → chunk-Y7PD5KP4.js} +1 -1
  133. package/dist/standalone/chunk-YFIPHCEC.js +1 -0
  134. package/dist/standalone/chunk-YJXOWLFJ.js +1 -0
  135. package/dist/standalone/{chunk-2XJ3WRKW.js → chunk-YNN6NFRZ.js} +1 -1
  136. package/dist/standalone/{chunk-DBCP55V6.js → chunk-YUGHRVPD.js} +1 -1
  137. package/dist/standalone/studio.js +1 -1
  138. package/dist/styles.css +1 -1
  139. package/package.json +6 -6
  140. package/dist/standalone/chunk-5SXQWGTH.js +0 -1
  141. package/dist/standalone/chunk-DGWFJ3GW.js +0 -1
  142. package/dist/standalone/chunk-ILGPO3PK.js +0 -3
  143. package/dist/standalone/chunk-MHGJUKCZ.js +0 -1
  144. package/dist/standalone/chunk-N3V74RBP.js +0 -1
  145. package/dist/standalone/chunk-OBFYFJYZ.js +0 -1
  146. package/dist/standalone/chunk-S2G7OH5T.js +0 -11
  147. package/dist/standalone/chunk-VJABWVPW.js +0 -1
@@ -1,25 +1,466 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { useVirtualizer } from '@tanstack/react-virtual';
3
- import { useState, useEffect, useMemo, useRef } from 'react';
3
+ import { useState, useReducer, useRef, useEffect, useMemo } from 'react';
4
4
  import { f as formatLogFields } from '../packem_shared/log-fields-jEH83H2G.js';
5
- import { E as ErrorAlert } from '../packem_shared/error-alert-vIPQoN3Y.js';
5
+ import { E as ErrorAlert } from '../packem_shared/error-alert-D9uIFJUS.js';
6
6
  import { L as LiveError } from '../packem_shared/live-status-FZ0psC1z.js';
7
7
  import { ShardInput } from '../packem_shared/ShardInput-CZnpHILL.js';
8
8
  import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
9
9
  import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
10
10
  import { I as Input } from '../packem_shared/input-XH4r1Pt1.js';
11
- import { u as useAdminQuery } from '../packem_shared/use-admin-query-BGJ010yZ.js';
11
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-C7JNuQp-.js';
12
12
  import useDebounced from '../packem_shared/useDebounced-Dxncpg6z.js';
13
13
  import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
14
- import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-C1LXrovV.js';
14
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-P2UzJscH.js';
15
15
  import { b as CLOUDFLARE_OBSERVABILITY_URL } from '../packem_shared/cf-links-SIbyi4Y1.js';
16
16
  import { r as recordShard } from '../packem_shared/shard-history-AxiJ1WPP.js';
17
17
  import { c as cn } from '../packem_shared/utils-B05Dmz_H.js';
18
18
  import { f as flooredRectObserver } from '../packem_shared/virtual-rect-CVMUskSm.js';
19
- import { jsxDEV } from 'react/jsx-dev-runtime';
19
+ import { useLunora } from '@lunora/react';
20
+ import { B as Button } from '../packem_shared/button-BhsN2uZH.js';
21
+ import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
22
+ import { f as fireAndForget, l as errorCode, e as errorMessage } from '../packem_shared/internal-DzHCc2Rq.js';
23
+ import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
20
24
 
21
25
  const LOG_LEVEL_ORDER = ["trace", "debug", "log", "info", "warn", "error", "fatal"];
22
26
 
27
+ const LOG_ARCHIVE_NOT_CONFIGURED = "LOG_ARCHIVE_NOT_CONFIGURED";
28
+
29
+ const LEVEL_VARIANT = {
30
+ debug: "secondary",
31
+ error: "destructive",
32
+ fatal: "destructive",
33
+ info: "outline",
34
+ log: "outline",
35
+ trace: "outline",
36
+ warn: "secondary"
37
+ };
38
+
39
+ const INITIAL_STATE = {
40
+ cursor: void 0,
41
+ error: null,
42
+ loading: false,
43
+ notConfigured: false,
44
+ rows: null
45
+ };
46
+ const archiveReducer = (state, action) => {
47
+ switch (action.type) {
48
+ case "append": {
49
+ return {
50
+ ...state,
51
+ cursor: action.cursor,
52
+ error: null,
53
+ loading: false,
54
+ rows: [...state.rows ?? [], ...action.rows]
55
+ };
56
+ }
57
+ case "failed": {
58
+ return {
59
+ cursor: void 0,
60
+ error: action.message,
61
+ loading: false,
62
+ notConfigured: false,
63
+ rows: null
64
+ };
65
+ }
66
+ case "loaded": {
67
+ return {
68
+ cursor: action.cursor,
69
+ error: null,
70
+ loading: false,
71
+ notConfigured: false,
72
+ rows: action.rows
73
+ };
74
+ }
75
+ case "loading": {
76
+ return {
77
+ ...state,
78
+ error: null,
79
+ loading: true,
80
+ notConfigured: false
81
+ };
82
+ }
83
+ case "notConfigured": {
84
+ return {
85
+ cursor: void 0,
86
+ error: null,
87
+ loading: false,
88
+ notConfigured: true,
89
+ rows: null
90
+ };
91
+ }
92
+ case "pageFailed": {
93
+ return {
94
+ ...state,
95
+ error: action.message,
96
+ loading: false
97
+ };
98
+ }
99
+ default: {
100
+ return state;
101
+ }
102
+ }
103
+ };
104
+ const ArchiveRow = (t0) => {
105
+ const $ = c(33);
106
+ const {
107
+ row
108
+ } = t0;
109
+ let t1;
110
+ if ($[0] !== row.fields) {
111
+ t1 = formatLogFields(row.fields);
112
+ $[0] = row.fields;
113
+ $[1] = t1;
114
+ } else {
115
+ t1 = $[1];
116
+ }
117
+ const fields = t1;
118
+ const t2 = `lg-archive-row-${String(row.ts)}`;
119
+ let t3;
120
+ if ($[2] !== row.ts) {
121
+ t3 = new Date(row.ts).toLocaleString();
122
+ $[2] = row.ts;
123
+ $[3] = t3;
124
+ } else {
125
+ t3 = $[3];
126
+ }
127
+ let t4;
128
+ if ($[4] !== t3) {
129
+ t4 = /* @__PURE__ */ jsxDEV(TableCell, {
130
+ className: "tabular-nums whitespace-nowrap text-xs text-muted-foreground",
131
+ children: t3
132
+ }, void 0, false);
133
+ $[4] = t3;
134
+ $[5] = t4;
135
+ } else {
136
+ t4 = $[5];
137
+ }
138
+ const t5 = LEVEL_VARIANT[row.level];
139
+ let t6;
140
+ if ($[6] !== row.level || $[7] !== t5) {
141
+ t6 = /* @__PURE__ */ jsxDEV(TableCell, {
142
+ children: /* @__PURE__ */ jsxDEV(Badge, {
143
+ variant: t5,
144
+ children: row.level
145
+ }, void 0, false)
146
+ }, void 0, false);
147
+ $[6] = row.level;
148
+ $[7] = t5;
149
+ $[8] = t6;
150
+ } else {
151
+ t6 = $[8];
152
+ }
153
+ let t7;
154
+ if ($[9] !== row.functionPath) {
155
+ t7 = /* @__PURE__ */ jsxDEV(TableCell, {
156
+ className: "font-mono text-xs",
157
+ children: row.functionPath
158
+ }, void 0, false);
159
+ $[9] = row.functionPath;
160
+ $[10] = t7;
161
+ } else {
162
+ t7 = $[10];
163
+ }
164
+ let t8;
165
+ if ($[11] !== row.message) {
166
+ t8 = /* @__PURE__ */ jsxDEV("div", {
167
+ className: "truncate",
168
+ title: row.message,
169
+ children: row.message
170
+ }, void 0, false);
171
+ $[11] = row.message;
172
+ $[12] = t8;
173
+ } else {
174
+ t8 = $[12];
175
+ }
176
+ let t9;
177
+ if ($[13] !== fields) {
178
+ t9 = fields !== "" && /* @__PURE__ */ jsxDEV("div", {
179
+ className: "truncate font-mono text-[11px] text-muted-foreground",
180
+ title: fields,
181
+ children: fields
182
+ }, void 0, false);
183
+ $[13] = fields;
184
+ $[14] = t9;
185
+ } else {
186
+ t9 = $[14];
187
+ }
188
+ let t10;
189
+ if ($[15] !== t8 || $[16] !== t9) {
190
+ t10 = /* @__PURE__ */ jsxDEV(TableCell, {
191
+ className: "max-w-md",
192
+ children: [t8, t9]
193
+ }, void 0, true);
194
+ $[15] = t8;
195
+ $[16] = t9;
196
+ $[17] = t10;
197
+ } else {
198
+ t10 = $[17];
199
+ }
200
+ const t11 = row.traceId ?? "—";
201
+ let t12;
202
+ if ($[18] !== t11) {
203
+ t12 = /* @__PURE__ */ jsxDEV(TableCell, {
204
+ className: "font-mono text-[11px] text-muted-foreground",
205
+ children: t11
206
+ }, void 0, false);
207
+ $[18] = t11;
208
+ $[19] = t12;
209
+ } else {
210
+ t12 = $[19];
211
+ }
212
+ const t13 = row.shardKey ?? "—";
213
+ let t14;
214
+ if ($[20] !== t13) {
215
+ t14 = /* @__PURE__ */ jsxDEV(TableCell, {
216
+ className: "font-mono text-[11px] text-muted-foreground",
217
+ children: t13
218
+ }, void 0, false);
219
+ $[20] = t13;
220
+ $[21] = t14;
221
+ } else {
222
+ t14 = $[21];
223
+ }
224
+ const t15 = row.userId ?? "—";
225
+ let t16;
226
+ if ($[22] !== t15) {
227
+ t16 = /* @__PURE__ */ jsxDEV(TableCell, {
228
+ className: "font-mono text-[11px] text-muted-foreground",
229
+ children: t15
230
+ }, void 0, false);
231
+ $[22] = t15;
232
+ $[23] = t16;
233
+ } else {
234
+ t16 = $[23];
235
+ }
236
+ let t17;
237
+ if ($[24] !== t10 || $[25] !== t12 || $[26] !== t14 || $[27] !== t16 || $[28] !== t2 || $[29] !== t4 || $[30] !== t6 || $[31] !== t7) {
238
+ t17 = /* @__PURE__ */ jsxDEV(TableRow, {
239
+ "data-testid": t2,
240
+ children: [t4, t6, t7, t10, t12, t14, t16]
241
+ }, void 0, true);
242
+ $[24] = t10;
243
+ $[25] = t12;
244
+ $[26] = t14;
245
+ $[27] = t16;
246
+ $[28] = t2;
247
+ $[29] = t4;
248
+ $[30] = t6;
249
+ $[31] = t7;
250
+ $[32] = t17;
251
+ } else {
252
+ t17 = $[32];
253
+ }
254
+ return t17;
255
+ };
256
+ const ArchiveFeed = ({
257
+ shardKey
258
+ }) => {
259
+ const client = useLunora();
260
+ const t = useT();
261
+ const [pathPrefix, setPathPrefix] = useState("");
262
+ const [userIdFilter, setUserIdFilter] = useState("");
263
+ const [minLevel, setMinLevel] = useState("");
264
+ const [{
265
+ cursor,
266
+ error,
267
+ loading,
268
+ notConfigured,
269
+ rows
270
+ }, dispatch] = useReducer(archiveReducer, INITIAL_STATE);
271
+ const debouncedPathPrefix = useDebounced(pathPrefix.trim(), 400);
272
+ const debouncedUserId = useDebounced(userIdFilter.trim(), 400);
273
+ const baseQuery = {
274
+ ...debouncedPathPrefix === "" ? {} : {
275
+ functionPathPrefix: debouncedPathPrefix
276
+ },
277
+ ...minLevel === "" ? {} : {
278
+ minLevel
279
+ },
280
+ ...shardKey === "" ? {} : {
281
+ shardKey
282
+ },
283
+ ...debouncedUserId === "" ? {} : {
284
+ userId: debouncedUserId
285
+ }
286
+ };
287
+ const querySignature = JSON.stringify(baseQuery);
288
+ const activeSignatureRef = useRef(querySignature);
289
+ useEffect(() => {
290
+ const token = {
291
+ cancelled: false
292
+ };
293
+ activeSignatureRef.current = querySignature;
294
+ fireAndForget((async () => {
295
+ dispatch({
296
+ type: "loading"
297
+ });
298
+ try {
299
+ const page = await client.queryLogArchive(baseQuery);
300
+ if (!token.cancelled) {
301
+ dispatch({
302
+ cursor: page.nextCursor,
303
+ rows: page.rows,
304
+ type: "loaded"
305
+ });
306
+ }
307
+ } catch (error_) {
308
+ if (!token.cancelled) {
309
+ dispatch(errorCode(error_) === LOG_ARCHIVE_NOT_CONFIGURED ? {
310
+ type: "notConfigured"
311
+ } : {
312
+ message: errorMessage(error_),
313
+ type: "failed"
314
+ });
315
+ }
316
+ }
317
+ })());
318
+ return () => {
319
+ token.cancelled = true;
320
+ };
321
+ }, [client, querySignature]);
322
+ const loadMore = async () => {
323
+ if (cursor === void 0) {
324
+ return;
325
+ }
326
+ const signature = querySignature;
327
+ dispatch({
328
+ type: "loading"
329
+ });
330
+ try {
331
+ const page = await client.queryLogArchive({
332
+ ...baseQuery,
333
+ cursor
334
+ });
335
+ if (activeSignatureRef.current === signature) {
336
+ dispatch({
337
+ cursor: page.nextCursor,
338
+ rows: page.rows,
339
+ type: "append"
340
+ });
341
+ }
342
+ } catch (error_) {
343
+ if (activeSignatureRef.current === signature) {
344
+ dispatch({
345
+ message: errorMessage(error_),
346
+ type: "pageFailed"
347
+ });
348
+ }
349
+ }
350
+ };
351
+ const onPathPrefixChange = (event) => {
352
+ setPathPrefix(event.target.value);
353
+ };
354
+ const onUserIdChange = (event) => {
355
+ setUserIdFilter(event.target.value);
356
+ };
357
+ const onMinLevelChange = (event) => {
358
+ setMinLevel(event.target.value);
359
+ };
360
+ const onLoadMore = () => {
361
+ fireAndForget(loadMore());
362
+ };
363
+ if (notConfigured) {
364
+ return /* @__PURE__ */ jsxDEV(EmptyState, {
365
+ action: /* @__PURE__ */ jsxDEV("a", {
366
+ className: "text-sm text-primary underline-offset-4 hover:underline",
367
+ href: CLOUDFLARE_OBSERVABILITY_URL,
368
+ rel: "noreferrer",
369
+ target: "_blank",
370
+ children: t("Open in Cloudflare")
371
+ }, void 0, false),
372
+ description: t("Wire pipelineLogSink to a Cloudflare Pipeline → R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),
373
+ testId: "lg-archive-not-configured",
374
+ title: t("Log archive not configured")
375
+ }, void 0, false);
376
+ }
377
+ return /* @__PURE__ */ jsxDEV("div", {
378
+ className: "flex flex-col gap-4",
379
+ "data-testid": "lg-archive",
380
+ children: [/* @__PURE__ */ jsxDEV("div", {
381
+ className: "flex flex-wrap items-center gap-2",
382
+ children: [/* @__PURE__ */ jsxDEV(Input, {
383
+ "aria-label": t("Function path prefix"),
384
+ className: "h-8 w-48",
385
+ "data-testid": "lg-archive-path",
386
+ onChange: onPathPrefixChange,
387
+ placeholder: t("function path…"),
388
+ value: pathPrefix
389
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
390
+ "aria-label": t("User id"),
391
+ className: "h-8 w-40",
392
+ "data-testid": "lg-archive-user",
393
+ onChange: onUserIdChange,
394
+ placeholder: t("user id…"),
395
+ value: userIdFilter
396
+ }, void 0, false), /* @__PURE__ */ jsxDEV("select", {
397
+ "aria-label": t("Minimum level"),
398
+ className: "h-8 rounded-md border border-border bg-background px-2 text-sm",
399
+ "data-testid": "lg-archive-min-level",
400
+ onChange: onMinLevelChange,
401
+ value: minLevel,
402
+ children: [/* @__PURE__ */ jsxDEV("option", {
403
+ value: "",
404
+ children: t("min level")
405
+ }, void 0, false), LOG_LEVEL_ORDER.map((level) => /* @__PURE__ */ jsxDEV("option", {
406
+ value: level,
407
+ children: level
408
+ }, level, false))]
409
+ }, void 0, true)]
410
+ }, void 0, true), error !== null && /* @__PURE__ */ jsxDEV("p", {
411
+ className: "text-sm text-destructive",
412
+ "data-testid": "lg-archive-error",
413
+ role: "alert",
414
+ children: error
415
+ }, void 0, false), loading && rows === null && error === null && /* @__PURE__ */ jsxDEV("p", {
416
+ className: "text-sm text-muted-foreground",
417
+ "data-testid": "lg-archive-loading",
418
+ children: t("Loading…")
419
+ }, void 0, false), rows !== null && rows.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
420
+ description: t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),
421
+ testId: "lg-archive-empty",
422
+ title: t("No archived logs.")
423
+ }, void 0, false), rows !== null && rows.length > 0 && /* @__PURE__ */ jsxDEV("div", {
424
+ className: "overflow-hidden rounded-xl border border-border shadow-xs",
425
+ children: /* @__PURE__ */ jsxDEV(Table, {
426
+ "data-testid": "lg-archive-table",
427
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
428
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
429
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
430
+ children: t("Time")
431
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
432
+ children: t("Level")
433
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
434
+ children: t("Function")
435
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
436
+ children: t("Message")
437
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
438
+ children: t("Trace")
439
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
440
+ children: t("Shard")
441
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
442
+ children: t("User")
443
+ }, void 0, false)]
444
+ }, void 0, true)
445
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
446
+ children: rows.map((row, index) => /* @__PURE__ */ jsxDEV(ArchiveRow, {
447
+ row
448
+ }, `${String(row.ts)}-${String(index)}`, false))
449
+ }, void 0, false)]
450
+ }, void 0, true)
451
+ }, void 0, false), cursor !== void 0 && /* @__PURE__ */ jsxDEV("div", {
452
+ children: /* @__PURE__ */ jsxDEV(Button, {
453
+ "data-testid": "lg-archive-more",
454
+ disabled: loading,
455
+ onClick: onLoadMore,
456
+ size: "sm",
457
+ variant: "outline",
458
+ children: loading ? t("Loading…") : t("Load more")
459
+ }, void 0, false)
460
+ }, void 0, false)]
461
+ }, void 0, true);
462
+ };
463
+
23
464
  const SCROLL_HEIGHT = 400;
24
465
  const ROW_HEIGHT = 36;
25
466
  const SCROLL_STYLE = {
@@ -32,15 +473,6 @@ const ROW_BASE_STYLE = {
32
473
  top: 0,
33
474
  width: "100%"
34
475
  };
35
- const LEVEL_VARIANT = {
36
- debug: "secondary",
37
- error: "destructive",
38
- fatal: "destructive",
39
- info: "outline",
40
- log: "outline",
41
- trace: "outline",
42
- warn: "secondary"
43
- };
44
476
  const OUTCOME_VARIANT = {
45
477
  error: "destructive",
46
478
  ok: "secondary"
@@ -640,6 +1072,10 @@ const LogsPanel = ({
640
1072
  setView("errors");
641
1073
  setShowSummary(false);
642
1074
  };
1075
+ const showArchive = () => {
1076
+ setView("archive");
1077
+ setShowSummary(false);
1078
+ };
643
1079
  return /* @__PURE__ */ jsxDEV("div", {
644
1080
  className: "flex flex-col gap-4",
645
1081
  "data-testid": "lunora-logs",
@@ -664,12 +1100,20 @@ const LogsPanel = ({
664
1100
  role: "tab",
665
1101
  type: "button",
666
1102
  children: t("Errors")
1103
+ }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
1104
+ "aria-selected": view === "archive",
1105
+ className: cn("px-3 py-1 text-sm", view === "archive" ? "bg-muted font-medium" : "text-muted-foreground"),
1106
+ "data-testid": "lg-view-archive",
1107
+ onClick: showArchive,
1108
+ role: "tab",
1109
+ type: "button",
1110
+ children: t("Archive")
667
1111
  }, void 0, false)]
668
1112
  }, void 0, true), /* @__PURE__ */ jsxDEV(ShardInput, {
669
1113
  onChange: setShardKey,
670
1114
  testId: "lg-shard-input",
671
1115
  value: shardKey
672
- }, void 0, false), /* @__PURE__ */ jsxDEV(LiveError, {
1116
+ }, void 0, false), view !== "archive" && /* @__PURE__ */ jsxDEV(LiveError, {
673
1117
  message: liveError,
674
1118
  prefix: "lg"
675
1119
  }, void 0, false), /* @__PURE__ */ jsxDEV("a", {
@@ -773,82 +1217,86 @@ const LogsPanel = ({
773
1217
  children: t("error")
774
1218
  }, void 0, false)]
775
1219
  }, void 0, true)]
776
- }, void 0, true), readout === "error" && /* @__PURE__ */ jsxDEV(ErrorAlert, {
777
- error: errorSource,
778
- testId: "lg-error"
779
- }, void 0, false), readout === "empty" && /* @__PURE__ */ jsxDEV(EmptyState, {
780
- description: t("Function and request logs for this shard show up here as your app handles traffic."),
781
- icon: /* @__PURE__ */ jsxDEV("svg", {
782
- "aria-hidden": "true",
783
- fill: "none",
784
- stroke: "currentColor",
785
- strokeLinecap: "round",
786
- strokeLinejoin: "round",
787
- strokeWidth: 1.6,
788
- viewBox: "0 0 24 24",
789
- children: /* @__PURE__ */ jsxDEV("path", {
790
- d: "M4 5h16M4 12h16M4 19h10"
791
- }, void 0, false)
792
- }, void 0, false),
793
- testId: "lg-empty",
794
- title: t("No logs.")
795
- }, void 0, false), readout === "summary" && /* @__PURE__ */ jsxDEV("div", {
796
- className: "flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs",
797
- "data-testid": "logs-summary",
798
- children: [/* @__PURE__ */ jsxDEV("p", {
799
- className: "text-xs text-muted-foreground",
800
- "data-testid": "logs-summary-total",
801
- children: t("{count} entries", {
802
- count: summary.total
803
- })
804
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
805
- children: [/* @__PURE__ */ jsxDEV("h4", {
806
- className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
807
- children: t("By level")
1220
+ }, void 0, true), view === "archive" ? /* @__PURE__ */ jsxDEV(ArchiveFeed, {
1221
+ shardKey: debouncedShard
1222
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Fragment, {
1223
+ children: [readout === "error" && /* @__PURE__ */ jsxDEV(ErrorAlert, {
1224
+ error: errorSource,
1225
+ testId: "lg-error"
1226
+ }, void 0, false), readout === "empty" && /* @__PURE__ */ jsxDEV(EmptyState, {
1227
+ description: t("Function and request logs for this shard show up here as your app handles traffic."),
1228
+ icon: /* @__PURE__ */ jsxDEV("svg", {
1229
+ "aria-hidden": "true",
1230
+ fill: "none",
1231
+ stroke: "currentColor",
1232
+ strokeLinecap: "round",
1233
+ strokeLinejoin: "round",
1234
+ strokeWidth: 1.6,
1235
+ viewBox: "0 0 24 24",
1236
+ children: /* @__PURE__ */ jsxDEV("path", {
1237
+ d: "M4 5h16M4 12h16M4 19h10"
1238
+ }, void 0, false)
1239
+ }, void 0, false),
1240
+ testId: "lg-empty",
1241
+ title: t("No logs.")
1242
+ }, void 0, false), readout === "summary" && /* @__PURE__ */ jsxDEV("div", {
1243
+ className: "flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs",
1244
+ "data-testid": "logs-summary",
1245
+ children: [/* @__PURE__ */ jsxDEV("p", {
1246
+ className: "text-xs text-muted-foreground",
1247
+ "data-testid": "logs-summary-total",
1248
+ children: t("{count} entries", {
1249
+ count: summary.total
1250
+ })
808
1251
  }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
809
- className: "overflow-hidden rounded-lg border border-border",
810
- "data-testid": "logs-summary-levels",
1252
+ children: [/* @__PURE__ */ jsxDEV("h4", {
1253
+ className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
1254
+ children: t("By level")
1255
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1256
+ className: "overflow-hidden rounded-lg border border-border",
1257
+ "data-testid": "logs-summary-levels",
1258
+ role: "grid",
1259
+ children: summary.byLevel.map((bucket) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
1260
+ bucket
1261
+ }, bucket.key, false))
1262
+ }, void 0, false)]
1263
+ }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
1264
+ children: [/* @__PURE__ */ jsxDEV("h4", {
1265
+ className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
1266
+ children: t("By function")
1267
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1268
+ className: "overflow-hidden rounded-lg border border-border",
1269
+ "data-testid": "logs-summary-paths",
1270
+ role: "grid",
1271
+ children: summary.byPath.map((bucket_0) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
1272
+ bucket: bucket_0
1273
+ }, bucket_0.key, false))
1274
+ }, void 0, false)]
1275
+ }, void 0, true)]
1276
+ }, void 0, true), readout === "list" && /* @__PURE__ */ jsxDEV("div", {
1277
+ className: "rounded-xl border border-border shadow-xs",
1278
+ "data-testid": "lg-scroll",
1279
+ ref: scrollRef,
1280
+ style: SCROLL_STYLE,
1281
+ children: /* @__PURE__ */ jsxDEV("div", {
1282
+ "aria-label": t("Recent logs"),
1283
+ "data-testid": "lg-table",
811
1284
  role: "grid",
812
- children: summary.byLevel.map((bucket) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
813
- bucket
814
- }, bucket.key, false))
815
- }, void 0, false)]
816
- }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
817
- children: [/* @__PURE__ */ jsxDEV("h4", {
818
- className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
819
- children: t("By function")
820
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
821
- className: "overflow-hidden rounded-lg border border-border",
822
- "data-testid": "logs-summary-paths",
823
- role: "grid",
824
- children: summary.byPath.map((bucket_0) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
825
- bucket: bucket_0
826
- }, bucket_0.key, false))
827
- }, void 0, false)]
828
- }, void 0, true)]
829
- }, void 0, true), readout === "list" && /* @__PURE__ */ jsxDEV("div", {
830
- className: "rounded-xl border border-border shadow-xs",
831
- "data-testid": "lg-scroll",
832
- ref: scrollRef,
833
- style: SCROLL_STYLE,
834
- children: /* @__PURE__ */ jsxDEV("div", {
835
- "aria-label": t("Recent logs"),
836
- "data-testid": "lg-table",
837
- role: "grid",
838
- style: gridStyle,
839
- children: virtualRows.map((virtualRow) => view === "requests" ? /* @__PURE__ */ jsxDEV(RequestRow, {
840
- entry: requests[virtualRow.index],
841
- index: virtualRow.index,
842
- measureRef: virtualizer.measureElement,
843
- start: virtualRow.start
844
- }, virtualRow.key, false) : /* @__PURE__ */ jsxDEV(LogRow, {
845
- entry: filtered[virtualRow.index],
846
- index: virtualRow.index,
847
- measureRef: virtualizer.measureElement,
848
- start: virtualRow.start
849
- }, virtualRow.key, false))
850
- }, void 0, false)
851
- }, void 0, false)]
1285
+ style: gridStyle,
1286
+ children: virtualRows.map((virtualRow) => view === "requests" ? /* @__PURE__ */ jsxDEV(RequestRow, {
1287
+ entry: requests[virtualRow.index],
1288
+ index: virtualRow.index,
1289
+ measureRef: virtualizer.measureElement,
1290
+ start: virtualRow.start
1291
+ }, virtualRow.key, false) : /* @__PURE__ */ jsxDEV(LogRow, {
1292
+ entry: filtered[virtualRow.index],
1293
+ index: virtualRow.index,
1294
+ measureRef: virtualizer.measureElement,
1295
+ start: virtualRow.start
1296
+ }, virtualRow.key, false))
1297
+ }, void 0, false)
1298
+ }, void 0, false)]
1299
+ }, void 0, true)]
852
1300
  }, void 0, true);
853
1301
  };
854
1302