nestlens 0.9.7 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api.guard.js +16 -1
- package/dist/api/dashboard-server.d.ts +62 -0
- package/dist/api/dashboard-server.js +244 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/core/collector.service.d.ts +8 -0
- package/dist/core/collector.service.js +8 -0
- package/dist/core/data-masker.service.d.ts +21 -6
- package/dist/core/data-masker.service.js +75 -12
- package/dist/core/masking-terms.d.ts +30 -0
- package/dist/core/masking-terms.js +21 -0
- package/dist/core/sampling.d.ts +41 -0
- package/dist/core/sampling.js +54 -0
- package/dist/core/sanitized-payload.d.ts +9 -0
- package/dist/core/sanitized-payload.js +42 -0
- package/dist/core/storage/memory.storage.d.ts +26 -0
- package/dist/core/storage/memory.storage.js +37 -8
- package/dist/dashboard/public/assets/{BatchDetailView-BVwqprXl.js → BatchDetailView-BA_QXL7a.js} +1 -1
- package/dist/dashboard/public/assets/{BatchesPage-D6Y-VbZW.js → BatchesPage-D4oKMowE.js} +1 -1
- package/dist/dashboard/public/assets/{CacheDetailView-DAKwW79l.js → CacheDetailView-BDg0OXAi.js} +1 -1
- package/dist/dashboard/public/assets/{CachePage-D3ZAuKbE.js → CachePage-BZKgOAHR.js} +1 -1
- package/dist/dashboard/public/assets/{CommandDetailView-DUlOruy-.js → CommandDetailView-CbQKT7r5.js} +1 -1
- package/dist/dashboard/public/assets/{CommandsPage-8Ly-1pVn.js → CommandsPage-BhYsUquS.js} +1 -1
- package/dist/dashboard/public/assets/{CopyButton-CCiHK8SA.js → CopyButton-oI0f2BPa.js} +1 -1
- package/dist/dashboard/public/assets/{DashboardPage-HQJ5EqZi.js → DashboardPage-w7CPjb-N.js} +1 -1
- package/dist/dashboard/public/assets/{DataTable-IY4rgbLi.js → DataTable-D39w-diZ.js} +1 -1
- package/dist/dashboard/public/assets/{DetailRow-BrSIGemm.js → DetailRow-BaSzSd02.js} +1 -1
- package/dist/dashboard/public/assets/{DumpDetailView-Df-ygu8R.js → DumpDetailView-c1-zovWx.js} +1 -1
- package/dist/dashboard/public/assets/{DumpsPage-DX7kzOSi.js → DumpsPage-94vKqo6p.js} +1 -1
- package/dist/dashboard/public/assets/{EntryDetailPage-CvuUpMuM.js → EntryDetailPage-CVC4IBjE.js} +3 -3
- package/dist/dashboard/public/assets/{EntrySearchInput-Cep2-s2v.js → EntrySearchInput-ZRceRlzI.js} +1 -1
- package/dist/dashboard/public/assets/{EventDetailView-DTTwJXmG.js → EventDetailView-lK4heuew.js} +1 -1
- package/dist/dashboard/public/assets/{EventsPage-DDPJ2rMk.js → EventsPage-MzZxRRE9.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionDetailView-IU2r55Ep.js → ExceptionDetailView-BguHjEHJ.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionsPage-DBYRnysW.js → ExceptionsPage-DHGFjUxu.js} +1 -1
- package/dist/dashboard/public/assets/{GateDetailView-Dk4Dflc1.js → GateDetailView-NwkvH8ib.js} +1 -1
- package/dist/dashboard/public/assets/{GatesPage-CbZbVBab.js → GatesPage-D9K4YB2k.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLDetailView-CkaJ573i.js → GraphQLDetailView-PkcaoZ15.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLPage-CT1lBIqP.js → GraphQLPage-C0vODDMm.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientDetailView-uzkJ0a2W.js → HttpClientDetailView-N79x9PvH.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientPage-UVqfS3lX.js → HttpClientPage-C4uuDTkf.js} +1 -1
- package/dist/dashboard/public/assets/{JobDetailView-Bw_G0h-k.js → JobDetailView-Do3XVw-b.js} +1 -1
- package/dist/dashboard/public/assets/{JobsPage-BehPu36v.js → JobsPage-Clr2WV32.js} +1 -1
- package/dist/dashboard/public/assets/{LogDetailView-C4zHaxtW.js → LogDetailView-pxP_iVYL.js} +1 -1
- package/dist/dashboard/public/assets/{LogsPage-rc3m7U7I.js → LogsPage-CsuPichq.js} +1 -1
- package/dist/dashboard/public/assets/{MailDetailView-C0agIRwB.js → MailDetailView-FNWdO4I6.js} +1 -1
- package/dist/dashboard/public/assets/{MailPage-DKkMqiyO.js → MailPage-B7i0Esr8.js} +1 -1
- package/dist/dashboard/public/assets/{ModelDetailView-ezmk3atr.js → ModelDetailView-LhtccX11.js} +1 -1
- package/dist/dashboard/public/assets/{ModelsPage-BHnRG1du.js → ModelsPage-Dob5tidP.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationDetailView-BRxW--Ek.js → NotificationDetailView-RxHmfj-e.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationsPage-BrTG1nga.js → NotificationsPage-C-HehjQ8.js} +1 -1
- package/dist/dashboard/public/assets/{PageHeader-CA02rA6z.js → PageHeader-BNjXB_Ja.js} +1 -1
- package/dist/dashboard/public/assets/{QueriesPage-kGgFPHUq.js → QueriesPage-DiA6xvVI.js} +1 -1
- package/dist/dashboard/public/assets/{QueryDetailView-BuP7IA2L.js → QueryDetailView-58AnmJUd.js} +1 -1
- package/dist/dashboard/public/assets/{RedisDetailView-CnhWC0Lh.js → RedisDetailView-B1CVesM0.js} +1 -1
- package/dist/dashboard/public/assets/{RedisPage-BSyT0Q7O.js → RedisPage-DQz69JsJ.js} +1 -1
- package/dist/dashboard/public/assets/{RequestDetailView-Nb4Miizp.js → RequestDetailView-BlOK9Jv_.js} +1 -1
- package/dist/dashboard/public/assets/{RequestsPage-ExHuUYNY.js → RequestsPage-KWb78XZC.js} +1 -1
- package/dist/dashboard/public/assets/{ScheduleDetailView-sPecJ0Wy.js → ScheduleDetailView-GkR80TZl.js} +1 -1
- package/dist/dashboard/public/assets/{SchedulePage-BqISID5x.js → SchedulePage-GRqVQK96.js} +1 -1
- package/dist/dashboard/public/assets/{UserCard-Ds2eFQ5u.js → UserCard-BuRugclY.js} +1 -1
- package/dist/dashboard/public/assets/{ViewDetailView-B-euVoGK.js → ViewDetailView-Df4tzNxi.js} +1 -1
- package/dist/dashboard/public/assets/{ViewsPage-Czow9YAd.js → ViewsPage-B3VLpJgd.js} +1 -1
- package/dist/dashboard/public/assets/{calendar-DjIv6CVc.js → calendar-iGz7imq4.js} +1 -1
- package/dist/dashboard/public/assets/{circle-alert-YrNLnEY3.js → circle-alert-BRXuJPBy.js} +1 -1
- package/dist/dashboard/public/assets/{circle-check-big-DArmNZLQ.js → circle-check-big-DVxhxYns.js} +1 -1
- package/dist/dashboard/public/assets/{circle-x-BAiU-N3B.js → circle-x-v0VbdG9M.js} +1 -1
- package/dist/dashboard/public/assets/{eye-DMeWKkCr.js → eye-DcMaRsYF.js} +1 -1
- package/dist/dashboard/public/assets/{index-CCIS1AbN.js → index-w_yLpa1c.js} +2 -2
- package/dist/dashboard/public/assets/{search-CtGPQIEG.js → search-BERxF7dG.js} +1 -1
- package/dist/dashboard/public/assets/{send-BjuXpyOz.js → send-IiapMYKZ.js} +1 -1
- package/dist/dashboard/public/assets/{timer-C0_HYkkd.js → timer-2vIduyIC.js} +1 -1
- package/dist/dashboard/public/assets/{types-DTQLegxJ.js → types-BblOEq1q.js} +1 -1
- package/dist/dashboard/public/assets/{users-CUxyUz2K.js → users-BlF2EBBP.js} +1 -1
- package/dist/dashboard/public/assets/{zap-DzO0l81l.js → zap-CEj-5YGt.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 +159 -11
- package/dist/nestlens.config.js +5 -0
- package/dist/nestlens.module.js +25 -10
- package/dist/types/entry.types.d.ts +5 -1
- package/dist/watchers/batch.watcher.js +2 -2
- package/dist/watchers/cache.watcher.js +2 -2
- package/dist/watchers/command.watcher.js +2 -2
- package/dist/watchers/dump.watcher.js +2 -2
- package/dist/watchers/event.watcher.js +2 -2
- package/dist/watchers/exception.watcher.js +2 -2
- package/dist/watchers/gate.watcher.js +2 -2
- package/dist/watchers/graphql/graphql.watcher.js +5 -1
- package/dist/watchers/graphql/types.d.ts +1 -1
- package/dist/watchers/graphql/types.js +41 -3
- package/dist/watchers/graphql/utils/variable-sanitizer.d.ts +5 -0
- package/dist/watchers/graphql/utils/variable-sanitizer.js +339 -30
- package/dist/watchers/http-client.watcher.js +2 -2
- package/dist/watchers/job.watcher.js +2 -2
- package/dist/watchers/log.watcher.js +2 -4
- package/dist/watchers/mail.watcher.js +2 -2
- package/dist/watchers/model.watcher.js +2 -2
- package/dist/watchers/notification.watcher.js +2 -2
- package/dist/watchers/query/query.watcher.js +2 -4
- package/dist/watchers/redis.watcher.js +2 -2
- package/dist/watchers/request.watcher.js +12 -5
- package/dist/watchers/schedule.watcher.js +2 -2
- package/dist/watchers/view.watcher.js +2 -2
- package/dist/watchers/watcher-config.d.ts +27 -0
- package/dist/watchers/watcher-config.js +31 -0
- package/package.json +3 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Entry } from '../types';
|
|
2
|
+
import { SamplingConfig } from '../nestlens.config';
|
|
3
|
+
/**
|
|
4
|
+
* Decides which entries are kept when not everything can be.
|
|
5
|
+
*
|
|
6
|
+
* Off unless configured: NestLens records everything by default, and that is
|
|
7
|
+
* the point of it. This exists for the application that has grown past what it
|
|
8
|
+
* wants to pay for that, and would rather see one request in ten completely
|
|
9
|
+
* than all of them not at all.
|
|
10
|
+
*
|
|
11
|
+
* ## Whole requests, not scattered entries
|
|
12
|
+
*
|
|
13
|
+
* The decision is made from the request id, not per entry. A request, its
|
|
14
|
+
* queries, its cache reads, its logs and its outgoing HTTP calls share one id,
|
|
15
|
+
* so they are kept together or dropped together. Sampling entry by entry would
|
|
16
|
+
* fill the dashboard with queries whose request was never recorded and requests
|
|
17
|
+
* whose queries were not — every detail page half empty, which is worse than a
|
|
18
|
+
* smaller number of complete ones.
|
|
19
|
+
*
|
|
20
|
+
* ## Deterministic, so it needs no memory
|
|
21
|
+
*
|
|
22
|
+
* The id is hashed and compared against the rate. The same id always gets the
|
|
23
|
+
* same answer, from any watcher, in any order, with nothing held between calls
|
|
24
|
+
* — no set of sampled requests to grow, expire or synchronise, and no
|
|
25
|
+
* difference between the entry that arrives first and the one that arrives
|
|
26
|
+
* after the response has been sent.
|
|
27
|
+
*
|
|
28
|
+
* Entries with no request id — a scheduled task, a console command, a job
|
|
29
|
+
* picked off a queue — are sampled on their own hash, since there is no request
|
|
30
|
+
* for them to belong to.
|
|
31
|
+
*/
|
|
32
|
+
export interface Sampler {
|
|
33
|
+
shouldRecord(entry: Entry): boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A sampler for the configured rate, or `undefined` when everything is kept.
|
|
37
|
+
*
|
|
38
|
+
* Returning `undefined` rather than a sampler that always says yes keeps the
|
|
39
|
+
* default path free of a call per entry.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createSampler(config?: SamplingConfig): Sampler | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSampler = createSampler;
|
|
4
|
+
/** Types that are recorded whatever the rate says, unless configured otherwise. */
|
|
5
|
+
const DEFAULT_ALWAYS = ['exception'];
|
|
6
|
+
/**
|
|
7
|
+
* FNV-1a, 32-bit.
|
|
8
|
+
*
|
|
9
|
+
* Chosen for being cheap and well-spread rather than for being unguessable:
|
|
10
|
+
* this runs on every entry, and a cryptographic hash would cost more than the
|
|
11
|
+
* sampling saves. Nothing here is a security decision.
|
|
12
|
+
*/
|
|
13
|
+
function hash(value) {
|
|
14
|
+
let h = 0x811c9dc5;
|
|
15
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
16
|
+
h ^= value.charCodeAt(i);
|
|
17
|
+
h = Math.imul(h, 0x01000193);
|
|
18
|
+
}
|
|
19
|
+
return h >>> 0;
|
|
20
|
+
}
|
|
21
|
+
const MAX_HASH = 0xffffffff;
|
|
22
|
+
/**
|
|
23
|
+
* A sampler for the configured rate, or `undefined` when everything is kept.
|
|
24
|
+
*
|
|
25
|
+
* Returning `undefined` rather than a sampler that always says yes keeps the
|
|
26
|
+
* default path free of a call per entry.
|
|
27
|
+
*/
|
|
28
|
+
function createSampler(config) {
|
|
29
|
+
if (!config) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const rate = config.rate ?? 1;
|
|
33
|
+
if (rate >= 1) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
// A rate of 0 keeps only what `always` names, which is a coherent thing to
|
|
37
|
+
// ask for: exceptions and nothing else.
|
|
38
|
+
const threshold = Math.max(0, rate) * MAX_HASH;
|
|
39
|
+
const always = new Set(config.always ?? DEFAULT_ALWAYS);
|
|
40
|
+
return {
|
|
41
|
+
shouldRecord(entry) {
|
|
42
|
+
if (always.has(entry.type)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
// No request id means nothing to correlate with, so the entry is sampled
|
|
46
|
+
// on its own — a coin flip rather than a hash, since there is no key that
|
|
47
|
+
// has to give the same answer twice.
|
|
48
|
+
if (entry.requestId === undefined) {
|
|
49
|
+
return Math.random() * MAX_HASH <= threshold;
|
|
50
|
+
}
|
|
51
|
+
return hash(entry.requestId) <= threshold;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records that `value` is already free of sensitive data.
|
|
3
|
+
*
|
|
4
|
+
* Returns its argument so it can wrap a `return`. Primitives are returned
|
|
5
|
+
* untouched: they carry no keys, so there is nothing to skip.
|
|
6
|
+
*/
|
|
7
|
+
export declare function markSanitized<T>(value: T): T;
|
|
8
|
+
/** Whether a watcher has already sanitised this exact value. */
|
|
9
|
+
export declare function isSanitized(value: unknown): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markSanitized = markSanitized;
|
|
4
|
+
exports.isSanitized = isSanitized;
|
|
5
|
+
/**
|
|
6
|
+
* Marks payload subtrees a watcher has already cleaned.
|
|
7
|
+
*
|
|
8
|
+
* `CollectorService.mask()` masks every payload on its way in, which is what
|
|
9
|
+
* makes a watcher that forgets to mask harmless. The GraphQL watcher does not
|
|
10
|
+
* forget — it builds a clean copy of the variables and of the response before
|
|
11
|
+
* the collector ever sees them — so masking those two again is a second deep
|
|
12
|
+
* clone of the largest thing in the entry, measured at about a third of the
|
|
13
|
+
* cost of capturing a response at all.
|
|
14
|
+
*
|
|
15
|
+
* Marked by value identity rather than by a flag on the entry, because only
|
|
16
|
+
* part of a GraphQL payload is sanitised: `errors[].extensions` carries
|
|
17
|
+
* whatever a resolver put there and still has to be masked. An entry-level
|
|
18
|
+
* flag would take that with it, and the failure would be silent — an unmasked
|
|
19
|
+
* secret in storage costs more than the traversal ever saves. Anything not
|
|
20
|
+
* marked is masked, so a watcher that grows a new field gets masking for it
|
|
21
|
+
* without anyone remembering to ask.
|
|
22
|
+
*
|
|
23
|
+
* A `WeakSet` holds no strong reference, so a mark lives exactly as long as the
|
|
24
|
+
* payload it describes and nothing here can grow.
|
|
25
|
+
*/
|
|
26
|
+
const sanitizedValues = new WeakSet();
|
|
27
|
+
/**
|
|
28
|
+
* Records that `value` is already free of sensitive data.
|
|
29
|
+
*
|
|
30
|
+
* Returns its argument so it can wrap a `return`. Primitives are returned
|
|
31
|
+
* untouched: they carry no keys, so there is nothing to skip.
|
|
32
|
+
*/
|
|
33
|
+
function markSanitized(value) {
|
|
34
|
+
if (value !== null && typeof value === 'object') {
|
|
35
|
+
sanitizedValues.add(value);
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
/** Whether a watcher has already sanitised this exact value. */
|
|
40
|
+
function isSanitized(value) {
|
|
41
|
+
return value !== null && typeof value === 'object' && sanitizedValues.has(value);
|
|
42
|
+
}
|
|
@@ -11,6 +11,8 @@ export declare class MemoryStorage implements StorageInterface, OnModuleDestroy
|
|
|
11
11
|
private readonly logger;
|
|
12
12
|
private entries;
|
|
13
13
|
private nextId;
|
|
14
|
+
/** Lowest id that might still be present; see `enforceMaxEntries`. */
|
|
15
|
+
private oldestId;
|
|
14
16
|
private entryTags;
|
|
15
17
|
private tagIndex;
|
|
16
18
|
private monitoredTags;
|
|
@@ -52,6 +54,30 @@ export declare class MemoryStorage implements StorageInterface, OnModuleDestroy
|
|
|
52
54
|
onModuleDestroy(): void;
|
|
53
55
|
private hydrateEntriesWithTags;
|
|
54
56
|
private removeEntryTagsInternal;
|
|
57
|
+
/**
|
|
58
|
+
* Drops the oldest entries once the cap is passed.
|
|
59
|
+
*
|
|
60
|
+
* Ids are allocated in order by `save()`, the only thing that inserts, so the
|
|
61
|
+
* lowest surviving id is the oldest entry. `oldestId` walks forward over the
|
|
62
|
+
* ones already gone and never goes back, which makes eviction amortised O(1)
|
|
63
|
+
* and — measured — free: a capped map costs the same to fill as an uncapped
|
|
64
|
+
* one.
|
|
65
|
+
*
|
|
66
|
+
* Two versions of this were wrong before, both of them quietly:
|
|
67
|
+
*
|
|
68
|
+
* - it copied every key into an array and sorted it, on every save once the
|
|
69
|
+
* cap was reached, which is the steady state of a capped storage. 32% of
|
|
70
|
+
* the whole process's CPU under load, more than the request handling it
|
|
71
|
+
* was recording.
|
|
72
|
+
* - then it took the front of the map with `keys().next()`, which reads
|
|
73
|
+
* correct and is not. V8 leaves a tombstone behind a deleted entry and a
|
|
74
|
+
* fresh iterator walks them all before reaching a live one, so the cost
|
|
75
|
+
* grew with everything ever evicted: 1,566ms against 16ms for the same
|
|
76
|
+
* 200,000 inserts, and the profile still put it at the top.
|
|
77
|
+
*
|
|
78
|
+
* `entryTags` is keyed by the same ids and is cleaned alongside, so the two
|
|
79
|
+
* cannot drift.
|
|
80
|
+
*/
|
|
55
81
|
private enforceMaxEntries;
|
|
56
82
|
private countWithFilters;
|
|
57
83
|
private applyAdvancedFilters;
|
|
@@ -25,6 +25,8 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
|
|
|
25
25
|
// Main storage
|
|
26
26
|
this.entries = new Map();
|
|
27
27
|
this.nextId = 1;
|
|
28
|
+
/** Lowest id that might still be present; see `enforceMaxEntries`. */
|
|
29
|
+
this.oldestId = 1;
|
|
28
30
|
// Tag storage
|
|
29
31
|
this.entryTags = new Map(); // entryId -> tags
|
|
30
32
|
this.tagIndex = new Map(); // tag -> entryIds
|
|
@@ -183,6 +185,7 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
|
|
|
183
185
|
this.entryTags.clear();
|
|
184
186
|
this.tagIndex.clear();
|
|
185
187
|
this.nextId = 1;
|
|
188
|
+
this.oldestId = 1;
|
|
186
189
|
this.logger.log('Storage cleared');
|
|
187
190
|
}
|
|
188
191
|
async close() {
|
|
@@ -437,16 +440,42 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
|
|
|
437
440
|
this.entryTags.delete(entryId);
|
|
438
441
|
}
|
|
439
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* Drops the oldest entries once the cap is passed.
|
|
445
|
+
*
|
|
446
|
+
* Ids are allocated in order by `save()`, the only thing that inserts, so the
|
|
447
|
+
* lowest surviving id is the oldest entry. `oldestId` walks forward over the
|
|
448
|
+
* ones already gone and never goes back, which makes eviction amortised O(1)
|
|
449
|
+
* and — measured — free: a capped map costs the same to fill as an uncapped
|
|
450
|
+
* one.
|
|
451
|
+
*
|
|
452
|
+
* Two versions of this were wrong before, both of them quietly:
|
|
453
|
+
*
|
|
454
|
+
* - it copied every key into an array and sorted it, on every save once the
|
|
455
|
+
* cap was reached, which is the steady state of a capped storage. 32% of
|
|
456
|
+
* the whole process's CPU under load, more than the request handling it
|
|
457
|
+
* was recording.
|
|
458
|
+
* - then it took the front of the map with `keys().next()`, which reads
|
|
459
|
+
* correct and is not. V8 leaves a tombstone behind a deleted entry and a
|
|
460
|
+
* fresh iterator walks them all before reaching a live one, so the cost
|
|
461
|
+
* grew with everything ever evicted: 1,566ms against 16ms for the same
|
|
462
|
+
* 200,000 inserts, and the profile still put it at the top.
|
|
463
|
+
*
|
|
464
|
+
* `entryTags` is keyed by the same ids and is cleaned alongside, so the two
|
|
465
|
+
* cannot drift.
|
|
466
|
+
*/
|
|
440
467
|
enforceMaxEntries() {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const toRemove = sorted.slice(0, this.entries.size - this.maxEntries);
|
|
445
|
-
for (const id of toRemove) {
|
|
446
|
-
this.entries.delete(id);
|
|
447
|
-
this.removeEntryTagsInternal(id);
|
|
468
|
+
while (this.entries.size > this.maxEntries) {
|
|
469
|
+
while (this.oldestId < this.nextId && !this.entries.has(this.oldestId)) {
|
|
470
|
+
this.oldestId += 1;
|
|
448
471
|
}
|
|
449
|
-
this
|
|
472
|
+
// Nothing left to evict that this counter knows about — only reachable
|
|
473
|
+
// if ids were removed some other way, and better than spinning.
|
|
474
|
+
if (this.oldestId >= this.nextId)
|
|
475
|
+
return;
|
|
476
|
+
this.entries.delete(this.oldestId);
|
|
477
|
+
this.removeEntryTagsInternal(this.oldestId);
|
|
478
|
+
this.oldestId += 1;
|
|
450
479
|
}
|
|
451
480
|
}
|
|
452
481
|
async countWithFilters(type, filters) {
|
package/dist/dashboard/public/assets/{BatchDetailView-BVwqprXl.js → BatchDetailView-BA_QXL7a.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-w_yLpa1c.js";import{p as n,f as v}from"./badgeColors-DQ_P_DOX.js";import{D as r,f as k}from"./DetailRow-BaSzSd02.js";import{C as m}from"./types-BblOEq1q.js";import{C as w}from"./CopyButton-oI0f2BPa.js";import{C as g}from"./circle-x-v0VbdG9M.js";import{C as j}from"./circle-alert-BRXuJPBy.js";import{C}from"./circle-check-big-DVxhxYns.js";import"./vendor-DBTT3jXp.js";import"./EntryDetailPage-CVC4IBjE.js";import"./search-BERxF7dG.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-w_yLpa1c.js";import{e as D,b as F}from"./vendor-DBTT3jXp.js";import{f as M,p as T}from"./badgeColors-DQ_P_DOX.js";import{u as A,P as L,N as R,L as $}from"./PageHeader-BNjXB_Ja.js";import{u as I,q as H,C as c}from"./types-BblOEq1q.js";import{T as s,D as S,b as W}from"./DataTable-D39w-diZ.js";function K(){const h=D(),{addFilter:o,clearAll:p,serverFilters:u,headerFilters:x,hasFilters:m}=I("batches"),{entries:g,loading:y,refreshing:i,newEntriesCount:f,hasMore:j,loadMore:b,loadNew:k,autoRefreshEnabled:C,live:N,setAutoRefresh:w,meta:n,isHighlighted:E}=A({type:"batch",limit:50,filters:u}),l=g.filter(e=>H(e)),v=F.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,B=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:["(",B,"%)"]})]})}},{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(S,{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:M(T(e.createdAt),{addSuffix:!0})})}],[o]);if(y&&l.length===0)return 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"})});const P=m?"pt-28":"pt-16";return t.jsxs("div",{children:[t.jsx(L,{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:C,live:N,onAutoRefreshToggle:w,filters:x,onClearAllFilters:p}),t.jsxs("div",{className:`${P} space-y-4 transition-all duration-200`,children:[t.jsx(R,{count:f,onClick:k,loading:i}),t.jsx(W,{columns:v,data:l,keyExtractor:e=>e.id,onRowClick:e=>h(`/batches/${e.id}`),rowClassName:e=>E(e.id)?"highlight-new":"",emptyMessage:"No batch operations recorded yet",emptyIcon:t.jsx(d,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),t.jsx($,{hasMore:j,onClick:b,loading:i})]})]})}export{K as default};
|
package/dist/dashboard/public/assets/{CacheDetailView-DAKwW79l.js → CacheDetailView-BDg0OXAi.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-w_yLpa1c.js";import{p as o,f as p}from"./badgeColors-DQ_P_DOX.js";import{D as t,f as b}from"./DetailRow-BaSzSd02.js";import{C as x}from"./types-BblOEq1q.js";import{u as j,C as y,T as f}from"./EntryDetailPage-CVC4IBjE.js";import{C as u}from"./CopyButton-oI0f2BPa.js";import{C as N}from"./circle-check-big-DVxhxYns.js";import{C as v}from"./circle-x-v0VbdG9M.js";import{T as k}from"./timer-2vIduyIC.js";import"./vendor-DBTT3jXp.js";import"./search-BERxF7dG.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-w_yLpa1c.js";import{e as T,b as E}from"./vendor-DBTT3jXp.js";import{f as v,p as D}from"./badgeColors-DQ_P_DOX.js";import{u as M,P as R,N as A,L as F}from"./PageHeader-BNjXB_Ja.js";import{u as H,f as P,C as l}from"./types-BblOEq1q.js";import{T as i,D as B,b as I}from"./DataTable-D39w-diZ.js";function V(){const n=T(),{clearAll:d,serverFilters:c,headerFilters:h,hasFilters:p}=H("cache"),{entries:u,loading:x,refreshing:t,newEntriesCount:m,hasMore:y,loadMore:g,loadNew:f,autoRefreshEnabled:j,live:k,setAutoRefresh:C,meta:r,isHighlighted:w}=M({type:"cache",limit:50,filters:c}),s=u.filter(e=>P(e)),N=E.useMemo(()=>[{key:"operation",header:"Operation",width:"100px",render:e=>a.jsx(l,{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(l,{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(B,{ms:e.payload.duration||0})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(i,{secondary:!0,className:"text-xs",children:v(D(e.createdAt),{addSuffix:!0})})}],[]);if(x&&s.length===0)return 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"})});const b=p?"pt-28":"pt-16";return a.jsxs("div",{children:[a.jsx(R,{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:j,live:k,onAutoRefreshToggle:C,filters:h,onClearAllFilters:d}),a.jsxs("div",{className:`${b} space-y-4 transition-all duration-200`,children:[a.jsx(A,{count:m,onClick:f,loading:t}),a.jsx(I,{columns:N,data:s,keyExtractor:e=>e.id,onRowClick:e=>n(`/cache/${e.id}`),rowClassName:e=>w(e.id)?"highlight-new":"",emptyMessage:"No cache operations recorded yet",emptyIcon:a.jsx(o,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(F,{hasMore:y,onClick:g,loading:t})]})]})}export{V as default};
|
package/dist/dashboard/public/assets/{CommandDetailView-DUlOruy-.js → CommandDetailView-CbQKT7r5.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a as m,C as p}from"./index-
|
|
1
|
+
import{j as e,a as m,C as p}from"./index-w_yLpa1c.js";import{b as v}from"./vendor-DBTT3jXp.js";import{p as h,f as N}from"./badgeColors-DQ_P_DOX.js";import{D as t,f as k}from"./DetailRow-BaSzSd02.js";import{C as b}from"./types-BblOEq1q.js";import{u as c,C as n,T as C}from"./EntryDetailPage-CVC4IBjE.js";import{C as T}from"./CopyButton-oI0f2BPa.js";import{C as w}from"./circle-check-big-DVxhxYns.js";import{C as g}from"./circle-x-v0VbdG9M.js";import"./search-BERxF7dG.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,a as l}from"./index-
|
|
1
|
+
import{j as a,a as l}from"./index-w_yLpa1c.js";import{e as P,b as T}from"./vendor-DBTT3jXp.js";import{f as D,p as F}from"./badgeColors-DQ_P_DOX.js";import{u as A,P as M,N as R,L as B}from"./PageHeader-BNjXB_Ja.js";import{u as H,o as L,C as d}from"./types-BblOEq1q.js";import{T as i,D as W,b as S}from"./DataTable-D39w-diZ.js";function J(){const m=P(),{addFilter:t,clearAll:c,serverFilters:u,headerFilters:h,hasFilters:p}=H("commands"),{entries:x,loading:g,refreshing:r,newEntriesCount:f,hasMore:y,loadMore:C,loadNew:j,autoRefreshEnabled:k,live:N,setAutoRefresh:w,meta:s,isHighlighted:b}=A({type:"command",limit:50,filters:u}),o=x.filter(e=>L(e)),E=T.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(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})})}],[t]);if(g&&o.length===0)return 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"})});const v=p?"pt-28":"pt-16";return a.jsxs("div",{children:[a.jsx(M,{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:k,live:N,onAutoRefreshToggle:w,filters:h,onClearAllFilters:c}),a.jsxs("div",{className:`${v} space-y-4 transition-all duration-200`,children:[a.jsx(R,{count:f,onClick:j,loading:r}),a.jsx(S,{columns:E,data:o,keyExtractor:e=>e.id,onRowClick:e=>m(`/commands/${e.id}`),rowClassName:e=>b(e.id)?"highlight-new":"",emptyMessage:"No commands recorded yet",emptyIcon:a.jsx(l,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(B,{hasMore:y,onClick:C,loading:r})]})]})}export{J 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-w_yLpa1c.js";import{b as p}from"./vendor-DBTT3jXp.js";import{a as i,b as c}from"./EntryDetailPage-CVC4IBjE.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-HQJ5EqZi.js → DashboardPage-w7CPjb-N.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as D,u as ge,j as e,D as ae,T as A,C as R,A as M,G as xe,F as me,B as ue,P as ye,a as be,H as B,b as he,L as pe,d as ke,M as fe,e as ve,R as je,f as Ne,S as we,g as V,h as W,i as Se,k as _,l as K,r as qe,m as Y}from"./index-
|
|
1
|
+
import{c as D,u as ge,j as e,D as ae,T as A,C as R,A as M,G as xe,F as me,B as ue,P as ye,a as be,H as B,b as he,L as pe,d as ke,M as fe,e as ve,R as je,f as Ne,S as we,g as V,h as W,i as Se,k as _,l as K,r as qe,m as Y}from"./index-w_yLpa1c.js";import{e as Ce,b as c,L as Ee}from"./vendor-DBTT3jXp.js";import{g as Pe,f,p as v}from"./badgeColors-DQ_P_DOX.js";import{Z as Te}from"./zap-CEj-5YGt.js";import{C as $e}from"./calendar-iGz7imq4.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 A,j as e,g as S}from"./index-
|
|
1
|
+
import{c as A,j as e,g as S}from"./index-w_yLpa1c.js";import{b as c}from"./vendor-DBTT3jXp.js";import{g as b}from"./badgeColors-DQ_P_DOX.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"./badgeColors-DQ_P_DOX.js";import{j as T}from"./index-CCIS1AbN.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"./badgeColors-DQ_P_DOX.js";import{j as T}from"./index-w_yLpa1c.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};
|
package/dist/dashboard/public/assets/{DumpDetailView-Df-ygu8R.js → DumpDetailView-c1-zovWx.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as n,j as e,H as d,D as h,F as j,C as g}from"./index-
|
|
1
|
+
import{c as n,j as e,H as d,D as h,F as j,C as g}from"./index-w_yLpa1c.js";import{p as c,f as u}from"./badgeColors-DQ_P_DOX.js";import{D as a,f}from"./DetailRow-BaSzSd02.js";import{C as l}from"./types-BblOEq1q.js";import{C as N}from"./CopyButton-oI0f2BPa.js";import{C as y}from"./circle-check-big-DVxhxYns.js";import{C as x}from"./circle-x-v0VbdG9M.js";import"./vendor-DBTT3jXp.js";import"./EntryDetailPage-CVC4IBjE.js";import"./search-BERxF7dG.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 l}from"./index-
|
|
1
|
+
import{j as a,H as l}from"./index-w_yLpa1c.js";import{e as P,b as B}from"./vendor-DBTT3jXp.js";import{f as M,p as R}from"./badgeColors-DQ_P_DOX.js";import{u as S,P as T,N as $,L as A}from"./PageHeader-BNjXB_Ja.js";import{u as z,r as H,C as d}from"./types-BblOEq1q.js";import{T as o,D as L,b}from"./DataTable-D39w-diZ.js";function J(){const p=P(),{addFilter:t,clearAll:u,serverFilters:c,headerFilters:h,hasFilters:m}=z("dumps"),{entries:x,loading:g,refreshing:i,newEntriesCount:f,hasMore:j,loadMore:y,loadNew:C,autoRefreshEnabled:k,live:w,setAutoRefresh:N,meta:s,isHighlighted:v}=S({type:"dump",limit:50,filters:c}),n=x.filter(e=>H(e)),D=e=>e?e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}MB`:`${(e/(1024*1024*1024)).toFixed(1)}GB`:"-",E=B.useMemo(()=>[{key:"operation",header:"Operation",width:"120px",render:e=>a.jsx(d,{onClick:r=>{r.stopPropagation(),t("operations",e.payload.operation)},children:e.payload.operation.toUpperCase()})},{key:"format",header:"Format",width:"100px",render:e=>a.jsx(d,{onClick:r=>{r.stopPropagation(),t("formats",e.payload.format)},className:"font-mono",children:e.payload.format})},{key:"records",header:"Records",width:"100px",align:"right",render:e=>e.payload.recordCount!==void 0?a.jsx(o,{children:e.payload.recordCount.toLocaleString()}):a.jsx(o,{secondary:!0,children:"-"})},{key:"size",header:"Size",width:"100px",align:"right",render:e=>a.jsx(o,{children:D(e.payload.fileSize)})},{key:"status",header:"Status",width:"100px",render:e=>a.jsx(d,{onClick:r=>{r.stopPropagation(),t("statuses",e.payload.status)},children:e.payload.status.toUpperCase()})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>a.jsx(L,{ms:e.payload.duration||0})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(o,{secondary:!0,className:"text-xs",children:M(R(e.createdAt),{addSuffix:!0})})}],[t]);if(g&&n.length===0)return 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"})});const F=m?"pt-28":"pt-16";return a.jsxs("div",{children:[a.jsx(T,{title:"Dumps",icon:l,iconColor:"text-slate-600 dark:text-slate-400",count:n.length,totalCount:s==null?void 0:s.total,refreshing:i,autoRefreshEnabled:k,live:w,onAutoRefreshToggle:N,filters:h,onClearAllFilters:u}),a.jsxs("div",{className:`${F} space-y-4 transition-all duration-200`,children:[a.jsx($,{count:f,onClick:C,loading:i}),a.jsx(b,{columns:E,data:n,keyExtractor:e=>e.id,onRowClick:e=>p(`/dumps/${e.id}`),rowClassName:e=>v(e.id)?"highlight-new":"",emptyMessage:"No data dumps recorded yet",emptyIcon:a.jsx(l,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(A,{hasMore:j,onClick:y,loading:i})]})]})}export{J as default};
|