nestlens 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/api/api.controller.d.ts +28 -5
  2. package/dist/api/api.controller.js +29 -9
  3. package/dist/core/alerting.service.js +37 -1
  4. package/dist/core/collector.service.d.ts +21 -0
  5. package/dist/core/collector.service.js +50 -2
  6. package/dist/core/storage/memory.storage.js +8 -1
  7. package/dist/core/storage/redis-url.d.ts +26 -0
  8. package/dist/core/storage/redis-url.js +51 -0
  9. package/dist/core/storage/redis.storage.js +10 -44
  10. package/dist/dashboard/public/assets/{BatchDetailView-DrhTmEz-.js → BatchDetailView-DZr7YDwl.js} +1 -1
  11. package/dist/dashboard/public/assets/{BatchesPage-D0OIyUR0.js → BatchesPage-2Hv2zWa4.js} +1 -1
  12. package/dist/dashboard/public/assets/{CacheDetailView-BbinMoJd.js → CacheDetailView-DGXqcx8-.js} +1 -1
  13. package/dist/dashboard/public/assets/{CachePage-BNZziysa.js → CachePage-BU15yBss.js} +1 -1
  14. package/dist/dashboard/public/assets/{CommandDetailView-cXUGT93v.js → CommandDetailView-li2tXFC7.js} +1 -1
  15. package/dist/dashboard/public/assets/{CommandsPage-DIjvN8Tm.js → CommandsPage-DaKvbjLB.js} +1 -1
  16. package/dist/dashboard/public/assets/{CopyButton-DO0tQZap.js → CopyButton-DzToeJlr.js} +1 -1
  17. package/dist/dashboard/public/assets/{DashboardPage-Bu2tjEtU.js → DashboardPage-fYcPzXMR.js} +1 -1
  18. package/dist/dashboard/public/assets/{DataTable-B5pCZtzn.js → DataTable-B_I--NVC.js} +1 -1
  19. package/dist/dashboard/public/assets/{DetailRow-CILUtuHz.js → DetailRow-Dc2FzrKz.js} +1 -1
  20. package/dist/dashboard/public/assets/{DumpDetailView-CN-92Xh3.js → DumpDetailView-BaW5Zi1h.js} +1 -1
  21. package/dist/dashboard/public/assets/{DumpsPage-XzXWa2Zx.js → DumpsPage-DmCtyQ1Q.js} +1 -1
  22. package/dist/dashboard/public/assets/{EntryDetailPage-BeNP5KQe.js → EntryDetailPage-CiECQkN4.js} +3 -3
  23. package/dist/dashboard/public/assets/{EntrySearchInput-D9Luyii-.js → EntrySearchInput-Cq-Ji-C2.js} +1 -1
  24. package/dist/dashboard/public/assets/{EventDetailView-CfROsYnP.js → EventDetailView-BPeTgmqk.js} +1 -1
  25. package/dist/dashboard/public/assets/{EventsPage-CGd4ilHn.js → EventsPage-DW1hhOrJ.js} +1 -1
  26. package/dist/dashboard/public/assets/{ExceptionDetailView-CR_YtAt5.js → ExceptionDetailView-B-V0O6G_.js} +1 -1
  27. package/dist/dashboard/public/assets/ExceptionsPage-BuAt8VvQ.js +6 -0
  28. package/dist/dashboard/public/assets/{GateDetailView-Mm2OKdJd.js → GateDetailView-Kn1IPKwS.js} +1 -1
  29. package/dist/dashboard/public/assets/{GatesPage-BDu7ZKzg.js → GatesPage-B3eMpohX.js} +1 -1
  30. package/dist/dashboard/public/assets/{GraphQLDetailView-CDCSxpoQ.js → GraphQLDetailView-uAonhJH8.js} +1 -1
  31. package/dist/dashboard/public/assets/{GraphQLPage-BFcNcF2K.js → GraphQLPage-Dv-1T6j_.js} +1 -1
  32. package/dist/dashboard/public/assets/{HttpClientDetailView-BKDaf1kG.js → HttpClientDetailView-CsBP-NRW.js} +1 -1
  33. package/dist/dashboard/public/assets/{HttpClientPage-DsLiAk3o.js → HttpClientPage-u1ZUWsG_.js} +1 -1
  34. package/dist/dashboard/public/assets/{JobDetailView-vzz_69RD.js → JobDetailView-BjtxrqrA.js} +1 -1
  35. package/dist/dashboard/public/assets/{JobsPage-DwKKclmA.js → JobsPage-DSBpskNC.js} +1 -1
  36. package/dist/dashboard/public/assets/{LogDetailView-BhtlmeVV.js → LogDetailView-C8q-I_AQ.js} +1 -1
  37. package/dist/dashboard/public/assets/{LogsPage-jIsp8Im3.js → LogsPage-CG-7wDcm.js} +1 -1
  38. package/dist/dashboard/public/assets/{MailDetailView-fyzHsAnK.js → MailDetailView-CQra2Fen.js} +1 -1
  39. package/dist/dashboard/public/assets/{MailPage-QeD7ZYIv.js → MailPage-IJnGG2Dj.js} +1 -1
  40. package/dist/dashboard/public/assets/{ModelDetailView--MfEk7iV.js → ModelDetailView-CqXFOspt.js} +1 -1
  41. package/dist/dashboard/public/assets/{ModelsPage-DcpvidHe.js → ModelsPage-BRNDZcOZ.js} +1 -1
  42. package/dist/dashboard/public/assets/{NotificationDetailView-DcSDXMCX.js → NotificationDetailView-c_SH4SBf.js} +1 -1
  43. package/dist/dashboard/public/assets/{NotificationsPage-9HLS-Dj0.js → NotificationsPage-DTpaCZD5.js} +1 -1
  44. package/dist/dashboard/public/assets/{PageHeader-BbUQ6Fod.js → PageHeader-BLRAvkWc.js} +1 -1
  45. package/dist/dashboard/public/assets/{QueriesPage-UAD6LBc3.js → QueriesPage-CObP-nH5.js} +1 -1
  46. package/dist/dashboard/public/assets/{QueryDetailView-D1TlCQwd.js → QueryDetailView-D-evIo6B.js} +1 -1
  47. package/dist/dashboard/public/assets/{RedisDetailView-yxO7EOBv.js → RedisDetailView-uM9LOGK-.js} +1 -1
  48. package/dist/dashboard/public/assets/{RedisPage-B-EnnsXI.js → RedisPage-BkBILFAA.js} +1 -1
  49. package/dist/dashboard/public/assets/{RequestDetailView-DpYYfFcS.js → RequestDetailView-Bsr5V8FV.js} +1 -1
  50. package/dist/dashboard/public/assets/{RequestsPage-DMsx7tQE.js → RequestsPage-C0ZycYjW.js} +1 -1
  51. package/dist/dashboard/public/assets/{ScheduleDetailView-t4Btd9LI.js → ScheduleDetailView-D1oDL2wj.js} +1 -1
  52. package/dist/dashboard/public/assets/{SchedulePage-CxBJpgGv.js → SchedulePage-DQzehEF6.js} +1 -1
  53. package/dist/dashboard/public/assets/{UserCard-fi9kRol2.js → UserCard-DCiq53By.js} +1 -1
  54. package/dist/dashboard/public/assets/{ViewDetailView-CX7dgrtr.js → ViewDetailView-CGYGCNEr.js} +1 -1
  55. package/dist/dashboard/public/assets/{ViewsPage-B4XLebCW.js → ViewsPage-tEd0XxCD.js} +1 -1
  56. package/dist/dashboard/public/assets/{calendar-DImlwX3C.js → calendar-Cy_qncyr.js} +1 -1
  57. package/dist/dashboard/public/assets/{circle-alert-t7DmSwSk.js → circle-alert-BCQHt4U6.js} +1 -1
  58. package/dist/dashboard/public/assets/{circle-check-big-BVE5y5eW.js → circle-check-big-CyDf-yDO.js} +1 -1
  59. package/dist/dashboard/public/assets/{circle-x-CjxRvM2o.js → circle-x-D3OiizLY.js} +1 -1
  60. package/dist/dashboard/public/assets/{eye-RW0AAbBn.js → eye-CCRjHtzP.js} +1 -1
  61. package/dist/dashboard/public/assets/index-Db_zkULa.js +361 -0
  62. package/dist/dashboard/public/assets/{search-Dx7bxjJ6.js → search-C83cbagr.js} +1 -1
  63. package/dist/dashboard/public/assets/{send-OVSDC_zi.js → send-BsoLJbNI.js} +1 -1
  64. package/dist/dashboard/public/assets/{timer-BPIGHr0_.js → timer-DP5XgATT.js} +1 -1
  65. package/dist/dashboard/public/assets/{types-zWn317o-.js → types-DOZkJpXV.js} +1 -1
  66. package/dist/dashboard/public/assets/{users-DGZXeIpK.js → users-lOn2MScD.js} +1 -1
  67. package/dist/dashboard/public/assets/{zap-BF90FAId.js → zap-CXCUXb-_.js} +1 -1
  68. package/dist/dashboard/public/index.html +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.js +0 -1
  71. package/dist/nestlens.config.d.ts +82 -5
  72. package/dist/nestlens.config.js +7 -3
  73. package/dist/nestlens.module.js +9 -2
  74. package/dist/presets.d.ts +29 -0
  75. package/dist/presets.js +78 -0
  76. package/dist/startup-summary.d.ts +15 -0
  77. package/dist/startup-summary.js +84 -0
  78. package/dist/types/entry.types.d.ts +13 -1
  79. package/dist/types/entry.types.js +33 -0
  80. package/dist/watchers/graphql/adapters/apollo.adapter.js +7 -0
  81. package/dist/watchers/graphql/adapters/base.adapter.d.ts +38 -0
  82. package/dist/watchers/graphql/adapters/base.adapter.js +50 -0
  83. package/dist/watchers/graphql/adapters/mercurius.adapter.d.ts +1 -1
  84. package/dist/watchers/graphql/adapters/mercurius.adapter.js +28 -3
  85. package/dist/watchers/graphql/field-instrumentation.d.ts +1 -1
  86. package/dist/watchers/graphql/field-instrumentation.js +12 -4
  87. package/dist/watchers/graphql/graphql.watcher.d.ts +15 -0
  88. package/dist/watchers/graphql/graphql.watcher.js +35 -0
  89. package/dist/watchers/graphql/types.d.ts +2 -0
  90. package/dist/watchers/graphql/types.js +2 -0
  91. package/dist/watchers/model.watcher.d.ts +27 -3
  92. package/dist/watchers/model.watcher.js +74 -29
  93. package/package.json +1 -1
  94. package/dist/dashboard/public/assets/ExceptionsPage-CzRqVNKO.js +0 -6
  95. package/dist/dashboard/public/assets/index-CAvLri3a.js +0 -361
