@bymax-one/nest-ai-tokens 1.0.1 → 1.0.3

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
@@ -8,6 +8,63 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.0.3] - 2026-08-06
12
+
13
+ ### Fixed
14
+
15
+ - **Every suppression reason was dropped from the mutation report.** All 249 `// Stryker
16
+ disable` directives in the source wrote their justification after `--`. Stryker reads a
17
+ directive with one regular expression, `/^\s?Stryker (disable|restore)(?: (next-line))?
18
+ ([a-zA-Z, ]+)(?::(.+)?)?/`, whose mutator list accepts letters, commas and spaces only
19
+ and which captures the reason exclusively after a colon. A `-` therefore closed the
20
+ mutator list and left the reason unmatched, so each directive still silenced its mutant
21
+ but the report recorded Stryker's fallback text, `Ignored using a comment`. The README
22
+ claimed the opposite — that every suppression carries its reason — and documented the
23
+ broken separator as the convention. The directives now use `<Mutator>: <reason>`, which
24
+ is the grammar the parser accepts, and the reasons reach the report.
25
+
26
+ ### Added
27
+
28
+ - `check:mutants` gate (`scripts/check-mutation-directives.mjs`) — validates every
29
+ `// Stryker` comment against the parser's own regular expression, rejecting a reason
30
+ written after `--`, a reason wrapped onto a second comment line (the report keeps only
31
+ the first fragment), and a mutator name Stryker does not know, which would silence
32
+ nothing at all. Wired into CI and `prepublishOnly`. Stryker warns about the last case,
33
+ but only during a mutation run, which on this repo happens post-merge.
34
+
35
+ ### Changed
36
+
37
+ - No runtime behaviour changed. `dist/` differs only in the text of those comments; the
38
+ server bundle moved from 38,096 to 38,145 B brotli, well inside its 40,000 B budget.
39
+
40
+ ## [1.0.2] - 2026-08-05
41
+
42
+ ### Fixed
43
+
44
+ - **The module could not be initialised by a consumer at all.** `MeteringInterceptor` is
45
+ registered as a plain class provider, so Nest resolves its constructor — but only the
46
+ third parameter carried a token. Nest reads two separate metadata keys for this:
47
+ `self:paramtypes`, written by `@Inject()`, and `design:paramtypes`, written by
48
+ TypeScript. The published bundle is built by tsup/esbuild, and esbuild states it cannot
49
+ implement `emitDecoratorMetadata` because it does not replicate TypeScript's type
50
+ system — so the second key was never there. The first two parameters had neither, and
51
+ the container threw `Nest can't resolve dependencies of the MeteringInterceptor
52
+ (?, +, Symbol(BYMAX_AI_TOKENS_OPTIONS))` before any provider was created. Both now
53
+ carry `@Inject`.
54
+
55
+ ### Changed
56
+
57
+ - `emitDecoratorMetadata` is `false` in `tsconfig.json`. It was `true`, which was never
58
+ true of the artifact: tsup prints `You have emitDecoratorMetadata enabled but
59
+ @swc/core was not installed, skipping swc plugin` on every build, and that warning had
60
+ been printed on every build of this package. Turning it off makes the source compile
61
+ the way the bundle is built, so a parameter that depends on reflected types now fails
62
+ where it is cheap to see.
63
+ - The imports that existed only to feed that metadata are `import type` again. The lint
64
+ rule reported each one the moment the flag went off, which makes it a precise detector
65
+ for this defect: an import that is value-only because a constructor parameter needs its
66
+ type is an import that will not survive the bundle.
67
+
11
68
  ## [1.0.1] - 2026-08-04
12
69
 
13
70
  ### Removed
@@ -135,4 +192,6 @@ have regressed from. They are kept because the reasoning is worth having.
135
192
 
136
193
  [1.0.0]: https://github.com/bymaxone/nest-ai-tokens/releases/tag/v1.0.0
137
194
  [1.0.1]: https://github.com/bymaxone/nest-ai-tokens/compare/v1.0.0...v1.0.1
138
- [Unreleased]: https://github.com/bymaxone/nest-ai-tokens/compare/v1.0.1...HEAD
195
+ [1.0.2]: https://github.com/bymaxone/nest-ai-tokens/compare/v1.0.1...v1.0.2
196
+ [1.0.3]: https://github.com/bymaxone/nest-ai-tokens/compare/v1.0.2...v1.0.3
197
+ [Unreleased]: https://github.com/bymaxone/nest-ai-tokens/compare/v1.0.3...HEAD
package/README.md CHANGED
@@ -742,9 +742,11 @@ tests pass".
742
742
  system does, `check:runtime` loads every subpath from the packed tarball in ESM and
743
743
  CommonJS, and `check:published` compiles this README's snippets against `dist/`
744
744
  - ✅ **Every suppression carries its reason** — no coverage directives anywhere; each
745
- `// Stryker disable` in the production source states, after `--`, why the mutant it
746
- silences is unobservable from a unit test (an internal error context, a provider id
747
- reached only through integration)
745
+ `// Stryker disable` in the production source states, after the `:` Stryker reads it
746
+ from, why the mutant it silences is unobservable from a unit test (an internal error
747
+ context, a provider id reached only through integration). `check:mutants` proves the
748
+ reasons parse, so they reach the mutation report instead of being replaced by
749
+ Stryker's `Ignored using a comment` fallback
748
750
 
749
751
  ```bash
750
752
  pnpm test # unit tests
@@ -276,7 +276,7 @@ function computePayloadHash(record) {
276
276
  // src/server/utils/hash-chain.ts
277
277
  function chainHash(prevHash, record) {
278
278
  return deriveIdempotencyKey({
279
- // Stryker disable next-line StringLiteral -- empty-string fallback for null prevHash; tests only verify hash determinism and inequality, not the specific hash value for a genesis block
279
+ // Stryker disable next-line StringLiteral: empty-string fallback for null prevHash; tests only verify hash determinism and inequality, not the specific hash value for a genesis block
280
280
  prevHash: prevHash ?? "",
281
281
  id: record.id,
282
282
  content: computePayloadHash(record)
@@ -274,7 +274,7 @@ function computePayloadHash(record) {
274
274
  // src/server/utils/hash-chain.ts
275
275
  function chainHash(prevHash, record) {
276
276
  return deriveIdempotencyKey({
277
- // Stryker disable next-line StringLiteral -- empty-string fallback for null prevHash; tests only verify hash determinism and inequality, not the specific hash value for a genesis block
277
+ // Stryker disable next-line StringLiteral: empty-string fallback for null prevHash; tests only verify hash determinism and inequality, not the specific hash value for a genesis block
278
278
  prevHash: prevHash ?? "",
279
279
  id: record.id,
280
280
  content: computePayloadHash(record)