nestlens 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +10 -0
  2. package/dist/api/api.controller.d.ts +16 -5
  3. package/dist/api/api.controller.js +95 -9
  4. package/dist/api/dto/clear-entries.dto.js +3 -3
  5. package/dist/api/dto/cursor-query.dto.d.ts +4 -0
  6. package/dist/api/dto/cursor-query.dto.js +59 -58
  7. package/dist/api/dto/entries-query.dto.d.ts +21 -20
  8. package/dist/api/dto/entries-query.dto.js +77 -43
  9. package/dist/api/dto/tags.dto.js +4 -4
  10. package/dist/api/dto/transformers/query-transformers.d.ts +21 -2
  11. package/dist/api/dto/transformers/query-transformers.js +57 -17
  12. package/dist/api/dto/transformers/query-validators.d.ts +69 -0
  13. package/dist/api/dto/transformers/query-validators.js +174 -1
  14. package/dist/api/pipes/nestlens-validation.pipe.js +11 -1
  15. package/dist/api/tag.controller.js +25 -0
  16. package/dist/api/tools/dto-schema.d.ts +38 -0
  17. package/dist/api/tools/dto-schema.js +128 -0
  18. package/dist/api/tools/index.d.ts +3 -0
  19. package/dist/api/tools/index.js +18 -0
  20. package/dist/api/tools/tool-manifest.d.ts +47 -0
  21. package/dist/api/tools/tool-manifest.js +142 -0
  22. package/dist/api/tools/tool.decorator.d.ts +34 -0
  23. package/dist/api/tools/tool.decorator.js +21 -0
  24. package/dist/dashboard/public/assets/{BatchDetailView-DQf7rhdt.js → BatchDetailView-Bx3TdDfp.js} +1 -1
  25. package/dist/dashboard/public/assets/{BatchesPage-W8k8XEu3.js → BatchesPage-1KG6BR9f.js} +1 -1
  26. package/dist/dashboard/public/assets/{CacheDetailView-D1W5C-eK.js → CacheDetailView-rTnzCvG4.js} +1 -1
  27. package/dist/dashboard/public/assets/{CachePage-CwEDXyxJ.js → CachePage-igKo0tKb.js} +1 -1
  28. package/dist/dashboard/public/assets/{CommandDetailView-DKQLM96e.js → CommandDetailView-Dw4f7EtH.js} +1 -1
  29. package/dist/dashboard/public/assets/{CommandsPage-B4XMyz_K.js → CommandsPage-BBB_gtAh.js} +1 -1
  30. package/dist/dashboard/public/assets/{CopyButton-DfPqcshv.js → CopyButton-CJnMlc7b.js} +1 -1
  31. package/dist/dashboard/public/assets/{DashboardPage-Ce497zS8.js → DashboardPage--XwFx1Nj.js} +1 -1
  32. package/dist/dashboard/public/assets/{DataTable-Cz2phOFe.js → DataTable-1ZO_pzuv.js} +1 -1
  33. package/dist/dashboard/public/assets/{DetailRow-DKG3Vf9j.js → DetailRow-BEPvO5v0.js} +1 -1
  34. package/dist/dashboard/public/assets/{DumpDetailView-BU9RRxWv.js → DumpDetailView-B_S45g59.js} +1 -1
  35. package/dist/dashboard/public/assets/{DumpsPage-ldSDznQa.js → DumpsPage-CgjJGtWe.js} +1 -1
  36. package/dist/dashboard/public/assets/{EntryDetailPage-BdBZLbAf.js → EntryDetailPage-CT4qp8Ac.js} +3 -3
  37. package/dist/dashboard/public/assets/{EntrySearchInput-BF9N_f7y.js → EntrySearchInput-CB_tENkD.js} +1 -1
  38. package/dist/dashboard/public/assets/{EventDetailView-CmV2uByp.js → EventDetailView-9jlisffP.js} +1 -1
  39. package/dist/dashboard/public/assets/{EventsPage-TlQQA-mn.js → EventsPage-CNIg2EPm.js} +1 -1
  40. package/dist/dashboard/public/assets/{ExceptionDetailView-B5aRNZz5.js → ExceptionDetailView-Bd31fgzl.js} +1 -1
  41. package/dist/dashboard/public/assets/{ExceptionsPage-DqiQXiJK.js → ExceptionsPage-TyciojQD.js} +1 -1
  42. package/dist/dashboard/public/assets/{GateDetailView-BPd0sJpT.js → GateDetailView-CuPPDUF1.js} +1 -1
  43. package/dist/dashboard/public/assets/{GatesPage-D4s1Ogo-.js → GatesPage-DNiVHAvK.js} +1 -1
  44. package/dist/dashboard/public/assets/{GraphQLDetailView-Dd_pgjdZ.js → GraphQLDetailView-CCJKoKpS.js} +1 -1
  45. package/dist/dashboard/public/assets/{GraphQLPage-AOD9WXa5.js → GraphQLPage-N5ynntO0.js} +1 -1
  46. package/dist/dashboard/public/assets/{HttpClientDetailView-CR7RujPI.js → HttpClientDetailView-DJz1tnPM.js} +1 -1
  47. package/dist/dashboard/public/assets/{HttpClientPage-CUNDLZdF.js → HttpClientPage-CCiIQKmX.js} +1 -1
  48. package/dist/dashboard/public/assets/{JobDetailView-C3U9nJFo.js → JobDetailView-DaXSRim-.js} +1 -1
  49. package/dist/dashboard/public/assets/{JobsPage-DX0A5Til.js → JobsPage-NZyF7yXM.js} +1 -1
  50. package/dist/dashboard/public/assets/{LogDetailView-V_x94h-I.js → LogDetailView-DZ0FK8Y8.js} +1 -1
  51. package/dist/dashboard/public/assets/{LogsPage-Cvrcv7tq.js → LogsPage-Dtg__OWJ.js} +1 -1
  52. package/dist/dashboard/public/assets/MailDetailView-Dwc2oKbD.js +9 -0
  53. package/dist/dashboard/public/assets/{MailPage-BZbVLHHN.js → MailPage-BlimH4zk.js} +1 -1
  54. package/dist/dashboard/public/assets/{ModelDetailView-CUEA5nRD.js → ModelDetailView-XRo3WGLf.js} +1 -1
  55. package/dist/dashboard/public/assets/{ModelsPage-CKUeCZLn.js → ModelsPage-D8DoB6NW.js} +1 -1
  56. package/dist/dashboard/public/assets/{NotificationDetailView-CT4EIDa3.js → NotificationDetailView-DSp0TodI.js} +1 -1
  57. package/dist/dashboard/public/assets/{NotificationsPage-CVnjoHST.js → NotificationsPage-DpMfY8II.js} +1 -1
  58. package/dist/dashboard/public/assets/{PageHeader-DR_M5h7z.js → PageHeader-BmgcMRRE.js} +1 -1
  59. package/dist/dashboard/public/assets/{QueriesPage-DR3EHxfO.js → QueriesPage-D1onXHzY.js} +1 -1
  60. package/dist/dashboard/public/assets/{QueryDetailView-dWmmR_nP.js → QueryDetailView-4tm2OHX5.js} +1 -1
  61. package/dist/dashboard/public/assets/{RedisDetailView-PALK5x6N.js → RedisDetailView-tYN_uEkB.js} +1 -1
  62. package/dist/dashboard/public/assets/{RedisPage-D-9y0o0o.js → RedisPage-CokZRio-.js} +1 -1
  63. package/dist/dashboard/public/assets/{RequestDetailView-DiS1WZ4m.js → RequestDetailView-DVdPPKM0.js} +1 -1
  64. package/dist/dashboard/public/assets/{RequestsPage-CCSIr_jW.js → RequestsPage-DtMophsJ.js} +1 -1
  65. package/dist/dashboard/public/assets/{ScheduleDetailView-G86hV8Ed.js → ScheduleDetailView-CorPCsz9.js} +1 -1
  66. package/dist/dashboard/public/assets/{SchedulePage-CQVmVvYe.js → SchedulePage-g4sa4RFq.js} +1 -1
  67. package/dist/dashboard/public/assets/{UserCard-Bp6Bf3OI.js → UserCard-DAPJk-EO.js} +1 -1
  68. package/dist/dashboard/public/assets/{ViewDetailView-D-dBm6G6.js → ViewDetailView-D0dL_DlW.js} +1 -1
  69. package/dist/dashboard/public/assets/{ViewsPage-ErK5Vmy0.js → ViewsPage-BanDzc1a.js} +1 -1
  70. package/dist/dashboard/public/assets/{calendar-BfDDUQSW.js → calendar-CPV1dZ0L.js} +1 -1
  71. package/dist/dashboard/public/assets/{circle-alert-DJ_9D_4c.js → circle-alert-gYh6oi6x.js} +1 -1
  72. package/dist/dashboard/public/assets/{circle-check-big-CiGeQW9J.js → circle-check-big-CSbW-duB.js} +1 -1
  73. package/dist/dashboard/public/assets/{circle-x-B-V5s-zK.js → circle-x-CTKr7jW6.js} +1 -1
  74. package/dist/dashboard/public/assets/{eye-LljylR_O.js → eye-DZpqw9X-.js} +1 -1
  75. package/dist/dashboard/public/assets/{index-HxcGVcSo.js → index-BM7yE9Cj.js} +2 -2
  76. package/dist/dashboard/public/assets/{search-VPXcw9Ki.js → search-BLEa-hQ6.js} +1 -1
  77. package/dist/dashboard/public/assets/{send-CdCk9jQ5.js → send-BUGOrYWh.js} +1 -1
  78. package/dist/dashboard/public/assets/{timer-I7o5QV6X.js → timer-DmUlWCyc.js} +1 -1
  79. package/dist/dashboard/public/assets/{types-BMBEhoQ2.js → types-DkVONef3.js} +1 -1
  80. package/dist/dashboard/public/assets/{users-CFzKwpf2.js → users-byPZT2l9.js} +1 -1
  81. package/dist/dashboard/public/assets/{zap-DMB3w7zm.js → zap-990QVDSP.js} +1 -1
  82. package/dist/dashboard/public/index.html +1 -1
  83. package/dist/mcp/bin.d.ts +2 -0
  84. package/dist/mcp/bin.js +29 -0
  85. package/dist/mcp/cli.d.ts +18 -0
  86. package/dist/mcp/cli.js +184 -0
  87. package/dist/mcp/client.d.ts +85 -0
  88. package/dist/mcp/client.js +378 -0
  89. package/dist/mcp/fit.d.ts +10 -0
  90. package/dist/mcp/fit.js +129 -0
  91. package/dist/mcp/http.d.ts +58 -0
  92. package/dist/mcp/http.js +209 -0
  93. package/dist/mcp/index.d.ts +6 -0
  94. package/dist/mcp/index.js +14 -0
  95. package/dist/mcp/server.d.ts +42 -0
  96. package/dist/mcp/server.js +249 -0
  97. package/package.json +20 -3
  98. package/dist/dashboard/public/assets/MailDetailView-CYCQI9Z8.js +0 -9