@@ -167,19 +167,26 @@ export declare class NestLensApiController {
167
167
  message: string;
168
168
  }>;
169
169
  /**
170
- * Mark an entry (exception) as resolved
170
+ * Mark an entry (exception) as resolved.
171
+ *
172
+ * An entry that is not there answers 404 rather than `success: true` with
173
+ * nothing attached. Both are reachable while a page is open — pruning
174
+ * deletes by age, the store evicts by size — and the dashboard applied what
175
+ * came back to the row it clicked, so `null` reached a list update and
176
+ * failed there instead, with a message about a property of null.
171
177
  */
172
178
  resolveEntry(id: number, _res?: unknown): Promise<{
173
179
  success: boolean;
174
- data: Entry | null;
180
+ data: Entry;
175
181
  }>;
176
182
  /**
177
- * Mark an entry as unresolved
183
+ * Mark an entry as unresolved. See {@link resolveEntry} for the 404.
178
184
  */
179
185
  unresolveEntry(id: number, _res?: unknown): Promise<{
180
186
  success: boolean;
181
- data: Entry | null;
187
+ data: Entry;
182
188
  }>;
189
+ private entryOr404;
183
190
  /**
184
191
  * Pause recording
185
192
  */
@@ -203,10 +210,26 @@ export declare class NestLensApiController {
203
210
  };
204
211
  }>;
205
212
  /**
206
- * Get recording status
213
+ * Whether recording is on, and what it has been doing.
214
+ *
215
+ * The counts are here because "nothing was recorded" and "nothing happened"
216
+ * look identical on a dashboard: an application spent two days deciding
217
+ * which of the two it was looking at. Sampling and the filter each drop
218
+ * entries deliberately, and this says how many.
207
219
  */
