@nestjs/observe 0.3.17 → 0.3.18

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/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024
4
- Kamil Mysliwiec <https://kamilmysliwiec.com>
3
+ Copyright (c) 2017-present Kamil Mysliwiec <https://kamilmysliwiec.com>
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining
7
6
  a copy of this software and associated documentation files (the
@@ -0,0 +1,46 @@
1
+ /** The file coding agents read for a repository's working notes. */
2
+ export declare const AGENTS_FILE = "AGENTS.md";
3
+ /**
4
+ * Claude Code's own file. Claude Code reads AGENTS.md only where no CLAUDE.md
5
+ * exists, so a project that has one gets the notes there too - unless it
6
+ * already pulls AGENTS.md in (`@AGENTS.md`), which says the same thing once.
7
+ */
8
+ export declare const CLAUDE_FILE = "CLAUDE.md";
9
+ /**
10
+ * The section's heading, and how a second `link` recognises a first: the
11
+ * notes are added once, and anyone who rewrites them afterwards keeps their
12
+ * version.
13
+ */
14
+ export declare const AGENT_NOTES_HEADING = "## Production data: NestJS Observe";
15
+ /**
16
+ * What a coding agent working in this repository should know about the app's
17
+ * production data, and where it is. Facts and links, not instructions to sell
18
+ * anything: an agent passes on a requirement it can name - "that needs the
19
+ * MCP server, which is on Pro" - and discounts what reads like a pitch.
20
+ *
21
+ * The same section `nest new` writes into a new project's AGENTS.md (the
22
+ * application schematic) when the project is created with Observe. Created
23
+ * without it, the project gets the section anyway, opening with how to link
24
+ * the app instead - worded to stay true once it is linked, because a section
25
+ * under this heading is never rewritten here.
26
+ */
27
+ export declare function agentNotes(rootModule?: string): string;
28
+ /** One file the notes went into, and whether it is new. */
29
+ export interface AgentNotesChange {
30
+ file: typeof AGENTS_FILE | typeof CLAUDE_FILE;
31
+ created: boolean;
32
+ }
33
+ /**
34
+ * Where the notes would go, without writing anything.
35
+ *
36
+ * AGENTS.md always, created when missing; CLAUDE.md only when the project
37
+ * already has one that neither has the notes nor pulls AGENTS.md in. A file
38
+ * that has the heading is never touched again.
39
+ */
40
+ export declare function pendingAgentNotes(cwd: string): AgentNotesChange[];
41
+ /**
42
+ * Adds the notes where `pendingAgentNotes` says they belong: appended to a
43
+ * file the project already has, or a new AGENTS.md holding only them.
44
+ * Returns what changed - nothing, on a second run.
45
+ */
46
+ export declare function writeAgentNotes(cwd: string, rootModule?: string): AgentNotesChange[];
@@ -0,0 +1,93 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ /** The file coding agents read for a repository's working notes. */
4
+ export const AGENTS_FILE = "AGENTS.md";
5
+ /**
6
+ * Claude Code's own file. Claude Code reads AGENTS.md only where no CLAUDE.md
7
+ * exists, so a project that has one gets the notes there too - unless it
8
+ * already pulls AGENTS.md in (`@AGENTS.md`), which says the same thing once.
9
+ */
10
+ export const CLAUDE_FILE = "CLAUDE.md";
11
+ /**
12
+ * The section's heading, and how a second `link` recognises a first: the
13
+ * notes are added once, and anyone who rewrites them afterwards keeps their
14
+ * version.
15
+ */
16
+ export const AGENT_NOTES_HEADING = "## Production data: NestJS Observe";
17
+ /**
18
+ * What a coding agent working in this repository should know about the app's
19
+ * production data, and where it is. Facts and links, not instructions to sell
20
+ * anything: an agent passes on a requirement it can name - "that needs the
21
+ * MCP server, which is on Pro" - and discounts what reads like a pitch.
22
+ *
23
+ * The same section `nest new` writes into a new project's AGENTS.md (the
24
+ * application schematic) when the project is created with Observe. Created
25
+ * without it, the project gets the section anyway, opening with how to link
26
+ * the app instead - worded to stay true once it is linked, because a section
27
+ * under this heading is never rewritten here.
28
+ */
29
+ export function agentNotes(rootModule = "the root module") {
30
+ return [
31
+ AGENT_NOTES_HEADING,
32
+ "",
33
+ `This app reports its traces, errors, logs and metrics to [NestJS Observe](https://observe.nestjs.com) through \`ObserveModule\` in ${rootModule}. Its key pair comes from \`OBSERVE_APP_KEY\` and \`OBSERVE_APP_SECRET\` in \`.env\`, which \`npx @nestjs/observe link\` writes.`,
34
+ "",
35
+ "When a task depends on how the app behaves in production - an error users hit, a slow endpoint, a failing job, whether a release made things worse - work from that data, not from the code alone:",
36
+ "",
37
+ "- The Observe MCP server answers those questions directly: errors with their traces and logs, slow operations, jobs, and what a release changed (`find_regressions`, `diff_release`). It is included on the Pro plan and above. In Claude Code: `claude mcp add observe --transport http https://observe-api.nestjs.com/mcp`, and the client opens a browser to approve. Other clients: https://www.observe.nestjs.com/documentation/mcp",
38
+ "- Without it, the user can open the request or error in the Observe dashboard and click **Copy agent prompt**, which hands over that page's trace, stack and logs as text.",
39
+ "",
40
+ ].join("\n");
41
+ }
42
+ /**
43
+ * Where the notes would go, without writing anything.
44
+ *
45
+ * AGENTS.md always, created when missing; CLAUDE.md only when the project
46
+ * already has one that neither has the notes nor pulls AGENTS.md in. A file
47
+ * that has the heading is never touched again.
48
+ */
49
+ export function pendingAgentNotes(cwd) {
50
+ const read = (file) => {
51
+ const path = join(cwd, file);
52
+ return existsSync(path) ? readFileSync(path, "utf8") : undefined;
53
+ };
54
+ const changes = [];
55
+ const agents = read(AGENTS_FILE);
56
+ if (agents === undefined) {
57
+ changes.push({ file: AGENTS_FILE, created: true });
58
+ }
59
+ else if (!agents.includes(AGENT_NOTES_HEADING)) {
60
+ changes.push({ file: AGENTS_FILE, created: false });
61
+ }
62
+ const claude = read(CLAUDE_FILE);
63
+ if (claude !== undefined &&
64
+ !claude.includes(AGENT_NOTES_HEADING) &&
65
+ !claude.includes(`@${AGENTS_FILE}`)) {
66
+ changes.push({ file: CLAUDE_FILE, created: false });
67
+ }
68
+ return changes;
69
+ }
70
+ /**
71
+ * Adds the notes where `pendingAgentNotes` says they belong: appended to a
72
+ * file the project already has, or a new AGENTS.md holding only them.
73
+ * Returns what changed - nothing, on a second run.
74
+ */
75
+ export function writeAgentNotes(cwd, rootModule) {
76
+ const changes = pendingAgentNotes(cwd);
77
+ const notes = agentNotes(rootModule ? `\`${rootModule}\`` : undefined);
78
+ for (const change of changes) {
79
+ const path = join(cwd, change.file);
80
+ if (change.created) {
81
+ writeFileSync(path, `# ${change.file}\n\n${notes}`);
82
+ continue;
83
+ }
84
+ const existing = readFileSync(path, "utf8");
85
+ const separator = existing.endsWith("\n\n")
86
+ ? ""
87
+ : existing.endsWith("\n")
88
+ ? "\n"
89
+ : "\n\n";
90
+ writeFileSync(path, `${existing}${separator}${notes}`);
91
+ }
92
+ return changes;
93
+ }
package/dist/cli/link.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { writeAgentNotes } from "./agent-notes.js";
1
2
  import { addDependencyCommand, detectPackageManager, } from "./package-manager.js";
2
3
  import { addEnvFileToStartScripts, ensureEnvIgnored, readPackageName, writeEnvFile, } from "./project-files.js";
3
4
  import { findEntryFiles, inspectProject, QUICK_START_URL, SDK_PACKAGE, serviceIdFor, } from "./project-setup.js";
@@ -87,6 +88,7 @@ export async function link(options, deps) {
87
88
  deps.log(`✔ Installed ${spec}.`);
88
89
  }
89
90
  let wired = true;
91
+ let rootModule;
90
92
  if (setup.wire) {
91
93
  const result = wire(deps, options.cwd, serviceIdFor(credentials.applicationName, applicationName));
92
94
  if (result.kind === "wired") {
@@ -96,6 +98,7 @@ export async function link(options, deps) {
96
98
  deps.log(` ${file.path.padEnd(width)} ${file.change}`);
97
99
  }
98
100
  deps.log(" Review the changes with git diff.");
101
+ rootModule = result.files.find((file) => !/(^|\/)main\.ts$/.test(file.path))?.path;
99
102
  }
100
103
  else {
101
104
  wired = false;
@@ -103,6 +106,16 @@ export async function link(options, deps) {
103
106
  deps.log(` Add it by hand - three edits: ${QUICK_START_URL}`);
104
107
  }
105
108
  }
109
+ // Where a coding agent working on the project learns that its production
110
+ // data exists, and how to reach it. Quietly: the console is for the link
111
+ // itself, and the file shows up in the diff like the wiring does. Optional
112
+ // too - the link is done either way.
113
+ try {
114
+ writeAgentNotes(options.cwd, rootModule);
115
+ }
116
+ catch {
117
+ // A read-only checkout or an odd file: nothing the person has to act on.
118
+ }
106
119
  deps.log(` ${wired ? "Start the app" : "Once it is wired, start the app"} and it reports to NestJS Observe. In production, set OBSERVE_APP_KEY and OBSERVE_APP_SECRET in the environment instead.`);
107
120
  return 0;
108
121
  }
@@ -111,9 +111,9 @@ export declare class GraphQLObserveAgentService<Store extends Record<string, unk
111
111
  * through `onResolution`, which never fires for a document that failed
112
112
  * parsing or validation, so a start hook there can go unmatched. Nothing is
113
113
  * leaked when it does: the state lives in the hook's return value rather than
114
- * in this service, and the registry drops a trace whose spans never closed.
115
- * The one visible consequence is that a malformed document collects nothing
116
- * on Mercurius, which is what it collected before any of this existed.
114
+ * in this service, and the registry ships a trace without the spans that
115
+ * never closed. A malformed document on Mercurius is therefore reported with
116
+ * its status code and no spans under it.
117
117
  */
118
118
  onRequestEnd(ctx: GqlRequestEndContext): void;
119
119
  /**
@@ -203,9 +203,9 @@ let GraphQLObserveAgentService = GraphQLObserveAgentService_1 = class GraphQLObs
203
203
  * through `onResolution`, which never fires for a document that failed
204
204
  * parsing or validation, so a start hook there can go unmatched. Nothing is
205
205
  * leaked when it does: the state lives in the hook's return value rather than
206
- * in this service, and the registry drops a trace whose spans never closed.
207
- * The one visible consequence is that a malformed document collects nothing
208
- * on Mercurius, which is what it collected before any of this existed.
206
+ * in this service, and the registry ships a trace without the spans that
207
+ * never closed. A malformed document on Mercurius is therefore reported with
208
+ * its status code and no spans under it.
209
209
  */
210
210
  onRequestEnd(ctx) {
211
211
  const state = ctx.state;
@@ -1,2 +1,3 @@
1
1
  export * from "./tracer.service.js";
2
2
  export { SPAN_COLLAPSED_TAG } from "./collapse-repeated-spans.util.js";
3
+ export { UNFINISHED_SPANS_TAG } from "./operation-trace.registry.js";
@@ -1,2 +1,3 @@
1
1
  export * from "./tracer.service.js";
2
2
  export { SPAN_COLLAPSED_TAG } from "./collapse-repeated-spans.util.js";
3
+ export { UNFINISHED_SPANS_TAG } from "./operation-trace.registry.js";
@@ -10,6 +10,16 @@ import { LogRedactor } from "../utils/log-redactor.js";
10
10
  import { CALLER_METADATA_KEY } from "../observe.constants.js";
11
11
  import { SpanCollapseSettings } from "./collapse-repeated-spans.util.js";
12
12
  import { SkipSpansPredicate } from "./skip-spans.util.js";
13
+ /**
14
+ * Tag under which a snapshot records how many spans were left out of its tree
15
+ * because they had not ended when it was shipped - the spans still open and
16
+ * everything recorded under them.
17
+ *
18
+ * A tag for the same reason `SPAN_COLLAPSED_TAG` is one: `tags` is already on
19
+ * every snapshot and already declared by the collector's contract, so no
20
+ * collector release has to come first. Absent on a snapshot shipped whole.
21
+ */
22
+ export declare const UNFINISHED_SPANS_TAG = "observe.unfinishedSpans";
13
23
  type TraceId = string;
14
24
  export declare class OperationTraceRegistry {
15
25
  private readonly als;
@@ -196,11 +206,23 @@ export declare class OperationTraceRegistry {
196
206
  hasSnapshotsAwaitingCompletion(): boolean;
197
207
  pluckSnapshot(traceId: string): Promise<RequestSnapshot | JobSnapshot | undefined>;
198
208
  /**
199
- * One line per trace `pluckSnapshot` gives up on, naming the spans that kept
200
- * it open. Their late ends are silent: one un-awaited call usually holds a
209
+ * Takes every span that is still open out of the tree, together with
210
+ * everything recorded under it, and counts what went on the snapshot.
211
+ *
212
+ * An open node cannot be shipped: it has no duration yet, and a parent's
213
+ * self time is its duration minus its children's, so it would skew the
214
+ * numbers of the span that called it. What finished under it goes too, as
215
+ * there is no truthful place left to hang it. After cleanup nothing writes
216
+ * to the shipped tree again - a late end or start finds no snapshot and
217
+ * returns.
218
+ */
219
+ private leaveOutUnfinishedSpans;
220
+ /**
221
+ * One line per trace `pluckSnapshot` ships without its open spans, naming
222
+ * them. Their late ends are silent: one un-awaited call usually holds a
201
223
  * whole chain of spans open, and a line per span said the same thing N times.
202
224
  */
203
- private reportDroppedTrace;
225
+ private reportUnfinishedSpans;
204
226
  /**
205
227
  * Whether `skipSpans` claims a finished operation. Only request snapshots
206
228
  * are asked: a job has no status to be judged by.
@@ -8,6 +8,16 @@ import { LogRedactor } from "../utils/log-redactor.js";
8
8
  import { CALLER_METADATA_KEY } from "../observe.constants.js";
9
9
  import { collapseRepeatedSpans, DEFAULT_SPAN_COLLAPSE, } from "./collapse-repeated-spans.util.js";
10
10
  const SNAPSHOT_COMPLETION_TIMEOUT_MS = 1000;
11
+ /**
12
+ * Tag under which a snapshot records how many spans were left out of its tree
13
+ * because they had not ended when it was shipped - the spans still open and
14
+ * everything recorded under them.
15
+ *
16
+ * A tag for the same reason `SPAN_COLLAPSED_TAG` is one: `tags` is already on
17
+ * every snapshot and already declared by the collector's contract, so no
18
+ * collector release has to come first. Absent on a snapshot shipped whole.
19
+ */
20
+ export const UNFINISHED_SPANS_TAG = "observe.unfinishedSpans";
11
21
  /**
12
22
  * An error the business logic did not model. `IntrinsicException` is what Nest
13
23
  * itself uses to tell a deliberately raised failure from a leaked one.
@@ -18,6 +28,14 @@ const UNHANDLED_ERROR_STATUS_CODE = 500;
18
28
  * count as handled; the exact code only matters when the exception carries one.
19
29
  */
20
30
  const HANDLED_ERROR_STATUS_CODE = 400;
31
+ /** A node and everything below it. */
32
+ function countNodes(node) {
33
+ let count = 1;
34
+ for (const child of node.children ?? []) {
35
+ count += countNodes(child);
36
+ }
37
+ return count;
38
+ }
21
39
  export class OperationTraceRegistry {
22
40
  als;
23
41
  sourceContext;
@@ -370,9 +388,10 @@ export class OperationTraceRegistry {
370
388
  callerId, error) {
371
389
  const snapshot = this.traceSnapshots.get(traceId);
372
390
  if (!snapshot) {
373
- // The trace was dropped while this span was still open - `pluckSnapshot`
374
- // gave up on it (and said so, once for the whole trace), or the client
375
- // aborted. Nothing is left to record it in.
391
+ // The trace was handed off while this span was still open -
392
+ // `pluckSnapshot` shipped it without the span (and said so, once for the
393
+ // whole trace) - or dropped because the client aborted. Nothing is left
394
+ // to record it in.
376
395
  return;
377
396
  }
378
397
  snapshot.refsMarkedAsComplete += 1;
@@ -563,9 +582,12 @@ export class OperationTraceRegistry {
563
582
  this.awaitingCompletion -= 1;
564
583
  }
565
584
  if (snapshot.refsCounter > snapshot.refsMarkedAsComplete) {
566
- this.reportDroppedTrace(traceId, snapshot);
567
- cleanup();
568
- return undefined;
585
+ // Shipped without the spans still open rather than not at all: the
586
+ // operation itself finished, and dropping it lost its status and
587
+ // error along with every span that did end. Read before cleanup,
588
+ // which takes the span map the warning names them from.
589
+ this.reportUnfinishedSpans(traceId, snapshot);
590
+ this.leaveOutUnfinishedSpans(snapshot);
569
591
  }
570
592
  }
571
593
  cleanup();
@@ -601,11 +623,45 @@ export class OperationTraceRegistry {
601
623
  return undefined;
602
624
  }
603
625
  /**
604
- * One line per trace `pluckSnapshot` gives up on, naming the spans that kept
605
- * it open. Their late ends are silent: one un-awaited call usually holds a
626
+ * Takes every span that is still open out of the tree, together with
627
+ * everything recorded under it, and counts what went on the snapshot.
628
+ *
629
+ * An open node cannot be shipped: it has no duration yet, and a parent's
630
+ * self time is its duration minus its children's, so it would skew the
631
+ * numbers of the span that called it. What finished under it goes too, as
632
+ * there is no truthful place left to hang it. After cleanup nothing writes
633
+ * to the shipped tree again - a late end or start finds no snapshot and
634
+ * returns.
635
+ */
636
+ leaveOutUnfinishedSpans(snapshot) {
637
+ let leftOut = 0;
638
+ const keepFinished = (nodes) => nodes.filter((node) => {
639
+ if ("type" in node && node.type === "start") {
640
+ leftOut += countNodes(node);
641
+ return false;
642
+ }
643
+ if (node.children && node.children.length > 0) {
644
+ node.children = keepFinished(node.children);
645
+ if (node.children.length === 0) {
646
+ // Same shape a leaf has when the registry completes it.
647
+ delete node.children;
648
+ }
649
+ }
650
+ return true;
651
+ });
652
+ snapshot.traces = keepFinished(snapshot.traces);
653
+ if (leftOut > 0) {
654
+ // A copy: the object `startTrace` was given is the transport's `tags`
655
+ // option, shared by every operation it reports.
656
+ snapshot.tags = { ...snapshot.tags, [UNFINISHED_SPANS_TAG]: leftOut };
657
+ }
658
+ }
659
+ /**
660
+ * One line per trace `pluckSnapshot` ships without its open spans, naming
661
+ * them. Their late ends are silent: one un-awaited call usually holds a
606
662
  * whole chain of spans open, and a line per span said the same thing N times.
607
663
  */
608
- reportDroppedTrace(traceId, snapshot) {
664
+ reportUnfinishedSpans(traceId, snapshot) {
609
665
  const open = [];
610
666
  for (const node of this.callerIdsByTraceId.get(traceId)?.values() ?? []) {
611
667
  if (node.type === "start") {
@@ -615,7 +671,7 @@ export class OperationTraceRegistry {
615
671
  const operation = ("operationId" in snapshot && snapshot.operationId) ||
616
672
  ("name" in snapshot && snapshot.name) ||
617
673
  traceId;
618
- this.logger.warn(`Trace "${traceId}" (${operation}) was not reported: ${open.join(", ") || "a span"} had not ended ${SNAPSHOT_COMPLETION_TIMEOUT_MS}ms after the operation did. Some of your async operations were not awaited and outlived the operation that started them. Ignore if this is the desired behavior.`);
674
+ this.logger.warn(`Trace "${traceId}" (${operation}) was reported without ${open.join(", ") || "a span"}, which had not ended ${SNAPSHOT_COMPLETION_TIMEOUT_MS}ms after the operation did. Some of your async operations were not awaited and outlived the operation that started them. Ignore if this is the desired behavior.`);
619
675
  }
620
676
  /**
621
677
  * Whether `skipSpans` claims a finished operation. Only request snapshots
@@ -4,10 +4,9 @@ import { Gauge, GaugeKind, Summary } from "../custom-metrics/index.js";
4
4
  import { Counter } from "../custom-metrics/counter.js";
5
5
  import { ObserveModuleOptionsWithDefaults } from "../interfaces/index.js";
6
6
  import { TraceSpanDelegate } from "../trace-span.delegate.js";
7
- import { KeyOf } from "../types/key-of.type.js";
8
7
  import { Path, PathValue } from "../types/path-value.type.js";
9
8
  import { OperationTraceRegistry } from "./operation-trace.registry.js";
10
- export declare class TracerService<Store extends Record<string | symbol, unknown> = Record<string | symbol, unknown>, TraceKey extends string = "traceId"> {
9
+ export declare class TracerService<Store extends object = Record<string | symbol, unknown>, TraceKey extends string = "traceId"> {
11
10
  private readonly operationTraceRegistry;
12
11
  private readonly als;
13
12
  private readonly observeAgentSharedBuffer;
@@ -17,7 +16,7 @@ export declare class TracerService<Store extends Record<string | symbol, unknown
17
16
  private readonly summaries;
18
17
  private readonly logger;
19
18
  private hasReportedUnusableOperationId;
20
- constructor(operationTraceRegistry: OperationTraceRegistry, als: AsyncLocalStorage<Map<KeyOf<Store> | TraceKey, any>>, observeAgentSharedBuffer: ObserveAgentSharedBuffer, options: ObserveModuleOptionsWithDefaults);
19
+ constructor(operationTraceRegistry: OperationTraceRegistry, als: AsyncLocalStorage<Map<string | symbol | TraceKey, any>>, observeAgentSharedBuffer: ObserveAgentSharedBuffer, options: ObserveModuleOptionsWithDefaults);
21
20
  /**
22
21
  * Creates a new trace span with the given name and executes the provided callback within that span.
23
22
  * The callback can be synchronous or asynchronous.
@@ -104,8 +104,7 @@ let TracerService = TracerService_1 = class TracerService {
104
104
  if (!store) {
105
105
  throw new Error('AsyncLocalStorage is not initialized. Ensure that you are using the "captureError" method within an async context.');
106
106
  }
107
- const traceId = store.get(TRACE_REGISTRY_KEY) ??
108
- store.get(this.options.traceIdKey);
107
+ const traceId = store.get(TRACE_REGISTRY_KEY) ?? store.get(this.options.traceIdKey);
109
108
  if (typeof traceId !== "string") {
110
109
  // Reporting an error must not raise one. The registry warned and gave up
111
110
  // in this case anyway, so the outcome is unchanged.
@@ -274,8 +273,7 @@ let TracerService = TracerService_1 = class TracerService {
274
273
  * methods with no async context at all - and is reported the same way.
275
274
  */
276
275
  requireTraceId(store, method) {
277
- const traceId = store.get(TRACE_REGISTRY_KEY) ??
278
- store.get(this.options.traceIdKey);
276
+ const traceId = store.get(TRACE_REGISTRY_KEY) ?? store.get(this.options.traceIdKey);
279
277
  if (typeof traceId !== "string") {
280
278
  throw new Error(`No trace id found in the current context. Ensure that you are using the "${method}" method within a traced operation.`);
281
279
  }
@@ -5,6 +5,6 @@
5
5
  type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
6
6
  export type PathImpl<T, Key extends keyof T> = Key extends string ? IsAny<T[Key]> extends true ? never : T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
7
7
  export type PathImpl2<T> = PathImpl<T, keyof T> | keyof T;
8
- export type Path<T> = keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
9
- export type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
8
+ export type Path<T> = string extends keyof T ? string : keyof T extends string ? PathImpl2<T> extends infer P ? P extends string | keyof T ? P : keyof T : keyof T : never;
9
+ export type PathValue<T, P extends Path<T>> = string extends keyof T ? T[P & keyof T] : P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
10
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/observe",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Observability and APM agent for NestJS - traces, runtime metrics and custom metrics",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://observe.nestjs.com",
@@ -121,8 +121,8 @@
121
121
  "devDependencies": {
122
122
  "@apollo/server": "5.5.1",
123
123
  "@as-integrations/express5": "1.1.2",
124
- "@commitlint/cli": "21.2.3",
125
- "@commitlint/config-angular": "21.2.3",
124
+ "@commitlint/cli": "21.2.4",
125
+ "@commitlint/config-angular": "21.2.4",
126
126
  "@grpc/grpc-js": "1.14.6",
127
127
  "@grpc/proto-loader": "0.8.1",
128
128
  "@mikro-orm/core": "7.2.0",
@@ -159,7 +159,7 @@
159
159
  "lint-staged": "17.6.0",
160
160
  "mongodb": "7.6.0",
161
161
  "mongoose": "9.10.1",
162
- "mssql": "12.7.9",
162
+ "mssql": "12.7.11",
163
163
  "mysql2": "3.24.6",
164
164
  "nestjs-cls": "6.2.1",
165
165
  "oxlint": "1.79.0",