nestlens 0.8.8 → 0.8.9
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/core/storage/entry-filter.d.ts +16 -0
- package/dist/core/storage/entry-filter.js +260 -0
- package/dist/core/storage/memory.storage.js +5 -247
- package/dist/core/storage/redis.storage.js +2 -54
- package/dist/dashboard/public/assets/{BatchesPage-Da6-LE7p.js → BatchesPage-B-FM-KDo.js} +1 -1
- package/dist/dashboard/public/assets/{CachePage-C6WIa9wE.js → CachePage-DdiQfS9v.js} +1 -1
- package/dist/dashboard/public/assets/{ClickableBadge-MXu6YkUJ.js → ClickableBadge-Vyx_sMAl.js} +1 -1
- package/dist/dashboard/public/assets/{CommandsPage-LAbYZ-a3.js → CommandsPage-zJMqAMw2.js} +1 -1
- package/dist/dashboard/public/assets/{DashboardPage-DK5v8C5f.js → DashboardPage-8LH8ftoZ.js} +1 -1
- package/dist/dashboard/public/assets/{DumpsPage-CyXey6np.js → DumpsPage-zoJtOb34.js} +1 -1
- package/dist/dashboard/public/assets/{EntryDetailPage-BD2PRQth.js → EntryDetailPage-DFx3gg0C.js} +1 -1
- package/dist/dashboard/public/assets/{EntrySearchInput-6EnNn0Gr.js → EntrySearchInput-BjzlyOoC.js} +1 -1
- package/dist/dashboard/public/assets/{EventsPage-Cyl11EwA.js → EventsPage-CWYR4iMv.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionsPage-CZdBOJGX.js → ExceptionsPage-BRBxnFaw.js} +1 -1
- package/dist/dashboard/public/assets/{GatesPage-CXEMLTV9.js → GatesPage-Db4jOQJV.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLPage-B541mzFi.js → GraphQLPage-B3rSuWjG.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientPage-DPikBJ0q.js → HttpClientPage-ax2dQyNU.js} +1 -1
- package/dist/dashboard/public/assets/{JobsPage-CAD5s2bm.js → JobsPage-DgrC3Sj1.js} +1 -1
- package/dist/dashboard/public/assets/{LogsPage-DSJ2-WrC.js → LogsPage-BBlP-X7a.js} +1 -1
- package/dist/dashboard/public/assets/{MailPage-Cs7Q78zr.js → MailPage-CoNbEq1o.js} +1 -1
- package/dist/dashboard/public/assets/{ModelsPage-DIRozljj.js → ModelsPage-DWb7rn2b.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationsPage-Dqxsi_wJ.js → NotificationsPage-DCLX_IJt.js} +1 -1
- package/dist/dashboard/public/assets/{PageHeader-l0rbvbEJ.js → PageHeader-gzCjMnIq.js} +1 -1
- package/dist/dashboard/public/assets/{QueriesPage-BEkQtsGy.js → QueriesPage-3UzIdKwS.js} +1 -1
- package/dist/dashboard/public/assets/{RedisPage-D55U0Vdz.js → RedisPage-CkCLM4ax.js} +1 -1
- package/dist/dashboard/public/assets/{RequestsPage-DMWkfYX0.js → RequestsPage-Dj4eX2lV.js} +1 -1
- package/dist/dashboard/public/assets/{SchedulePage-XR2f9XdQ.js → SchedulePage-egoitltq.js} +1 -1
- package/dist/dashboard/public/assets/{ViewsPage-D0RDqTkG.js → ViewsPage-HadbKX46.js} +1 -1
- package/dist/dashboard/public/assets/{calendar-u8l0OwR3.js → calendar-BsVc-vvl.js} +1 -1
- package/dist/dashboard/public/assets/{circle-check-big-Dv8ky8SZ.js → circle-check-big-D8hxmLVs.js} +1 -1
- package/dist/dashboard/public/assets/{eye-B2We_czC.js → eye-DoP8A5L_.js} +1 -1
- package/dist/dashboard/public/assets/{index-BBxPq0bb.js → index-NYfiXmMn.js} +2 -2
- package/dist/dashboard/public/assets/{search-gQGNOvtD.js → search-C8zDS2B0.js} +1 -1
- package/dist/dashboard/public/assets/{types-DauH_Fk6.js → types-DrGQDdvv.js} +1 -1
- package/dist/dashboard/public/assets/{zap-C-mK4UPD.js → zap-DXGDS502.js} +1 -1
- package/dist/dashboard/public/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CursorPaginationParams, StoredEntry } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a stored entry satisfies a set of dashboard filters.
|
|
4
|
+
*
|
|
5
|
+
* One implementation on purpose. MemoryStorage and RedisStorage each filter in
|
|
6
|
+
* JavaScript over hydrated entries, and each used to carry its own copy of
|
|
7
|
+
* these rules — the Redis copy said "apply the same filter logic as
|
|
8
|
+
* MemoryStorage" while implementing nine of the forty-four. Filtering by
|
|
9
|
+
* method, path, status, IP or tag on Redis did nothing at all: the badge click
|
|
10
|
+
* changed the URL and the list came back untouched, with no error to notice.
|
|
11
|
+
*
|
|
12
|
+
* Tags are read from the entry rather than from a storage's own index, so both
|
|
13
|
+
* callers hydrate before filtering and the rules stay independent of where the
|
|
14
|
+
* entries came from.
|
|
15
|
+
*/
|
|
16
|
+
export declare const matchesEntryFilters: (entry: StoredEntry, filters: CursorPaginationParams["filters"]) => boolean;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchesEntryFilters = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a stored entry satisfies a set of dashboard filters.
|
|
6
|
+
*
|
|
7
|
+
* One implementation on purpose. MemoryStorage and RedisStorage each filter in
|
|
8
|
+
* JavaScript over hydrated entries, and each used to carry its own copy of
|
|
9
|
+
* these rules — the Redis copy said "apply the same filter logic as
|
|
10
|
+
* MemoryStorage" while implementing nine of the forty-four. Filtering by
|
|
11
|
+
* method, path, status, IP or tag on Redis did nothing at all: the badge click
|
|
12
|
+
* changed the URL and the list came back untouched, with no error to notice.
|
|
13
|
+
*
|
|
14
|
+
* Tags are read from the entry rather than from a storage's own index, so both
|
|
15
|
+
* callers hydrate before filtering and the rules stay independent of where the
|
|
16
|
+
* entries came from.
|
|
17
|
+
*/
|
|
18
|
+
const matchesEntryFilters = (entry, filters) => {
|
|
19
|
+
if (!filters)
|
|
20
|
+
return true;
|
|
21
|
+
const payload = entry.payload;
|
|
22
|
+
// Log filters
|
|
23
|
+
if (filters.levels?.length && entry.type === 'log') {
|
|
24
|
+
if (!filters.levels.includes(payload.level))
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (filters.contexts?.length && entry.type === 'log') {
|
|
28
|
+
if (!filters.contexts.includes(payload.context))
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// Query filters
|
|
32
|
+
if (filters.queryTypes?.length && entry.type === 'query') {
|
|
33
|
+
const query = payload.query || '';
|
|
34
|
+
if (!filters.queryTypes.some((qt) => query.toUpperCase().startsWith(qt)))
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (filters.sources?.length) {
|
|
38
|
+
if (!filters.sources.includes(payload.source))
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (filters.slow !== undefined && entry.type === 'query') {
|
|
42
|
+
if (payload.slow !== filters.slow)
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// Exception filters
|
|
46
|
+
if (filters.names?.length && entry.type === 'exception') {
|
|
47
|
+
const name = payload.name;
|
|
48
|
+
if (!filters.names.some((n) => name?.includes(n)))
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (filters.resolved !== undefined) {
|
|
52
|
+
const isResolved = !!entry.resolvedAt;
|
|
53
|
+
if (isResolved !== filters.resolved)
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// Request filters
|
|
57
|
+
if (filters.methods?.length) {
|
|
58
|
+
const method = payload.method || payload.request?.method;
|
|
59
|
+
if (!method || !filters.methods.includes(method))
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (filters.paths?.length) {
|
|
63
|
+
const path = payload.path || payload.request?.url || '';
|
|
64
|
+
if (!filters.paths.some((p) => {
|
|
65
|
+
const pattern = p.replace(/\*/g, '.*');
|
|
66
|
+
return new RegExp(pattern).test(path);
|
|
67
|
+
}))
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (filters.statuses?.length) {
|
|
71
|
+
const status = payload.statusCode;
|
|
72
|
+
const hasErr = filters.statuses.includes('ERR');
|
|
73
|
+
const numericStatuses = filters.statuses.filter((s) => s !== 'ERR');
|
|
74
|
+
if (status === undefined || status === null) {
|
|
75
|
+
if (!hasErr)
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
if (!numericStatuses.includes(status))
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (filters.hostnames?.length) {
|
|
84
|
+
const host = payload.headers?.host ||
|
|
85
|
+
payload.headers?.Host ||
|
|
86
|
+
payload.hostname;
|
|
87
|
+
if (!host || !filters.hostnames.some((h) => host.includes(h)))
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (filters.controllers?.length) {
|
|
91
|
+
if (!filters.controllers.includes(payload.controllerAction))
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (filters.ips?.length) {
|
|
95
|
+
if (!filters.ips.includes(payload.ip))
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
// Event filters
|
|
99
|
+
if (filters.eventNames?.length && entry.type === 'event') {
|
|
100
|
+
const name = payload.name;
|
|
101
|
+
if (!filters.eventNames.some((n) => name?.includes(n)))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
// Schedule filters
|
|
105
|
+
if (filters.scheduleStatuses?.length && entry.type === 'schedule') {
|
|
106
|
+
if (!filters.scheduleStatuses.includes(payload.status))
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (filters.scheduleNames?.length && entry.type === 'schedule') {
|
|
110
|
+
const name = payload.name;
|
|
111
|
+
if (!filters.scheduleNames.some((n) => name?.includes(n)))
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
// Job filters
|
|
115
|
+
if (filters.jobStatuses?.length && entry.type === 'job') {
|
|
116
|
+
if (!filters.jobStatuses.includes(payload.status))
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if (filters.jobNames?.length && entry.type === 'job') {
|
|
120
|
+
const name = payload.name;
|
|
121
|
+
if (!filters.jobNames.some((n) => name?.includes(n)))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (filters.queues?.length && entry.type === 'job') {
|
|
125
|
+
if (!filters.queues.includes(payload.queue))
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
// Cache filters
|
|
129
|
+
if (filters.cacheOperations?.length && entry.type === 'cache') {
|
|
130
|
+
if (!filters.cacheOperations.includes(payload.operation))
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
// Mail filters
|
|
134
|
+
if (filters.mailStatuses?.length && entry.type === 'mail') {
|
|
135
|
+
if (!filters.mailStatuses.includes(payload.status))
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
// Redis filters
|
|
139
|
+
if (filters.redisStatuses?.length && entry.type === 'redis') {
|
|
140
|
+
if (!filters.redisStatuses.includes(payload.status))
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (filters.redisCommands?.length && entry.type === 'redis') {
|
|
144
|
+
if (!filters.redisCommands.includes(payload.command))
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
// Model filters
|
|
148
|
+
if (filters.modelActions?.length && entry.type === 'model') {
|
|
149
|
+
if (!filters.modelActions.includes(payload.action))
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
if (filters.entities?.length && entry.type === 'model') {
|
|
153
|
+
if (!filters.entities.includes(payload.entity))
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
if (filters.modelSources?.length && entry.type === 'model') {
|
|
157
|
+
if (!filters.modelSources.includes(payload.source))
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
// Notification filters
|
|
161
|
+
if (filters.notificationTypes?.length && entry.type === 'notification') {
|
|
162
|
+
if (!filters.notificationTypes.includes(payload.type))
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
if (filters.notificationStatuses?.length && entry.type === 'notification') {
|
|
166
|
+
if (!filters.notificationStatuses.includes(payload.status))
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
// View filters
|
|
170
|
+
if (filters.viewFormats?.length && entry.type === 'view') {
|
|
171
|
+
if (!filters.viewFormats.includes(payload.format))
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
if (filters.viewStatuses?.length && entry.type === 'view') {
|
|
175
|
+
if (!filters.viewStatuses.includes(payload.status))
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
// Command filters
|
|
179
|
+
if (filters.commandStatuses?.length && entry.type === 'command') {
|
|
180
|
+
if (!filters.commandStatuses.includes(payload.status))
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
if (filters.commandNames?.length && entry.type === 'command') {
|
|
184
|
+
const name = payload.name;
|
|
185
|
+
if (!filters.commandNames.some((n) => name?.includes(n)))
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
// Gate filters
|
|
189
|
+
if (filters.gateNames?.length && entry.type === 'gate') {
|
|
190
|
+
const gate = payload.gate;
|
|
191
|
+
if (!filters.gateNames.some((n) => gate?.includes(n)))
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (filters.gateResults?.length && entry.type === 'gate') {
|
|
195
|
+
const allowed = payload.allowed;
|
|
196
|
+
const result = allowed ? 'allowed' : 'denied';
|
|
197
|
+
if (!filters.gateResults.includes(result))
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
// Batch filters
|
|
201
|
+
if (filters.batchStatuses?.length && entry.type === 'batch') {
|
|
202
|
+
if (!filters.batchStatuses.includes(payload.status))
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (filters.batchOperations?.length && entry.type === 'batch') {
|
|
206
|
+
if (!filters.batchOperations.includes(payload.operation))
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
// Dump filters
|
|
210
|
+
if (filters.dumpStatuses?.length && entry.type === 'dump') {
|
|
211
|
+
if (!filters.dumpStatuses.includes(payload.status))
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (filters.dumpOperations?.length && entry.type === 'dump') {
|
|
215
|
+
if (!filters.dumpOperations.includes(payload.operation))
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
if (filters.dumpFormats?.length && entry.type === 'dump') {
|
|
219
|
+
if (!filters.dumpFormats.includes(payload.format))
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
// GraphQL filters
|
|
223
|
+
if (filters.operationTypes?.length && entry.type === 'graphql') {
|
|
224
|
+
if (!filters.operationTypes.includes(payload.operationType))
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
if (filters.operationNames?.length && entry.type === 'graphql') {
|
|
228
|
+
const opName = payload.operationName;
|
|
229
|
+
if (!filters.operationNames.some((n) => opName?.includes(n)))
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
if (filters.hasErrors !== undefined && entry.type === 'graphql') {
|
|
233
|
+
if (payload.hasErrors !== filters.hasErrors)
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (filters.hasN1 !== undefined && entry.type === 'graphql') {
|
|
237
|
+
const n1Array = payload.potentialN1;
|
|
238
|
+
const hasN1 = n1Array && n1Array.length > 0;
|
|
239
|
+
if (hasN1 !== filters.hasN1)
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
// Tag filter (case-insensitive)
|
|
243
|
+
if (filters.tags?.length) {
|
|
244
|
+
// Normalize both sides to uppercase for case-insensitive matching
|
|
245
|
+
const entryTags = (entry.tags ?? []).map((t) => t.toUpperCase());
|
|
246
|
+
const normalizedFilterTags = filters.tags.map((t) => t.toUpperCase());
|
|
247
|
+
if (!normalizedFilterTags.some((t) => entryTags.includes(t)))
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
// Search filter (matches payload content or entry tags)
|
|
251
|
+
if (filters.search) {
|
|
252
|
+
const term = filters.search.toLowerCase();
|
|
253
|
+
const payloadStr = JSON.stringify(payload).toLowerCase();
|
|
254
|
+
const tagMatch = (entry.tags ?? []).some((t) => t.toLowerCase().includes(term));
|
|
255
|
+
if (!payloadStr.includes(term) && !tagMatch)
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
return true;
|
|
259
|
+
};
|
|
260
|
+
exports.matchesEntryFilters = matchesEntryFilters;
|
|
@@ -12,6 +12,7 @@ var MemoryStorage_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.MemoryStorage = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
+
const entry_filter_1 = require("./entry-filter");
|
|
15
16
|
/**
|
|
16
17
|
* In-memory storage implementation for NestLens.
|
|
17
18
|
* Zero dependencies, works everywhere including Docker.
|
|
@@ -123,9 +124,10 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
|
|
|
123
124
|
const afterSequence = params.afterSequence;
|
|
124
125
|
results = results.filter((e) => e.id > afterSequence);
|
|
125
126
|
}
|
|
126
|
-
//
|
|
127
|
+
// Hydrate tags before filtering: the tag and search rules read them off the
|
|
128
|
+
// entry, which is also how RedisStorage orders these two steps.
|
|
127
129
|
if (params.filters) {
|
|
128
|
-
results = this.applyAdvancedFilters(results, params.filters);
|
|
130
|
+
results = this.applyAdvancedFilters(this.hydrateEntriesWithTags(results), params.filters);
|
|
129
131
|
}
|
|
130
132
|
// Sort
|
|
131
133
|
if (params.afterSequence !== undefined) {
|
|
@@ -464,251 +466,7 @@ let MemoryStorage = MemoryStorage_1 = class MemoryStorage {
|
|
|
464
466
|
return results.length;
|
|
465
467
|
}
|
|
466
468
|
applyAdvancedFilters(entries, filters) {
|
|
467
|
-
|
|
468
|
-
return entries;
|
|
469
|
-
return entries.filter((entry) => {
|
|
470
|
-
const payload = entry.payload;
|
|
471
|
-
// Log filters
|
|
472
|
-
if (filters.levels?.length && entry.type === 'log') {
|
|
473
|
-
if (!filters.levels.includes(payload.level))
|
|
474
|
-
return false;
|
|
475
|
-
}
|
|
476
|
-
if (filters.contexts?.length && entry.type === 'log') {
|
|
477
|
-
if (!filters.contexts.includes(payload.context))
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
// Query filters
|
|
481
|
-
if (filters.queryTypes?.length && entry.type === 'query') {
|
|
482
|
-
const query = payload.query || '';
|
|
483
|
-
if (!filters.queryTypes.some((qt) => query.toUpperCase().startsWith(qt)))
|
|
484
|
-
return false;
|
|
485
|
-
}
|
|
486
|
-
if (filters.sources?.length) {
|
|
487
|
-
if (!filters.sources.includes(payload.source))
|
|
488
|
-
return false;
|
|
489
|
-
}
|
|
490
|
-
if (filters.slow !== undefined && entry.type === 'query') {
|
|
491
|
-
if (payload.slow !== filters.slow)
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
|
-
// Exception filters
|
|
495
|
-
if (filters.names?.length && entry.type === 'exception') {
|
|
496
|
-
const name = payload.name;
|
|
497
|
-
if (!filters.names.some((n) => name?.includes(n)))
|
|
498
|
-
return false;
|
|
499
|
-
}
|
|
500
|
-
if (filters.resolved !== undefined) {
|
|
501
|
-
const isResolved = !!entry.resolvedAt;
|
|
502
|
-
if (isResolved !== filters.resolved)
|
|
503
|
-
return false;
|
|
504
|
-
}
|
|
505
|
-
// Request filters
|
|
506
|
-
if (filters.methods?.length) {
|
|
507
|
-
const method = payload.method || payload.request?.method;
|
|
508
|
-
if (!method || !filters.methods.includes(method))
|
|
509
|
-
return false;
|
|
510
|
-
}
|
|
511
|
-
if (filters.paths?.length) {
|
|
512
|
-
const path = payload.path || payload.request?.url || '';
|
|
513
|
-
if (!filters.paths.some((p) => {
|
|
514
|
-
const pattern = p.replace(/\*/g, '.*');
|
|
515
|
-
return new RegExp(pattern).test(path);
|
|
516
|
-
}))
|
|
517
|
-
return false;
|
|
518
|
-
}
|
|
519
|
-
if (filters.statuses?.length) {
|
|
520
|
-
const status = payload.statusCode;
|
|
521
|
-
const hasErr = filters.statuses.includes('ERR');
|
|
522
|
-
const numericStatuses = filters.statuses.filter((s) => s !== 'ERR');
|
|
523
|
-
if (status === undefined || status === null) {
|
|
524
|
-
if (!hasErr)
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
if (!numericStatuses.includes(status))
|
|
529
|
-
return false;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
if (filters.hostnames?.length) {
|
|
533
|
-
const host = payload.headers?.host ||
|
|
534
|
-
payload.headers?.Host ||
|
|
535
|
-
payload.hostname;
|
|
536
|
-
if (!host || !filters.hostnames.some((h) => host.includes(h)))
|
|
537
|
-
return false;
|
|
538
|
-
}
|
|
539
|
-
if (filters.controllers?.length) {
|
|
540
|
-
if (!filters.controllers.includes(payload.controllerAction))
|
|
541
|
-
return false;
|
|
542
|
-
}
|
|
543
|
-
if (filters.ips?.length) {
|
|
544
|
-
if (!filters.ips.includes(payload.ip))
|
|
545
|
-
return false;
|
|
546
|
-
}
|
|
547
|
-
// Event filters
|
|
548
|
-
if (filters.eventNames?.length && entry.type === 'event') {
|
|
549
|
-
const name = payload.name;
|
|
550
|
-
if (!filters.eventNames.some((n) => name?.includes(n)))
|
|
551
|
-
return false;
|
|
552
|
-
}
|
|
553
|
-
// Schedule filters
|
|
554
|
-
if (filters.scheduleStatuses?.length && entry.type === 'schedule') {
|
|
555
|
-
if (!filters.scheduleStatuses.includes(payload.status))
|
|
556
|
-
return false;
|
|
557
|
-
}
|
|
558
|
-
if (filters.scheduleNames?.length && entry.type === 'schedule') {
|
|
559
|
-
const name = payload.name;
|
|
560
|
-
if (!filters.scheduleNames.some((n) => name?.includes(n)))
|
|
561
|
-
return false;
|
|
562
|
-
}
|
|
563
|
-
// Job filters
|
|
564
|
-
if (filters.jobStatuses?.length && entry.type === 'job') {
|
|
565
|
-
if (!filters.jobStatuses.includes(payload.status))
|
|
566
|
-
return false;
|
|
567
|
-
}
|
|
568
|
-
if (filters.jobNames?.length && entry.type === 'job') {
|
|
569
|
-
const name = payload.name;
|
|
570
|
-
if (!filters.jobNames.some((n) => name?.includes(n)))
|
|
571
|
-
return false;
|
|
572
|
-
}
|
|
573
|
-
if (filters.queues?.length && entry.type === 'job') {
|
|
574
|
-
if (!filters.queues.includes(payload.queue))
|
|
575
|
-
return false;
|
|
576
|
-
}
|
|
577
|
-
// Cache filters
|
|
578
|
-
if (filters.cacheOperations?.length && entry.type === 'cache') {
|
|
579
|
-
if (!filters.cacheOperations.includes(payload.operation))
|
|
580
|
-
return false;
|
|
581
|
-
}
|
|
582
|
-
// Mail filters
|
|
583
|
-
if (filters.mailStatuses?.length && entry.type === 'mail') {
|
|
584
|
-
if (!filters.mailStatuses.includes(payload.status))
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
// Redis filters
|
|
588
|
-
if (filters.redisStatuses?.length && entry.type === 'redis') {
|
|
589
|
-
if (!filters.redisStatuses.includes(payload.status))
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
if (filters.redisCommands?.length && entry.type === 'redis') {
|
|
593
|
-
if (!filters.redisCommands.includes(payload.command))
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
|
-
// Model filters
|
|
597
|
-
if (filters.modelActions?.length && entry.type === 'model') {
|
|
598
|
-
if (!filters.modelActions.includes(payload.action))
|
|
599
|
-
return false;
|
|
600
|
-
}
|
|
601
|
-
if (filters.entities?.length && entry.type === 'model') {
|
|
602
|
-
if (!filters.entities.includes(payload.entity))
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
if (filters.modelSources?.length && entry.type === 'model') {
|
|
606
|
-
if (!filters.modelSources.includes(payload.source))
|
|
607
|
-
return false;
|
|
608
|
-
}
|
|
609
|
-
// Notification filters
|
|
610
|
-
if (filters.notificationTypes?.length && entry.type === 'notification') {
|
|
611
|
-
if (!filters.notificationTypes.includes(payload.type))
|
|
612
|
-
return false;
|
|
613
|
-
}
|
|
614
|
-
if (filters.notificationStatuses?.length && entry.type === 'notification') {
|
|
615
|
-
if (!filters.notificationStatuses.includes(payload.status))
|
|
616
|
-
return false;
|
|
617
|
-
}
|
|
618
|
-
// View filters
|
|
619
|
-
if (filters.viewFormats?.length && entry.type === 'view') {
|
|
620
|
-
if (!filters.viewFormats.includes(payload.format))
|
|
621
|
-
return false;
|
|
622
|
-
}
|
|
623
|
-
if (filters.viewStatuses?.length && entry.type === 'view') {
|
|
624
|
-
if (!filters.viewStatuses.includes(payload.status))
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
// Command filters
|
|
628
|
-
if (filters.commandStatuses?.length && entry.type === 'command') {
|
|
629
|
-
if (!filters.commandStatuses.includes(payload.status))
|
|
630
|
-
return false;
|
|
631
|
-
}
|
|
632
|
-
if (filters.commandNames?.length && entry.type === 'command') {
|
|
633
|
-
const name = payload.name;
|
|
634
|
-
if (!filters.commandNames.some((n) => name?.includes(n)))
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
// Gate filters
|
|
638
|
-
if (filters.gateNames?.length && entry.type === 'gate') {
|
|
639
|
-
const gate = payload.gate;
|
|
640
|
-
if (!filters.gateNames.some((n) => gate?.includes(n)))
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
if (filters.gateResults?.length && entry.type === 'gate') {
|
|
644
|
-
const allowed = payload.allowed;
|
|
645
|
-
const result = allowed ? 'allowed' : 'denied';
|
|
646
|
-
if (!filters.gateResults.includes(result))
|
|
647
|
-
return false;
|
|
648
|
-
}
|
|
649
|
-
// Batch filters
|
|
650
|
-
if (filters.batchStatuses?.length && entry.type === 'batch') {
|
|
651
|
-
if (!filters.batchStatuses.includes(payload.status))
|
|
652
|
-
return false;
|
|
653
|
-
}
|
|
654
|
-
if (filters.batchOperations?.length && entry.type === 'batch') {
|
|
655
|
-
if (!filters.batchOperations.includes(payload.operation))
|
|
656
|
-
return false;
|
|
657
|
-
}
|
|
658
|
-
// Dump filters
|
|
659
|
-
if (filters.dumpStatuses?.length && entry.type === 'dump') {
|
|
660
|
-
if (!filters.dumpStatuses.includes(payload.status))
|
|
661
|
-
return false;
|
|
662
|
-
}
|
|
663
|
-
if (filters.dumpOperations?.length && entry.type === 'dump') {
|
|
664
|
-
if (!filters.dumpOperations.includes(payload.operation))
|
|
665
|
-
return false;
|
|
666
|
-
}
|
|
667
|
-
if (filters.dumpFormats?.length && entry.type === 'dump') {
|
|
668
|
-
if (!filters.dumpFormats.includes(payload.format))
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
// GraphQL filters
|
|
672
|
-
if (filters.operationTypes?.length && entry.type === 'graphql') {
|
|
673
|
-
if (!filters.operationTypes.includes(payload.operationType))
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
if (filters.operationNames?.length && entry.type === 'graphql') {
|
|
677
|
-
const opName = payload.operationName;
|
|
678
|
-
if (!filters.operationNames.some((n) => opName?.includes(n)))
|
|
679
|
-
return false;
|
|
680
|
-
}
|
|
681
|
-
if (filters.hasErrors !== undefined && entry.type === 'graphql') {
|
|
682
|
-
if (payload.hasErrors !== filters.hasErrors)
|
|
683
|
-
return false;
|
|
684
|
-
}
|
|
685
|
-
if (filters.hasN1 !== undefined && entry.type === 'graphql') {
|
|
686
|
-
const n1Array = payload.potentialN1;
|
|
687
|
-
const hasN1 = n1Array && n1Array.length > 0;
|
|
688
|
-
if (hasN1 !== filters.hasN1)
|
|
689
|
-
return false;
|
|
690
|
-
}
|
|
691
|
-
// Tag filter (case-insensitive)
|
|
692
|
-
if (filters.tags?.length) {
|
|
693
|
-
const entryTagSet = this.entryTags.get(entry.id);
|
|
694
|
-
// Normalize filter tags to uppercase for case-insensitive matching
|
|
695
|
-
const normalizedFilterTags = filters.tags.map((t) => t.toUpperCase());
|
|
696
|
-
if (!entryTagSet || !normalizedFilterTags.some((t) => entryTagSet.has(t)))
|
|
697
|
-
return false;
|
|
698
|
-
}
|
|
699
|
-
// Search filter (matches payload content or entry tags)
|
|
700
|
-
if (filters.search) {
|
|
701
|
-
const term = filters.search.toLowerCase();
|
|
702
|
-
const payloadStr = JSON.stringify(payload).toLowerCase();
|
|
703
|
-
const entryTagSet = this.entryTags.get(entry.id);
|
|
704
|
-
const tagMatch = entryTagSet
|
|
705
|
-
? [...entryTagSet].some((t) => t.toLowerCase().includes(term))
|
|
706
|
-
: false;
|
|
707
|
-
if (!payloadStr.includes(term) && !tagMatch)
|
|
708
|
-
return false;
|
|
709
|
-
}
|
|
710
|
-
return true;
|
|
711
|
-
});
|
|
469
|
+
return entries.filter((entry) => (0, entry_filter_1.matchesEntryFilters)(entry, filters));
|
|
712
470
|
}
|
|
713
471
|
};
|
|
714
472
|
exports.MemoryStorage = MemoryStorage;
|
|
@@ -45,6 +45,7 @@ var RedisStorage_1;
|
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.RedisStorage = void 0;
|
|
47
47
|
const common_1 = require("@nestjs/common");
|
|
48
|
+
const entry_filter_1 = require("./entry-filter");
|
|
48
49
|
/**
|
|
49
50
|
* Redis storage implementation for NestLens.
|
|
50
51
|
* Requires ioredis to be installed.
|
|
@@ -702,60 +703,7 @@ let RedisStorage = RedisStorage_1 = class RedisStorage {
|
|
|
702
703
|
await client.del(this.key('tags', String(id)));
|
|
703
704
|
}
|
|
704
705
|
applyAdvancedFilters(entries, filters) {
|
|
705
|
-
|
|
706
|
-
return entries;
|
|
707
|
-
return entries.filter((entry) => {
|
|
708
|
-
const payload = entry.payload;
|
|
709
|
-
// Apply the same filter logic as MemoryStorage
|
|
710
|
-
if (filters.levels?.length && entry.type === 'log') {
|
|
711
|
-
if (!filters.levels.includes(payload.level))
|
|
712
|
-
return false;
|
|
713
|
-
}
|
|
714
|
-
if (filters.search) {
|
|
715
|
-
const term = filters.search.toLowerCase();
|
|
716
|
-
const payloadStr = JSON.stringify(payload).toLowerCase();
|
|
717
|
-
const tagMatch = (entry.tags ?? []).some((t) => t.toLowerCase().includes(term));
|
|
718
|
-
if (!payloadStr.includes(term) && !tagMatch)
|
|
719
|
-
return false;
|
|
720
|
-
}
|
|
721
|
-
if (filters.resolved !== undefined) {
|
|
722
|
-
const isResolved = !!entry.resolvedAt;
|
|
723
|
-
if (isResolved !== filters.resolved)
|
|
724
|
-
return false;
|
|
725
|
-
}
|
|
726
|
-
// Event filters
|
|
727
|
-
if (filters.eventNames?.length && entry.type === 'event') {
|
|
728
|
-
const name = payload.name;
|
|
729
|
-
if (!filters.eventNames.some((n) => name?.includes(n)))
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
// Schedule filters
|
|
733
|
-
if (filters.scheduleStatuses?.length && entry.type === 'schedule') {
|
|
734
|
-
if (!filters.scheduleStatuses.includes(payload.status))
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
if (filters.scheduleNames?.length && entry.type === 'schedule') {
|
|
738
|
-
const name = payload.name;
|
|
739
|
-
if (!filters.scheduleNames.some((n) => name?.includes(n)))
|
|
740
|
-
return false;
|
|
741
|
-
}
|
|
742
|
-
// Job filters
|
|
743
|
-
if (filters.jobStatuses?.length && entry.type === 'job') {
|
|
744
|
-
if (!filters.jobStatuses.includes(payload.status))
|
|
745
|
-
return false;
|
|
746
|
-
}
|
|
747
|
-
if (filters.jobNames?.length && entry.type === 'job') {
|
|
748
|
-
const name = payload.name;
|
|
749
|
-
if (!filters.jobNames.some((n) => name?.includes(n)))
|
|
750
|
-
return false;
|
|
751
|
-
}
|
|
752
|
-
if (filters.queues?.length && entry.type === 'job') {
|
|
753
|
-
if (!filters.queues.includes(payload.queue))
|
|
754
|
-
return false;
|
|
755
|
-
}
|
|
756
|
-
// Additional filters can be added as needed
|
|
757
|
-
return true;
|
|
758
|
-
});
|
|
706
|
+
return entries.filter((entry) => (0, entry_filter_1.matchesEntryFilters)(entry, filters));
|
|
759
707
|
}
|
|
760
708
|
};
|
|
761
709
|
exports.RedisStorage = RedisStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,L as d}from"./index-
|
|
1
|
+
import{j as a,L as d}from"./index-NYfiXmMn.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-Vyx_sMAl.js";import{u as L,P as R,N as $,L as I}from"./PageHeader-gzCjMnIq.js";import{s as H,T as s,D as S,b as W}from"./types-DrGQDdvv.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-NYfiXmMn.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-Vyx_sMAl.js";import{u as R,P as A,N as F,L as H}from"./PageHeader-gzCjMnIq.js";import{h as P,T as i,D as B,b as I}from"./types-DrGQDdvv.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};
|