208
220
  getRecordingStatus(_res?: unknown): Promise<{
209
221
  data: {
222
+ counts: {
223
+ recorded: number;
224
+ droppedBySampling: number;
225
+ droppedByFilter: number;
226
+ droppedByBuffer: number;
227
+ };
228
+ buffer: {
229
+ pending: number;
230
+ capacity: number;
231
+ dropped: number;
232
+ };
210
233
  isPaused: boolean;
211
234
  pausedAt?: Date;
212
235
  pauseReason?: string;
@@ -217,20 +217,30 @@ let NestLensApiController = class NestLensApiController {
217
217
  }
218
218
  // ==================== Resolution Endpoints ====================
219
219
  /**
220
- * Mark an entry (exception) as resolved
220
+ * Mark an entry (exception) as resolved.
221
+ *
222
+ * An entry that is not there answers 404 rather than `success: true` with
223
+ * nothing attached. Both are reachable while a page is open — pruning
224
+ * deletes by age, the store evicts by size — and the dashboard applied what
225
+ * came back to the row it clicked, so `null` reached a list update and
226
+ * failed there instead, with a message about a property of null.
221
227
  */
222
228
  async resolveEntry(id, _res) {
223
229
  await this.storage.resolveEntry(id);
224
- const entry = await this.storage.findById(id);
225
- return { success: true, data: entry };
230
+ return { success: true, data: this.entryOr404(await this.storage.findById(id), id) };
226
231
  }
227
232
  /**
228
- * Mark an entry as unresolved
233
+ * Mark an entry as unresolved. See {@link resolveEntry} for the 404.
229
234
  */
230
235
  async unresolveEntry(id, _res) {
231
236
  await this.storage.unresolveEntry(id);
232
- const entry = await this.storage.findById(id);
233
- return { success: true, data: entry };
237
+ return { success: true, data: this.entryOr404(await this.storage.findById(id), id) };
238
+ }
239
+ entryOr404(entry, id) {
240
+ if (!entry) {
241
+ throw exceptions_1.NestLensApiException.entryNotFound(id);
242
+ }
243
+ return entry;
234
244
  }
235
245
  // ==================== Recording Control Endpoints ====================
236
246
  /**
@@ -250,11 +260,21 @@ let NestLensApiController = class NestLensApiController {
250
260
  return { success: true, data: status };
251
261
  }
252
262
  /**
253
- * Get recording status
263
+ * Whether recording is on, and what it has been doing.
264
+ *
265
+ * The counts are here because "nothing was recorded" and "nothing happened"
266
+ * look identical on a dashboard: an application spent two days deciding
267
+ * which of the two it was looking at. Sampling and the filter each drop
268
+ * entries deliberately, and this says how many.
254
269
  */
255
270
  async getRecordingStatus(_res) {
256
- const status = this.collectorService.getRecordingStatus();
257
- return { data: status };
271
+ return {
272
+ data: {
273
+ ...this.collectorService.getRecordingStatus(),
274
+ counts: this.collectorService.getRecordingCounts(),
275
+ buffer: this.collectorService.getBufferSize(),
276
+ },
277
+ };
258
278
  }
259
279
  };
260
280
  exports.NestLensApiController = NestLensApiController;
@@ -38,6 +38,42 @@ const MAX_TIMEOUT_MS = 2 ** 31 - 1;
38
38
  * expire, and a cap alone would evict live keys under load.
39
39
  */
40
40
  const MAX_THROTTLE_KEYS = 5_000;
41
+ /**
42
+ * Whether a webhook is for this entry.
43
+ *
44
+ * `events` is a list of types, and the thing people actually want to be told
45
+ * about is *failures* — which needs a list per type plus an entry filter that
46
+ * knows the shape of each payload. An application reported reaching that at a
47
+ * hundred lines of configuration. `'failures'` says it directly.
48
+ *
49
+ * A 4xx is not a failure here: a malformed query or a bad request is the
50
+ * caller's mistake, and a webhook anyone with curl can ring is a pager anyone
51
+ * with curl can ring.
52
+ */
53
+ const announces = (events, entry) => {
54
+ if (events === 'failures')
55
+ return isFailure(entry);
56
+ return events.includes(entry.type);
57
+ };
58
+ const isFailure = (entry) => {
59
+ switch (entry.type) {
60
+ case 'exception':
61
+ return true;
62
+ case 'graphql':
63
+ return entry.payload.hasErrors === true && (entry.payload.statusCode ?? 500) >= 500;
64
+ case 'request':
65
+ return (entry.payload.statusCode ?? 0) >= 500;
66
+ case 'job':
67
+ case 'schedule':
68
+ case 'mail':
69
+ case 'notification':
70
+ return entry.payload.status === 'failed';
71
+ case 'log':
72
+ return entry.payload.level === 'error';
73
+ default:
74
+ return false;
75
+ }
76
+ };
41
77
  /**
42
78
  * Sends collected entries (exceptions by default) to Slack/Discord/generic
43
79
  * webhooks in real time. Subscribes to the collector's entry stream, so it
@@ -72,7 +108,7 @@ let AlertingService = AlertingService_1 = class AlertingService {
72
108
  async dispatch(entry) {
73
109
  const webhooks = this.config?.webhooks ?? [];
74
110
  await Promise.all(webhooks
75
- .filter((webhook) => (webhook.events ?? DEFAULT_EVENTS).includes(entry.type))
111
+ .filter((webhook) => announces(webhook.events ?? DEFAULT_EVENTS, entry))
76
112
  .filter((webhook) => !this.isThrottled(webhook, entry))
77
113
  .map((webhook) => this.send(webhook, entry)));
78
114
  }
@@ -37,6 +37,10 @@ export declare class CollectorService implements OnModuleDestroy {
37
37
  */
38
38
  private storageIsFailing;
39
39
  private droppedEntries;
40
+ /** Counted where they are decided; read by `getRecordingCounts`. */
41
+ private recordedEntries;
42
+ private droppedBySampling;
43
+ private droppedByFilter;
40
44
  private isPaused;
41
45
  private pausedAt?;
42
46
  private pauseReason?;
@@ -90,6 +94,20 @@ export declare class CollectorService implements OnModuleDestroy {
90
94
  capacity: number;
91
95
  dropped: number;
92
96
  };
97
+ /**
98
+ * What was recorded, and what was dropped on the way in.
99
+ *
100
+ * "Nothing was recorded" and "nothing happened" look identical on the
101
+ * dashboard, and an application spent two days deciding which of the two it
102
+ * was looking at. Sampling and the filter each drop entries deliberately;
103
+ * saying how many turns that question into a glance.
104
+ */
105
+ getRecordingCounts(): {
106
+ recorded: number;
107
+ droppedBySampling: number;
108
+ droppedByFilter: number;
109
+ droppedByBuffer: number;
110
+ };
93
111
  /**
94
112
  * Collect an entry
95
113
  * Uses discriminated union pattern - the type parameter determines the expected payload type
@@ -143,6 +161,9 @@ export declare class CollectorService implements OnModuleDestroy {
143
161
  /** Whether a batch is on its way to the storage. */
144
162
  private flushing?;
145
163
  private flushOnce;
164
+ /** Reported once: a callback that is wrong is wrong on every flush. */
165
+ private readonly warned;
166
+ private warnOnce;
146
167
  /**
147
168
  * Keeps the buffer within its bound, dropping the oldest entries first.
148
169
  */
@@ -72,11 +72,17 @@ let CollectorService = CollectorService_1 = class CollectorService {
72
72
  */
73
73
  this.storageIsFailing = false;
74
74
  this.droppedEntries = 0;
75
+ /** Counted where they are decided; read by `getRecordingCounts`. */
76
+ this.recordedEntries = 0;
77
+ this.droppedBySampling = 0;
78
+ this.droppedByFilter = 0;
75
79
  this.isPaused = false;
76
80
  // Real-time stream of persisted entries. Powers the SSE live-tail and the
77
81
  // alerting service. Entries are emitted after they have been saved (so they
78
82
  // carry an id), never blocking collection if a subscriber misbehaves.
79
83
  this.entrySubject = new rxjs_1.Subject();
84
+ /** Reported once: a callback that is wrong is wrong on every flush. */
85
+ this.warned = new Set();
80
86
  this.sampler = (0, sampling_1.createSampler)(this.config.sampling);
81
87
  this.startFlushTimer();
82
88
  }
@@ -146,6 +152,22 @@ let CollectorService = CollectorService_1 = class CollectorService {
146
152
  dropped: this.droppedEntries,
147
153
  };
148
154
  }
155
+ /**
156
+ * What was recorded, and what was dropped on the way in.
157
+ *
158
+ * "Nothing was recorded" and "nothing happened" look identical on the
159
+ * dashboard, and an application spent two days deciding which of the two it
160
+ * was looking at. Sampling and the filter each drop entries deliberately;
161
+ * saying how many turns that question into a glance.
162
+ */
163
+ getRecordingCounts() {
164
+ return {
165
+ recorded: this.recordedEntries,
166
+ droppedBySampling: this.droppedBySampling,
167
+ droppedByFilter: this.droppedByFilter,
168
+ droppedByBuffer: this.droppedEntries,
169
+ };
170
+ }
149
171
  /**
150
172
  * Collect an entry
151
173
  * Uses discriminated union pattern - the type parameter determines the expected payload type
@@ -171,6 +193,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
171
193
  requestId: requestId ?? (0, request_context_1.currentRequestId)(),
172
194
  };
173
195
  if (this.sampler && !this.sampler.shouldRecord(entry)) {
196
+ this.droppedBySampling += 1;
174
197
  return;
175
198
  }
176
199
  // The filter callback runs in the application's own process against its own
@@ -178,6 +201,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
178
201
  // there stored, streamed and posted to webhooks — is masked.
179
202
  const shouldCollect = await this.applyFilter(entry);
180
203
  if (!shouldCollect) {
204
+ this.droppedByFilter += 1;
181
205
  return;
182
206
  }
183
207
  try {
@@ -190,6 +214,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
190
214
  this.logger.warn(`Failed to record entry: ${error}`);
191
215
  return;
192
216
  }
217
+ this.recordedEntries += 1;
193
218
  this.enforceBufferLimit();
194
219
  // Flush if buffer is full — unless storage is already failing, in which
195
220
  // case the periodic timer retries and the caller is not made to wait.
@@ -214,15 +239,18 @@ let CollectorService = CollectorService_1 = class CollectorService {
214
239
  requestId: requestId ?? (0, request_context_1.currentRequestId)(),
215
240
  };
216
241
  if (this.sampler && !this.sampler.shouldRecord(entry)) {
242
+ this.droppedBySampling += 1;
217
243
  return null;
218
244
  }
219
245
  // Apply filter
220
246
  const shouldCollect = await this.applyFilter(entry);
221
247
  if (!shouldCollect) {
248
+ this.droppedByFilter += 1;
222
249
  return null;
223
250
  }
224
251
  try {
225
252
  const savedEntry = await this.storage.save(this.mask(entry));
253
+ this.recordedEntries += 1;
226
254
  // Apply auto-tagging and family hash after saving
227
255
  await this.applyAutoTagging(savedEntry);
228
256
  this.emit(savedEntry);
@@ -350,8 +378,22 @@ let CollectorService = CollectorService_1 = class CollectorService {
350
378
  // Apply batch filter if configured
351
379
  if (this.config.filterBatch) {
352
380
  try {
353
- const result = this.config.filterBatch(entries);
354
- entries = await (0, thenable_1.settled)(result);
381
+ const result = await (0, thenable_1.settled)(this.config.filterBatch(entries));
382
+ // A callback that returns something other than a list is the same kind
383
+ // of mistake as one that throws, and `filterBatch` is documented as
384
+ // failing open. It did the opposite: `entries` became `undefined`,
385
+ // reading its length threw out of `flush()`, and every entry in the
386
+ // batch was gone — the buffer had already been emptied. A `forEach`
387
+ // where a `filter` was meant returns `undefined`, and NestLens then
388
+ // recorded nothing at all for as long as the callback stayed.
389
+ if (Array.isArray(result)) {
390
+ entries = result;
391
+ }
392
+ else {
393
+ this.warnOnce('filter-batch-shape', `\`filterBatch\` returned ${result === null ? 'null' : typeof result} rather than an ` +
394
+ 'array of entries, so it was ignored and every entry kept. Return the entries to ' +
395
+ 'keep — an empty array keeps none.');
396
+ }
355
397
  }
356
398
  catch (error) {
357
399
  this.logger.warn(`Batch filter callback error: ${error}`);
@@ -387,6 +429,12 @@ let CollectorService = CollectorService_1 = class CollectorService {
387
429
  this.enforceBufferLimit();
388
430
  }
389
431
  }
432
+ warnOnce(key, message) {
433
+ if (this.warned.has(key))
434
+ return;
435
+ this.warned.add(key);
436
+ this.logger.warn(message);
437
+ }
390
438
  /**
391
439
  * Keeps the buffer within its bound, dropping the oldest entries first.
392
440
  */
