nestlens 0.12.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.
- package/dist/api/api.controller.d.ts +17 -1
- package/dist/api/api.controller.js +13 -3
- package/dist/core/alerting.service.js +37 -1
- package/dist/core/collector.service.d.ts +18 -0
- package/dist/core/collector.service.js +26 -0
- package/dist/core/storage/redis-url.d.ts +26 -0
- package/dist/core/storage/redis-url.js +51 -0
- package/dist/core/storage/redis.storage.js +10 -44
- package/dist/dashboard/public/assets/{BatchDetailView-Kz8lmg7b.js → BatchDetailView-DZr7YDwl.js} +1 -1
- package/dist/dashboard/public/assets/{BatchesPage-DFiQiYm9.js → BatchesPage-2Hv2zWa4.js} +1 -1
- package/dist/dashboard/public/assets/{CacheDetailView-gWQ36gpT.js → CacheDetailView-DGXqcx8-.js} +1 -1
- package/dist/dashboard/public/assets/{CachePage-CcP5UUIo.js → CachePage-BU15yBss.js} +1 -1
- package/dist/dashboard/public/assets/{CommandDetailView-tLDOIYKo.js → CommandDetailView-li2tXFC7.js} +1 -1
- package/dist/dashboard/public/assets/{CommandsPage-x_pU8uSm.js → CommandsPage-DaKvbjLB.js} +1 -1
- package/dist/dashboard/public/assets/{CopyButton-Dp88z3zD.js → CopyButton-DzToeJlr.js} +1 -1
- package/dist/dashboard/public/assets/{DashboardPage-CHgsQI3w.js → DashboardPage-fYcPzXMR.js} +1 -1
- package/dist/dashboard/public/assets/{DataTable-CiPeRzYj.js → DataTable-B_I--NVC.js} +1 -1
- package/dist/dashboard/public/assets/{DetailRow-ZFijkJy9.js → DetailRow-Dc2FzrKz.js} +1 -1
- package/dist/dashboard/public/assets/{DumpDetailView-BQ_0UMzI.js → DumpDetailView-BaW5Zi1h.js} +1 -1
- package/dist/dashboard/public/assets/{DumpsPage-D0o-EOvX.js → DumpsPage-DmCtyQ1Q.js} +1 -1
- package/dist/dashboard/public/assets/{EntryDetailPage-BhGVuHY8.js → EntryDetailPage-CiECQkN4.js} +3 -3
- package/dist/dashboard/public/assets/{EntrySearchInput-BhuYJjcJ.js → EntrySearchInput-Cq-Ji-C2.js} +1 -1
- package/dist/dashboard/public/assets/{EventDetailView-CqB1VO-o.js → EventDetailView-BPeTgmqk.js} +1 -1
- package/dist/dashboard/public/assets/{EventsPage-BWvlMQOM.js → EventsPage-DW1hhOrJ.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionDetailView-BrwzI-Ny.js → ExceptionDetailView-B-V0O6G_.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionsPage-7wZOjI4L.js → ExceptionsPage-BuAt8VvQ.js} +1 -1
- package/dist/dashboard/public/assets/{GateDetailView-DETgnBEJ.js → GateDetailView-Kn1IPKwS.js} +1 -1
- package/dist/dashboard/public/assets/{GatesPage-Biem1pTa.js → GatesPage-B3eMpohX.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLDetailView-Z2P5Z_wK.js → GraphQLDetailView-uAonhJH8.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLPage-D7IVeu7T.js → GraphQLPage-Dv-1T6j_.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientDetailView-DjgiZtq7.js → HttpClientDetailView-CsBP-NRW.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientPage-D-9rOwxW.js → HttpClientPage-u1ZUWsG_.js} +1 -1
- package/dist/dashboard/public/assets/{JobDetailView-DVKXNyhm.js → JobDetailView-BjtxrqrA.js} +1 -1
- package/dist/dashboard/public/assets/{JobsPage-DudumyIp.js → JobsPage-DSBpskNC.js} +1 -1
- package/dist/dashboard/public/assets/{LogDetailView-Cdwx8HAo.js → LogDetailView-C8q-I_AQ.js} +1 -1
- package/dist/dashboard/public/assets/{LogsPage-DWkRIHul.js → LogsPage-CG-7wDcm.js} +1 -1
- package/dist/dashboard/public/assets/{MailDetailView-5VJ2aebx.js → MailDetailView-CQra2Fen.js} +1 -1
- package/dist/dashboard/public/assets/{MailPage-ClZNTH_r.js → MailPage-IJnGG2Dj.js} +1 -1
- package/dist/dashboard/public/assets/{ModelDetailView-Btpt8H6c.js → ModelDetailView-CqXFOspt.js} +1 -1
- package/dist/dashboard/public/assets/{ModelsPage-PxJ57v2N.js → ModelsPage-BRNDZcOZ.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationDetailView-84rPC1SX.js → NotificationDetailView-c_SH4SBf.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationsPage-qNuVSo-j.js → NotificationsPage-DTpaCZD5.js} +1 -1
- package/dist/dashboard/public/assets/{PageHeader-BlZTS6Mp.js → PageHeader-BLRAvkWc.js} +1 -1
- package/dist/dashboard/public/assets/{QueriesPage-BY0lUO0g.js → QueriesPage-CObP-nH5.js} +1 -1
- package/dist/dashboard/public/assets/{QueryDetailView-CIJHScnv.js → QueryDetailView-D-evIo6B.js} +1 -1
- package/dist/dashboard/public/assets/{RedisDetailView-C2MB0DYY.js → RedisDetailView-uM9LOGK-.js} +1 -1
- package/dist/dashboard/public/assets/{RedisPage-C0MTmo7p.js → RedisPage-BkBILFAA.js} +1 -1
- package/dist/dashboard/public/assets/{RequestDetailView-w80IdX1R.js → RequestDetailView-Bsr5V8FV.js} +1 -1
- package/dist/dashboard/public/assets/{RequestsPage-DDoBHD10.js → RequestsPage-C0ZycYjW.js} +1 -1
- package/dist/dashboard/public/assets/{ScheduleDetailView-DJyMNKdl.js → ScheduleDetailView-D1oDL2wj.js} +1 -1
- package/dist/dashboard/public/assets/{SchedulePage-D3Y5zH7a.js → SchedulePage-DQzehEF6.js} +1 -1
- package/dist/dashboard/public/assets/{UserCard-DWitStWv.js → UserCard-DCiq53By.js} +1 -1
- package/dist/dashboard/public/assets/{ViewDetailView-DVM9EkE8.js → ViewDetailView-CGYGCNEr.js} +1 -1
- package/dist/dashboard/public/assets/{ViewsPage-CvOj7zwQ.js → ViewsPage-tEd0XxCD.js} +1 -1
- package/dist/dashboard/public/assets/{calendar-DSvr3OS6.js → calendar-Cy_qncyr.js} +1 -1
- package/dist/dashboard/public/assets/{circle-alert-sFDCyGtd.js → circle-alert-BCQHt4U6.js} +1 -1
- package/dist/dashboard/public/assets/{circle-check-big-1nqSueTn.js → circle-check-big-CyDf-yDO.js} +1 -1
- package/dist/dashboard/public/assets/{circle-x-DuabRgyL.js → circle-x-D3OiizLY.js} +1 -1
- package/dist/dashboard/public/assets/{eye-Bx7jqdVx.js → eye-CCRjHtzP.js} +1 -1
- package/dist/dashboard/public/assets/{index-QEFm0Hwa.js → index-Db_zkULa.js} +2 -2
- package/dist/dashboard/public/assets/{search-CzOe6pQ2.js → search-C83cbagr.js} +1 -1
- package/dist/dashboard/public/assets/{send-CQVyUZLn.js → send-BsoLJbNI.js} +1 -1
- package/dist/dashboard/public/assets/{timer-Wzp2Wnna.js → timer-DP5XgATT.js} +1 -1
- package/dist/dashboard/public/assets/{types-Dd6NUxj7.js → types-DOZkJpXV.js} +1 -1
- package/dist/dashboard/public/assets/{users-64hxmfDp.js → users-lOn2MScD.js} +1 -1
- package/dist/dashboard/public/assets/{zap-DvUE0l48.js → zap-CXCUXb-_.js} +1 -1
- package/dist/dashboard/public/index.html +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +0 -1
- package/dist/nestlens.config.d.ts +67 -5
- package/dist/nestlens.module.js +9 -2
- package/dist/presets.d.ts +29 -0
- package/dist/presets.js +78 -0
- package/dist/startup-summary.d.ts +15 -0
- package/dist/startup-summary.js +84 -0
- package/dist/types/entry.types.d.ts +13 -1
- package/dist/types/entry.types.js +33 -0
- package/dist/watchers/graphql/graphql.watcher.js +6 -1
- package/package.json +1 -1
|
@@ -210,10 +210,26 @@ export declare class NestLensApiController {
|
|
|
210
210
|
};
|
|
211
211
|
}>;
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
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.
|
|
214
219
|
*/
|
|
215
220
|
getRecordingStatus(_res?: unknown): Promise<{
|
|
216
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
|
+
};
|
|
217
233
|
isPaused: boolean;
|
|
218
234
|
pausedAt?: Date;
|
|
219
235
|
pauseReason?: string;
|
|
@@ -260,11 +260,21 @@ let NestLensApiController = class NestLensApiController {
|
|
|
260
260
|
return { success: true, data: status };
|
|
261
261
|
}
|
|
262
262
|
/**
|
|
263
|
-
*
|
|
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.
|
|
264
269
|
*/
|
|
265
270
|
async getRecordingStatus(_res) {
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
return {
|
|
272
|
+
data: {
|
|
273
|
+
...this.collectorService.getRecordingStatus(),
|
|
274
|
+
counts: this.collectorService.getRecordingCounts(),
|
|
275
|
+
buffer: this.collectorService.getBufferSize(),
|
|
276
|
+
},
|
|
277
|
+
};
|
|
268
278
|
}
|
|
269
279
|
};
|
|
270
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
|
|
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
|
|
@@ -72,6 +72,10 @@ 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
|
|
@@ -148,6 +152,22 @@ let CollectorService = CollectorService_1 = class CollectorService {
|
|
|
148
152
|
dropped: this.droppedEntries,
|
|
149
153
|
};
|
|
150
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
|
+
}
|
|
151
171
|
/**
|
|
152
172
|
* Collect an entry
|
|
153
173
|
* Uses discriminated union pattern - the type parameter determines the expected payload type
|
|
@@ -173,6 +193,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
|
|
|
173
193
|
requestId: requestId ?? (0, request_context_1.currentRequestId)(),
|
|
174
194
|
};
|
|
175
195
|
if (this.sampler && !this.sampler.shouldRecord(entry)) {
|
|
196
|
+
this.droppedBySampling += 1;
|
|
176
197
|
return;
|
|
177
198
|
}
|
|
178
199
|
// The filter callback runs in the application's own process against its own
|
|
@@ -180,6 +201,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
|
|
|
180
201
|
// there stored, streamed and posted to webhooks — is masked.
|
|
181
202
|
const shouldCollect = await this.applyFilter(entry);
|
|
182
203
|
if (!shouldCollect) {
|
|
204
|
+
this.droppedByFilter += 1;
|
|
183
205
|
return;
|
|
184
206
|
}
|
|
185
207
|
try {
|
|
@@ -192,6 +214,7 @@ let CollectorService = CollectorService_1 = class CollectorService {
|
|
|
192
214
|
this.logger.warn(`Failed to record entry: ${error}`);
|
|
193
215
|
return;
|
|
194
216
|
}
|
|
217
|
+
this.recordedEntries += 1;
|
|
195
218
|
this.enforceBufferLimit();
|
|
196
219
|
// Flush if buffer is full — unless storage is already failing, in which
|
|
197
220
|
// case the periodic timer retries and the caller is not made to wait.
|
|
@@ -216,15 +239,18 @@ let CollectorService = CollectorService_1 = class CollectorService {
|
|
|
216
239
|
requestId: requestId ?? (0, request_context_1.currentRequestId)(),
|
|
217
240
|
};
|
|
218
241
|
if (this.sampler && !this.sampler.shouldRecord(entry)) {
|
|
242
|
+
this.droppedBySampling += 1;
|
|
219
243
|
return null;
|
|
220
244
|
}
|
|
221
245
|
// Apply filter
|
|
222
246
|
const shouldCollect = await this.applyFilter(entry);
|
|
223
247
|
if (!shouldCollect) {
|
|
248
|
+
this.droppedByFilter += 1;
|
|
224
249
|
return null;
|
|
225
250
|
}
|
|
226
251
|
try {
|
|
227
252
|
const savedEntry = await this.storage.save(this.mask(entry));
|
|
253
|
+
this.recordedEntries += 1;
|
|
228
254
|
// Apply auto-tagging and family hash after saving
|
|
229
255
|
await this.applyAutoTagging(savedEntry);
|
|
230
256
|
this.emit(savedEntry);
|
|
@@ -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
|
-
//
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
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
|
-
|
|
811
|
-
|
|
812
|
-
|
|
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)
|
package/dist/dashboard/public/assets/{BatchDetailView-Kz8lmg7b.js → BatchDetailView-DZr7YDwl.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,L as o,A as y,C as u}from"./index-
|
|
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-
|
|
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};
|
package/dist/dashboard/public/assets/{CacheDetailView-gWQ36gpT.js → CacheDetailView-DGXqcx8-.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as h,j as e,D as d,C as g}from"./index-
|
|
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-
|
|
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};
|
package/dist/dashboard/public/assets/{CommandDetailView-tLDOIYKo.js → CommandDetailView-li2tXFC7.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,b as m,C as p}from"./index-
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,b as l}from"./index-
|
|
1
|
+
import{j as a,b as l}from"./index-Db_zkULa.js";import{e as T,b as D}from"./vendor-DBTT3jXp.js";import{f as M,p as P}from"./date-Dwgqy666.js";import{u as A,a as B,P as H,R as L,N as W,L as S}from"./PageHeader-BLRAvkWc.js";import{u as I,o as U,C as d}from"./types-DOZkJpXV.js";import{T as i,D as $,b as q}from"./DataTable-B_I--NVC.js";import"./timer-DP5XgATT.js";function X(){const m=T(),{addFilter:t,clearAll:c,serverFilters:u,headerFilters:h}=I("commands"),{rangeFilters:p,windowMinutes:x}=A(),{entries:g,loading:f,refreshing:r,error:y,refresh:C,newEntriesCount:j,hasMore:k,loadMore:w,loadNew:N,autoRefreshEnabled:b,live:E,setAutoRefresh:R,meta:s,isHighlighted:v}=B({type:"command",limit:50,filters:{...u,...p},windowMinutes:x}),o=g.filter(e=>U(e)),F=D.useMemo(()=>[{key:"name",header:"Command",minWidth:"250px",render:e=>a.jsx(d,{onClick:n=>{n.stopPropagation(),t("names",e.payload.name)},className:"font-mono",children:e.payload.name})},{key:"handler",header:"Handler",minWidth:"200px",render:e=>e.payload.handler?a.jsx(i,{mono:!0,truncate:!0,maxWidth:"250px",children:e.payload.handler}):a.jsx(i,{secondary:!0,children:"-"})},{key:"status",header:"Status",width:"100px",render:e=>a.jsx(d,{onClick:n=>{n.stopPropagation(),t("statuses",e.payload.status)},children:e.payload.status.toUpperCase()})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>a.jsx($,{ms:e.payload.duration??0})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(i,{secondary:!0,className:"text-xs",children:M(P(e.createdAt),{addSuffix:!0})})}],[t]);return f&&o.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:"Commands",icon:l,iconColor:"text-green-600 dark:text-green-400",count:o.length,totalCount:s==null?void 0:s.total,refreshing:r,autoRefreshEnabled:b,live:E,onAutoRefreshToggle:R,filters:h,filterControls:a.jsx(L,{route:"commands"}),onClearAllFilters:c}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(W,{count:j,onClick:N,loading:r}),a.jsx(q,{columns:F,data:o,keyExtractor:e=>e.id,onRowClick:e=>m(`/commands/${e.id}`),rowClassName:e=>v(e.id)?"highlight-new":"",emptyMessage:"No commands recorded yet",error:y,onRetry:C,emptyIcon:a.jsx(l,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(S,{hasMore:k,onClick:w,loading:r})]})]})}export{X as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e,z as n}from"./index-
|
|
1
|
+
import{j as e,z as n}from"./index-Db_zkULa.js";import{b as p}from"./vendor-DBTT3jXp.js";import{a as i,b as c}from"./EntryDetailPage-CiECQkN4.js";function y({text:l,label:r="Copy",successMessage:x="Copied to clipboard!",className:t="",iconOnly:d=!1}){const[s,a]=p.useState(!1),o=async()=>{try{await navigator.clipboard.writeText(l),a(!0),n.success(x),setTimeout(()=>a(!1),2e3)}catch{n.error("Failed to copy")}};return d?e.jsx("button",{onClick:o,className:`p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors ${t}`,title:r,children:s?e.jsx(i,{className:"h-4 w-4 text-green-500"}):e.jsx(c,{className:"h-4 w-4 text-gray-500"})}):e.jsx("button",{onClick:o,className:`inline-flex items-center space-x-2 px-3 py-1.5 text-sm font-medium rounded-lg
|
|
2
2
|
bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600
|
|
3
3
|
text-gray-700 dark:text-gray-300 transition-colors ${t}`,children:s?e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{className:"h-4 w-4"}),e.jsx("span",{children:r})]})})}export{y as C};
|
package/dist/dashboard/public/assets/{DashboardPage-CHgsQI3w.js → DashboardPage-fYcPzXMR.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as $,g as pe,j as e,X as he,a as be,z as j,r as fe,u as ke,T as v,D as oe,C as I,A as G,G as ve,F as je,B as Ne,P as we,b as Ee,H,d as Ce,L as Se,e as Te,M as $e,f as qe,R as Pe,h as Me,S as Le,i as X,k as Y,l as Re,m as ee,n as te,o as Ae,p as ae}from"./index-
|
|
1
|
+
import{c as $,g as pe,j as e,X as he,a as be,z as j,r as fe,u as ke,T as v,D as oe,C as I,A as G,G as ve,F as je,B as Ne,P as we,b as Ee,H,d as Ce,L as Se,e as Te,M as $e,f as qe,R as Pe,h as Me,S as Le,i as X,k as Y,l as Re,m as ee,n as te,o as Ae,p as ae}from"./index-Db_zkULa.js";import{b as d,e as De,L as Be}from"./vendor-DBTT3jXp.js";import{g as ie,f as C,p as S}from"./date-Dwgqy666.js";import{E as Ie}from"./eye-CCRjHtzP.js";import{Z as Fe}from"./zap-CXCUXb-_.js";import{C as Ge}from"./calendar-Cy_qncyr.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as F,j as e,i as z,T as R}from"./index-
|
|
1
|
+
import{c as F,j as e,i as z,T as R}from"./index-Db_zkULa.js";import{b as c}from"./vendor-DBTT3jXp.js";import{g as m}from"./date-Dwgqy666.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{t as m,a as M,c as b,n as _,b as E,m as Q,d as F,e as B}from"./date-Dwgqy666.js";import{j as T}from"./index-QEFm0Hwa.js";function Y(r,e){var u,o,l,h;const t=M(),n=(e==null?void 0:e.weekStartsOn)??((o=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:o.weekStartsOn)??t.weekStartsOn??((h=(l=t.locale)==null?void 0:l.options)==null?void 0:h.weekStartsOn)??0,a=m(r,e==null?void 0:e.in),s=a.getDay(),i=(s<n?7:0)+s-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function D(r,e){return Y(r,{...e,weekStartsOn:1})}function H(r,e){const t=m(r,e==null?void 0:e.in),n=t.getFullYear(),a=b(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const s=D(a),i=b(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const u=D(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=u.getTime()?n:n-1}function S(r,e){const t=m(r,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function X(r,e,t){const[n,a]=_(t==null?void 0:t.in,r,e),s=S(n),i=S(a),u=+s-E(s),o=+i-E(i);return Math.round((u-o)/Q)}function L(r,e){const t=H(r,e),n=b(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),D(n)}function R(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function I(r){return!(!R(r)&&typeof r!="number"||isNaN(+m(r)))}function j(r,e){const t=m(r,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function $(r,e){const t=m(r,e==null?void 0:e.in);return X(t,j(t))+1}function V(r,e){const t=m(r,e==null?void 0:e.in),n=+D(t)-+L(t);return Math.round(n/F)+1}function C(r,e){var h,O,x,k;const t=m(r,e==null?void 0:e.in),n=t.getFullYear(),a=M(),s=(e==null?void 0:e.firstWeekContainsDate)??((O=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:O.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(x=a.locale)==null?void 0:x.options)==null?void 0:k.firstWeekContainsDate)??1,i=b((e==null?void 0:e.in)||r,0);i.setFullYear(n+1,0,s),i.setHours(0,0,0,0);const u=Y(i,e),o=b((e==null?void 0:e.in)||r,0);o.setFullYear(n,0,s),o.setHours(0,0,0,0);const l=Y(o,e);return+t>=+u?n+1:+t>=+l?n:n-1}function J(r,e){var u,o,l,h;const t=M(),n=(e==null?void 0:e.firstWeekContainsDate)??((o=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:o.firstWeekContainsDate)??t.firstWeekContainsDate??((h=(l=t.locale)==null?void 0:l.options)==null?void 0:h.firstWeekContainsDate)??1,a=C(r,e),s=b((e==null?void 0:e.in)||r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),Y(s,e)}function K(r,e){const t=m(r,e==null?void 0:e.in),n=+Y(t,e)-+J(t,e);return Math.round(n/F)+1}function c(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const g={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return c(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):c(t+1,2)},d(r,e){return c(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return c(r.getHours()%12||12,e.length)},H(r,e){return c(r.getHours(),e.length)},m(r,e){return c(r.getMinutes(),e.length)},s(r,e){return c(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return c(a,e.length)}},y={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},W={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return g.y(r,e)},Y:function(r,e,t,n){const a=C(r,n),s=a>0?a:1-a;if(e==="YY"){const i=s%100;return c(i,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):c(s,e.length)},R:function(r,e){const t=H(r);return c(t,e.length)},u:function(r,e){const t=r.getFullYear();return c(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return c(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return g.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=K(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(r,e,t){const n=V(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):c(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):g.d(r,e)},D:function(r,e,t){const n=$(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):c(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return c(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return c(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=y.noon:n===0?a=y.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=y.evening:n>=12?a=y.afternoon:n>=4?a=y.morning:a=y.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return g.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):g.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):g.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):g.s(r,e)},S:function(r,e){return g.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return N(n);case"XXXX":case"XX":return w(n);case"XXXXX":case"XXX":default:return w(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return N(n);case"xxxx":case"xx":return w(n);case"xxxxx":case"xxx":default:return w(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+q(n,":");case"OOOO":default:return"GMT"+w(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+q(n,":");case"zzzz":default:return"GMT"+w(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return c(n,e.length)},T:function(r,e,t){return c(+r,e.length)}};function q(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+c(s,2)}function N(r,e){return r%60===0?(r>0?"-":"+")+c(Math.abs(r)/60,2):w(r,e)}function w(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=c(Math.trunc(n/60),2),s=c(n%60,2);return t+a+e+s}const v=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},G=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},U=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return v(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",v(n,e)).replace("{{time}}",G(a,e))},Z={p:G,P:U},A=/^D+$/,z=/^Y+$/,p=["D","DD","YY","YYYY"];function ee(r){return A.test(r)}function te(r){return z.test(r)}function re(r,e,t){const n=ne(r,e,t);if(console.warn(n),p.includes(r))throw new RangeError(n)}function ne(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ae=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,se=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ce=/^'([^]*?)'?$/,ie=/''/g,ue=/[a-zA-Z]/;function he(r,e,t){var h,O,x,k;const n=M(),a=n.locale??B,s=n.firstWeekContainsDate??((O=(h=n.locale)==null?void 0:h.options)==null?void 0:O.firstWeekContainsDate)??1,i=n.weekStartsOn??((k=(x=n.locale)==null?void 0:x.options)==null?void 0:k.weekStartsOn)??0,u=m(r,t==null?void 0:t.in);if(!I(u))throw new RangeError("Invalid time value");let o=e.match(se).map(f=>{const d=f[0];if(d==="p"||d==="P"){const P=Z[d];return P(f,a.formatLong)}return f}).join("").match(ae).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const d=f[0];if(d==="'")return{isToken:!1,value:oe(f)};if(W[d])return{isToken:!0,value:f};if(d.match(ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:f}});a.localize.preprocessor&&(o=a.localize.preprocessor(u,o));const l={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return o.map(f=>{if(!f.isToken)return f.value;const d=f.value;(te(d)||ee(d))&&re(d,e,String(r));const P=W[d[0]];return P(u,d,a.localize,l)}).join("")}function oe(r){const e=r.match(ce);return e?e[1].replace(ie,"'"):r}function me({label:r,value:e,className:t=""}){return T.jsxs("div",{className:`grid grid-cols-[180px_1fr] gap-4 py-3 border-b border-gray-100 dark:border-gray-700 last:border-0 ${t}`,children:[T.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:r}),T.jsx("dd",{className:"text-sm text-gray-900 dark:text-white break-all",children:e})]})}export{me as D,he as f};
|
|
1
|
+
import{t as m,a as M,c as b,n as _,b as E,m as Q,d as F,e as B}from"./date-Dwgqy666.js";import{j as T}from"./index-Db_zkULa.js";function Y(r,e){var u,o,l,h;const t=M(),n=(e==null?void 0:e.weekStartsOn)??((o=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:o.weekStartsOn)??t.weekStartsOn??((h=(l=t.locale)==null?void 0:l.options)==null?void 0:h.weekStartsOn)??0,a=m(r,e==null?void 0:e.in),s=a.getDay(),i=(s<n?7:0)+s-n;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function D(r,e){return Y(r,{...e,weekStartsOn:1})}function H(r,e){const t=m(r,e==null?void 0:e.in),n=t.getFullYear(),a=b(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const s=D(a),i=b(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const u=D(i);return t.getTime()>=s.getTime()?n+1:t.getTime()>=u.getTime()?n:n-1}function S(r,e){const t=m(r,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function X(r,e,t){const[n,a]=_(t==null?void 0:t.in,r,e),s=S(n),i=S(a),u=+s-E(s),o=+i-E(i);return Math.round((u-o)/Q)}function L(r,e){const t=H(r,e),n=b(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),D(n)}function R(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function I(r){return!(!R(r)&&typeof r!="number"||isNaN(+m(r)))}function j(r,e){const t=m(r,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function $(r,e){const t=m(r,e==null?void 0:e.in);return X(t,j(t))+1}function V(r,e){const t=m(r,e==null?void 0:e.in),n=+D(t)-+L(t);return Math.round(n/F)+1}function C(r,e){var h,O,x,k;const t=m(r,e==null?void 0:e.in),n=t.getFullYear(),a=M(),s=(e==null?void 0:e.firstWeekContainsDate)??((O=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:O.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(x=a.locale)==null?void 0:x.options)==null?void 0:k.firstWeekContainsDate)??1,i=b((e==null?void 0:e.in)||r,0);i.setFullYear(n+1,0,s),i.setHours(0,0,0,0);const u=Y(i,e),o=b((e==null?void 0:e.in)||r,0);o.setFullYear(n,0,s),o.setHours(0,0,0,0);const l=Y(o,e);return+t>=+u?n+1:+t>=+l?n:n-1}function J(r,e){var u,o,l,h;const t=M(),n=(e==null?void 0:e.firstWeekContainsDate)??((o=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:o.firstWeekContainsDate)??t.firstWeekContainsDate??((h=(l=t.locale)==null?void 0:l.options)==null?void 0:h.firstWeekContainsDate)??1,a=C(r,e),s=b((e==null?void 0:e.in)||r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),Y(s,e)}function K(r,e){const t=m(r,e==null?void 0:e.in),n=+Y(t,e)-+J(t,e);return Math.round(n/F)+1}function c(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const g={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return c(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):c(t+1,2)},d(r,e){return c(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return c(r.getHours()%12||12,e.length)},H(r,e){return c(r.getHours(),e.length)},m(r,e){return c(r.getMinutes(),e.length)},s(r,e){return c(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return c(a,e.length)}},y={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},W={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return g.y(r,e)},Y:function(r,e,t,n){const a=C(r,n),s=a>0?a:1-a;if(e==="YY"){const i=s%100;return c(i,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):c(s,e.length)},R:function(r,e){const t=H(r);return c(t,e.length)},u:function(r,e){const t=r.getFullYear();return c(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return c(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return g.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=K(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(r,e,t){const n=V(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):c(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):g.d(r,e)},D:function(r,e,t){const n=$(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):c(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return c(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return c(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=y.noon:n===0?a=y.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=y.evening:n>=12?a=y.afternoon:n>=4?a=y.morning:a=y.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return g.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):g.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):g.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):g.s(r,e)},S:function(r,e){return g.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return N(n);case"XXXX":case"XX":return w(n);case"XXXXX":case"XXX":default:return w(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return N(n);case"xxxx":case"xx":return w(n);case"xxxxx":case"xxx":default:return w(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+q(n,":");case"OOOO":default:return"GMT"+w(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+q(n,":");case"zzzz":default:return"GMT"+w(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return c(n,e.length)},T:function(r,e,t){return c(+r,e.length)}};function q(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+c(s,2)}function N(r,e){return r%60===0?(r>0?"-":"+")+c(Math.abs(r)/60,2):w(r,e)}function w(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=c(Math.trunc(n/60),2),s=c(n%60,2);return t+a+e+s}const v=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},G=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},U=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return v(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",v(n,e)).replace("{{time}}",G(a,e))},Z={p:G,P:U},A=/^D+$/,z=/^Y+$/,p=["D","DD","YY","YYYY"];function ee(r){return A.test(r)}function te(r){return z.test(r)}function re(r,e,t){const n=ne(r,e,t);if(console.warn(n),p.includes(r))throw new RangeError(n)}function ne(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ae=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,se=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ce=/^'([^]*?)'?$/,ie=/''/g,ue=/[a-zA-Z]/;function he(r,e,t){var h,O,x,k;const n=M(),a=n.locale??B,s=n.firstWeekContainsDate??((O=(h=n.locale)==null?void 0:h.options)==null?void 0:O.firstWeekContainsDate)??1,i=n.weekStartsOn??((k=(x=n.locale)==null?void 0:x.options)==null?void 0:k.weekStartsOn)??0,u=m(r,t==null?void 0:t.in);if(!I(u))throw new RangeError("Invalid time value");let o=e.match(se).map(f=>{const d=f[0];if(d==="p"||d==="P"){const P=Z[d];return P(f,a.formatLong)}return f}).join("").match(ae).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const d=f[0];if(d==="'")return{isToken:!1,value:oe(f)};if(W[d])return{isToken:!0,value:f};if(d.match(ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:f}});a.localize.preprocessor&&(o=a.localize.preprocessor(u,o));const l={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return o.map(f=>{if(!f.isToken)return f.value;const d=f.value;(te(d)||ee(d))&&re(d,e,String(r));const P=W[d[0]];return P(u,d,a.localize,l)}).join("")}function oe(r){const e=r.match(ce);return e?e[1].replace(ie,"'"):r}function me({label:r,value:e,className:t=""}){return T.jsxs("div",{className:`grid grid-cols-[180px_1fr] gap-4 py-3 border-b border-gray-100 dark:border-gray-700 last:border-0 ${t}`,children:[T.jsx("dt",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:r}),T.jsx("dd",{className:"text-sm text-gray-900 dark:text-white break-all",children:e})]})}export{me as D,he as f};
|