nestlens 0.8.4 → 0.8.6
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/dashboard.controller.d.ts +5 -4
- package/dist/api/dashboard.controller.js +5 -4
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/spa-wildcard.d.ts +50 -0
- package/dist/api/spa-wildcard.js +102 -0
- package/dist/core/storage/redis.storage.d.ts +14 -18
- package/dist/core/storage/redis.storage.js +84 -9
- package/dist/dashboard/public/assets/{BatchesPage-Be2pyBW1.js → BatchesPage-Pun3mkyo.js} +1 -1
- package/dist/dashboard/public/assets/{CachePage-D7Kbnbd0.js → CachePage-BbwIJ1ii.js} +1 -1
- package/dist/dashboard/public/assets/{ClickableBadge-BMv7BT5d.js → ClickableBadge-BDF_xguC.js} +1 -1
- package/dist/dashboard/public/assets/{CommandsPage-Dka-rd2n.js → CommandsPage-DbXxE0B2.js} +1 -1
- package/dist/dashboard/public/assets/{DashboardPage-D_boxQLL.js → DashboardPage-XHDrJmKt.js} +1 -1
- package/dist/dashboard/public/assets/{DumpsPage-CBdtECHX.js → DumpsPage-B6wALf3q.js} +1 -1
- package/dist/dashboard/public/assets/{EntryDetailPage-bchF1CyH.js → EntryDetailPage-Cntb_d8d.js} +1 -1
- package/dist/dashboard/public/assets/{EntrySearchInput-B0inpTDa.js → EntrySearchInput-BbxhtfSP.js} +1 -1
- package/dist/dashboard/public/assets/{EventsPage-DyWBq1Uz.js → EventsPage-CplkErDU.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionsPage-DUAve13R.js → ExceptionsPage-DknQi8ni.js} +1 -1
- package/dist/dashboard/public/assets/{GatesPage-grMG9-Pd.js → GatesPage-FV1TYSLA.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLPage-DMiSp1JA.js → GraphQLPage-D6X9Ou2L.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientPage-9bBt0DkK.js → HttpClientPage-KsHbgzKe.js} +1 -1
- package/dist/dashboard/public/assets/{JobsPage-Cp5LjuZV.js → JobsPage-CakDNDNm.js} +1 -1
- package/dist/dashboard/public/assets/{LogsPage-CCQCPtf2.js → LogsPage-CMMOJO3G.js} +1 -1
- package/dist/dashboard/public/assets/{MailPage-F1fRQOqV.js → MailPage-DF3ob78y.js} +1 -1
- package/dist/dashboard/public/assets/{ModelsPage-B7KhpXXG.js → ModelsPage-8dOCyvA-.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationsPage-CkMMZzIi.js → NotificationsPage-CcSLYMSX.js} +1 -1
- package/dist/dashboard/public/assets/{PageHeader-DX-OMwaI.js → PageHeader-C-LDCH8m.js} +1 -1
- package/dist/dashboard/public/assets/{QueriesPage-DWPD6H4n.js → QueriesPage-BoX8h2zT.js} +1 -1
- package/dist/dashboard/public/assets/{RedisPage-D4gL25Ig.js → RedisPage-BgSoCv89.js} +1 -1
- package/dist/dashboard/public/assets/{RequestsPage-Dqymx42m.js → RequestsPage-5lJXGHwS.js} +1 -1
- package/dist/dashboard/public/assets/{SchedulePage-BqqBFGe3.js → SchedulePage-hq0i-gxe.js} +1 -1
- package/dist/dashboard/public/assets/{ViewsPage-CRRuOZy9.js → ViewsPage-D_tbt0MI.js} +1 -1
- package/dist/dashboard/public/assets/{calendar-Clp1lAlK.js → calendar-B9V9qYRf.js} +1 -1
- package/dist/dashboard/public/assets/{circle-check-big-DetB5WLf.js → circle-check-big--p__my73.js} +1 -1
- package/dist/dashboard/public/assets/{eye-CSqFQRNH.js → eye-W_cx4t8b.js} +1 -1
- package/dist/dashboard/public/assets/{index-DbQfemEm.js → index-l287glk6.js} +2 -2
- package/dist/dashboard/public/assets/{search-D49Ll27y.js → search-CeL9wSpm.js} +1 -1
- package/dist/dashboard/public/assets/{types-CqX7bh6c.js → types-taCMgqPD.js} +1 -1
- package/dist/dashboard/public/assets/{zap-kpgvBBxB.js → zap-cgkITMWP.js} +1 -1
- package/dist/dashboard/public/index.html +1 -1
- package/dist/nestlens.module.js +3 -1
- package/package.json +3 -1
|
@@ -15,10 +15,11 @@ export declare class DashboardController {
|
|
|
15
15
|
* router, so it gets index.html and React decides what to render — including
|
|
16
16
|
* its own not-found page. Declared last so the asset and SVG routes above win.
|
|
17
17
|
*
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* The bare `*` here is the fallback, not the final answer: it is the one form
|
|
19
|
+
* every router has always accepted, and Express 5 takes it only under protest,
|
|
20
|
+
* logging a deprecation notice about our route on every boot.
|
|
21
|
+
* {@link SpaRouteRegistrar} replaces it with whichever form the adapter in use
|
|
22
|
+
* actually wants, before Nest resolves routes.
|
|
22
23
|
*/
|
|
23
24
|
serveSpaRoute(res: unknown, forwarded?: string): void;
|
|
24
25
|
/**
|
|
@@ -85,10 +85,11 @@ let DashboardController = class DashboardController {
|
|
|
85
85
|
* router, so it gets index.html and React decides what to render — including
|
|
86
86
|
* its own not-found page. Declared last so the asset and SVG routes above win.
|
|
87
87
|
*
|
|
88
|
-
* The
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
88
|
+
* The bare `*` here is the fallback, not the final answer: it is the one form
|
|
89
|
+
* every router has always accepted, and Express 5 takes it only under protest,
|
|
90
|
+
* logging a deprecation notice about our route on every boot.
|
|
91
|
+
* {@link SpaRouteRegistrar} replaces it with whichever form the adapter in use
|
|
92
|
+
* actually wants, before Nest resolves routes.
|
|
92
93
|
*/
|
|
93
94
|
serveSpaRoute(res, forwarded) {
|
|
94
95
|
this.sendIndexHtml(res, forwarded);
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -19,3 +19,4 @@ __exportStar(require("./api.guard"), exports);
|
|
|
19
19
|
__exportStar(require("./dashboard.controller"), exports);
|
|
20
20
|
__exportStar(require("./stream.controller"), exports);
|
|
21
21
|
__exportStar(require("./tag.controller"), exports);
|
|
22
|
+
__exportStar(require("./spa-wildcard"), exports);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { HttpAdapterHost } from '@nestjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* The SPA fallback has to match any depth — `/nestlens/requests/42` is a route
|
|
4
|
+
* inside the dashboard, not a file — and the two routers spell that differently.
|
|
5
|
+
* Measured on NestJS 11, booting each syntax on each adapter:
|
|
6
|
+
*
|
|
7
|
+
* | | Express | Fastify |
|
|
8
|
+
* |-----------|--------------------------|-----------------------------|
|
|
9
|
+
* | `*` | serves, logs a warning | serves |
|
|
10
|
+
* | `*path` | serves | fails to boot |
|
|
11
|
+
* | `{*path}` | serves | fails to boot |
|
|
12
|
+
*
|
|
13
|
+
* Fastify's router rejects anything after the star ("Wildcard must be the last
|
|
14
|
+
* character in the route"), so the bare form is the only one it takes. Express
|
|
15
|
+
* 5 routes through path-to-regexp v8, which dropped the bare star: NestJS
|
|
16
|
+
* accepts it, rewrites it, and says so on every boot —
|
|
17
|
+
*
|
|
18
|
+
* [LegacyRouteConverter] Unsupported route path: "/nestlens/*" …
|
|
19
|
+
*
|
|
20
|
+
* — which is a deprecation notice about our route in someone else's log.
|
|
21
|
+
* Express 4 (NestJS 9 and 10) is the other way round: it wants the bare star and
|
|
22
|
+
* reads `*path` as a star followed by the literal text `path`, matching nothing.
|
|
23
|
+
*
|
|
24
|
+
* So the answer depends on the router, which is not known when `forRoot()` runs.
|
|
25
|
+
* {@link SpaRouteRegistrar} settles it once the adapter exists.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toSpaWildcard: (adapterType: string | undefined, expressMajor: number | undefined) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Express's major version, or `undefined` when it cannot be read.
|
|
30
|
+
*
|
|
31
|
+
* Required lazily: Express is not a dependency of this package, and an
|
|
32
|
+
* application on Fastify has no reason to have it installed. Only reached when
|
|
33
|
+
* the adapter has already identified itself as Express.
|
|
34
|
+
*/
|
|
35
|
+
export declare const readExpressMajor: () => number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Points the dashboard's catch-all at the syntax the running router accepts.
|
|
38
|
+
*
|
|
39
|
+
* A provider rather than a lifecycle hook on purpose: providers are constructed
|
|
40
|
+
* while the application is being assembled, which is before Nest's
|
|
41
|
+
* RoutesResolver reads the metadata — and by then `HttpAdapterHost` already
|
|
42
|
+
* holds the real adapter. `forRoot()`, where the rest of the mount points are
|
|
43
|
+
* decided, runs too early to know which one it will be.
|
|
44
|
+
*
|
|
45
|
+
* If it never runs, the decorator's own bare `*` stands, which every router has
|
|
46
|
+
* always accepted.
|
|
47
|
+
*/
|
|
48
|
+
export declare class SpaRouteRegistrar {
|
|
49
|
+
constructor(adapterHost?: HttpAdapterHost);
|
|
50
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SpaRouteRegistrar = exports.readExpressMajor = exports.toSpaWildcard = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const constants_1 = require("@nestjs/common/constants");
|
|
18
|
+
const core_1 = require("@nestjs/core");
|
|
19
|
+
const dashboard_controller_1 = require("./dashboard.controller");
|
|
20
|
+
/**
|
|
21
|
+
* The SPA fallback has to match any depth — `/nestlens/requests/42` is a route
|
|
22
|
+
* inside the dashboard, not a file — and the two routers spell that differently.
|
|
23
|
+
* Measured on NestJS 11, booting each syntax on each adapter:
|
|
24
|
+
*
|
|
25
|
+
* | | Express | Fastify |
|
|
26
|
+
* |-----------|--------------------------|-----------------------------|
|
|
27
|
+
* | `*` | serves, logs a warning | serves |
|
|
28
|
+
* | `*path` | serves | fails to boot |
|
|
29
|
+
* | `{*path}` | serves | fails to boot |
|
|
30
|
+
*
|
|
31
|
+
* Fastify's router rejects anything after the star ("Wildcard must be the last
|
|
32
|
+
* character in the route"), so the bare form is the only one it takes. Express
|
|
33
|
+
* 5 routes through path-to-regexp v8, which dropped the bare star: NestJS
|
|
34
|
+
* accepts it, rewrites it, and says so on every boot —
|
|
35
|
+
*
|
|
36
|
+
* [LegacyRouteConverter] Unsupported route path: "/nestlens/*" …
|
|
37
|
+
*
|
|
38
|
+
* — which is a deprecation notice about our route in someone else's log.
|
|
39
|
+
* Express 4 (NestJS 9 and 10) is the other way round: it wants the bare star and
|
|
40
|
+
* reads `*path` as a star followed by the literal text `path`, matching nothing.
|
|
41
|
+
*
|
|
42
|
+
* So the answer depends on the router, which is not known when `forRoot()` runs.
|
|
43
|
+
* {@link SpaRouteRegistrar} settles it once the adapter exists.
|
|
44
|
+
*/
|
|
45
|
+
const toSpaWildcard = (adapterType, expressMajor) => {
|
|
46
|
+
if (adapterType !== 'express') {
|
|
47
|
+
return '*';
|
|
48
|
+
}
|
|
49
|
+
return (expressMajor ?? 0) >= 5 ? '*path' : '*';
|
|
50
|
+
};
|
|
51
|
+
exports.toSpaWildcard = toSpaWildcard;
|
|
52
|
+
/**
|
|
53
|
+
* Express's major version, or `undefined` when it cannot be read.
|
|
54
|
+
*
|
|
55
|
+
* Required lazily: Express is not a dependency of this package, and an
|
|
56
|
+
* application on Fastify has no reason to have it installed. Only reached when
|
|
57
|
+
* the adapter has already identified itself as Express.
|
|
58
|
+
*/
|
|
59
|
+
const readExpressMajor = () => {
|
|
60
|
+
try {
|
|
61
|
+
const { version } = require('express/package.json');
|
|
62
|
+
const major = Number.parseInt(version ?? '', 10);
|
|
63
|
+
return Number.isNaN(major) ? undefined : major;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.readExpressMajor = readExpressMajor;
|
|
70
|
+
/**
|
|
71
|
+
* Points the dashboard's catch-all at the syntax the running router accepts.
|
|
72
|
+
*
|
|
73
|
+
* A provider rather than a lifecycle hook on purpose: providers are constructed
|
|
74
|
+
* while the application is being assembled, which is before Nest's
|
|
75
|
+
* RoutesResolver reads the metadata — and by then `HttpAdapterHost` already
|
|
76
|
+
* holds the real adapter. `forRoot()`, where the rest of the mount points are
|
|
77
|
+
* decided, runs too early to know which one it will be.
|
|
78
|
+
*
|
|
79
|
+
* If it never runs, the decorator's own bare `*` stands, which every router has
|
|
80
|
+
* always accepted.
|
|
81
|
+
*/
|
|
82
|
+
let SpaRouteRegistrar = class SpaRouteRegistrar {
|
|
83
|
+
constructor(adapterHost) {
|
|
84
|
+
const adapter = adapterHost?.httpAdapter;
|
|
85
|
+
if (!adapter) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const adapterType = typeof adapter.getType === 'function' ? adapter.getType() : undefined;
|
|
89
|
+
const handler = Object.getOwnPropertyDescriptor(dashboard_controller_1.DashboardController.prototype, 'serveSpaRoute')
|
|
90
|
+
?.value;
|
|
91
|
+
if (!handler) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
Reflect.defineMetadata(constants_1.PATH_METADATA, (0, exports.toSpaWildcard)(adapterType, adapterType === 'express' ? (0, exports.readExpressMajor)() : undefined), handler);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.SpaRouteRegistrar = SpaRouteRegistrar;
|
|
98
|
+
exports.SpaRouteRegistrar = SpaRouteRegistrar = __decorate([
|
|
99
|
+
(0, common_1.Injectable)(),
|
|
100
|
+
__param(0, (0, common_1.Optional)()),
|
|
101
|
+
__metadata("design:paramtypes", [core_1.HttpAdapterHost])
|
|
102
|
+
], SpaRouteRegistrar);
|
|
@@ -2,24 +2,6 @@ import { OnModuleDestroy } from '@nestjs/common';
|
|
|
2
2
|
import { Entry, EntryFilter, EntryStats, EntryType, CursorPaginationParams, CursorPaginatedResponse, StorageStats, MonitoredTag, TagWithCount } from '../../types';
|
|
3
3
|
import { StorageInterface } from './storage.interface';
|
|
4
4
|
import { RedisStorageConfig } from '../../nestlens.config';
|
|
5
|
-
/**
|
|
6
|
-
* Redis storage implementation for NestLens.
|
|
7
|
-
* Requires ioredis to be installed.
|
|
8
|
-
* Ideal for production environments with horizontal scaling.
|
|
9
|
-
*
|
|
10
|
-
* Redis Key Structure:
|
|
11
|
-
* - {prefix}entries:{id} - Hash storing entry data
|
|
12
|
-
* - {prefix}entries:all - Sorted set of all entry IDs (score = timestamp)
|
|
13
|
-
* - {prefix}entries:type:{type} - Sorted set of entry IDs by type
|
|
14
|
-
* - {prefix}entries:request:{requestId} - Set of entry IDs for a request
|
|
15
|
-
* - {prefix}entries:sequence - Counter for entry IDs
|
|
16
|
-
* - {prefix}tags:{entryId} - Set of tags for an entry
|
|
17
|
-
* - {prefix}tags:index:{tag} - Set of entry IDs with this tag
|
|
18
|
-
* - {prefix}tags:counts - Hash of tag -> count
|
|
19
|
-
* - {prefix}monitored - Hash of monitored tags
|
|
20
|
-
* - {prefix}monitored:sequence - Counter for monitored tag IDs
|
|
21
|
-
* - {prefix}family:{hash} - Set of entry IDs with this family hash
|
|
22
|
-
*/
|
|
23
5
|
export declare class RedisStorage implements StorageInterface, OnModuleDestroy {
|
|
24
6
|
private readonly logger;
|
|
25
7
|
private client;
|
|
@@ -36,6 +18,20 @@ export declare class RedisStorage implements StorageInterface, OnModuleDestroy {
|
|
|
36
18
|
private loadRedisClient;
|
|
37
19
|
private getClient;
|
|
38
20
|
initialize(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Rescores an index written by an earlier version.
|
|
23
|
+
*
|
|
24
|
+
* Entries used to be scored by their save time, which put a millisecond clock
|
|
25
|
+
* where the cursor expects a sequence number. Left alone after an upgrade, the
|
|
26
|
+
* old members would keep their huge timestamp scores and sort above every new
|
|
27
|
+
* entry — so the listing would open on yesterday's data and paging would
|
|
28
|
+
* misbehave around the boundary.
|
|
29
|
+
*
|
|
30
|
+
* The ids are already there as members, so the scores can simply be rewritten
|
|
31
|
+
* and the time index rebuilt from each entry's own `createdAt`. Nothing is
|
|
32
|
+
* deleted: an upgrade keeps whatever the application had recorded.
|
|
33
|
+
*/
|
|
34
|
+
private migrateIndexScores;
|
|
39
35
|
save(entry: Entry): Promise<Entry>;
|
|
40
36
|
saveBatch(entries: Entry[]): Promise<Entry[]>;
|
|
41
37
|
find(filter: EntryFilter): Promise<Entry[]>;
|
|
@@ -52,10 +52,12 @@ const common_1 = require("@nestjs/common");
|
|
|
52
52
|
*
|
|
53
53
|
* Redis Key Structure:
|
|
54
54
|
* - {prefix}entries:{id} - Hash storing entry data
|
|
55
|
-
* - {prefix}entries:all - Sorted set of all entry IDs (score =
|
|
56
|
-
* - {prefix}entries:type:{type} - Sorted set of entry IDs by type
|
|
55
|
+
* - {prefix}entries:all - Sorted set of all entry IDs (score = id)
|
|
56
|
+
* - {prefix}entries:type:{type} - Sorted set of entry IDs by type (score = id)
|
|
57
|
+
* - {prefix}entries:createdAt - Sorted set of entry IDs by save time, for pruning
|
|
57
58
|
* - {prefix}entries:request:{requestId} - Set of entry IDs for a request
|
|
58
59
|
* - {prefix}entries:sequence - Counter for entry IDs
|
|
60
|
+
* - {prefix}schema - Index layout version, so an upgrade rescores once
|
|
59
61
|
* - {prefix}tags:{entryId} - Set of tags for an entry
|
|
60
62
|
* - {prefix}tags:index:{tag} - Set of entry IDs with this tag
|
|
61
63
|
* - {prefix}tags:counts - Hash of tag -> count
|
|
@@ -63,6 +65,11 @@ const common_1 = require("@nestjs/common");
|
|
|
63
65
|
* - {prefix}monitored:sequence - Counter for monitored tag IDs
|
|
64
66
|
* - {prefix}family:{hash} - Set of entry IDs with this family hash
|
|
65
67
|
*/
|
|
68
|
+
/**
|
|
69
|
+
* Bumped when the meaning of an index score changes, so an existing database is
|
|
70
|
+
* rewritten once rather than read with the wrong assumption.
|
|
71
|
+
*/
|
|
72
|
+
const INDEX_SCHEMA_VERSION = '2';
|
|
66
73
|
let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
67
74
|
constructor(config = {}) {
|
|
68
75
|
this.logger = new common_1.Logger(RedisStorage_1.name);
|
|
@@ -114,8 +121,63 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
114
121
|
}
|
|
115
122
|
async initialize() {
|
|
116
123
|
this.client = await this.loadRedisClient();
|
|
124
|
+
// ioredis connects in the background, so this is the first command anything
|
|
125
|
+
// sends — and the first chance for an unreachable Redis to throw. NestLens
|
|
126
|
+
// is a debugging tool: it does not get to stop the application it is
|
|
127
|
+
// watching from starting. The rescore is retried on the next boot.
|
|
128
|
+
try {
|
|
129
|
+
await this.migrateIndexScores();
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
133
|
+
this.logger.warn(`Could not prepare the entry indexes: ${reason}`);
|
|
134
|
+
}
|
|
117
135
|
this.logger.log('Redis storage initialized');
|
|
118
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Rescores an index written by an earlier version.
|
|
139
|
+
*
|
|
140
|
+
* Entries used to be scored by their save time, which put a millisecond clock
|
|
141
|
+
* where the cursor expects a sequence number. Left alone after an upgrade, the
|
|
142
|
+
* old members would keep their huge timestamp scores and sort above every new
|
|
143
|
+
* entry — so the listing would open on yesterday's data and paging would
|
|
144
|
+
* misbehave around the boundary.
|
|
145
|
+
*
|
|
146
|
+
* The ids are already there as members, so the scores can simply be rewritten
|
|
147
|
+
* and the time index rebuilt from each entry's own `createdAt`. Nothing is
|
|
148
|
+
* deleted: an upgrade keeps whatever the application had recorded.
|
|
149
|
+
*/
|
|
150
|
+
async migrateIndexScores() {
|
|
151
|
+
const client = this.getClient();
|
|
152
|
+
const schemaKey = this.key('schema');
|
|
153
|
+
if ((await client.get(schemaKey)) === INDEX_SCHEMA_VERSION) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const ids = await client.zrange(this.key('entries', 'all'), 0, -1);
|
|
157
|
+
if (ids.length > 0) {
|
|
158
|
+
const reader = client.pipeline();
|
|
159
|
+
for (const id of ids) {
|
|
160
|
+
reader.hgetall(this.key('entries', id));
|
|
161
|
+
}
|
|
162
|
+
const hashes = (await reader.exec()) ?? [];
|
|
163
|
+
const writer = client.pipeline();
|
|
164
|
+
let rescored = 0;
|
|
165
|
+
ids.forEach((id, index) => {
|
|
166
|
+
const hash = hashes[index]?.[1];
|
|
167
|
+
if (!hash?.type) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
writer.zadd(this.key('entries', 'all'), Number(id), id);
|
|
171
|
+
writer.zadd(this.key('entries', 'type', hash.type), Number(id), id);
|
|
172
|
+
const createdAt = Date.parse(hash.createdAt ?? '');
|
|
173
|
+
writer.zadd(this.key('entries', 'createdAt'), Number.isNaN(createdAt) ? Number(id) : createdAt, id);
|
|
174
|
+
rescored += 1;
|
|
175
|
+
});
|
|
176
|
+
await writer.exec();
|
|
177
|
+
this.logger.log(`Rescored ${rescored} entries onto the sequence index`);
|
|
178
|
+
}
|
|
179
|
+
await client.set(schemaKey, INDEX_SCHEMA_VERSION);
|
|
180
|
+
}
|
|
119
181
|
// ==================== Core CRUD Operations ====================
|
|
120
182
|
async save(entry) {
|
|
121
183
|
const client = this.getClient();
|
|
@@ -129,9 +191,15 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
129
191
|
};
|
|
130
192
|
// Store entry as hash
|
|
131
193
|
await client.hset(this.key('entries', String(id)), 'id', String(id), 'type', entry.type, 'requestId', entry.requestId ?? '', 'payload', JSON.stringify(entry.payload), 'createdAt', createdAt, 'familyHash', entry.familyHash ?? '', 'resolvedAt', entry.resolvedAt ?? '');
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
194
|
+
// Scored by id, not by time: the id is what a cursor carries, and it is
|
|
195
|
+
// unique. Scoring by timestamp made `beforeSequence` compare an id against a
|
|
196
|
+
// millisecond clock — every page after the first came back empty — and gave
|
|
197
|
+
// entries saved in the same millisecond equal scores, so an exclusive range
|
|
198
|
+
// would have skipped them.
|
|
199
|
+
await client.zadd(this.key('entries', 'all'), id, String(id));
|
|
200
|
+
await client.zadd(this.key('entries', 'type', entry.type), id, String(id));
|
|
201
|
+
// Pruning is the one thing that genuinely asks a time question.
|
|
202
|
+
await client.zadd(this.key('entries', 'createdAt'), timestamp, String(id));
|
|
135
203
|
// Add to request index if applicable
|
|
136
204
|
if (entry.requestId) {
|
|
137
205
|
await client.sadd(this.key('entries', 'request', entry.requestId), String(id));
|
|
@@ -154,8 +222,9 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
154
222
|
const savedEntry = { ...entry, id, createdAt };
|
|
155
223
|
results.push(savedEntry);
|
|
156
224
|
pipeline.hset(this.key('entries', String(id)), 'id', String(id), 'type', entry.type, 'requestId', entry.requestId ?? '', 'payload', JSON.stringify(entry.payload), 'createdAt', createdAt, 'familyHash', entry.familyHash ?? '', 'resolvedAt', entry.resolvedAt ?? '');
|
|
157
|
-
pipeline.zadd(this.key('entries', 'all'),
|
|
158
|
-
pipeline.zadd(this.key('entries', 'type', entry.type),
|
|
225
|
+
pipeline.zadd(this.key('entries', 'all'), id, String(id));
|
|
226
|
+
pipeline.zadd(this.key('entries', 'type', entry.type), id, String(id));
|
|
227
|
+
pipeline.zadd(this.key('entries', 'createdAt'), timestamp + i, String(id));
|
|
159
228
|
if (entry.requestId) {
|
|
160
229
|
pipeline.sadd(this.key('entries', 'request', entry.requestId), String(id));
|
|
161
230
|
}
|
|
@@ -392,7 +461,7 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
392
461
|
async prune(before) {
|
|
393
462
|
const client = this.getClient();
|
|
394
463
|
const maxScore = before.getTime();
|
|
395
|
-
const ids = await client.zrangebyscore(this.key('entries', '
|
|
464
|
+
const ids = await client.zrangebyscore(this.key('entries', 'createdAt'), '-inf', maxScore);
|
|
396
465
|
if (ids.length === 0)
|
|
397
466
|
return 0;
|
|
398
467
|
for (const id of ids) {
|
|
@@ -404,7 +473,12 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
404
473
|
async pruneByType(type, before) {
|
|
405
474
|
const client = this.getClient();
|
|
406
475
|
const maxScore = before.getTime();
|
|
407
|
-
const
|
|
476
|
+
const olderThanCutoff = await client.zrangebyscore(this.key('entries', 'createdAt'), '-inf', maxScore);
|
|
477
|
+
// The type index is scored by id now, so it can no longer answer a time
|
|
478
|
+
// question on its own; membership is what it is asked for instead.
|
|
479
|
+
const typeKey = this.key('entries', 'type', type);
|
|
480
|
+
const membership = await Promise.all(olderThanCutoff.map((id) => client.zscore(typeKey, id)));
|
|
481
|
+
const ids = olderThanCutoff.filter((_, index) => membership[index] !== null);
|
|
408
482
|
if (ids.length === 0)
|
|
409
483
|
return 0;
|
|
410
484
|
for (const id of ids) {
|
|
@@ -612,6 +686,7 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
612
686
|
await client.del(this.key('entries', String(id)));
|
|
613
687
|
await client.zrem(this.key('entries', 'all'), String(id));
|
|
614
688
|
await client.zrem(this.key('entries', 'type', hash.type), String(id));
|
|
689
|
+
await client.zrem(this.key('entries', 'createdAt'), String(id));
|
|
615
690
|
if (hash.requestId) {
|
|
616
691
|
await client.srem(this.key('entries', 'request', hash.requestId), String(id));
|
|
617
692
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,L as d}from"./index-
|
|
1
|
+
import{j as a,L as d}from"./index-l287glk6.js";import{e as D,b as F}from"./vendor-DBTT3jXp.js";import{u as M,C as c,f as T,p as A}from"./ClickableBadge-BDF_xguC.js";import{u as L,P as R,N as $,L as I}from"./PageHeader-C-LDCH8m.js";import{s as H,T as s,D as S,b as W}from"./types-taCMgqPD.js";function J(){const h=D(),{addFilter:r,clearAll:p,serverFilters:u,headerFilters:x,hasFilters:m}=M("batches"),{entries:g,loading:y,refreshing:o,newEntriesCount:f,hasMore:j,loadMore:b,loadNew:k,autoRefreshEnabled:C,live:N,setAutoRefresh:w,meta:i,isHighlighted:E}=L({type:"batch",limit:50,filters:u}),n=g.filter(e=>H(e)),v=F.useMemo(()=>[{key:"name",header:"Name",minWidth:"200px",render:e=>a.jsx(s,{mono:!0,truncate:!0,maxWidth:"250px",children:e.payload.name})},{key:"operation",header:"Operation",width:"150px",render:e=>e.payload.operation?a.jsx(c,{onClick:t=>{t.stopPropagation(),r("operations",e.payload.operation)},children:e.payload.operation}):a.jsx(s,{secondary:!0,children:"-"})},{key:"progress",header:"Progress",width:"150px",render:e=>{const{processedItems:t,totalItems:l}=e.payload,B=l>0?Math.round(t/l*100):0;return a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(s,{children:`${t}/${l}`}),a.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",B,"%)"]})]})}},{key:"status",header:"Status",width:"120px",render:e=>a.jsx(c,{onClick:t=>{t.stopPropagation(),r("statuses",e.payload.status)},children:e.payload.status.toUpperCase()})},{key:"duration",header:"Duration",width:"100px",align:"right",render:e=>e.payload.duration?a.jsx(S,{ms:e.payload.duration}):a.jsx(s,{secondary:!0,children:"-"})},{key:"time",header:"Time",width:"170px",align:"right",render:e=>a.jsx(s,{secondary:!0,className:"text-xs",children:T(A(e.createdAt),{addSuffix:!0})})}],[r]);if(y&&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 P=m?"pt-28":"pt-16";return a.jsxs("div",{children:[a.jsx(R,{title:"Batches",icon:d,iconColor:"text-blue-600 dark:text-blue-400",count:n.length,totalCount:i==null?void 0:i.total,refreshing:o,autoRefreshEnabled:C,live:N,onAutoRefreshToggle:w,filters:x,onClearAllFilters:p}),a.jsxs("div",{className:`${P} space-y-4 transition-all duration-200`,children:[a.jsx($,{count:f,onClick:k,loading:o}),a.jsx(W,{columns:v,data:n,keyExtractor:e=>e.id,onRowClick:e=>h(`/batches/${e.id}`),rowClassName:e=>E(e.id)?"highlight-new":"",emptyMessage:"No batch operations recorded yet",emptyIcon:a.jsx(d,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),a.jsx(I,{hasMore:j,onClick:b,loading:o})]})]})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,H as o}from"./index-
|
|
1
|
+
import{j as a,H as o}from"./index-l287glk6.js";import{e as T,b as E}from"./vendor-DBTT3jXp.js";import{u as v,C as l,f as D,p as M}from"./ClickableBadge-BDF_xguC.js";import{u as R,P as A,N as F,L as H}from"./PageHeader-C-LDCH8m.js";import{h as P,T as i,D as B,b as I}from"./types-taCMgqPD.js";function O(){const n=T(),{clearAll:d,serverFilters:c,headerFilters:h,hasFilters:p}=v("cache"),{entries:u,loading:x,refreshing:t,newEntriesCount:y,hasMore:m,loadMore:g,loadNew:f,autoRefreshEnabled:j,live:k,setAutoRefresh:C,meta:r,isHighlighted:w}=R({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:D(M(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(A,{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(F,{count:y,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(H,{hasMore:m,onClick:g,loading:t})]})]})}export{O as default};
|
package/dist/dashboard/public/assets/{ClickableBadge-BMv7BT5d.js → ClickableBadge-BDF_xguC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as T}from"./index-DbQfemEm.js";import{f as H,b as p,e as j,u as q}from"./vendor-DBTT3jXp.js";const Ye=6048e5,Ve=864e5,S=43200,L=1440,K=Symbol.for("constructDateFrom");function C(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&K in t?t[K](e):t instanceof Date?new t.constructor(e):new Date(e)}function k(t,e){return C(e||t,t)}let G={};function X(){return G}function I(t){const e=k(t),a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),+t-+a}function O(t,...e){const a=C.bind(null,t||e.find(r=>typeof r=="object"));return e.map(a)}function P(t,e){const a=+k(t)-+k(e);return a<0?-1:a>0?1:a}function Y(t){return C(t,Date.now())}function V(t,e,a){const[r,n]=O(a==null?void 0:a.in,t,e),l=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return l*12+i}function B(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function Q(t,e){return+k(t)-+k(e)}function z(t,e){const a=k(t,e==null?void 0:e.in);return a.setHours(23,59,59,999),a}function _(t,e){const a=k(t,e==null?void 0:e.in),r=a.getMonth();return a.setFullYear(a.getFullYear(),r+1,0),a.setHours(23,59,59,999),a}function $(t,e){const a=k(t,e==null?void 0:e.in);return+z(a,e)==+_(a,e)}function J(t,e,a){const[r,n,l]=O(a==null?void 0:a.in,t,t,e),i=P(n,l),s=Math.abs(V(n,l));if(s<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let b=P(n,l)===-i;$(r)&&s===1&&P(r,l)===1&&(b=!1);const f=i*(s-+b);return f===0?0:f}function Z(t,e,a){const r=Q(t,e)/1e3;return B(a==null?void 0:a.roundingMethod)(r)}const ee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},te=(t,e,a)=>{let r;const n=ee[t];return typeof n=="string"?r=n:e===1?r=n.one:r=n.other.replace("{{count}}",e.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r};function M(t){return(e={})=>{const a=e.width?String(e.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const ae={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},re={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ne={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},se={date:M({formats:ae,defaultWidth:"full"}),time:M({formats:re,defaultWidth:"full"}),dateTime:M({formats:ne,defaultWidth:"full"})},ie={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},oe=(t,e,a,r)=>ie[t];function v(t){return(e,a)=>{const r=a!=null&&a.context?String(a.context):"standalone";let n;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,s=a!=null&&a.width?String(a.width):i;n=t.formattingValues[s]||t.formattingValues[i]}else{const i=t.defaultWidth,s=a!=null&&a.width?String(a.width):t.defaultWidth;n=t.values[s]||t.values[i]}const l=t.argumentCallback?t.argumentCallback(e):e;return n[l]}}const le={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},de={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ce={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},me={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ge=(t,e)=>{const a=Number(t),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},he={ordinalNumber:ge,era:v({values:le,defaultWidth:"wide"}),quarter:v({values:ue,defaultWidth:"wide",argumentCallback:t=>t-1}),month:v({values:de,defaultWidth:"wide"}),day:v({values:ce,defaultWidth:"wide"}),dayPeriod:v({values:me,defaultWidth:"wide",formattingValues:fe,defaultFormattingWidth:"wide"})};function E(t){return(e,a={})=>{const r=a.width,n=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],l=e.match(n);if(!l)return null;const i=l[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],b=Array.isArray(s)?be(s,h=>h.test(i)):ye(s,h=>h.test(i));let f;f=t.valueCallback?t.valueCallback(b):b,f=a.valueCallback?a.valueCallback(f):f;const g=e.slice(i.length);return{value:f,rest:g}}}function ye(t,e){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&e(t[a]))return a}function be(t,e){for(let a=0;a<t.length;a++)if(e(t[a]))return a}function pe(t){return(e,a={})=>{const r=e.match(t.matchPattern);if(!r)return null;const n=r[0],l=e.match(t.parsePattern);if(!l)return null;let i=t.valueCallback?t.valueCallback(l[0]):l[0];i=a.valueCallback?a.valueCallback(i):i;const s=e.slice(n.length);return{value:i,rest:s}}}const ke=/^(\d+)(th|st|nd|rd)?/i,xe=/\d+/i,Ne={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ve={any:[/^b/i,/^(a|c)/i]},Ee={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},we={any:[/1/i,/2/i,/3/i,/4/i]},Se={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Te={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Pe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Me={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},De={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ce={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Oe={ordinalNumber:pe({matchPattern:ke,parsePattern:xe,valueCallback:t=>parseInt(t,10)}),era:E({matchPatterns:Ne,defaultMatchWidth:"wide",parsePatterns:ve,defaultParseWidth:"any"}),quarter:E({matchPatterns:Ee,defaultMatchWidth:"wide",parsePatterns:we,defaultParseWidth:"any",valueCallback:t=>t+1}),month:E({matchPatterns:Se,defaultMatchWidth:"wide",parsePatterns:Te,defaultParseWidth:"any"}),day:E({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),dayPeriod:E({matchPatterns:De,defaultMatchWidth:"any",parsePatterns:Ce,defaultParseWidth:"any"})},Re={code:"en-US",formatDistance:te,formatLong:se,formatRelative:oe,localize:he,match:Oe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ae(t,e,a){const r=X(),n=(a==null?void 0:a.locale)??r.locale??Re,l=2520,i=P(t,e);if(isNaN(i))throw new RangeError("Invalid time value");const s=Object.assign({},a,{addSuffix:a==null?void 0:a.addSuffix,comparison:i}),[b,f]=O(a==null?void 0:a.in,...i>0?[e,t]:[t,e]),g=Z(f,b),h=(I(f)-I(b))/1e3,m=Math.round((g-h)/60);let u;if(m<2)return a!=null&&a.includeSeconds?g<5?n.formatDistance("lessThanXSeconds",5,s):g<10?n.formatDistance("lessThanXSeconds",10,s):g<20?n.formatDistance("lessThanXSeconds",20,s):g<40?n.formatDistance("halfAMinute",0,s):g<60?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",1,s):m===0?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",m,s);if(m<45)return n.formatDistance("xMinutes",m,s);if(m<90)return n.formatDistance("aboutXHours",1,s);if(m<L){const o=Math.round(m/60);return n.formatDistance("aboutXHours",o,s)}else{if(m<l)return n.formatDistance("xDays",1,s);if(m<S){const o=Math.round(m/L);return n.formatDistance("xDays",o,s)}else if(m<S*2)return u=Math.round(m/S),n.formatDistance("aboutXMonths",u,s)}if(u=J(f,b),u<12){const o=Math.round(m/S);return n.formatDistance("xMonths",o,s)}else{const o=u%12,d=Math.trunc(u/12);return o<3?n.formatDistance("aboutXYears",d,s):o<9?n.formatDistance("overXYears",d,s):n.formatDistance("almostXYears",d+1,s)}}function Be(t,e){return Ae(t,Y(t),e)}function Qe(t){if(t.includes("T")&&(t.includes("Z")||t.includes("+")))return new Date(t);const e=t.replace(" ","T")+"Z";return new Date(e)}const D={request:{displayName:"Request",pluralName:"Requests",route:"requests",icon:"Globe",filters:{methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","GRAPHQL"]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},paths:{urlKey:"paths",displayName:"Path",values:[]},controllers:{urlKey:"controllers",displayName:"Controller",values:[]},hostnames:{urlKey:"hostnames",displayName:"Hostname",values:[]},ips:{urlKey:"ips",displayName:"IP",values:[]}}},query:{displayName:"Query",pluralName:"Queries",route:"queries",icon:"Database",filters:{types:{urlKey:"queryTypes",displayName:"Type",values:["SELECT","INSERT","UPDATE","DELETE","CREATE","ALTER","DROP","TRUNCATE"]},sources:{urlKey:"sources",displayName:"Source",values:["typeorm","prisma","mongoose","sequelize","knex","mikro-orm","drizzle"]}}},exception:{displayName:"Exception",pluralName:"Exceptions",route:"exceptions",icon:"AlertTriangle",filters:{names:{urlKey:"names",displayName:"Name",values:[]},methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},paths:{urlKey:"paths",displayName:"Path",values:[]}}},log:{displayName:"Log",pluralName:"Logs",route:"logs",icon:"FileText",filters:{levels:{urlKey:"levels",displayName:"Level",values:["log","error","warn","debug","verbose","fatal","info"]},contexts:{urlKey:"contexts",displayName:"Context",values:[]}}},event:{displayName:"Event",pluralName:"Events",route:"events",icon:"Zap",filters:{names:{urlKey:"eventNames",displayName:"Event",values:[]}}},job:{displayName:"Job",pluralName:"Jobs",route:"jobs",icon:"Briefcase",filters:{names:{urlKey:"jobNames",displayName:"Job",values:[]},statuses:{urlKey:"jobStatuses",displayName:"Status",values:["waiting","active","completed","failed","delayed","paused","stuck"]},queues:{urlKey:"queues",displayName:"Queue",values:[]}}},schedule:{displayName:"Schedule",pluralName:"Schedule",route:"schedule",icon:"Clock",filters:{names:{urlKey:"scheduleNames",displayName:"Task",values:[]},statuses:{urlKey:"scheduleStatuses",displayName:"Status",values:["started","completed","failed","skipped","running"]}}},cache:{displayName:"Cache",pluralName:"Cache",route:"cache",icon:"HardDrive",filters:{operations:{urlKey:"cacheOperations",displayName:"Operation",values:["get","set","del","clear","has","reset","mget","mset"]}}},mail:{displayName:"Mail",pluralName:"Mail",route:"mail",icon:"Mail",filters:{statuses:{urlKey:"mailStatuses",displayName:"Status",values:["sent","failed","pending","queued","delivered","bounced","error"]}}},"http-client":{displayName:"HTTP Client",pluralName:"HTTP Client",route:"http-client",icon:"Globe",filters:{methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},hostnames:{urlKey:"hostnames",displayName:"Hostname",values:[]}}},redis:{displayName:"Redis",pluralName:"Redis",route:"redis",icon:"Database",filters:{commands:{urlKey:"redisCommands",displayName:"Command",values:["GET","SET","DEL","HGET","HSET","HDEL","HGETALL","LPUSH","RPUSH","LPOP","RPOP","LRANGE","SADD","SREM","SMEMBERS","ZADD","ZRANGE","ZREM","EXPIRE","TTL","KEYS","SCAN","PING","INFO","INCR","DECR","MGET","MSET","PUBLISH","SUBSCRIBE"]},statuses:{urlKey:"redisStatuses",displayName:"Status",values:["success","failed","error","timeout"]}}},model:{displayName:"Model",pluralName:"Models",route:"models",icon:"Box",filters:{actions:{urlKey:"modelActions",displayName:"Action",values:["find","findOne","findMany","create","update","delete","save","remove","count","aggregate","upsert","createMany","updateMany","deleteMany"]},entities:{urlKey:"entities",displayName:"Entity",values:[]},sources:{urlKey:"modelSources",displayName:"Source",values:["typeorm","prisma","mongoose","sequelize","mikro-orm","drizzle"]}}},notification:{displayName:"Notification",pluralName:"Notifications",route:"notifications",icon:"Bell",filters:{types:{urlKey:"notificationTypes",displayName:"Type",values:["email","sms","push","socket","webhook","slack","telegram","discord"]},statuses:{urlKey:"notificationStatuses",displayName:"Status",values:["sent","failed","pending","delivered","read","error","queued"]}}},view:{displayName:"View",pluralName:"Views",route:"views",icon:"Layout",filters:{formats:{urlKey:"viewFormats",displayName:"Format",values:["html","json","xml","pdf","csv","text","markdown"]},statuses:{urlKey:"viewStatuses",displayName:"Status",values:["rendered","error","failed","cached","success"]}}},command:{displayName:"Command",pluralName:"Commands",route:"commands",icon:"Terminal",filters:{statuses:{urlKey:"commandStatuses",displayName:"Status",values:["executing","completed","failed","cancelled","timeout","running"]},names:{urlKey:"commandNames",displayName:"Command",values:[]}}},gate:{displayName:"Gate",pluralName:"Gates",route:"gates",icon:"Shield",filters:{names:{urlKey:"gateNames",displayName:"Gate",values:[]},results:{urlKey:"gateResults",displayName:"Result",values:["allowed","denied"]}}},batch:{displayName:"Batch",pluralName:"Batches",route:"batches",icon:"Layers",filters:{operations:{urlKey:"batchOperations",displayName:"Operation",values:["insert","update","delete","upsert","sync"]},statuses:{urlKey:"batchStatuses",displayName:"Status",values:["pending","processing","completed","failed","partial","cancelled"]}}},dump:{displayName:"Dump",pluralName:"Dumps",route:"dumps",icon:"HardDrive",filters:{operations:{urlKey:"dumpOperations",displayName:"Operation",values:["export","import","backup","restore","migrate","sync"]},formats:{urlKey:"dumpFormats",displayName:"Format",values:["json","csv","xml","sql","yaml","binary","xlsx"]},statuses:{urlKey:"dumpStatuses",displayName:"Status",values:["pending","completed","failed","error","success","cancelled","running"]}}},graphql:{displayName:"GraphQL",pluralName:"GraphQL",route:"graphql",icon:"Hexagon",filters:{operationTypes:{urlKey:"operationTypes",displayName:"Type",values:["query","mutation","subscription"]},operationNames:{urlKey:"operationNames",displayName:"Operation",values:[]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},ips:{urlKey:"ips",displayName:"IP",values:[]}}}},Le={requests:"request",queries:"query",exceptions:"exception",logs:"log",events:"event",jobs:"job",schedule:"schedule",cache:"cache",mail:"mail","http-client":"http-client",redis:"redis",models:"model",notifications:"notification",views:"view",commands:"command",gates:"gate",batches:"batch",dumps:"dump",graphql:"graphql"};function Ke(t){if(t in D)return D[t];const e=Le[t];if(e)return D[e]}const W=Ke;function ze(t){const[e,a]=H(),r=W(t),n=p.useCallback(u=>{if(u==="tags")return"tags";if(!r)return u;const o=r.filters[u];return(o==null?void 0:o.urlKey)||u},[r]),l=p.useMemo(()=>{const u={};if(!r)return u;const o=Object.values(r.filters).map(d=>d.urlKey);o.push("tags","search");for(const d of o){const c=e.get(d);c&&(u[d]=c.split(",").filter(Boolean))}return u},[e,r]),i=p.useCallback((u,o)=>{!r&&u!=="tags"&&console.warn("[useEntryFilters] No config found for entry type, using category as urlKey");const d=n(u),c=l[d]||[];if(!c.includes(o)){const y=new URLSearchParams(e);y.set(d,[...c,o].join(",")),a(y,{replace:!0})}},[r,n,l,e,a]),s=p.useCallback((u,o)=>{const c=(l[u]||[]).filter(x=>x!==o),y=new URLSearchParams(e);c.length>0?y.set(u,c.join(",")):y.delete(u),a(y,{replace:!0})},[l,e,a]),b=p.useCallback(()=>{a({},{replace:!0})},[a]),f=p.useMemo(()=>l,[l]),g=p.useMemo(()=>{if(!r)return[];const u=[];for(const[o,d]of Object.entries(l)){if(d.length===0)continue;let c=o,y=o==="tags"?"Tag":o;for(const[x,N]of Object.entries(r.filters))if(N.urlKey===o){c=x,y=N.displayName;break}u.push({category:c,urlKey:o,displayName:y,values:d})}return u},[l,r]),h=p.useMemo(()=>{const u=[];for(const o of g)for(const d of o.values)u.push({category:o.displayName,value:d.toUpperCase(),onRemove:()=>s(o.urlKey,d)});return u},[g,s]),m=g.length>0;return{addFilter:i,removeFilter:s,clearAll:b,serverFilters:f,activeFilters:g,headerFilters:h,hasFilters:m,getUrlKey:n}}function Ie(t,e){if(e==="tags")return"tags";const a=W(t);if(!a)return e;const r=a.filters[e];return(r==null?void 0:r.urlKey)||e}const F=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","GRAPHQL"],U=["bg-rose-100 text-rose-800 dark:bg-rose-900 dark:text-rose-400","bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-400","bg-lime-100 text-lime-800 dark:bg-lime-900 dark:text-lime-400","bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-400","bg-sky-100 text-sky-800 dark:bg-sky-900 dark:text-sky-400","bg-violet-100 text-violet-800 dark:bg-violet-900 dark:text-violet-400","bg-fuchsia-100 text-fuchsia-800 dark:bg-fuchsia-900 dark:text-fuchsia-400","bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-400"];function We(t){let e=0;for(let a=0;a<t.length;a++)e=(e<<5)-e+t.charCodeAt(a),e=e&e;return Math.abs(e)%U.length}const Fe=["localhost"],Ue=(t,e)=>{if(e&&e!=="tag")return e;if(/^user:/i.test(t))return"tags";if(/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return"ips";const a=t.toUpperCase();if(F.includes(a))return"methods";const r=parseInt(t,10);return!isNaN(r)&&r>=100&&r<600?"statuses":/^[a-fA-F0-9:]+$/.test(t)&&t.includes(":")&&!t.includes(".")?"ips":t.includes("#")||t.includes("::")||/Controller\./i.test(t)?"controllers":Fe.includes(t.toLowerCase())||(t.includes(".")||t.includes(":"))&&!t.startsWith("/")&&!/^\d+$/.test(t)?"hostnames":"tags"};function He(t){const e=t.toUpperCase();if(t.startsWith("/"))return"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400";if(/^(\d{1,3}\.){3}\d{1,3}$/.test(t)||/^[a-fA-F0-9:]+$/.test(t)&&t.includes(":")&&!t.includes("."))return"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-400";if(t.includes("#")||t.includes("::")||/Controller\./i.test(t))return"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-400";if(e.startsWith("USER:"))return"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400";const a=t.toLowerCase(),r=/:\d+$/.test(t),n=/\.(com|org|net|io|dev|app|co|local|internal)$/i.test(t),l=/^[A-Z0-9_.]+$/.test(t)&&t.includes(".");if(a==="localhost"||r&&!t.startsWith("/")||n&&!l)return"bg-slate-100 text-slate-800 dark:bg-slate-700 dark:text-slate-300";if(e==="GET")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";if(e==="POST")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="PUT")return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";if(e==="PATCH")return"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200";if(e==="DELETE")return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";if(["HEAD","OPTIONS"].includes(e))return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";if(e==="GRAPHQL")return"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200";const i=parseInt(e,10);if(!isNaN(i)&&i>=100&&i<600)return i>=500?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":i>=400?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":i>=300?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";if(e==="SUCCESS"||e==="2XX"||e==="HIT")return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";if(e==="REDIRECT"||e==="3XX")return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";if(e==="WARNING"||e==="WARN"||e==="4XX"||e==="CLIENT-ERROR")return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400";if(e==="ERROR"||e==="5XX"||e==="HTTP-ERROR"||e==="VALIDATION-ERROR"||e==="FAILED")return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";if(e==="SLOW"||e==="SLOW QUERY")return"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400";if(e==="N+1"||e==="N1")return"bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300";if(["SELECT","INSERT","UPDATE"].includes(e))return"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400";if(e==="DEBUG")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="LOG"||e==="INFO")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";if(e==="VERBOSE")return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";if(e==="QUERY"||e==="MUTATION"||e==="SUBSCRIPTION"){if(e==="QUERY")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="MUTATION")return"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200";if(e==="SUBSCRIPTION")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"}return e==="REQUEST"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":e==="EXCEPTION"?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":e==="LOG"||e==="EVENT"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":e==="JOB"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":e==="CACHE"?"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200":e==="MAIL"?"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200":e==="SCHEDULE"?"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300":e==="HTTP-CLIENT"?"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200":e==="RESOLVED"||e==="COMPLETED"||e==="SENT"||e==="ACTIVE"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="WAITING"||e==="DELAYED"||e==="PENDING"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="MISS"?"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300":e==="GET"&&!F.includes(e)?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="SET"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="DEL"||e==="DELETE"?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":e==="CLEAR"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="STARTED"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="TYPEORM"?"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400":e==="PRISMA"?"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-400":e==="MONGOOSE"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="SEQUELIZE"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="KNEX"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="MIKRO-ORM"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400":e==="NORMAL"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":U[We(e)]}function je({children:t,listType:e,filterType:a="tag",filterValue:r,onClick:n,clickable:l=!0,className:i="",ariaLabel:s}){const b=j(),f=q(),g=c=>{if(c.preventDefault(),c.stopPropagation(),n){n(c);return}if(e&&l){const y=r||String(t),x=a&&a!=="tag"?Ie(e,a):Ue(y,a),N=f.pathname,w=N===`/${e}`||N.startsWith(`/${e}/`)?new URLSearchParams(f.search):new URLSearchParams,R=w.get(x);if(R){const A=R.split(",");A.includes(y)||w.set(x,[...A,y].join(","))}else w.set(x,y);b(`/${e}?${w.toString()}`)}},h=l&&(!!n||!!e),m=He(String(t)),u=h?"cursor-pointer hover:scale-105 transition-transform":"",o=String(t).toUpperCase(),d=s||(h?`Click to filter by ${o}`:void 0);return T.jsx("span",{onClick:h?g:void 0,role:h?"button":void 0,"aria-label":d,tabIndex:h?0:void 0,onKeyDown:h?c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),g(c))}:void 0,title:o,className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap shadow ${m} ${u} ${h?"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1":""} ${i}`,children:o})}function _e({items:t,listType:e,filterType:a="tag",maxItems:r=99,clickable:n=!0}){if(!t||t.length===0)return null;const l=t.slice(0,r),i=t.length-r;return T.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[l.map(s=>T.jsx(je,{listType:e,filterType:a,clickable:n,children:s},s)),i>0&&T.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["+",i]})]})}export{_e as B,je as C,X as a,I as b,C as c,Ye as d,Re as e,Be as f,He as g,Ve as m,O as n,Qe as p,k as t,ze as u};
|
|
1
|
+
import{j as T}from"./index-l287glk6.js";import{f as H,b as p,e as j,u as q}from"./vendor-DBTT3jXp.js";const Ye=6048e5,Ve=864e5,S=43200,L=1440,K=Symbol.for("constructDateFrom");function C(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&K in t?t[K](e):t instanceof Date?new t.constructor(e):new Date(e)}function k(t,e){return C(e||t,t)}let G={};function X(){return G}function I(t){const e=k(t),a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),+t-+a}function O(t,...e){const a=C.bind(null,t||e.find(r=>typeof r=="object"));return e.map(a)}function P(t,e){const a=+k(t)-+k(e);return a<0?-1:a>0?1:a}function Y(t){return C(t,Date.now())}function V(t,e,a){const[r,n]=O(a==null?void 0:a.in,t,e),l=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return l*12+i}function B(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function Q(t,e){return+k(t)-+k(e)}function z(t,e){const a=k(t,e==null?void 0:e.in);return a.setHours(23,59,59,999),a}function _(t,e){const a=k(t,e==null?void 0:e.in),r=a.getMonth();return a.setFullYear(a.getFullYear(),r+1,0),a.setHours(23,59,59,999),a}function $(t,e){const a=k(t,e==null?void 0:e.in);return+z(a,e)==+_(a,e)}function J(t,e,a){const[r,n,l]=O(a==null?void 0:a.in,t,t,e),i=P(n,l),s=Math.abs(V(n,l));if(s<1)return 0;n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let b=P(n,l)===-i;$(r)&&s===1&&P(r,l)===1&&(b=!1);const f=i*(s-+b);return f===0?0:f}function Z(t,e,a){const r=Q(t,e)/1e3;return B(a==null?void 0:a.roundingMethod)(r)}const ee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},te=(t,e,a)=>{let r;const n=ee[t];return typeof n=="string"?r=n:e===1?r=n.one:r=n.other.replace("{{count}}",e.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r};function M(t){return(e={})=>{const a=e.width?String(e.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const ae={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},re={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ne={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},se={date:M({formats:ae,defaultWidth:"full"}),time:M({formats:re,defaultWidth:"full"}),dateTime:M({formats:ne,defaultWidth:"full"})},ie={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},oe=(t,e,a,r)=>ie[t];function v(t){return(e,a)=>{const r=a!=null&&a.context?String(a.context):"standalone";let n;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,s=a!=null&&a.width?String(a.width):i;n=t.formattingValues[s]||t.formattingValues[i]}else{const i=t.defaultWidth,s=a!=null&&a.width?String(a.width):t.defaultWidth;n=t.values[s]||t.values[i]}const l=t.argumentCallback?t.argumentCallback(e):e;return n[l]}}const le={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},de={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ce={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},me={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ge=(t,e)=>{const a=Number(t),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},he={ordinalNumber:ge,era:v({values:le,defaultWidth:"wide"}),quarter:v({values:ue,defaultWidth:"wide",argumentCallback:t=>t-1}),month:v({values:de,defaultWidth:"wide"}),day:v({values:ce,defaultWidth:"wide"}),dayPeriod:v({values:me,defaultWidth:"wide",formattingValues:fe,defaultFormattingWidth:"wide"})};function E(t){return(e,a={})=>{const r=a.width,n=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],l=e.match(n);if(!l)return null;const i=l[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],b=Array.isArray(s)?be(s,h=>h.test(i)):ye(s,h=>h.test(i));let f;f=t.valueCallback?t.valueCallback(b):b,f=a.valueCallback?a.valueCallback(f):f;const g=e.slice(i.length);return{value:f,rest:g}}}function ye(t,e){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&e(t[a]))return a}function be(t,e){for(let a=0;a<t.length;a++)if(e(t[a]))return a}function pe(t){return(e,a={})=>{const r=e.match(t.matchPattern);if(!r)return null;const n=r[0],l=e.match(t.parsePattern);if(!l)return null;let i=t.valueCallback?t.valueCallback(l[0]):l[0];i=a.valueCallback?a.valueCallback(i):i;const s=e.slice(n.length);return{value:i,rest:s}}}const ke=/^(\d+)(th|st|nd|rd)?/i,xe=/\d+/i,Ne={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ve={any:[/^b/i,/^(a|c)/i]},Ee={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},we={any:[/1/i,/2/i,/3/i,/4/i]},Se={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Te={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Pe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Me={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},De={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ce={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Oe={ordinalNumber:pe({matchPattern:ke,parsePattern:xe,valueCallback:t=>parseInt(t,10)}),era:E({matchPatterns:Ne,defaultMatchWidth:"wide",parsePatterns:ve,defaultParseWidth:"any"}),quarter:E({matchPatterns:Ee,defaultMatchWidth:"wide",parsePatterns:we,defaultParseWidth:"any",valueCallback:t=>t+1}),month:E({matchPatterns:Se,defaultMatchWidth:"wide",parsePatterns:Te,defaultParseWidth:"any"}),day:E({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),dayPeriod:E({matchPatterns:De,defaultMatchWidth:"any",parsePatterns:Ce,defaultParseWidth:"any"})},Re={code:"en-US",formatDistance:te,formatLong:se,formatRelative:oe,localize:he,match:Oe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ae(t,e,a){const r=X(),n=(a==null?void 0:a.locale)??r.locale??Re,l=2520,i=P(t,e);if(isNaN(i))throw new RangeError("Invalid time value");const s=Object.assign({},a,{addSuffix:a==null?void 0:a.addSuffix,comparison:i}),[b,f]=O(a==null?void 0:a.in,...i>0?[e,t]:[t,e]),g=Z(f,b),h=(I(f)-I(b))/1e3,m=Math.round((g-h)/60);let u;if(m<2)return a!=null&&a.includeSeconds?g<5?n.formatDistance("lessThanXSeconds",5,s):g<10?n.formatDistance("lessThanXSeconds",10,s):g<20?n.formatDistance("lessThanXSeconds",20,s):g<40?n.formatDistance("halfAMinute",0,s):g<60?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",1,s):m===0?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",m,s);if(m<45)return n.formatDistance("xMinutes",m,s);if(m<90)return n.formatDistance("aboutXHours",1,s);if(m<L){const o=Math.round(m/60);return n.formatDistance("aboutXHours",o,s)}else{if(m<l)return n.formatDistance("xDays",1,s);if(m<S){const o=Math.round(m/L);return n.formatDistance("xDays",o,s)}else if(m<S*2)return u=Math.round(m/S),n.formatDistance("aboutXMonths",u,s)}if(u=J(f,b),u<12){const o=Math.round(m/S);return n.formatDistance("xMonths",o,s)}else{const o=u%12,d=Math.trunc(u/12);return o<3?n.formatDistance("aboutXYears",d,s):o<9?n.formatDistance("overXYears",d,s):n.formatDistance("almostXYears",d+1,s)}}function Be(t,e){return Ae(t,Y(t),e)}function Qe(t){if(t.includes("T")&&(t.includes("Z")||t.includes("+")))return new Date(t);const e=t.replace(" ","T")+"Z";return new Date(e)}const D={request:{displayName:"Request",pluralName:"Requests",route:"requests",icon:"Globe",filters:{methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","GRAPHQL"]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},paths:{urlKey:"paths",displayName:"Path",values:[]},controllers:{urlKey:"controllers",displayName:"Controller",values:[]},hostnames:{urlKey:"hostnames",displayName:"Hostname",values:[]},ips:{urlKey:"ips",displayName:"IP",values:[]}}},query:{displayName:"Query",pluralName:"Queries",route:"queries",icon:"Database",filters:{types:{urlKey:"queryTypes",displayName:"Type",values:["SELECT","INSERT","UPDATE","DELETE","CREATE","ALTER","DROP","TRUNCATE"]},sources:{urlKey:"sources",displayName:"Source",values:["typeorm","prisma","mongoose","sequelize","knex","mikro-orm","drizzle"]}}},exception:{displayName:"Exception",pluralName:"Exceptions",route:"exceptions",icon:"AlertTriangle",filters:{names:{urlKey:"names",displayName:"Name",values:[]},methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},paths:{urlKey:"paths",displayName:"Path",values:[]}}},log:{displayName:"Log",pluralName:"Logs",route:"logs",icon:"FileText",filters:{levels:{urlKey:"levels",displayName:"Level",values:["log","error","warn","debug","verbose","fatal","info"]},contexts:{urlKey:"contexts",displayName:"Context",values:[]}}},event:{displayName:"Event",pluralName:"Events",route:"events",icon:"Zap",filters:{names:{urlKey:"eventNames",displayName:"Event",values:[]}}},job:{displayName:"Job",pluralName:"Jobs",route:"jobs",icon:"Briefcase",filters:{names:{urlKey:"jobNames",displayName:"Job",values:[]},statuses:{urlKey:"jobStatuses",displayName:"Status",values:["waiting","active","completed","failed","delayed","paused","stuck"]},queues:{urlKey:"queues",displayName:"Queue",values:[]}}},schedule:{displayName:"Schedule",pluralName:"Schedule",route:"schedule",icon:"Clock",filters:{names:{urlKey:"scheduleNames",displayName:"Task",values:[]},statuses:{urlKey:"scheduleStatuses",displayName:"Status",values:["started","completed","failed","skipped","running"]}}},cache:{displayName:"Cache",pluralName:"Cache",route:"cache",icon:"HardDrive",filters:{operations:{urlKey:"cacheOperations",displayName:"Operation",values:["get","set","del","clear","has","reset","mget","mset"]}}},mail:{displayName:"Mail",pluralName:"Mail",route:"mail",icon:"Mail",filters:{statuses:{urlKey:"mailStatuses",displayName:"Status",values:["sent","failed","pending","queued","delivered","bounced","error"]}}},"http-client":{displayName:"HTTP Client",pluralName:"HTTP Client",route:"http-client",icon:"Globe",filters:{methods:{urlKey:"methods",displayName:"Method",values:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},hostnames:{urlKey:"hostnames",displayName:"Hostname",values:[]}}},redis:{displayName:"Redis",pluralName:"Redis",route:"redis",icon:"Database",filters:{commands:{urlKey:"redisCommands",displayName:"Command",values:["GET","SET","DEL","HGET","HSET","HDEL","HGETALL","LPUSH","RPUSH","LPOP","RPOP","LRANGE","SADD","SREM","SMEMBERS","ZADD","ZRANGE","ZREM","EXPIRE","TTL","KEYS","SCAN","PING","INFO","INCR","DECR","MGET","MSET","PUBLISH","SUBSCRIBE"]},statuses:{urlKey:"redisStatuses",displayName:"Status",values:["success","failed","error","timeout"]}}},model:{displayName:"Model",pluralName:"Models",route:"models",icon:"Box",filters:{actions:{urlKey:"modelActions",displayName:"Action",values:["find","findOne","findMany","create","update","delete","save","remove","count","aggregate","upsert","createMany","updateMany","deleteMany"]},entities:{urlKey:"entities",displayName:"Entity",values:[]},sources:{urlKey:"modelSources",displayName:"Source",values:["typeorm","prisma","mongoose","sequelize","mikro-orm","drizzle"]}}},notification:{displayName:"Notification",pluralName:"Notifications",route:"notifications",icon:"Bell",filters:{types:{urlKey:"notificationTypes",displayName:"Type",values:["email","sms","push","socket","webhook","slack","telegram","discord"]},statuses:{urlKey:"notificationStatuses",displayName:"Status",values:["sent","failed","pending","delivered","read","error","queued"]}}},view:{displayName:"View",pluralName:"Views",route:"views",icon:"Layout",filters:{formats:{urlKey:"viewFormats",displayName:"Format",values:["html","json","xml","pdf","csv","text","markdown"]},statuses:{urlKey:"viewStatuses",displayName:"Status",values:["rendered","error","failed","cached","success"]}}},command:{displayName:"Command",pluralName:"Commands",route:"commands",icon:"Terminal",filters:{statuses:{urlKey:"commandStatuses",displayName:"Status",values:["executing","completed","failed","cancelled","timeout","running"]},names:{urlKey:"commandNames",displayName:"Command",values:[]}}},gate:{displayName:"Gate",pluralName:"Gates",route:"gates",icon:"Shield",filters:{names:{urlKey:"gateNames",displayName:"Gate",values:[]},results:{urlKey:"gateResults",displayName:"Result",values:["allowed","denied"]}}},batch:{displayName:"Batch",pluralName:"Batches",route:"batches",icon:"Layers",filters:{operations:{urlKey:"batchOperations",displayName:"Operation",values:["insert","update","delete","upsert","sync"]},statuses:{urlKey:"batchStatuses",displayName:"Status",values:["pending","processing","completed","failed","partial","cancelled"]}}},dump:{displayName:"Dump",pluralName:"Dumps",route:"dumps",icon:"HardDrive",filters:{operations:{urlKey:"dumpOperations",displayName:"Operation",values:["export","import","backup","restore","migrate","sync"]},formats:{urlKey:"dumpFormats",displayName:"Format",values:["json","csv","xml","sql","yaml","binary","xlsx"]},statuses:{urlKey:"dumpStatuses",displayName:"Status",values:["pending","completed","failed","error","success","cancelled","running"]}}},graphql:{displayName:"GraphQL",pluralName:"GraphQL",route:"graphql",icon:"Hexagon",filters:{operationTypes:{urlKey:"operationTypes",displayName:"Type",values:["query","mutation","subscription"]},operationNames:{urlKey:"operationNames",displayName:"Operation",values:[]},statuses:{urlKey:"statuses",displayName:"Status",values:[]},ips:{urlKey:"ips",displayName:"IP",values:[]}}}},Le={requests:"request",queries:"query",exceptions:"exception",logs:"log",events:"event",jobs:"job",schedule:"schedule",cache:"cache",mail:"mail","http-client":"http-client",redis:"redis",models:"model",notifications:"notification",views:"view",commands:"command",gates:"gate",batches:"batch",dumps:"dump",graphql:"graphql"};function Ke(t){if(t in D)return D[t];const e=Le[t];if(e)return D[e]}const W=Ke;function ze(t){const[e,a]=H(),r=W(t),n=p.useCallback(u=>{if(u==="tags")return"tags";if(!r)return u;const o=r.filters[u];return(o==null?void 0:o.urlKey)||u},[r]),l=p.useMemo(()=>{const u={};if(!r)return u;const o=Object.values(r.filters).map(d=>d.urlKey);o.push("tags","search");for(const d of o){const c=e.get(d);c&&(u[d]=c.split(",").filter(Boolean))}return u},[e,r]),i=p.useCallback((u,o)=>{!r&&u!=="tags"&&console.warn("[useEntryFilters] No config found for entry type, using category as urlKey");const d=n(u),c=l[d]||[];if(!c.includes(o)){const y=new URLSearchParams(e);y.set(d,[...c,o].join(",")),a(y,{replace:!0})}},[r,n,l,e,a]),s=p.useCallback((u,o)=>{const c=(l[u]||[]).filter(x=>x!==o),y=new URLSearchParams(e);c.length>0?y.set(u,c.join(",")):y.delete(u),a(y,{replace:!0})},[l,e,a]),b=p.useCallback(()=>{a({},{replace:!0})},[a]),f=p.useMemo(()=>l,[l]),g=p.useMemo(()=>{if(!r)return[];const u=[];for(const[o,d]of Object.entries(l)){if(d.length===0)continue;let c=o,y=o==="tags"?"Tag":o;for(const[x,N]of Object.entries(r.filters))if(N.urlKey===o){c=x,y=N.displayName;break}u.push({category:c,urlKey:o,displayName:y,values:d})}return u},[l,r]),h=p.useMemo(()=>{const u=[];for(const o of g)for(const d of o.values)u.push({category:o.displayName,value:d.toUpperCase(),onRemove:()=>s(o.urlKey,d)});return u},[g,s]),m=g.length>0;return{addFilter:i,removeFilter:s,clearAll:b,serverFilters:f,activeFilters:g,headerFilters:h,hasFilters:m,getUrlKey:n}}function Ie(t,e){if(e==="tags")return"tags";const a=W(t);if(!a)return e;const r=a.filters[e];return(r==null?void 0:r.urlKey)||e}const F=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","GRAPHQL"],U=["bg-rose-100 text-rose-800 dark:bg-rose-900 dark:text-rose-400","bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-400","bg-lime-100 text-lime-800 dark:bg-lime-900 dark:text-lime-400","bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-400","bg-sky-100 text-sky-800 dark:bg-sky-900 dark:text-sky-400","bg-violet-100 text-violet-800 dark:bg-violet-900 dark:text-violet-400","bg-fuchsia-100 text-fuchsia-800 dark:bg-fuchsia-900 dark:text-fuchsia-400","bg-teal-100 text-teal-800 dark:bg-teal-900 dark:text-teal-400"];function We(t){let e=0;for(let a=0;a<t.length;a++)e=(e<<5)-e+t.charCodeAt(a),e=e&e;return Math.abs(e)%U.length}const Fe=["localhost"],Ue=(t,e)=>{if(e&&e!=="tag")return e;if(/^user:/i.test(t))return"tags";if(/^(\d{1,3}\.){3}\d{1,3}$/.test(t))return"ips";const a=t.toUpperCase();if(F.includes(a))return"methods";const r=parseInt(t,10);return!isNaN(r)&&r>=100&&r<600?"statuses":/^[a-fA-F0-9:]+$/.test(t)&&t.includes(":")&&!t.includes(".")?"ips":t.includes("#")||t.includes("::")||/Controller\./i.test(t)?"controllers":Fe.includes(t.toLowerCase())||(t.includes(".")||t.includes(":"))&&!t.startsWith("/")&&!/^\d+$/.test(t)?"hostnames":"tags"};function He(t){const e=t.toUpperCase();if(t.startsWith("/"))return"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400";if(/^(\d{1,3}\.){3}\d{1,3}$/.test(t)||/^[a-fA-F0-9:]+$/.test(t)&&t.includes(":")&&!t.includes("."))return"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-400";if(t.includes("#")||t.includes("::")||/Controller\./i.test(t))return"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-400";if(e.startsWith("USER:"))return"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400";const a=t.toLowerCase(),r=/:\d+$/.test(t),n=/\.(com|org|net|io|dev|app|co|local|internal)$/i.test(t),l=/^[A-Z0-9_.]+$/.test(t)&&t.includes(".");if(a==="localhost"||r&&!t.startsWith("/")||n&&!l)return"bg-slate-100 text-slate-800 dark:bg-slate-700 dark:text-slate-300";if(e==="GET")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";if(e==="POST")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="PUT")return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";if(e==="PATCH")return"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200";if(e==="DELETE")return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";if(["HEAD","OPTIONS"].includes(e))return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";if(e==="GRAPHQL")return"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200";const i=parseInt(e,10);if(!isNaN(i)&&i>=100&&i<600)return i>=500?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":i>=400?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":i>=300?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";if(e==="SUCCESS"||e==="2XX"||e==="HIT")return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";if(e==="REDIRECT"||e==="3XX")return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";if(e==="WARNING"||e==="WARN"||e==="4XX"||e==="CLIENT-ERROR")return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400";if(e==="ERROR"||e==="5XX"||e==="HTTP-ERROR"||e==="VALIDATION-ERROR"||e==="FAILED")return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";if(e==="SLOW"||e==="SLOW QUERY")return"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400";if(e==="N+1"||e==="N1")return"bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300";if(["SELECT","INSERT","UPDATE"].includes(e))return"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400";if(e==="DEBUG")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="LOG"||e==="INFO")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";if(e==="VERBOSE")return"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300";if(e==="QUERY"||e==="MUTATION"||e==="SUBSCRIPTION"){if(e==="QUERY")return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";if(e==="MUTATION")return"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200";if(e==="SUBSCRIPTION")return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"}return e==="REQUEST"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":e==="EXCEPTION"?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":e==="LOG"||e==="EVENT"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":e==="JOB"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":e==="CACHE"?"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200":e==="MAIL"?"bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200":e==="SCHEDULE"?"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300":e==="HTTP-CLIENT"?"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200":e==="RESOLVED"||e==="COMPLETED"||e==="SENT"||e==="ACTIVE"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="WAITING"||e==="DELAYED"||e==="PENDING"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="MISS"?"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300":e==="GET"&&!F.includes(e)?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="SET"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="DEL"||e==="DELETE"?"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":e==="CLEAR"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="STARTED"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="TYPEORM"?"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400":e==="PRISMA"?"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-400":e==="MONGOOSE"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":e==="SEQUELIZE"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":e==="KNEX"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":e==="MIKRO-ORM"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400":e==="NORMAL"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":U[We(e)]}function je({children:t,listType:e,filterType:a="tag",filterValue:r,onClick:n,clickable:l=!0,className:i="",ariaLabel:s}){const b=j(),f=q(),g=c=>{if(c.preventDefault(),c.stopPropagation(),n){n(c);return}if(e&&l){const y=r||String(t),x=a&&a!=="tag"?Ie(e,a):Ue(y,a),N=f.pathname,w=N===`/${e}`||N.startsWith(`/${e}/`)?new URLSearchParams(f.search):new URLSearchParams,R=w.get(x);if(R){const A=R.split(",");A.includes(y)||w.set(x,[...A,y].join(","))}else w.set(x,y);b(`/${e}?${w.toString()}`)}},h=l&&(!!n||!!e),m=He(String(t)),u=h?"cursor-pointer hover:scale-105 transition-transform":"",o=String(t).toUpperCase(),d=s||(h?`Click to filter by ${o}`:void 0);return T.jsx("span",{onClick:h?g:void 0,role:h?"button":void 0,"aria-label":d,tabIndex:h?0:void 0,onKeyDown:h?c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),g(c))}:void 0,title:o,className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-bold uppercase tracking-wide max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap shadow ${m} ${u} ${h?"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1":""} ${i}`,children:o})}function _e({items:t,listType:e,filterType:a="tag",maxItems:r=99,clickable:n=!0}){if(!t||t.length===0)return null;const l=t.slice(0,r),i=t.length-r;return T.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[l.map(s=>T.jsx(je,{listType:e,filterType:a,clickable:n,children:s},s)),i>0&&T.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["+",i]})]})}export{_e as B,je as C,X as a,I as b,C as c,Ye as d,Re as e,Be as f,He as g,Ve as m,O as n,Qe as p,k as t,ze as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,a as l}from"./index-
|
|
1
|
+
import{j as a,a as l}from"./index-l287glk6.js";import{e as P,b as T}from"./vendor-DBTT3jXp.js";import{u as D,C as d,f as F,p as A}from"./ClickableBadge-BDF_xguC.js";import{u as M,P as R,N as B,L as H}from"./PageHeader-C-LDCH8m.js";import{q as L,T as i,D as W,b as S}from"./types-taCMgqPD.js";function G(){const m=P(),{addFilter:t,clearAll:c,serverFilters:u,headerFilters:h,hasFilters:p}=D("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}=M({type:"command",limit:50,filters:u}),n=x.filter(e=>L(e)),E=T.useMemo(()=>[{key:"name",header:"Command",minWidth:"250px",render:e=>a.jsx(d,{onClick:o=>{o.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:o=>{o.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:F(A(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 v=p?"pt-28":"pt-16";return a.jsxs("div",{children:[a.jsx(R,{title:"Commands",icon:l,iconColor:"text-green-600 dark:text-green-400",count:n.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(B,{count:f,onClick:j,loading:r}),a.jsx(S,{columns:E,data:n,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(H,{hasMore:y,onClick:C,loading:r})]})]})}export{G as default};
|