nestlens 0.14.0 → 0.14.2

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 (65) hide show
  1. package/dist/api/dashboard-server.js +60 -6
  2. package/dist/dashboard/public/assets/{BatchDetailView-BGIncdDY.js → BatchDetailView-DQf7rhdt.js} +1 -1
  3. package/dist/dashboard/public/assets/{BatchesPage-ugxH2v0z.js → BatchesPage-W8k8XEu3.js} +1 -1
  4. package/dist/dashboard/public/assets/{CacheDetailView-DszaZXmk.js → CacheDetailView-D1W5C-eK.js} +1 -1
  5. package/dist/dashboard/public/assets/{CachePage-tk4-Mzj-.js → CachePage-CwEDXyxJ.js} +1 -1
  6. package/dist/dashboard/public/assets/{CommandDetailView-oe6WXq6m.js → CommandDetailView-DKQLM96e.js} +1 -1
  7. package/dist/dashboard/public/assets/{CommandsPage-BT5pa5B8.js → CommandsPage-B4XMyz_K.js} +1 -1
  8. package/dist/dashboard/public/assets/{CopyButton-djrkphpR.js → CopyButton-DfPqcshv.js} +1 -1
  9. package/dist/dashboard/public/assets/{DashboardPage-D0ukXtDo.js → DashboardPage-Ce497zS8.js} +1 -1
  10. package/dist/dashboard/public/assets/{DataTable-CDqXyed8.js → DataTable-Cz2phOFe.js} +1 -1
  11. package/dist/dashboard/public/assets/{DetailRow-CWJp1tTe.js → DetailRow-DKG3Vf9j.js} +1 -1
  12. package/dist/dashboard/public/assets/{DumpDetailView-BMkCXdx-.js → DumpDetailView-BU9RRxWv.js} +1 -1
  13. package/dist/dashboard/public/assets/{DumpsPage-C0_N90Tx.js → DumpsPage-ldSDznQa.js} +1 -1
  14. package/dist/dashboard/public/assets/{EntryDetailPage-Dw2pcYO2.js → EntryDetailPage-BdBZLbAf.js} +3 -3
  15. package/dist/dashboard/public/assets/{EntrySearchInput-BGWM929F.js → EntrySearchInput-BF9N_f7y.js} +1 -1
  16. package/dist/dashboard/public/assets/{EventDetailView-CqLCbVkJ.js → EventDetailView-CmV2uByp.js} +1 -1
  17. package/dist/dashboard/public/assets/{EventsPage-CRGB2aCi.js → EventsPage-TlQQA-mn.js} +1 -1
  18. package/dist/dashboard/public/assets/{ExceptionDetailView-Dq8Di5sK.js → ExceptionDetailView-B5aRNZz5.js} +1 -1
  19. package/dist/dashboard/public/assets/{ExceptionsPage-CA8ilfoK.js → ExceptionsPage-DqiQXiJK.js} +1 -1
  20. package/dist/dashboard/public/assets/{GateDetailView-DYDLxDRn.js → GateDetailView-BPd0sJpT.js} +1 -1
  21. package/dist/dashboard/public/assets/{GatesPage-Do-qOR5X.js → GatesPage-D4s1Ogo-.js} +1 -1
  22. package/dist/dashboard/public/assets/{GraphQLDetailView-BFwIn1GM.js → GraphQLDetailView-Dd_pgjdZ.js} +1 -1
  23. package/dist/dashboard/public/assets/{GraphQLPage-CNWITXJX.js → GraphQLPage-AOD9WXa5.js} +1 -1
  24. package/dist/dashboard/public/assets/{HttpClientDetailView-BgYy7Ucb.js → HttpClientDetailView-CR7RujPI.js} +1 -1
  25. package/dist/dashboard/public/assets/{HttpClientPage-BJd_ibF6.js → HttpClientPage-CUNDLZdF.js} +1 -1
  26. package/dist/dashboard/public/assets/{JobDetailView-B3psHOxq.js → JobDetailView-C3U9nJFo.js} +1 -1
  27. package/dist/dashboard/public/assets/{JobsPage-DAdrYeU-.js → JobsPage-DX0A5Til.js} +1 -1
  28. package/dist/dashboard/public/assets/{LogDetailView-BealPvcV.js → LogDetailView-V_x94h-I.js} +1 -1
  29. package/dist/dashboard/public/assets/{LogsPage-CCwjLuWQ.js → LogsPage-Cvrcv7tq.js} +1 -1
  30. package/dist/dashboard/public/assets/{MailDetailView-CM54VOlh.js → MailDetailView-CYCQI9Z8.js} +1 -1
  31. package/dist/dashboard/public/assets/{MailPage-CdiZI_hh.js → MailPage-BZbVLHHN.js} +1 -1
  32. package/dist/dashboard/public/assets/{ModelDetailView-B8KVVw2M.js → ModelDetailView-CUEA5nRD.js} +1 -1
  33. package/dist/dashboard/public/assets/{ModelsPage-0-jYL1-U.js → ModelsPage-CKUeCZLn.js} +1 -1
  34. package/dist/dashboard/public/assets/{NotificationDetailView-0VYorYuc.js → NotificationDetailView-CT4EIDa3.js} +1 -1
  35. package/dist/dashboard/public/assets/{NotificationsPage-szMmustZ.js → NotificationsPage-CVnjoHST.js} +1 -1
  36. package/dist/dashboard/public/assets/{PageHeader-9OQepDeQ.js → PageHeader-DR_M5h7z.js} +1 -1
  37. package/dist/dashboard/public/assets/{QueriesPage-BJfywln6.js → QueriesPage-DR3EHxfO.js} +1 -1
  38. package/dist/dashboard/public/assets/{QueryDetailView-BRe55CUs.js → QueryDetailView-dWmmR_nP.js} +1 -1
  39. package/dist/dashboard/public/assets/{RedisDetailView-BZ8zYVsk.js → RedisDetailView-PALK5x6N.js} +1 -1
  40. package/dist/dashboard/public/assets/{RedisPage-CHxk1zKp.js → RedisPage-D-9y0o0o.js} +1 -1
  41. package/dist/dashboard/public/assets/{RequestDetailView-BT568MaZ.js → RequestDetailView-DiS1WZ4m.js} +1 -1
  42. package/dist/dashboard/public/assets/{RequestsPage-BPeHtBRn.js → RequestsPage-CCSIr_jW.js} +1 -1
  43. package/dist/dashboard/public/assets/{ScheduleDetailView-OG--Lyzr.js → ScheduleDetailView-G86hV8Ed.js} +1 -1
  44. package/dist/dashboard/public/assets/{SchedulePage-uM09HkqS.js → SchedulePage-CQVmVvYe.js} +1 -1
  45. package/dist/dashboard/public/assets/{UserCard-CfcScmF8.js → UserCard-Bp6Bf3OI.js} +1 -1
  46. package/dist/dashboard/public/assets/{ViewDetailView-CcWB9bLw.js → ViewDetailView-D-dBm6G6.js} +1 -1
  47. package/dist/dashboard/public/assets/{ViewsPage-L56Rz7jz.js → ViewsPage-ErK5Vmy0.js} +1 -1
  48. package/dist/dashboard/public/assets/{calendar-B4UUBe_A.js → calendar-BfDDUQSW.js} +1 -1
  49. package/dist/dashboard/public/assets/{circle-alert-s9ODnOC3.js → circle-alert-DJ_9D_4c.js} +1 -1
  50. package/dist/dashboard/public/assets/{circle-check-big-C4ws6-wY.js → circle-check-big-CiGeQW9J.js} +1 -1
  51. package/dist/dashboard/public/assets/{circle-x-D14U2UWr.js → circle-x-B-V5s-zK.js} +1 -1
  52. package/dist/dashboard/public/assets/{eye-CIA_cZlW.js → eye-LljylR_O.js} +1 -1
  53. package/dist/dashboard/public/assets/{index-dkeMTrq0.js → index-HxcGVcSo.js} +2 -2
  54. package/dist/dashboard/public/assets/{search-C0XvQMrJ.js → search-VPXcw9Ki.js} +1 -1
  55. package/dist/dashboard/public/assets/{send-CTeWfM1I.js → send-CdCk9jQ5.js} +1 -1
  56. package/dist/dashboard/public/assets/{timer-BVP3d7zc.js → timer-I7o5QV6X.js} +1 -1
  57. package/dist/dashboard/public/assets/{types-CuCQ6L2Z.js → types-BMBEhoQ2.js} +1 -1
  58. package/dist/dashboard/public/assets/{users-UyMivszP.js → users-CFzKwpf2.js} +1 -1
  59. package/dist/dashboard/public/assets/{zap-CAbVWiHg.js → zap-DMB3w7zm.js} +1 -1
  60. package/dist/dashboard/public/index.html +1 -1
  61. package/dist/watchers/graphql/adapters/apollo.adapter.js +19 -1
  62. package/dist/watchers/graphql/graphql.watcher.d.ts +7 -0
  63. package/dist/watchers/graphql/graphql.watcher.js +34 -0
  64. package/dist/watchers/http-client.watcher.js +14 -1
  65. package/package.json +7 -1
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-dkeMTrq0.js";/**
1
+ import{c as e}from"./index-HxcGVcSo.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-dkeMTrq0.js";/**
1
+ import{c as a}from"./index-HxcGVcSo.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="./nestlens-icon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>NestLens - Debug Dashboard</title>
8
- <script type="module" crossorigin src="./assets/index-dkeMTrq0.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-HxcGVcSo.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/vendor-DBTT3jXp.js">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-ReuerEhs.css">
11
11
  </head>
@@ -207,7 +207,25 @@ class ApolloAdapter extends base_adapter_1.BaseGraphQLAdapter {
207
207
  ? adapter.nsToMs(endTime - executionStartTime)
208
208
  : undefined;
209
209
  // Get response errors
210
+ // What the client was sent: formatted, and the right thing to put on the
211
+ // entry — a reader wants to see what the caller saw.
210
212
  const responseErrors = ctx.response.body?.singleResult?.errors ?? errors;
213
+ /**
214
+ * What was actually thrown, which is a different list.
215
+ *
216
+ * Apollo formats its errors before `willSendResponse`: measured on a real
217
+ * server, the errors here are plain objects carrying
218
+ * `message, locations, path, extensions` and no `originalError`.
219
+ * `didEncounterErrors` is handed the `GraphQLError`s themselves, which is
220
+ * the only place a resolver's own exception — its name, its stack — can
221
+ * be seen.
222
+ *
223
+ * Recording read the formatted list and found nothing thrown, so a
224
+ * failed operation produced no exception entry at all on a real Apollo
225
+ * server. Every test that said otherwise had fed the hook errors it had
226
+ * built itself, with `originalError` attached.
227
+ */
228
+ const thrownErrors = errors.length > 0 ? errors : responseErrors;
211
229
  // Calculate depth. Nothing to walk when the text never arrived, which