package/README.md CHANGED
@@ -101,6 +101,16 @@ export class AppModule {}
101
101
 
102
102
  Visit **http://localhost:3000/nestlens** and start debugging.
103
103
 
104
+ ### Let an AI agent read it
105
+
106
+ `nestlens-mcp` is an [MCP](https://modelcontextprotocol.io) server over a running NestLens. It is a hub of two tools — one lists everything NestLens can do, the other runs it — read from your application each time, so a new endpoint is available to an agent without a new release. It is read-only unless you pass `--allow-write`.
107
+
108
+ ```bash
109
+ claude mcp add nestlens -- npx nestlens-mcp --url http://localhost:3000/nestlens
110
+ ```
111
+
112
+ For a NestLens on a development or production server, run `nestlens-mcp --http` next to it and give the agent a URL. Setup for Claude Code, Cursor, VS Code and Claude Desktop is in the [MCP guide](https://nestlens-docs.vercel.app/docs/integrations/mcp).
113
+
104
114
  <br/>
105
115
 
106
116
  <p align="center">
@@ -3,7 +3,8 @@ import { PruningService } from '../core';
3
3
  import { CollectorService } from '../core';
4
4
  import { NestLensConfig } from '../nestlens.config';
5
5
  import { CursorPaginatedResponse, Entry } from '../types';
6
- import { CheckNewQueryDto, CursorQueryDto, EntriesQueryDto, LatestSequenceQueryDto, ClearEntriesQueryDto, LogsQueryDto, PauseRecordingDto, QueriesQueryDto } from './dto';
6
+ import { CheckNewQueryDto, CursorQueryDto, EntriesQueryDto, FamilyQueryDto, GroupedEntriesQueryDto, LatestSequenceQueryDto, ClearEntriesQueryDto, LogsQueryDto, PageQueryDto, PauseRecordingDto, QueriesQueryDto } from './dto';
7
+ import { NestLensToolManifest } from './tools';
7
8
  /**
8
9
  * Every handler here takes an unused `@Res() _res` parameter. It is not a
9
10
  * mistake and the value is never touched: its presence is how a handler tells
@@ -21,6 +22,16 @@ export declare class NestLensApiController {
21
22
  private readonly pruningService;
22
23
  private readonly collectorService;
23
24
  constructor(storage: StorageInterface, config: NestLensConfig, pruningService: PruningService, collectorService: CollectorService);
25
+ /**
26
+ * What this API offers as tools, read from the controllers' own metadata.
27
+ *
28
+ * This is what the MCP server lists, so a handler becomes a tool by carrying
29
+ * `@NestLensTool` and nothing else needs to change. It is not itself a tool:
30
+ * the manifest describes the API, and an agent that has this has no use for it.
31
+ */
32
+ getTools(_res?: unknown): Promise<{
33
+ data: NestLensToolManifest;
34
+ }>;
24
35
  getEntries(query: EntriesQueryDto, _res?: unknown): Promise<{
25
36
  data: Entry[];
26
37
  meta: {
@@ -68,7 +79,7 @@ export declare class NestLensApiController {
68
79
  * Get entries grouped by family hash
69
80
  * NOTE: Must come BEFORE @Get('entries/:id') to avoid route conflict
70
81
  */
71
- getGroupedEntries(query: EntriesQueryDto, _res?: unknown): Promise<{
82
+ getGroupedEntries(query: GroupedEntriesQueryDto, _res?: unknown): Promise<{
72
83
  data: {
73
84
  familyHash: string;
74
85
  count: number;
@@ -79,7 +90,7 @@ export declare class NestLensApiController {
79
90
  * Get all entries with the same family hash
80
91
  * NOTE: Must come BEFORE @Get('entries/:id') to avoid route conflict
81
92
  */
82
- getEntriesByFamilyHash(hash: string, query: EntriesQueryDto, _res?: unknown): Promise<{
93
+ getEntriesByFamilyHash(hash: string, query: FamilyQueryDto, _res?: unknown): Promise<{
83
94
  data: Entry[];
84
95
  }>;
85
96
  getEntry(id: number, _res?: unknown): Promise<{
@@ -92,7 +103,7 @@ export declare class NestLensApiController {
92
103
  getStats(_res?: unknown): Promise<{
93
104
  data: import("../types").EntryStats;
94
105
  }>;
95
- getRequests(query: EntriesQueryDto, _res?: unknown): Promise<{
106
+ getRequests(query: PageQueryDto, _res?: unknown): Promise<{
96
107
  data: Entry[];
97
108
  meta: {
98
109
  total: number;
@@ -108,7 +119,7 @@ export declare class NestLensApiController {
108
119
  offset: number;
109
120
  };
110
121
  }>;
111
- getExceptions(query: EntriesQueryDto, _res?: unknown): Promise<{
122
+ getExceptions(query: PageQueryDto, _res?: unknown): Promise<{
112
123
  data: Entry[];
113
124
  meta: {
114
125
  total: number;
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
+ var NestLensApiController_1;
14
15
  Object.defineProperty(exports, "__esModule", { value: true });
15
16
  exports.NestLensApiController = void 0;
16
17
  const common_1 = require("@nestjs/common");
@@ -24,6 +25,8 @@ const dto_1 = require("./dto");
24
25
  const filters_1 = require("../api/filters");
25
26
  const interceptors_1 = require("../api/interceptors");
26
27
  const exceptions_1 = require("../api/exceptions");
28
+ const tools_1 = require("./tools");
29
+ const tag_controller_1 = require("./tag.controller");
27
30
  /**
28
31
  * Every handler here takes an unused `@Res() _res` parameter. It is not a
29
32
  * mistake and the value is never touched: its presence is how a handler tells
@@ -35,13 +38,23 @@ const exceptions_1 = require("../api/exceptions");
35
38
  * Handlers still return their data, so they stay directly unit-testable and the
36
39
  * envelope shape lives in one place — the interceptor.
37
40
  */
38
- let NestLensApiController = class NestLensApiController {
41
+ let NestLensApiController = NestLensApiController_1 = class NestLensApiController {
39
42
  constructor(storage, config, pruningService, collectorService) {
40
43
  this.storage = storage;
41
44
  this.config = config;
42
45
  this.pruningService = pruningService;
43
46
  this.collectorService = collectorService;
44
47
  }
48
+ /**
49
+ * What this API offers as tools, read from the controllers' own metadata.
50
+ *
51
+ * This is what the MCP server lists, so a handler becomes a tool by carrying
52
+ * `@NestLensTool` and nothing else needs to change. It is not itself a tool:
53
+ * the manifest describes the API, and an agent that has this has no use for it.
54
+ */
55
+ async getTools(_res) {
56
+ return { data: (0, tools_1.buildToolManifest)([NestLensApiController_1, tag_controller_1.TagController]) };
57
+ }
45
58
  async getEntries(query, _res) {
46
59
  return this.filteredPage(query.type, query);
47
60
  }
@@ -150,13 +163,13 @@ let NestLensApiController = class NestLensApiController {
150
163
  return { data: stats };
151
164
  }
152
165
  async getRequests(query, _res) {
153
- return this.getEntries({ ...query, type: 'request' });
166
+ return this.filteredPage('request', query);
154
167
  }
155
168
  async getQueries(query, _res) {
156
- return this.filteredPage('query', query, query.slow === 'true' ? { slow: true } : undefined);
169
+ return this.filteredPage('query', query, query.slow === undefined ? undefined : { slow: query.slow });
157
170
  }
158
171
  async getExceptions(query, _res) {
159
- return this.getEntries({ ...query, type: 'exception' });
172
+ return this.filteredPage('exception', query);
160
173
  }
161
174
  async getLogs(query, _res) {
162
175
  return this.filteredPage('log', query, query.level ? { levels: [query.level] } : undefined);
@@ -296,6 +309,16 @@ let NestLensApiController = class NestLensApiController {
296
309
  };
297
310
  exports.NestLensApiController = NestLensApiController;
298
311
  __decorate([
312
+ (0, common_1.Get)('tools'),
313
+ __param(0, (0, common_1.Res)()),
314
+ __metadata("design:type", Function),
315
+ __metadata("design:paramtypes", [Object]),
316
+ __metadata("design:returntype", Promise)
317
+ ], NestLensApiController.prototype, "getTools", null);
318
+ __decorate([
319
+ (0, tools_1.NestLensTool)({
320
+ description: 'List recorded entries, newest first, with offset paging. Filter by type, time window (from/to), duration, or requestId. Use this for a quick look; prefer get_entries_with_cursor when you need the type-specific filters (log level, HTTP status, slow queries, exception names, and so on) or a full search.',
321
+ }),
299
322
  (0, common_1.Get)('entries'),
300
323
  __param(0, (0, common_1.Query)()),
301
324
  __param(1, (0, common_1.Res)()),
@@ -304,6 +327,9 @@ __decorate([
304
327
  __metadata("design:returntype", Promise)
305
328
  ], NestLensApiController.prototype, "getEntries", null);
306
329
  __decorate([
330
+ (0, tools_1.NestLensTool)({
331
+ description: "List recorded entries with every filter NestLens has, paged by sequence number. Set `type` first, then use that type's filters: logs (levels, contexts), queries (slow, queryTypes, sources), requests (methods, paths, statuses, controllers, hostnames, ips), exceptions (names, resolved), jobs (jobStatuses, jobNames, queues), graphql (operationTypes, operationNames, hasErrors, hasN1), and so on. `search` matches the entry's text. To get the next page pass the last entry's sequence as `beforeSequence` (older) or `afterSequence` (newer).",
332
+ }),
307
333
  (0, common_1.Get)('entries/cursor'),
308
334
  __param(0, (0, common_1.Query)()),
309
335
  __param(1, (0, common_1.Res)()),
@@ -312,6 +338,9 @@ __decorate([
312
338
  __metadata("design:returntype", Promise)
313
339
  ], NestLensApiController.prototype, "getEntriesWithCursor", null);
314
340
  __decorate([
341
+ (0, tools_1.NestLensTool)({
342
+ description: 'The sequence number of the newest entry, optionally of one type. Use it as a bookmark, then call check_new_entries later to see whether anything happened since.',
343
+ }),
315
344
  (0, common_1.Get)('entries/latest-sequence'),
316
345
  __param(0, (0, common_1.Query)()),
317
346
  __param(1, (0, common_1.Res)()),
@@ -320,6 +349,9 @@ __decorate([
320
349
  __metadata("design:returntype", Promise)
321
350
  ], NestLensApiController.prototype, "getLatestSequence", null);
322
351
  __decorate([
352
+ (0, tools_1.NestLensTool)({
353
+ description: "Count the entries recorded after a sequence number. Cheap way to ask 'did anything new happen since I last looked?'.",
354
+ }),
323
355
  (0, common_1.Get)('entries/check-new'),
324
356
  __param(0, (0, common_1.Query)()),
325
357
  __param(1, (0, common_1.Res)()),
@@ -328,23 +360,32 @@ __decorate([
328
360
  __metadata("design:returntype", Promise)
329
361
  ], NestLensApiController.prototype, "checkNewEntries", null);
330
362
  __decorate([
363
+ (0, tools_1.NestLensTool)({
364
+ description: 'Group entries by family hash: identical queries, repeated exceptions and similar requests collapse into one row with a count. Use it to find the noisy ones — the same exception thrown 400 times, the same query run on every request.',
365
+ }),
331
366
  (0, common_1.Get)('entries/grouped'),
332
367
  __param(0, (0, common_1.Query)()),
333
368
  __param(1, (0, common_1.Res)()),
334
369
  __metadata("design:type", Function),
335
- __metadata("design:paramtypes", [dto_1.EntriesQueryDto, Object]),
370
+ __metadata("design:paramtypes", [dto_1.GroupedEntriesQueryDto, Object]),
336
371
  __metadata("design:returntype", Promise)
337
372
  ], NestLensApiController.prototype, "getGroupedEntries", null);
338
373
  __decorate([
374
+ (0, tools_1.NestLensTool)({
375
+ description: 'Every entry that shares one family hash, as listed by get_grouped_entries. Use it to inspect all occurrences of one repeated query or exception.',
376
+ }),
339
377
  (0, common_1.Get)('entries/family/:hash'),
340
378
  __param(0, (0, common_1.Param)('hash')),
341
379
  __param(1, (0, common_1.Query)()),
342
380
  __param(2, (0, common_1.Res)()),
343
381
  __metadata("design:type", Function),
344
- __metadata("design:paramtypes", [String, dto_1.EntriesQueryDto, Object]),
382
+ __metadata("design:paramtypes", [String, dto_1.FamilyQueryDto, Object]),
345
383
  __metadata("design:returntype", Promise)
346
384
  ], NestLensApiController.prototype, "getEntriesByFamilyHash", null);
347
385
  __decorate([
386
+ (0, tools_1.NestLensTool)({
387
+ description: 'One entry in full by id. For a request entry it also returns what that request produced — its queries, exceptions, logs and outgoing calls — which is the quickest way to see why a request was slow or failed.',
388
+ }),
348
389
  (0, common_1.Get)('entries/:id'),
349
390
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
350
391
  __param(1, (0, common_1.Res)()),
@@ -353,6 +394,9 @@ __decorate([
353
394
  __metadata("design:returntype", Promise)
354
395
  ], NestLensApiController.prototype, "getEntry", null);
355
396
  __decorate([
397
+ (0, tools_1.NestLensTool)({
398
+ description: 'Headline figures: total entries, a count per type, average response time, slow query count and how many exceptions are unresolved. The first call to make when asking what is going on in the application.',
399
+ }),
356
400
  (0, common_1.Get)('stats'),
357
401
  __param(0, (0, common_1.Res)()),
358
402
  __metadata("design:type", Function),
@@ -360,14 +404,20 @@ __decorate([
360
404
  __metadata("design:returntype", Promise)
361
405
  ], NestLensApiController.prototype, "getStats", null);
362
406
  __decorate([
407
+ (0, tools_1.NestLensTool)({
408
+ description: 'List recorded HTTP requests, newest first. Same filters as get_entries; for filtering by method, path or status use get_entries_with_cursor with type=request.',
409
+ }),
363
410
  (0, common_1.Get)('requests'),
364
411
  __param(0, (0, common_1.Query)()),
365
412
  __param(1, (0, common_1.Res)()),
366
413
  __metadata("design:type", Function),
367
- __metadata("design:paramtypes", [dto_1.EntriesQueryDto, Object]),
414
+ __metadata("design:paramtypes", [dto_1.PageQueryDto, Object]),
368
415
  __metadata("design:returntype", Promise)
369
416
  ], NestLensApiController.prototype, "getRequests", null);
370
417
  __decorate([
418
+ (0, tools_1.NestLensTool)({
419
+ description: 'List recorded database queries, newest first. Pass slow=true for only the queries over the slow threshold.',
420
+ }),
371
421
  (0, common_1.Get)('queries'),
372
422
  __param(0, (0, common_1.Query)()),
373
423
  __param(1, (0, common_1.Res)()),
@@ -376,14 +426,20 @@ __decorate([
376
426
  __metadata("design:returntype", Promise)
377
427
  ], NestLensApiController.prototype, "getQueries", null);
378
428
  __decorate([
429
+ (0, tools_1.NestLensTool)({
430
+ description: 'List recorded exceptions, newest first, with their stack traces.',
431
+ }),
379
432
  (0, common_1.Get)('exceptions'),
380
433
  __param(0, (0, common_1.Query)()),
381
434
  __param(1, (0, common_1.Res)()),
382
435
  __metadata("design:type", Function),
383
- __metadata("design:paramtypes", [dto_1.EntriesQueryDto, Object]),
436
+ __metadata("design:paramtypes", [dto_1.PageQueryDto, Object]),
384
437
  __metadata("design:returntype", Promise)
385
438
  ], NestLensApiController.prototype, "getExceptions", null);
386
439
  __decorate([
440
+ (0, tools_1.NestLensTool)({
441
+ description: 'List recorded log lines, newest first. Pass level (log, error, warn, debug, verbose) to narrow to one level.',
442
+ }),
387
443
  (0, common_1.Get)('logs'),
388
444
  __param(0, (0, common_1.Query)()),
389
445
  __param(1, (0, common_1.Res)()),
@@ -392,6 +448,9 @@ __decorate([
392
448
  __metadata("design:returntype", Promise)
393
449
  ], NestLensApiController.prototype, "getLogs", null);
394
450
  __decorate([
451
+ (0, tools_1.NestLensTool)({
452
+ description: 'How much NestLens has stored and where: entry totals, oldest and newest entry, storage size.',
453
+ }),
395
454
  (0, common_1.Get)('storage/stats'),
396
455
  __param(0, (0, common_1.Res)()),
397
456
  __metadata("design:type", Function),
@@ -399,6 +458,9 @@ __decorate([
399
458
  __metadata("design:returntype", Promise)
400
459
  ], NestLensApiController.prototype, "getStorageStats", null);
401
460
  __decorate([
461
+ (0, tools_1.NestLensTool)({
462
+ description: 'Whether automatic pruning is on, how old an entry may get, when it last ran and when it runs next.',
463
+ }),
402
464
  (0, common_1.Get)('pruning/status'),
403
465
  __param(0, (0, common_1.Res)()),
404
466
  __metadata("design:type", Function),
@@ -406,6 +468,10 @@ __decorate([
406
468
  __metadata("design:returntype", Promise)
407
469
  ], NestLensApiController.prototype, "getPruningStatus", null);
408
470
  __decorate([
471
+ (0, tools_1.NestLensTool)({
472
+ description: 'Run pruning now, by the same rules as the timer. Deletes entries older than the retention window and leaves monitored tags alone.',
473
+ destructive: true,
474
+ }),
409
475
  (0, common_1.Post)('pruning/run'),
410
476
  __param(0, (0, common_1.Res)()),
411
477
  __metadata("design:type", Function),
@@ -413,6 +479,10 @@ __decorate([
413
479
  __metadata("design:returntype", Promise)
414
480
  ], NestLensApiController.prototype, "runPruning", null);
415
481
  __decorate([
482
+ (0, tools_1.NestLensTool)({
483
+ description: 'Delete recorded entries: all of them, or all of one `type`. Age and monitored tags are ignored. Cannot be undone.',
484
+ destructive: true,
485
+ }),
416
486
  (0, common_1.Delete)('entries'),
417
487
  __param(0, (0, common_1.Query)()),
418
488
  __param(1, (0, common_1.Res)()),
@@ -421,6 +491,9 @@ __decorate([
421
491
  __metadata("design:returntype", Promise)
422
492
  ], NestLensApiController.prototype, "clearEntries", null);
423
493
  __decorate([
494
+ (0, tools_1.NestLensTool)({
495
+ description: 'Mark an exception entry as resolved, so it drops out of the unresolved count.',
496
+ }),
424
497
  (0, common_1.Patch)('entries/:id/resolve'),
425
498
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
426
499
  __param(1, (0, common_1.Res)()),
@@ -429,6 +502,9 @@ __decorate([
429
502
  __metadata("design:returntype", Promise)
430
503
  ], NestLensApiController.prototype, "resolveEntry", null);
431
504
  __decorate([
505
+ (0, tools_1.NestLensTool)({
506
+ description: 'Mark an exception entry as unresolved again.',
507
+ }),
432
508
  (0, common_1.Patch)('entries/:id/unresolve'),
433
509
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
434
510
  __param(1, (0, common_1.Res)()),
@@ -437,6 +513,10 @@ __decorate([
437
513
  __metadata("design:returntype", Promise)
438
514
  ], NestLensApiController.prototype, "unresolveEntry", null);
439
515
  __decorate([
516
+ (0, tools_1.NestLensTool)({
517
+ description: 'Stop recording new entries until resume_recording is called. Anything that happens while paused is not captured. Optional `reason` is kept and reported by get_recording_status.',
518
+ destructive: true,
519
+ }),
440
520
  (0, common_1.Post)('recording/pause'),
441
521
  __param(0, (0, common_1.Body)()),
442
522
  __param(1, (0, common_1.Res)()),
@@ -445,6 +525,9 @@ __decorate([
445
525
  __metadata("design:returntype", Promise)
446
526
  ], NestLensApiController.prototype, "pauseRecording", null);
447
527
  __decorate([
528
+ (0, tools_1.NestLensTool)({
529
+ description: 'Start recording again after pause_recording.',
530
+ }),
448
531
  (0, common_1.Post)('recording/resume'),
449
532
  __param(0, (0, common_1.Res)()),
450
533
  __metadata("design:type", Function),
@@ -452,13 +535,16 @@ __decorate([
452
535
  __metadata("design:returntype", Promise)
453
536
  ], NestLensApiController.prototype, "resumeRecording", null);
454
537
  __decorate([
538
+ (0, tools_1.NestLensTool)({
539
+ description: 'Whether recording is on, when and why it was paused, and how many entries sampling and the filter have dropped. Check this when the list is empty and you need to know whether nothing happened or nothing was recorded.',
540
+ }),
455
541
  (0, common_1.Get)('recording/status'),
456
542
  __param(0, (0, common_1.Res)()),
457
543
  __metadata("design:type", Function),
458
544
  __metadata("design:paramtypes", [Object]),
459
545
  __metadata("design:returntype", Promise)
460
546
  ], NestLensApiController.prototype, "getRecordingStatus", null);
461
- exports.NestLensApiController = NestLensApiController = __decorate([
547
+ exports.NestLensApiController = NestLensApiController = NestLensApiController_1 = __decorate([
462
548
  (0, common_1.Controller)(`${nestlens_config_1.NESTLENS_API_PREFIX}/api`),
463
549
  (0, common_1.UseGuards)(api_guard_1.NestLensGuard),
464
550
  (0, common_1.UseFilters)(filters_1.NestLensApiExceptionFilter),
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ClearEntriesQueryDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
13
  const entry_types_1 = require("./entry-types");
14
+ const transformers_1 = require("./transformers");
15
15
  /**
16
16
  * Query of `DELETE entries`.
17
17
  *
@@ -24,8 +24,8 @@ class ClearEntriesQueryDto {
24
24
  }
25
25
  exports.ClearEntriesQueryDto = ClearEntriesQueryDto;
26
26
  __decorate([
27
- (0, class_validator_1.IsOptional)(),
28
- (0, class_validator_1.IsIn)(entry_types_1.ENTRY_TYPES, {
27
+ (0, transformers_1.IsOptionalScope)(),
28
+ (0, transformers_1.IsInUnlessBlank)(entry_types_1.ENTRY_TYPES, {
29
29
  message: `type must be one of: ${entry_types_1.ENTRY_TYPES.join(', ')}`,
30
30
  }),
31
31
  __metadata("design:type", String)
@@ -7,6 +7,10 @@ export declare class CursorQueryDto {
7
7
  type?: EntryType;
8
8
  limit?: number;
9
9
  beforeSequence?: number;
10
+ /**
11
+ * One direction or the other. Given both, memory storage returned the range
12
+ * between them while SQLite and Redis read below `beforeSequence` alone.
13
+ */
10
14
  afterSequence?: number;
11
15
  /**
12
16
  * The instants an entry has to fall between.