@@ -33,7 +33,7 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
33
33
  // Monitored tags
34
34
  this.monitoredTags = new Map();
35
35
  this.nextMonitoredTagId = 1;
36
- this.maxEntries = config.maxEntries ?? 10000;
36
+ this.maxEntries = Math.max(0, config.maxEntries ?? 10000);
37
37
  }
38
38
  async initialize() {
39
39
  this.logger.log(`In-memory storage initialized (maxEntries: ${this.maxEntries})`);
@@ -503,6 +503,13 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
503
503
  * cannot drift.
504
504
  */
505
505
  enforceMaxEntries() {
506
+ // `0` is no ceiling, which is what the option documents and what the other
507
+ // two drivers do with it. Read as a limit it meant the opposite — the
508
+ // store evicted every entry as it arrived, so an application that asked to
509
+ // keep everything recorded nothing: 250 entries in, 0 kept, while SQLite
510
+ // kept all 250 from the same setting.
511
+ if (this.maxEntries <= 0)
512
+ return;
506
513
  while (this.entries.size > this.maxEntries) {
507
514
  while (this.oldestId < this.nextId && !this.entries.has(this.oldestId)) {
508
515
  this.oldestId += 1;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The connection URL with the configured database in it.
3
+ *
4
+ * `url` and `db` look additive — the URL for where the server is, `db` for
5
+ * which database — and they are not: ioredis takes the database from the URL's
6
+ * path and ignores the option beside it. Measured against ioredis:
7
+ * `new Redis('redis://127.0.0.1:6379/0', { db: 9 })` connects to 0.
8
+ *
9
+ * So an application that configured
10
+ *
11
+ * ```ts
12
+ * redis: { url: process.env.REDIS_URL, db: 1, keyPrefix: 'nestlens:' }
13
+ * ```
14
+ *
15
+ * wrote every entry into database 0, silently — reported by a deployment that
16
+ * found it by asking Redis. `keyPrefix` keeps the keys apart from the
17
+ * application's own, but `FLUSHDB` does not, and neither does an eviction
18
+ * policy: under `allkeys-lru` the entries and the application's cache compete
19
+ * for the same memory and evict each other.
20
+ *
21
+ * The setting is honoured instead of ignored: the database goes into the URL,
22
+ * which is the one place ioredis reads it from. Where the URL already names a
23
+ * different one, that is a configuration disagreeing with itself and it is
24
+ * said out loud rather than resolved quietly.
25
+ */
26
+ export declare const withDatabase: (url: string, db: number | undefined) => string;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withDatabase = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const logger = new common_1.Logger('RedisStorage');
6
+ /**
7
+ * The connection URL with the configured database in it.
8
+ *
9
+ * `url` and `db` look additive — the URL for where the server is, `db` for
10
+ * which database — and they are not: ioredis takes the database from the URL's
11
+ * path and ignores the option beside it. Measured against ioredis:
12
+ * `new Redis('redis://127.0.0.1:6379/0', { db: 9 })` connects to 0.
13
+ *
14
+ * So an application that configured
15
+ *
16
+ * ```ts
17
+ * redis: { url: process.env.REDIS_URL, db: 1, keyPrefix: 'nestlens:' }
18
+ * ```
19
+ *
20
+ * wrote every entry into database 0, silently — reported by a deployment that
21
+ * found it by asking Redis. `keyPrefix` keeps the keys apart from the
22
+ * application's own, but `FLUSHDB` does not, and neither does an eviction
23
+ * policy: under `allkeys-lru` the entries and the application's cache compete
24
+ * for the same memory and evict each other.
25
+ *
26
+ * The setting is honoured instead of ignored: the database goes into the URL,
27
+ * which is the one place ioredis reads it from. Where the URL already names a
28
+ * different one, that is a configuration disagreeing with itself and it is
29
+ * said out loud rather than resolved quietly.
30
+ */
31
+ const withDatabase = (url, db) => {
32
+ if (db === undefined)
33
+ return url;
34
+ let parsed;
35
+ try {
36
+ parsed = new URL(url);
37
+ }
38
+ catch {
39
+ // Not a URL this can read — ioredis has its own parser and may well
40
+ // accept it, so it is passed on untouched rather than refused here.
41
+ return url;
42
+ }
43
+ const inUrl = parsed.pathname.replace(/^\//, '');
44
+ if (inUrl.length > 0 && inUrl !== String(db)) {
45
+ logger.warn(`storage.redis.url names database ${inUrl} and storage.redis.db says ${db}. ` +
46
+ `Using ${db}; remove one of them so the configuration says one thing.`);
47
+ }
48
+ parsed.pathname = `/${db}`;
49
+ return parsed.toString();
50
+ };
51
+ exports.withDatabase = withDatabase;
@@ -45,9 +45,11 @@ var RedisStorage_1;
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.RedisStorage = void 0;
47
47
  const common_1 = require("@nestjs/common");
48
+ const types_1 = require("../../types");
48
49
  const entry_filter_1 = require("./entry-filter");
49
50
  const tag_normalization_1 = require("./tag-normalization");
50
51
  const serialize_payload_1 = require("./serialize-payload");
52
+ const redis_url_1 = require("./redis-url");
51
53
  /**
52
54
  * Redis storage implementation for NestLens.
53
55
  * Requires ioredis to be installed.
@@ -138,7 +140,7 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
138
140
  const { default: RedisClient } = await Promise.resolve().then(() => __importStar(require('ioredis')));
139
141
  const commandTimeout = this.config.commandTimeout ?? 5000;
140
142
  const client = this.config.url
141
- ? new RedisClient(this.config.url, { commandTimeout })
143
+ ? new RedisClient((0, redis_url_1.withDatabase)(this.config.url, this.config.db), { commandTimeout })
142
144
  : new RedisClient({
143
145
  host: this.config.host ?? 'localhost',
144
146
  port: this.config.port ?? 6379,
@@ -699,28 +701,10 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
699
701
  return client.zcount(key, `(${sequence}`, '+inf');
700
702
  }
701
703
  async getStats() {
702
- // Get counts by type
703
- const types = [
704
- 'request',
705
- 'query',
706
- 'exception',
707
- 'log',
708
- 'cache',
709
- 'event',
710
- 'job',
711
- 'schedule',
712
- 'mail',
713
- 'http-client',
714
- 'redis',
715
- 'model',
716
- 'notification',
717
- 'view',
718
- 'command',
719
- 'gate',
720
- 'batch',
721
- 'dump',
722
- ];
723
- const { byType, total } = await this.countByType(types);
704
+ // Every type there is, from the one list that defines them. Written out
705
+ // here, this fell one behind the union — `graphql` was missing, so those
706
+ // entries were invisible to stats however many the store held.
707
+ const { byType, total } = await this.countByType([...types_1.ENTRY_TYPES]);
724
708
  const [unresolvedExceptions, slowQueries, avgResponseTime] = await Promise.all([
725
709
  this.countUnresolvedExceptions(),
726
710
  this.countSlowQueries(),
@@ -807,27 +791,9 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
807
791
  }
808
792
  async getStorageStats() {
809
793
  const client = this.getClient();
810
- const types = [
811
- 'request',
812
- 'query',
813
- 'exception',
814
- 'log',
815
- 'cache',
816
- 'event',
817
- 'job',
818
- 'schedule',
819
- 'mail',
820
- 'http-client',
821
- 'redis',
822
- 'model',
823
- 'notification',
824
- 'view',
825
- 'command',
826
- 'gate',
827
- 'batch',
828
- 'dump',
829
- ];
830
- const { byType, total } = await this.countByType(types);
794
+ // The same one list, for the same reason: written out here, this was the
795
+ // second place `graphql` was missing from.
796
+ const { byType, total } = await this.countByType([...types_1.ENTRY_TYPES]);
831
797
  const [oldest, newest] = await client
832
798
  .pipeline()
833
799
  .zrange(this.key('entries', 'all'), 0, 0)
@@ -1 +1 @@
1
- import{j as e,L as o,A as y,C as u}from"./index-CAvLri3a.js";import{p as n,f as v}from"./date-Dwgqy666.js";import{D as r,f as k}from"./DetailRow-CILUtuHz.js";import{C as m}from"./types-zWn317o-.js";import{C as w}from"./CopyButton-DO0tQZap.js";import{C as g}from"./circle-x-CjxRvM2o.js";import{C as j}from"./circle-alert-t7DmSwSk.js";import{C}from"./circle-check-big-BVE5y5eW.js";import"./vendor-DBTT3jXp.js";import"./EntryDetailPage-BeNP5KQe.js";import"./search-Dx7bxjJ6.js";const p={completed:{icon:C,color:"text-green-500",bg:"bg-green-100 dark:bg-green-900/30"},partial:{icon:j,color:"text-yellow-500",bg:"bg-yellow-100 dark:bg-yellow-900/30"},failed:{icon:g,color:"text-red-500",bg:"bg-red-100 dark:bg-red-900/30"}};function h(a){return a?a<1024?`${a}B`:a<1024*1024?`${(a/1024).toFixed(1)}KB`:a<1024*1024*1024?`${(a/(1024*1024)).toFixed(1)}MB`:`${(a/(1024*1024*1024)).toFixed(1)}GB`:"-"}function E({entry:a}){const{payload:s,createdAt:c}=a,t=p[s.status]||p.completed,f=t.icon,{processedItems:x,totalItems:d,failedItems:l}=s,i=d>0?Math.round(x/d*100):0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:`p-2 ${t.bg} rounded-lg`,children:e.jsx(o,{className:`h-5 w-5 ${t.color}`})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white font-mono",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Batch Operation"})]})]}),e.jsx(w,{text:s.name,label:"Copy batch name"})]})}),e.jsxs("div",{className:`grid ${s.memory!==void 0?"grid-cols-2 md:grid-cols-5":"grid-cols-2 md:grid-cols-4"} divide-x divide-gray-200 dark:divide-gray-700`,children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Status"})]}),e.jsx("p",{className:`text-lg font-bold ${t.color}`,children:s.status.toUpperCase()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(y,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Progress"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[i,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"%"})]})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(u,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Duration"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[s.duration,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"ms"})]})]}),l>0&&e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(g,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Failed"})]}),e.jsx("p",{className:"text-lg font-bold text-red-600 dark:text-red-400",children:l})]}),s.memory!==void 0&&e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(o,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Memory"})]}),e.jsx("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:h(s.memory)})]})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Details"})}),e.jsx("div",{className:"p-4",children:e.jsxs("dl",{className:"divide-y-0",children:[e.jsx(r,{label:"Time",value:e.jsxs("span",{children:[k(n(c),"MMMM do yyyy, h:mm:ss a")," ",e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",v(n(c),{addSuffix:!0}),")"]})]})}),e.jsx(r,{label:"Name",value:e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white",children:s.name})}),s.operation&&e.jsx(r,{label:"Operation",value:e.jsx(m,{listType:"batches",filterType:"operations",filterValue:s.operation,children:s.operation})}),e.jsx(r,{label:"Status",value:e.jsx(m,{listType:"batches",filterType:"statuses",filterValue:s.status,children:s.status.toUpperCase()})}),e.jsx(r,{label:"Progress",value:e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-mono",children:[x," / ",d," (",i,"%)"]}),e.jsx("div",{className:"mt-2 w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:e.jsx("div",{className:"bg-blue-600 dark:bg-blue-500 h-2 rounded-full transition-all",style:{width:`${i}%`}})})]})}),l>0&&e.jsx(r,{label:"Failed Items",value:e.jsx("span",{className:"text-red-600 dark:text-red-400 font-mono",children:l})}),e.jsx(r,{label:"Duration",value:`${s.duration}ms`}),s.batchSize&&e.jsx(r,{label:"Batch Size",value:s.batchSize}),s.memory!==void 0&&e.jsx(r,{label:"Memory",value:h(s.memory)})]})})]}),s.errors&&s.errors.length>0&&e.jsxs("div",{className:"card border-red-200 dark:border-red-800",children:[e.jsx("div",{className:"px-4 py-3 border-b border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(j,{className:"h-5 w-5 text-red-500"}),e.jsxs("h2",{className:"text-lg font-semibold text-red-700 dark:text-red-400",children:["Errors (",s.errors.length,")"]})]})}),e.jsx("div",{className:"divide-y divide-red-200 dark:divide-red-800",children:s.errors.map((N,b)=>e.jsx("div",{className:"p-4 bg-red-50/50 dark:bg-red-900/10",children:e.jsx("pre",{className:"text-sm text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap overflow-x-auto",children:N})},b))})]})]})}export{E as default};
1
+ import{j as e,L as o,A as y,C as u}from"./index-Db_zkULa.js";import{p as n,f as v}from"./date-Dwgqy666.js";import{D as r,f as k}from"./DetailRow-Dc2FzrKz.js";import{C as m}from"./types-DOZkJpXV.js";import{C as w}from"./CopyButton-DzToeJlr.js";import{C as g}from"./circle-x-D3OiizLY.js";import{C as j}from"./circle-alert-BCQHt4U6.js";import{C}from"./circle-check-big-CyDf-yDO.js";import"./vendor-DBTT3jXp.js";import"./EntryDetailPage-CiECQkN4.js";import"./search-C83cbagr.js";const p={completed:{icon:C,color:"text-green-500",bg:"bg-green-100 dark:bg-green-900/30"},partial:{icon:j,color:"text-yellow-500",bg:"bg-yellow-100 dark:bg-yellow-900/30"},failed:{icon:g,color:"text-red-500",bg:"bg-red-100 dark:bg-red-900/30"}};function h(a){return a?a<1024?`${a}B`:a<1024*1024?`${(a/1024).toFixed(1)}KB`:a<1024*1024*1024?`${(a/(1024*1024)).toFixed(1)}MB`:`${(a/(1024*1024*1024)).toFixed(1)}GB`:"-"}function E({entry:a}){const{payload:s,createdAt:c}=a,t=p[s.status]||p.completed,f=t.icon,{processedItems:x,totalItems:d,failedItems:l}=s,i=d>0?Math.round(x/d*100):0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:`p-2 ${t.bg} rounded-lg`,children:e.jsx(o,{className:`h-5 w-5 ${t.color}`})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white font-mono",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Batch Operation"})]})]}),e.jsx(w,{text:s.name,label:"Copy batch name"})]})}),e.jsxs("div",{className:`grid ${s.memory!==void 0?"grid-cols-2 md:grid-cols-5":"grid-cols-2 md:grid-cols-4"} divide-x divide-gray-200 dark:divide-gray-700`,children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Status"})]}),e.jsx("p",{className:`text-lg font-bold ${t.color}`,children:s.status.toUpperCase()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(y,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Progress"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[i,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"%"})]})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(u,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Duration"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[s.duration,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"ms"})]})]}),l>0&&e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(g,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Failed"})]}),e.jsx("p",{className:"text-lg font-bold text-red-600 dark:text-red-400",children:l})]}),s.memory!==void 0&&e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(o,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Memory"})]}),e.jsx("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:h(s.memory)})]})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Details"})}),e.jsx("div",{className:"p-4",children:e.jsxs("dl",{className:"divide-y-0",children:[e.jsx(r,{label:"Time",value:e.jsxs("span",{children:[k(n(c),"MMMM do yyyy, h:mm:ss a")," ",e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",v(n(c),{addSuffix:!0}),")"]})]})}),e.jsx(r,{label:"Name",value:e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white",children:s.name})}),s.operation&&e.jsx(r,{label:"Operation",value:e.jsx(m,{listType:"batches",filterType:"operations",filterValue:s.operation,children:s.operation})}),e.jsx(r,{label:"Status",value:e.jsx(m,{listType:"batches",filterType:"statuses",filterValue:s.status,children:s.status.toUpperCase()})}),e.jsx(r,{label:"Progress",value:e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-mono",children:[x," / ",d," (",i,"%)"]}),e.jsx("div",{className:"mt-2 w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:e.jsx("div",{className:"bg-blue-600 dark:bg-blue-500 h-2 rounded-full transition-all",style:{width:`${i}%`}})})]})}),l>0&&e.jsx(r,{label:"Failed Items",value:e.jsx("span",{className:"text-red-600 dark:text-red-400 font-mono",children:l})}),e.jsx(r,{label:"Duration",value:`${s.duration}ms`}),s.batchSize&&e.jsx(r,{label:"Batch Size",value:s.batchSize}),s.memory!==void 0&&e.jsx(r,{label:"Memory",value:h(s.memory)})]})})]}),s.errors&&s.errors.length>0&&e.jsxs("div",{className:"card border-red-200 dark:border-red-800",children:[e.jsx("div",{className:"px-4 py-3 border-b border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(j,{className:"h-5 w-5 text-red-500"}),e.jsxs("h2",{className:"text-lg font-semibold text-red-700 dark:text-red-400",children:["Errors (",s.errors.length,")"]})]})}),e.jsx("div",{className:"divide-y divide-red-200 dark:divide-red-800",children:s.errors.map((N,b)=>e.jsx("div",{className:"p-4 bg-red-50/50 dark:bg-red-900/10",children:e.jsx("pre",{className:"text-sm text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap overflow-x-auto",children:N})},b))})]})]})}export{E as default};
@@ -1 +1 @@
1
- import{j as t,L as d}from"./index-CAvLri3a.js";import{e as B,b as D}from"./vendor-DBTT3jXp.js";import{f as T,p as A}from"./date-Dwgqy666.js";import{u as L,a as I,P as $,R as H,N as S,L as W}from"./PageHeader-BbUQ6Fod.js";import{u as q,q as O,C as c}from"./types-zWn317o-.js";import{T as s,D as U,b as z}from"./DataTable-B5pCZtzn.js";import"./timer-BPIGHr0_.js";function Z(){const h=B(),{addFilter:o,clearAll:u,serverFilters:p,headerFilters:x}=q("batches"),{rangeFilters:m,windowMinutes:g}=L(),{entries:y,loading:f,refreshing:i,error:j,refresh:b,newEntriesCount:C,hasMore:k,loadMore:w,loadNew:N,autoRefreshEnabled:E,live:v,setAutoRefresh:R,meta:n,isHighlighted:F}=I({type:"batch",limit:50,filters:{...p,...m},windowMinutes:g}),l=y.filter(e=>O(e)),M=D.useMemo(()=>[{key:"name",header:"Name",minWidth:"200px",render:e=>t.jsx(s,{mono:!0,truncate:!0,maxWidth:"250px",children:e.payload.name})},{key:"operation",header:"Operation",width:"150px",render:e=>{const a=e.payload.operation;return a?t.jsx(c,{onClick:r=>{r.stopPropagation(),o("operations",a)},children:a}):t.jsx(s,{secondary:!0,children:"-"})}},{key:"progress",header:"Progress",width:"150px",render:e=>{const{processedItems:a,totalItems:r}=e.payload,P=r>0?Math.round(a/r*100):0;return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(s,{children:`${a}/${r}`}),t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",P,"%)"]})]})}},{key:"status",header:"Status",width:"120px",render:e=>t.jsx(c,{onClick:a=>{a.stopPropagation(),o("statuses",e.payload.status)},children:e.payload.status.toUpperCase()})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>e.payload.duration?t.jsx(U,{ms:e.payload.duration}):t.jsx(s,{secondary:!0,children:"-"})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>t.jsx(s,{secondary:!0,className:"text-xs",children:T(A(e.createdAt),{addSuffix:!0})})}],[o]);return f&&l.length===0?t.jsx("div",{className:"flex items-center justify-center h-64",role:"status","aria-label":"Loading...",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):t.jsxs("div",{children:[t.jsx($,{title:"Batches",icon:d,iconColor:"text-blue-600 dark:text-blue-400",count:l.length,totalCount:n==null?void 0:n.total,refreshing:i,autoRefreshEnabled:E,live:v,onAutoRefreshToggle:R,filters:x,filterControls:t.jsx(H,{route:"batches"}),onClearAllFilters:u}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(S,{count:C,onClick:N,loading:i}),t.jsx(z,{columns:M,data:l,keyExtractor:e=>e.id,onRowClick:e=>h(`/batches/${e.id}`),rowClassName:e=>F(e.id)?"highlight-new":"",emptyMessage:"No batch operations recorded yet",error:j,onRetry:b,emptyIcon:t.jsx(d,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),t.jsx(W,{hasMore:k,onClick:w,loading:i})]})]})}export{Z as default};
1
+ import{j as t,L as d}from"./index-Db_zkULa.js";import{e as B,b as D}from"./vendor-DBTT3jXp.js";import{f as T,p as A}from"./date-Dwgqy666.js";import{u as L,a as I,P as $,R as H,N as S,L as W}from"./PageHeader-BLRAvkWc.js";import{u as q,q as O,C as c}from"./types-DOZkJpXV.js";import{T as s,D as U,b as z}from"./DataTable-B_I--NVC.js";import"./timer-DP5XgATT.js";function Z(){const h=B(),{addFilter:o,clearAll:u,serverFilters:p,headerFilters:x}=q("batches"),{rangeFilters:m,windowMinutes:g}=L(),{entries:y,loading:f,refreshing:i,error:j,refresh:b,newEntriesCount:C,hasMore:k,loadMore:w,loadNew:N,autoRefreshEnabled:E,live:v,setAutoRefresh:R,meta:n,isHighlighted:F}=I({type:"batch",limit:50,filters:{...p,...m},windowMinutes:g}),l=y.filter(e=>O(e)),M=D.useMemo(()=>[{key:"name",header:"Name",minWidth:"200px",render:e=>t.jsx(s,{mono:!0,truncate:!0,maxWidth:"250px",children:e.payload.name})},{key:"operation",header:"Operation",width:"150px",render:e=>{const a=e.payload.operation;return a?t.jsx(c,{onClick:r=>{r.stopPropagation(),o("operations",a)},children:a}):t.jsx(s,{secondary:!0,children:"-"})}},{key:"progress",header:"Progress",width:"150px",render:e=>{const{processedItems:a,totalItems:r}=e.payload,P=r>0?Math.round(a/r*100):0;return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(s,{children:`${a}/${r}`}),t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",P,"%)"]})]})}},{key:"status",header:"Status",width:"120px",render:e=>t.jsx(c,{onClick:a=>{a.stopPropagation(),o("statuses",e.payload.status)},children:e.payload.status.toUpperCase()})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>e.payload.duration?t.jsx(U,{ms:e.payload.duration}):t.jsx(s,{secondary:!0,children:"-"})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>t.jsx(s,{secondary:!0,className:"text-xs",children:T(A(e.createdAt),{addSuffix:!0})})}],[o]);return f&&l.length===0?t.jsx("div",{className:"flex items-center justify-center h-64",role:"status","aria-label":"Loading...",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):t.jsxs("div",{children:[t.jsx($,{title:"Batches",icon:d,iconColor:"text-blue-600 dark:text-blue-400",count:l.length,totalCount:n==null?void 0:n.total,refreshing:i,autoRefreshEnabled:E,live:v,onAutoRefreshToggle:R,filters:x,filterControls:t.jsx(H,{route:"batches"}),onClearAllFilters:u}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(S,{count:C,onClick:N,loading:i}),t.jsx(z,{columns:M,data:l,keyExtractor:e=>e.id,onRowClick:e=>h(`/batches/${e.id}`),rowClassName:e=>F(e.id)?"highlight-new":"",emptyMessage:"No batch operations recorded yet",error:j,onRetry:b,emptyIcon:t.jsx(d,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),t.jsx(W,{hasMore:k,onClick:w,loading:i})]})]})}export{Z as default};
@@ -1,4 +1,4 @@
1
- import{c as h,j as e,D as d,C as g}from"./index-CAvLri3a.js";import{p as o,f as p}from"./date-Dwgqy666.js";import{D as t,f as b}from"./DetailRow-CILUtuHz.js";import{C as x}from"./types-zWn317o-.js";import{u as j,C as y,T as f}from"./EntryDetailPage-BeNP5KQe.js";import{C as u}from"./CopyButton-DO0tQZap.js";import{C as N}from"./circle-check-big-BVE5y5eW.js";import{C as v}from"./circle-x-CjxRvM2o.js";import{T as k}from"./timer-BPIGHr0_.js";import"./vendor-DBTT3jXp.js";import"./search-Dx7bxjJ6.js";/**
1
+ import{c as h,j as e,D as d,C as g}from"./index-Db_zkULa.js";import{p as o,f as p}from"./date-Dwgqy666.js";import{D as t,f as b}from"./DetailRow-Dc2FzrKz.js";import{C as x}from"./types-DOZkJpXV.js";import{u as j,C as y,T as f}from"./EntryDetailPage-CiECQkN4.js";import{C as u}from"./CopyButton-DzToeJlr.js";import{C as N}from"./circle-check-big-CyDf-yDO.js";import{C as v}from"./circle-x-D3OiizLY.js";import{T as k}from"./timer-DP5XgATT.js";import"./vendor-DBTT3jXp.js";import"./search-C83cbagr.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as a,H as o}from"./index-CAvLri3a.js";import{e as R,b as v}from"./vendor-DBTT3jXp.js";import{f as D,p as F}from"./date-Dwgqy666.js";import{u as M,a as A,P as H,R as P,N as B,L as I}from"./PageHeader-BbUQ6Fod.js";import{u as L,f as S,C as n}from"./types-zWn317o-.js";import{T as i,D as W,b as K}from"./DataTable-B5pCZtzn.js";import"./timer-BPIGHr0_.js";function Q(){const l=R(),{clearAll:d,serverFilters:c,headerFilters:h}=L("cache"),{rangeFilters:u,windowMinutes:p}=M(),{entries:x,loading:m,refreshing:t,error:y,refresh:g,newEntriesCount:f,hasMore:j,loadMore:C,loadNew:k,autoRefreshEnabled:w,live:N,setAutoRefresh:b,meta:r,isHighlighted:T}=A({type:"cache",limit:50,filters:{...c,...u},windowMinutes:p}),s=x.filter(e=>S(e)),E=v.useMemo(()=>[{key:"operation",header:"Operation",width:"100px",render:e=>a.jsx(n,{listType:"cache",filterType:"operations",children:e.payload.operation})},{key:"key",header:"Key",minWidth:"200px",render:e=>a.jsx(i,{mono:!0,truncate:!0,maxWidth:"400px",children:e.payload.key.length>50?e.payload.key.substring(0,50)+"...":e.payload.key})},{key:"result",header:"Result",width:"80px",align:"center",render:e=>e.payload.operation==="get"?a.jsx(n,{listType:"cache",filterType:"tags",filterValue:e.payload.hit?"hit":"miss",children:e.payload.hit?"HIT":"MISS"}):a.jsx(i,{secondary:!0,children:"—"})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>a.jsx(W,{ms:e.payload.duration||0})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(i,{secondary:!0,className:"text-xs",children:D(F(e.createdAt),{addSuffix:!0})})}],[]);return m&&s.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",role:"status","aria-label":"Loading...",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):a.jsxs("div",{children:[a.jsx(H,{title:"Cache",icon:o,iconColor:"text-cyan-600 dark:text-cyan-400",count:s.length,totalCount:r==null?void 0:r.total,refreshing:t,autoRefreshEnabled:w,live:N,onAutoRefreshToggle:b,filters:h,filterControls:a.jsx(P,{route:"cache"}),onClearAllFilters:d}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(B,{count:f,onClick:k,loading:t}),a.jsx(K,{columns:E,data:s,keyExtractor:e=>e.id,onRowClick:e=>l(`/cache/${e.id}`),rowClassName:e=>T(e.id)?"highlight-new":"",emptyMessage:"No cache operations recorded yet",error:y,onRetry:g,emptyIcon:a.jsx(o,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(I,{hasMore:j,onClick:C,loading:t})]})]})}export{Q as default};
1
+ import{j as a,H as o}from"./index-Db_zkULa.js";import{e as R,b as v}from"./vendor-DBTT3jXp.js";import{f as D,p as F}from"./date-Dwgqy666.js";import{u as M,a as A,P as H,R as P,N as B,L as I}from"./PageHeader-BLRAvkWc.js";import{u as L,f as S,C as n}from"./types-DOZkJpXV.js";import{T as i,D as W,b as K}from"./DataTable-B_I--NVC.js";import"./timer-DP5XgATT.js";function Q(){const l=R(),{clearAll:d,serverFilters:c,headerFilters:h}=L("cache"),{rangeFilters:u,windowMinutes:p}=M(),{entries:x,loading:m,refreshing:t,error:y,refresh:g,newEntriesCount:f,hasMore:j,loadMore:C,loadNew:k,autoRefreshEnabled:w,live:N,setAutoRefresh:b,meta:r,isHighlighted:T}=A({type:"cache",limit:50,filters:{...c,...u},windowMinutes:p}),s=x.filter(e=>S(e)),E=v.useMemo(()=>[{key:"operation",header:"Operation",width:"100px",render:e=>a.jsx(n,{listType:"cache",filterType:"operations",children:e.payload.operation})},{key:"key",header:"Key",minWidth:"200px",render:e=>a.jsx(i,{mono:!0,truncate:!0,maxWidth:"400px",children:e.payload.key.length>50?e.payload.key.substring(0,50)+"...":e.payload.key})},{key:"result",header:"Result",width:"80px",align:"center",render:e=>e.payload.operation==="get"?a.jsx(n,{listType:"cache",filterType:"tags",filterValue:e.payload.hit?"hit":"miss",children:e.payload.hit?"HIT":"MISS"}):a.jsx(i,{secondary:!0,children:"—"})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>a.jsx(W,{ms:e.payload.duration||0})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(i,{secondary:!0,className:"text-xs",children:D(F(e.createdAt),{addSuffix:!0})})}],[]);return m&&s.length===0?a.jsx("div",{className:"flex items-center justify-center h-64",role:"status","aria-label":"Loading...",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary-600"})}):a.jsxs("div",{children:[a.jsx(H,{title:"Cache",icon:o,iconColor:"text-cyan-600 dark:text-cyan-400",count:s.length,totalCount:r==null?void 0:r.total,refreshing:t,autoRefreshEnabled:w,live:N,onAutoRefreshToggle:b,filters:h,filterControls:a.jsx(P,{route:"cache"}),onClearAllFilters:d}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(B,{count:f,onClick:k,loading:t}),a.jsx(K,{columns:E,data:s,keyExtractor:e=>e.id,onRowClick:e=>l(`/cache/${e.id}`),rowClassName:e=>T(e.id)?"highlight-new":"",emptyMessage:"No cache operations recorded yet",error:y,onRetry:g,emptyIcon:a.jsx(o,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(I,{hasMore:j,onClick:C,loading:t})]})]})}export{Q as default};
@@ -1 +1 @@
1
- import{j as e,b as m,C as p}from"./index-CAvLri3a.js";import{b as v}from"./vendor-DBTT3jXp.js";import{p as h,f as N}from"./date-Dwgqy666.js";import{D as t,f as k}from"./DetailRow-CILUtuHz.js";import{C as b}from"./types-zWn317o-.js";import{u as c,C as n,T as C}from"./EntryDetailPage-BeNP5KQe.js";import{C as T}from"./CopyButton-DO0tQZap.js";import{C as w}from"./circle-check-big-BVE5y5eW.js";import{C as g}from"./circle-x-CjxRvM2o.js";import"./search-Dx7bxjJ6.js";function I({entry:u}){const{payload:a,createdAt:x}=u,d=c(),l=c(),o=c(),[i,j]=v.useState("payload"),r=a.status==="completed"?{icon:w,color:"text-green-500",bg:"bg-green-100 dark:bg-green-900/30"}:a.status==="executing"?{icon:p,color:"text-blue-500",bg:"bg-blue-100 dark:bg-blue-900/30"}:{icon:g,color:"text-red-500",bg:"bg-red-100 dark:bg-red-900/30"},y=r.icon,s=[];a.payload!==void 0&&s.push({id:"payload",label:"Payload",content:e.jsx(n,{data:a.payload,toolbarState:d.state,searchBar:d.SearchBar,maxHeight:400})}),a.result!==void 0&&s.push({id:"result",label:"Result",content:e.jsx(n,{data:a.result,toolbarState:l.state,searchBar:l.SearchBar,maxHeight:400})}),a.metadata!==void 0&&s.push({id:"metadata",label:"Metadata",content:e.jsx(n,{data:a.metadata,toolbarState:o.state,searchBar:o.SearchBar,maxHeight:400})});const f=()=>{if(i==="payload"&&a.payload!==void 0)return e.jsx(d.Toolbar,{data:a.payload});if(i==="result"&&a.result!==void 0)return e.jsx(l.Toolbar,{data:a.result});if(i==="metadata"&&a.metadata!==void 0)return e.jsx(o.Toolbar,{data:a.metadata})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:`p-2 ${r.bg} rounded-lg`,children:e.jsx(m,{className:`h-5 w-5 ${r.color}`})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white font-mono",children:a.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Command Execution"})]})]}),e.jsx(T,{text:a.name,label:"Copy command"})]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(m,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Command"})]}),e.jsx("p",{className:"text-lg font-bold text-gray-900 dark:text-white font-mono truncate",title:a.name,children:a.name})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(y,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Status"})]}),e.jsx("p",{className:`text-lg font-bold ${r.color}`,children:a.status.toUpperCase()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(p,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Duration"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[a.duration,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"ms"})]})]})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Details"})}),e.jsx("div",{className:"p-4",children:e.jsxs("dl",{className:"divide-y-0",children:[e.jsx(t,{label:"Time",value:e.jsxs("span",{children:[k(h(x),"MMMM do yyyy, h:mm:ss a")," ",e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",N(h(x),{addSuffix:!0}),")"]})]})}),e.jsx(t,{label:"Command",value:e.jsx(b,{listType:"commands",filterType:"names",filterValue:a.name,children:a.name})}),a.handler&&e.jsx(t,{label:"Handler",value:e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white",children:a.handler})}),e.jsx(t,{label:"Status",value:e.jsx(b,{listType:"commands",filterType:"statuses",filterValue:a.status,children:a.status.toUpperCase()})}),e.jsx(t,{label:"Duration",value:a.duration!==void 0?`${a.duration}ms`:"-"})]})})]}),a.error&&e.jsxs("div",{className:"card border-red-200 dark:border-red-800",children:[e.jsx("div",{className:"px-4 py-3 border-b border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(g,{className:"h-5 w-5 text-red-500"}),e.jsx("h2",{className:"text-lg font-semibold text-red-700 dark:text-red-400",children:"Error"})]})}),e.jsx("div",{className:"p-4 bg-red-50/50 dark:bg-red-900/10",children:e.jsx("pre",{className:"text-sm text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap overflow-x-auto",children:a.error})})]}),s.length>0&&e.jsx(C,{tabs:s,defaultTab:"payload",hashKey:"command",headerRight:f(),onTabChange:j})]})}export{I as default};
1
+ import{j as e,b as m,C as p}from"./index-Db_zkULa.js";import{b as v}from"./vendor-DBTT3jXp.js";import{p as h,f as N}from"./date-Dwgqy666.js";import{D as t,f as k}from"./DetailRow-Dc2FzrKz.js";import{C as b}from"./types-DOZkJpXV.js";import{u as c,C as n,T as C}from"./EntryDetailPage-CiECQkN4.js";import{C as T}from"./CopyButton-DzToeJlr.js";import{C as w}from"./circle-check-big-CyDf-yDO.js";import{C as g}from"./circle-x-D3OiizLY.js";import"./search-C83cbagr.js";function I({entry:u}){const{payload:a,createdAt:x}=u,d=c(),l=c(),o=c(),[i,j]=v.useState("payload"),r=a.status==="completed"?{icon:w,color:"text-green-500",bg:"bg-green-100 dark:bg-green-900/30"}:a.status==="executing"?{icon:p,color:"text-blue-500",bg:"bg-blue-100 dark:bg-blue-900/30"}:{icon:g,color:"text-red-500",bg:"bg-red-100 dark:bg-red-900/30"},y=r.icon,s=[];a.payload!==void 0&&s.push({id:"payload",label:"Payload",content:e.jsx(n,{data:a.payload,toolbarState:d.state,searchBar:d.SearchBar,maxHeight:400})}),a.result!==void 0&&s.push({id:"result",label:"Result",content:e.jsx(n,{data:a.result,toolbarState:l.state,searchBar:l.SearchBar,maxHeight:400})}),a.metadata!==void 0&&s.push({id:"metadata",label:"Metadata",content:e.jsx(n,{data:a.metadata,toolbarState:o.state,searchBar:o.SearchBar,maxHeight:400})});const f=()=>{if(i==="payload"&&a.payload!==void 0)return e.jsx(d.Toolbar,{data:a.payload});if(i==="result"&&a.result!==void 0)return e.jsx(l.Toolbar,{data:a.result});if(i==="metadata"&&a.metadata!==void 0)return e.jsx(o.Toolbar,{data:a.metadata})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:`p-2 ${r.bg} rounded-lg`,children:e.jsx(m,{className:`h-5 w-5 ${r.color}`})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white font-mono",children:a.name}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Command Execution"})]})]}),e.jsx(T,{text:a.name,label:"Copy command"})]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(m,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Command"})]}),e.jsx("p",{className:"text-lg font-bold text-gray-900 dark:text-white font-mono truncate",title:a.name,children:a.name})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(y,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Status"})]}),e.jsx("p",{className:`text-lg font-bold ${r.color}`,children:a.status.toUpperCase()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-gray-500 dark:text-gray-400 mb-1",children:[e.jsx(p,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs uppercase tracking-wider",children:"Duration"})]}),e.jsxs("p",{className:"text-lg font-bold text-gray-900 dark:text-white",children:[a.duration,e.jsx("span",{className:"text-sm font-normal text-gray-500 dark:text-gray-400",children:"ms"})]})]})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Details"})}),e.jsx("div",{className:"p-4",children:e.jsxs("dl",{className:"divide-y-0",children:[e.jsx(t,{label:"Time",value:e.jsxs("span",{children:[k(h(x),"MMMM do yyyy, h:mm:ss a")," ",e.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",N(h(x),{addSuffix:!0}),")"]})]})}),e.jsx(t,{label:"Command",value:e.jsx(b,{listType:"commands",filterType:"names",filterValue:a.name,children:a.name})}),a.handler&&e.jsx(t,{label:"Handler",value:e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white",children:a.handler})}),e.jsx(t,{label:"Status",value:e.jsx(b,{listType:"commands",filterType:"statuses",filterValue:a.status,children:a.status.toUpperCase()})}),e.jsx(t,{label:"Duration",value:a.duration!==void 0?`${a.duration}ms`:"-"})]})})]}),a.error&&e.jsxs("div",{className:"card border-red-200 dark:border-red-800",children:[e.jsx("div",{className:"px-4 py-3 border-b border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(g,{className:"h-5 w-5 text-red-500"}),e.jsx("h2",{className:"text-lg font-semibold text-red-700 dark:text-red-400",children:"Error"})]})}),e.jsx("div",{className:"p-4 bg-red-50/50 dark:bg-red-900/10",children:e.jsx("pre",{className:"text-sm text-red-600 dark:text-red-400 font-mono whitespace-pre-wrap overflow-x-auto",children:a.error})})]}),s.length>0&&e.jsx(C,{tabs:s,defaultTab:"payload",hashKey:"command",headerRight:f(),onTabChange:j})]})}export{I as default};