212
230
  // is an APQ hash the server could not resolve.
213
231
  const depthResult = query ? (0, depth_calculator_1.calculateDepth)(query) : { maxDepth: 0 };
@@ -292,7 +310,7 @@ class ApolloAdapter extends base_adapter_1.BaseGraphQLAdapter {
292
310
  await adapter.collectEntry(payload, requestId);
293
311
  // And what it threw, if anything: a failed operation is an exception the
294
312
  // application had, and everything that reads exceptions was blind to it.
295
- await adapter.recordErrors(responseErrors, {
313
+ await adapter.recordErrors(thrownErrors, {
296
314
  name: operationName,
297
315
  type: operationType,
298
316
  requestId,
@@ -105,6 +105,13 @@ export declare class GraphQLWatcher implements OnModuleInit, OnApplicationBootst
105
105
  * Detect which GraphQL server is installed
106
106
  */
107
107
  detectServer(): DetectedServer;
108
+ /**
109
+ * Which HTTP platform the application is running on, where that is knowable.
110
+ *
111
+ * Read through the module reference rather than injected, so a watcher built
112
+ * in a test without an HTTP adapter still starts.
113
+ */
114
+ private platform;
108
115
  /**
109
116
  * Create the appropriate adapter
110
117
  */
@@ -195,6 +195,26 @@ let GraphQLWatcher = GraphQLWatcher_1 = class GraphQLWatcher {
195
195
  * Detect which GraphQL server is installed
196
196
  */
197
197
  detectServer() {
198
+ // Mercurius runs on Fastify and nowhere else, so an application on Fastify
199
+ // with Mercurius installed is running Mercurius — and one on Express
200
+ // cannot be, whatever it has in `node_modules`.
201
+ //
202
+ // This used to be the package list alone, first match wins, with Apollo
203
+ // first. An application carrying both — a monorepo, a dependency left
204
+ // behind, `@nestjs/apollo` beside a Fastify app — got the Apollo adapter,
205
+ // whose hooks were then installed on a server nobody was using: not one
206
+ // operation recorded, and nothing said why. This repository put itself in
207
+ // exactly that state the moment `@apollo/server` was added for testing.
208
+ //
209
+ // The driver the application registered would be a better answer still,
210
+ // and it cannot be had: `moduleRef.get(MercuriusDriver)` does not resolve —
211
+ // measured — because `GraphQLModule` does not provide it under that token.
212
+ // An application that really is running Apollo on Fastify with Mercurius
213
+ // installed can say `server: 'apollo'`.
214
+ if ((0, base_adapter_1.isPackageAvailable)('mercurius') && this.platform() === 'fastify') {
215
+ this.logger.debug('Detected Mercurius, on Fastify');
216
+ return 'mercurius';
217
+ }
198
218
  // Check for Apollo Server
199
219
  if ((0, base_adapter_1.isPackageAvailable)('@apollo/server')) {
200
220
  this.logger.debug('Detected Apollo Server');
@@ -208,6 +228,20 @@ let GraphQLWatcher = GraphQLWatcher_1 = class GraphQLWatcher {
208
228
  // No GraphQL server found
209
229
  return 'none';
210
230
  }
231
+ /**
232
+ * Which HTTP platform the application is running on, where that is knowable.
233
+ *
234
+ * Read through the module reference rather than injected, so a watcher built
235
+ * in a test without an HTTP adapter still starts.
236
+ */
237
+ platform() {
238
+ try {
239
+ return this.moduleRef.get(core_1.HttpAdapterHost, { strict: false })?.httpAdapter?.getType?.();
240
+ }
241
+ catch {
242
+ return undefined;
243
+ }
244
+ }
211
245
  /**
212
246
  * Create the appropriate adapter
213
247
  */
@@ -20,8 +20,21 @@ const data_masker_service_1 = require("../core/data-masker.service");
20
20
  const nestlens_config_1 = require("../nestlens.config");
21
21
  const watcher_config_1 = require("./watcher-config");
22
22
  const capture_payload_1 = require("./capture-payload");
23
+ /**
24
+ * An axios instance is callable, so `typeof` reports `'function'`.
25
+ *
26
+ * This checked for `'object'` alone, which no axios instance has ever
27
+ * satisfied: `axios.create()` returns a wrapped function with the interceptor
28
+ * managers hung off it, and `HttpService.axiosRef` hands back that same
29
+ * function. So every client this watcher was ever given — the documented
30
+ * `NESTLENS_HTTP_CLIENT` token included — was answered with
31
+ * `Invalid axios instance provided` and nothing was recorded. Measured against
32
+ * `@nestjs/axios` 4: `typeof axiosRef` is `'function'`.
33
+ *
34
+ * The rest of the check is what actually identifies one, and it is unchanged.
35
+ */
23
36
  function hasInterceptors(value) {
24
- if (!value || typeof value !== 'object')
37
+ if (!value || (typeof value !== 'object' && typeof value !== 'function'))
25
38
  return false;
26
39
  const { interceptors } = value;
27
40
  if (!interceptors || typeof interceptors !== 'object')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestlens",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "Laravel Telescope-like debugging and monitoring tool for NestJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -149,6 +149,10 @@
149
149
  "better-sqlite3": "^11.6.0"
150
150
  },
151
151
  "devDependencies": {
152
+ "@apollo/server": "^5.5.1",
153
+ "@nestjs/apollo": "^13.4.5",
154
+ "@nestjs/axios": "^4.0.1",
155
+ "@nestjs/cache-manager": "^3.1.3",
152
156
  "@nestjs/common": "^11.0.0",
153
157
  "@nestjs/core": "^11.0.0",
154
158
  "@nestjs/graphql": "^13.4.5",
@@ -171,7 +175,9 @@
171
175
  "@types/uuid": "^10.0.0",
172
176
  "@typescript-eslint/eslint-plugin": "^8.18.0",
173
177
  "@typescript-eslint/parser": "^8.18.0",
178
+ "axios": "^1.19.0",
174
179
  "better-sqlite3": "^12.11.1",
180
+ "cache-manager": "^7.2.9",
175
181
  "cron": "^4.4.0",
176
182
  "eslint": "^9.16.0",
177
183
  "eslint-config-prettier": "^10.1.8",