@dudousxd/nestjs-diagnostics 0.7.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @dudousxd/nestjs-diagnostics
2
2
 
3
+ ## 0.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`db48c6e`](https://github.com/DavideCarvalho/nestjs-diagnostics/commit/db48c6e5484bbccbb8ed34a633816ad1ed252c47) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Document the capability token trio in English, and correct two claims
8
+
9
+ Comment-only change to `capability.ts`, `inject-capability.ts` and
10
+ `conformance.ts`, the only three source files whose doc comments were written in
11
+ Portuguese. Two statements were also wrong and are fixed: `capability()` is not
12
+ the single source of the `@dudousxd/nestjs-<lib>:<name>` naming (`CONTEXT_ACCESSOR`
13
+ spells the same token by hand, as `capability.spec.ts` pins), and
14
+ `assertCapabilityNaming` checks the token's name, not that `capability()` minted
15
+ it. `InjectCapability`'s dangling pointer to an out-of-repo plan is replaced with
16
+ the in-repo `CapabilityOf` type and the reason it is exported from the `/nestjs`
17
+ subpath only. No runtime behavior changes.
18
+
19
+ ## 0.7.1
20
+
21
+ ### Patch Changes
22
+
23
+ - [`96d300d`](https://github.com/DavideCarvalho/nestjs-diagnostics/commit/96d300d3af86b77fbdf16b307d986aec922945c4) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - add NestJS 12 to the supported peer range
24
+
3
25
  ## 0.7.0
4
26
 
5
27
  ### Minor Changes
@@ -1,15 +1,20 @@
1
1
  /**
2
- * O token de DI estável para a capability `<lib>:<name>`. Fonte única do naming
3
- * `@dudousxd/nestjs-<lib>:<name>`. Como usa o registry global de símbolos
4
- * (`Symbol.for`), produtor e consumidor em libs diferentes — sem se importarem —
5
- * resolvem o MESMO símbolo. Espelha o `channelName(lib, event)` do transporte de
6
- * eventos, do outro lado do mesmo protocolo.
2
+ * The stable DI token for the capability `<lib>:<name>`, built from the canonical
3
+ * `@dudousxd/nestjs-<lib>:<name>` name. Because it goes through the global symbol
4
+ * registry (`Symbol.for`), a producer and a consumer living in different libs —
5
+ * neither importing the other — resolve the SAME symbol. Mirrors the event
6
+ * transport's `channelName(lib, event)`, on the other side of the same protocol.
7
+ *
8
+ * The naming is a convention, not an exclusive factory: a token spelled by hand
9
+ * with the same string IS the same symbol, which is what lets a lib adopt this
10
+ * without a breaking change. `CONTEXT_ACCESSOR` in `context-accessor.ts` is
11
+ * exactly that case — `capability('context', 'accessor')` resolves to it.
7
12
  */
8
13
  export declare function capability(lib: string, name: string): symbol;
9
14
  /**
10
- * Registry tipado de capabilities, augmentado pelas libs via declaration merging
11
- * — espelho exato do `ChannelRegistry` do transporte de eventos. Vazio por
12
- * padrão; o caminho não-tipado (`unknown`) está sempre disponível.
15
+ * Typed capability registry, augmented by libs through declaration merging — the
16
+ * exact mirror of the event transport's `ChannelRegistry`. Empty by default; the
17
+ * untyped (`unknown`) path is always available.
13
18
  *
14
19
  * ```ts
15
20
  * declare module '@dudousxd/nestjs-diagnostics' {
@@ -22,9 +27,9 @@ export declare function capability(lib: string, name: string): symbol;
22
27
  export interface CapabilityRegistry {
23
28
  }
24
29
  /**
25
- * O tipo declarado para `(TLib, TName)` no {@link CapabilityRegistry}, ou
26
- * `unknown` quando o par não está registrado. Espelha `PayloadOf` do
27
- * transporte de eventos.
30
+ * The type declared for `(TLib, TName)` in the {@link CapabilityRegistry}, or
31
+ * `unknown` when the pair is not registered. Mirrors `PayloadOf` from the event
32
+ * transport.
28
33
  */
29
34
  export type CapabilityOf<TLib extends string, TName extends string> = TLib extends keyof CapabilityRegistry ? TName extends keyof CapabilityRegistry[TLib] ? CapabilityRegistry[TLib][TName] : unknown : unknown;
30
35
  //# sourceMappingURL=capability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;;GAIG;AACH,MAAM,MAAM,YAAY,CACtB,IAAI,SAAS,MAAM,EACnB,KAAK,SAAS,MAAM,IAClB,IAAI,SAAS,MAAM,kBAAkB,GACrC,KAAK,SAAS,MAAM,kBAAkB,CAAC,IAAI,CAAC,GAC1C,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAC/B,OAAO,GACT,OAAO,CAAC"}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;;GAIG;AACH,MAAM,MAAM,YAAY,CACtB,IAAI,SAAS,MAAM,EACnB,KAAK,SAAS,MAAM,IAClB,IAAI,SAAS,MAAM,kBAAkB,GACrC,KAAK,SAAS,MAAM,kBAAkB,CAAC,IAAI,CAAC,GAC1C,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAC/B,OAAO,GACT,OAAO,CAAC"}
@@ -1,9 +1,14 @@
1
1
  /**
2
- * O token de DI estável para a capability `<lib>:<name>`. Fonte única do naming
3
- * `@dudousxd/nestjs-<lib>:<name>`. Como usa o registry global de símbolos
4
- * (`Symbol.for`), produtor e consumidor em libs diferentes — sem se importarem —
5
- * resolvem o MESMO símbolo. Espelha o `channelName(lib, event)` do transporte de
6
- * eventos, do outro lado do mesmo protocolo.
2
+ * The stable DI token for the capability `<lib>:<name>`, built from the canonical
3
+ * `@dudousxd/nestjs-<lib>:<name>` name. Because it goes through the global symbol
4
+ * registry (`Symbol.for`), a producer and a consumer living in different libs —
5
+ * neither importing the other — resolve the SAME symbol. Mirrors the event
6
+ * transport's `channelName(lib, event)`, on the other side of the same protocol.
7
+ *
8
+ * The naming is a convention, not an exclusive factory: a token spelled by hand
9
+ * with the same string IS the same symbol, which is what lets a lib adopt this
10
+ * without a breaking change. `CONTEXT_ACCESSOR` in `context-accessor.ts` is
11
+ * exactly that case — `capability('context', 'accessor')` resolves to it.
7
12
  */
8
13
  export function capability(lib, name) {
9
14
  return Symbol.for(`@dudousxd/nestjs-${lib}:${name}`);
@@ -1 +1 @@
1
- {"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,IAAY;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,oBAAoB,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,IAAY;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,oBAAoB,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC"}
@@ -1,9 +1,13 @@
1
1
  /**
2
- * Trava anti-drift para contract tests: assere que TODO token exportado por uma
3
- * lib segue o naming canônico `@dudousxd/nestjs-<lib>:<name>` (i.e. foi criado
4
- * por `capability(lib, ...)`). `Symbol.for(k).description === k`, então basta
5
- * checar o prefixo da `description` — não é preciso comparar identidade.
6
- * Lança um erro que NOMEIA o export ofensor, virando o drift em teste vermelho.
2
+ * Anti-drift latch for contract tests: asserts that EVERY token a lib exports
3
+ * follows the canonical `@dudousxd/nestjs-<lib>:<name>` naming. Because
4
+ * `Symbol.for(k).description === k`, checking the `description` prefix is enough —
5
+ * no identity comparison needed. Throws an error that NAMES the offending export,
6
+ * turning drift into a red test.
7
+ *
8
+ * It checks the NAME, not the provenance: a symbol spelled by hand with the right
9
+ * prefix passes exactly like one built by `capability(lib, ...)`. That is the
10
+ * point — the canonical name is the contract, not the factory call.
7
11
  */
8
12
  export declare function assertCapabilityNaming(lib: string, tokens: Record<string, symbol>): void;
9
13
  //# sourceMappingURL=conformance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../src/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAWxF"}
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../src/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAWxF"}
@@ -1,9 +1,13 @@
1
1
  /**
2
- * Trava anti-drift para contract tests: assere que TODO token exportado por uma
3
- * lib segue o naming canônico `@dudousxd/nestjs-<lib>:<name>` (i.e. foi criado
4
- * por `capability(lib, ...)`). `Symbol.for(k).description === k`, então basta
5
- * checar o prefixo da `description` — não é preciso comparar identidade.
6
- * Lança um erro que NOMEIA o export ofensor, virando o drift em teste vermelho.
2
+ * Anti-drift latch for contract tests: asserts that EVERY token a lib exports
3
+ * follows the canonical `@dudousxd/nestjs-<lib>:<name>` naming. Because
4
+ * `Symbol.for(k).description === k`, checking the `description` prefix is enough —
5
+ * no identity comparison needed. Throws an error that NAMES the offending export,
6
+ * turning drift into a red test.
7
+ *
8
+ * It checks the NAME, not the provenance: a symbol spelled by hand with the right
9
+ * prefix passes exactly like one built by `capability(lib, ...)`. That is the
10
+ * point — the canonical name is the contract, not the factory call.
7
11
  */
8
12
  export function assertCapabilityNaming(lib, tokens) {
9
13
  const prefix = `@dudousxd/nestjs-${lib}:`;
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.js","sourceRoot":"","sources":["../src/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,MAA8B;IAChF,MAAM,MAAM,GAAG,oBAAoB,GAAG,GAAG,CAAC;IAC1C,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,qBAAqB,UAAU,qBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;gBAC1E,2BAA2B,MAAM,sBAAsB,GAAG,aAAa,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"conformance.js","sourceRoot":"","sources":["../src/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,MAA8B;IAChF,MAAM,MAAM,GAAG,oBAAoB,GAAG,GAAG,CAAC;IAC1C,KAAK,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC;QAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,qBAAqB,UAAU,qBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;gBAC1E,2BAA2B,MAAM,sBAAsB,GAAG,aAAa,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,9 +1,14 @@
1
1
  /**
2
- * Injeta a capability de um peer `<lib>:<name>` OPCIONALMENTE — equivale a
3
- * `@Optional() @Inject(capability(lib, name))`, sem a string mágica copiada à
4
- * mão. Quando o produtor (a outra lib) está ausente, o parâmetro recebe
5
- * `undefined` em vez de quebrar a injeção. O tipo do parâmetro é anotado pelo
6
- * consumidor (ver nota no plano sobre declaration merging cross-repo).
2
+ * Injects a peer lib's `<lib>:<name>` capability OPTIONALLY — equivalent to
3
+ * `@Optional() @Inject(capability(lib, name))`, without the magic string copied by
4
+ * hand. When the producer lib is absent, the parameter receives `undefined`
5
+ * instead of breaking injection.
6
+ *
7
+ * The decorator carries no type of its own: annotate the parameter on the consumer
8
+ * side, e.g. with {@link import('./capability.js').CapabilityOf CapabilityOf}.
9
+ *
10
+ * Exported from the `/nestjs` subpath only, never from the main barrel: this file
11
+ * imports `@nestjs/common`, and the root entry point stays Nest-free.
7
12
  */
8
13
  export declare function InjectCapability(lib: string, name: string): ParameterDecorator;
9
14
  //# sourceMappingURL=inject-capability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inject-capability.d.ts","sourceRoot":"","sources":["../src/inject-capability.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAM9E"}
1
+ {"version":3,"file":"inject-capability.d.ts","sourceRoot":"","sources":["../src/inject-capability.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAM9E"}
@@ -1,11 +1,16 @@
1
1
  import { Inject, Optional } from '@nestjs/common';
2
2
  import { capability } from './capability.js';
3
3
  /**
4
- * Injeta a capability de um peer `<lib>:<name>` OPCIONALMENTE — equivale a
5
- * `@Optional() @Inject(capability(lib, name))`, sem a string mágica copiada à
6
- * mão. Quando o produtor (a outra lib) está ausente, o parâmetro recebe
7
- * `undefined` em vez de quebrar a injeção. O tipo do parâmetro é anotado pelo
8
- * consumidor (ver nota no plano sobre declaration merging cross-repo).
4
+ * Injects a peer lib's `<lib>:<name>` capability OPTIONALLY — equivalent to
5
+ * `@Optional() @Inject(capability(lib, name))`, without the magic string copied by
6
+ * hand. When the producer lib is absent, the parameter receives `undefined`
7
+ * instead of breaking injection.
8
+ *
9
+ * The decorator carries no type of its own: annotate the parameter on the consumer
10
+ * side, e.g. with {@link import('./capability.js').CapabilityOf CapabilityOf}.
11
+ *
12
+ * Exported from the `/nestjs` subpath only, never from the main barrel: this file
13
+ * imports `@nestjs/common`, and the root entry point stays Nest-free.
9
14
  */
10
15
  export function InjectCapability(lib, name) {
11
16
  const token = capability(lib, name);
@@ -1 +1 @@
1
- {"version":3,"file":"inject-capability.js","sourceRoot":"","sources":["../src/inject-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC7C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAChD,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"inject-capability.js","sourceRoot":"","sources":["../src/inject-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC7C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAChD,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-diagnostics",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "A standard convention for @dudousxd/nestjs-* libs to emit observability events over node:diagnostics_channel.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  }
26
26
  },
27
27
  "peerDependencies": {
28
- "@nestjs/common": "^10 || ^11",
29
- "@nestjs/core": "^10 || ^11",
28
+ "@nestjs/common": "^10 || ^11 || ^12",
29
+ "@nestjs/core": "^10 || ^11 || ^12",
30
30
  "reflect-metadata": "^0.2"
31
31
  },
32
32
  "peerDependenciesMeta": {
@@ -58,14 +58,14 @@
58
58
  "**/trace.ts"
59
59
  ],
60
60
  "devDependencies": {
61
- "@nestjs/common": "^11",
62
- "@nestjs/core": "^11",
63
- "@nestjs/testing": "^11",
64
- "@types/node": "^20.0.0",
65
- "reflect-metadata": "^0.2",
66
- "typescript": "^5.4.0",
67
- "unplugin-swc": "^1.5.1",
68
- "vitest": "^3.0.0"
61
+ "@nestjs/common": "12.0.1",
62
+ "@nestjs/core": "12.0.1",
63
+ "@nestjs/testing": "12.0.1",
64
+ "@types/node": "20.19.43",
65
+ "reflect-metadata": "0.2.2",
66
+ "typescript": "5.9.3",
67
+ "unplugin-swc": "1.6.0",
68
+ "vitest": "3.2.7"
69
69
  },
70
70
  "engines": {
71
71
  "node": ">=20"