Skip to content

Releases: haskou/metrics

v1.2.3

Choose a tag to compare

@github-actions github-actions released this 13 Oct 15:05

Changes

  • fix(deps): ⬆️ update dependency @haskou/value-objects to ^8.4.3

Release details

Pull request notes

This PR contains the following updates:

Package Change Age Confidence
@haskou/value-objects (source) ^8.3.4 → ^8.4.3 age confidence

Release Notes

haskou/value-objects (@​haskou/value-objects)

v8.4.3

Compare Source

Changes

  • fix(exports): 🐛 Export ComparableItem and SerializedValue

Release details

Pull request notes

What

ComparableItem (constraint of UniqueObjectArray<T>) and SerializedValue (constraint of PrimitiveOf<T>) appear in the public signatures but were not exported, so consumers could not name them.

  • ComparableItem moves to src/interfaces/ComparableItem.ts.
  • SerializedValue moves to src/types/SerializedValue.ts.
  • Both are re-exported through the existing interfaces and types barrels, so they are available from the package root.
  • UniqueObjectArray.ts and PrimitiveOf.ts now import them instead of declaring them.

Notes

  • Neither type was exported in any earlier release I checked (8.3.4, 8.4.2). This adds exports, it does not restore removed ones.
  • Pure type-level change, no runtime behaviour change.

Verification

yarn test (717 tests) and yarn build pass. Coverage stays at 100%. dist/index.d.cts declares both with export, and a throwaway consumer importing them from dist compiled under --strict.

v8.4.2

Compare Source

Changes

  • fix(positive-integer): 🐛 Extend PositiveNumber instead of Integer

Release details

Pull request notes

What

PositiveInteger now extends PositiveNumber instead of Integer. PositiveNumber validates the sign and PositiveInteger adds the integer check (InvalidIntegerError).

Behaviour changes

  • new PositiveInteger(1) instanceof Integer is now false. Code typing a parameter as Integer and passing a PositiveInteger will stop compiling. FileSize is the only consumer in this repo and is unaffected.
  • The sign is validated first, so new PositiveInteger(-0.5) throws InvalidPositiveNumberError (it used to throw InvalidIntegerError).
  • The % 1 === 0 check now exists in both Integer and PositiveInteger.

Docs and tests

docs/reference/positive-integer.md updated (signature and notes). Spec now asserts inheritance from PositiveNumber, no inheritance from Integer, and the new error for -0.5.

Verification

yarn test (717 tests) and yarn build pass. Coverage stays at 100%.

v8.4.1

Compare Source

Changes

  • fix(file-size): 🐛 Type FileSize add and subtract as FileSize

Release details

Pull request notes

What

FileSize.add and FileSize.subtract were typed as NumberValueObject (inherited), although at runtime they return a FileSize. They are now declared as add(other: FileSize): FileSize and subtract(other: FileSize): FileSize.

Notes

  • Adding or subtracting two FileSize is a closed operation, so the return type is exact. NumberValueObject is unchanged: its arithmetic can fail on subclass invariants, so this would be a wrong promise there.
  • Implemented with clone(), so subclasses of FileSize keep their own type at runtime.
  • Breaking at type level: size.add(100) with a plain number no longer compiles. Pass new FileSize(100).
  • Docs for FileSize updated with the new signatures and the negative-result error.

Verification

yarn test, yarn build pass. Coverage stays at 100%. The arithmetic test calls FileSize.to() on the results, so it only compiles if both return FileSize.

v8.4.0

Compare Source

Changes

  • feat(file-size): ✨ Add FileSize, FileSizeUnit and PositiveInteger value objects

Release details

Pull request notes

What

  • PositiveInteger (extends Integer, accepts 0).
  • FileSizeUnit (extends Enum): SI (kB..PB, base 1000) and IEC (KiB..PiB, base 1024) units, with a single typed bytes-per-unit table and FileSizeUnit.SI / FileSizeUnit.IEC sets.
  • FileSize (extends PositiveInteger, stored in bytes): fromBytes, from(value, unit), parse, toBytes, to(unit), toHumanReadable(units), plus inherited arithmetic.

Behaviour worth reviewing

  • toHumanReadable returns { value, unit }: no formatting or rounding in the domain.
  • from and parse round to the nearest byte. multiply/divide do not round and throw InvalidIntegerError on non-integer results. subtract below zero throws InvalidPositiveNumberError.
  • Static factories use the this: new (...) => T pattern from #​94, so subclasses get their own type (covered in SubclassFactories.spec.ts).
  • parse units are exact and case-sensitive (KB is invalid).

Docs

Reference pages for the three classes, plus sidebar, reference index, docs home and README entries. The README table was re-aligned by prettier.

Verification

yarn test, yarn build and yarn docs:build pass. Coverage is 100% (statements, branches, functions, lines).


Configuration

📅 Schedule: (in timezone Europe/Madrid)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

v1.2.2

Choose a tag to compare

@github-actions github-actions released this 11 Oct 04:56

Changes

  • fix(deps): ⬆️ update dependency @haskou/value-objects to ^8.3.4

Release details

Pull request notes

This PR contains the following updates:

Package Change Age Confidence
@haskou/value-objects (source) ^8.3.3 → ^8.3.4 age confidence

Release Notes

haskou/value-objects (@​haskou/value-objects)

v8.3.4

Compare Source

Changes

  • fix(factories): 🐛 Return subclass from static factories (#​94)

Release details

Pull request notes

Closes #​94

UUID.generate, ShortId.generate, Timestamp.now/new/fromSeconds and Duration.from* now instantiate through the receiver (new this(...)) with a typed this, so subclasses get subclass instances and types, and isEqual works against them.

Note: calling the factories detached (const f = UUID.generate; f(), .map(Duration.fromDays)) no longer works.

Adds regression tests in tests/value-objects/SubclassFactories.spec.ts.


Configuration

📅 Schedule: (in timezone Europe/Madrid)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

v1.2.1

Choose a tag to compare

@github-actions github-actions released this 03 Oct 14:31

Changes

  • fix(deps): ⬆️ update dependency @haskou/value-objects to ^8.3.3

Release details

Pull request notes

Bumps runtime dependency @haskou/value-objects ^7.0.3 → ^8.3.3 (major; yarn.lock also drops the now-removed buffer/uuid transitive deps).

Breaking changes in v8 (UniqueObjectArray now immutable; Media.getBuffer returns Uint8Array) do not affect this repo: only simple value objects are used; no source changes needed.

Verification (all pass): yarn install, yarn build, yarn lint, yarn test (build + typecheck + jest), yarn test:package. Note: yarn lint before yarn build reports errors in tests/compatibility because they import dist; unrelated to the bump.

v1.2.0

Choose a tag to compare

@github-actions github-actions released this 16 Sep 20:34

Changes

  • feat(runtime): ✨ Add runtime portability and shared ESM/CJS state

Release details

Pull request notes

El paquete exigía Node >=22 y duplicaba configuración, buffers e identidad de clases al combinar ESM, CommonJS o subpaths. Esta PR hace portable el núcleo y comparte implementación y tipos entre los formatos en Node.

  • Selecciona el muestreo nativo automáticamente en Node mediante imports condicionales: recordCpu y recordMemory siguen funcionando sin configuración adicional. En navegador se omiten esas mediciones; un resourceUsage personalizado conserva prioridad.
  • Publica ESM nativo para navegador y wrappers ESM sobre módulos CJS compartidos en Node, con declaraciones compatibles entre ambos formatos.
  • Actualiza dependencias, README y documentación; conserva TypeScript 6 por compatibilidad con ESLint.
  • Añade verificación del paquete en Node 22/24/26 y del bundle de navegador sin globals de Node. El playground funciona sin compilar previamente la librería.

Validación local: lint, typecheck, 87 tests con cobertura del 100 %, consumidores TypeScript ESM/CJS y Bundler, comprobaciones del paquete en Node 22/24/26, bundle portable y compilación de docs/playground. publint únicamente sugirió añadir engines.node, omitido deliberadamente.

No cambia el comportamiento público de CPU/memoria en Node. Publicación minor mediante rama feat/*.

v1.1.0

Choose a tag to compare

@github-actions github-actions released this 15 Jul 23:00

Changes

  • feat(playground): ✨ Show call attributes in logs

Release details

Pull request notes

Summary

  • render attributes for called log entries in the playground telemetry panel
  • pass the searched repository as an instrumentation attribute
  • keep the attribute rendering compact and stable by sorting keys

Validation

  • yarn typecheck
  • yarn playground:build

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 15 Jul 22:54

Changes

  • break(metrics): 💥 Harden metrics public API

Release details

Pull request notes

Summary

  • add global instrumentation defaults to configureMetrics
  • restrict the root package exports to the public entrypoints
  • expose advanced APIs through contracts and model subpaths
  • include structured error details in failure logs
  • document Prometheus cardinality rules

Impact

This is a breaking API hardening change because support/model exports are no longer re-exported from the package root.

Validation

  • yarn lint
  • yarn typecheck
  • yarn test:coverage
  • yarn docs:build
  • yarn test:package
  • yarn build

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 15 Jul 22:45

Changes

  • feat(playground): ✨ Show telemetry from live requests

Release details

Pull request notes

Summary

  • add a Vite playground that calls the GitHub repository API
  • show live metrics, logs, request results, and source context
  • include playground-specific errors and build configuration

Validation

  • yarn typecheck
  • yarn playground:build

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 15 Jul 18:04

Changes

  • feat(playground): ✨ Show telemetry from live requests

Release details

Pull request notes

Changes

  • Replace the fixed delay and forced failure controls with a live GitHub repository request.
  • Present repository data, metrics, structured logs, and stack traces as readable UI elements.
  • Add explicit errors for invalid repository names and unsuccessful GitHub responses.
  • Import the Node resource and system clock adapters directly so browser builds do not traverse prom-client.

Motivation

The previous playground manufactured an 80 ms duration and accepted a boolean that forced the method to fail. Those controls demonstrated the output shape without proving that the library measured real work.

The new flow calls GitHub's public API through GitHubRepositoryFinder.find(). Visitors can inspect a public repository or enter a missing repository to capture a real HTTP failure.

Impact

The playground now reports network duration, calls, failures, logs, and stack traces produced by real executions. It keeps arguments out of telemetry and explains that CPU and RAM sampling require the Node.js adapter.

Direct adapter imports also remove Node module externalization warnings from the browser bundle.

Validation

  • yarn format:check
  • yarn lint
  • yarn test:coverage: 39 suites, 81 tests, and 100% coverage
  • yarn test:package
  • yarn pages:build

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 15 Jul 17:24

Changes

  • feat(ci): 👷 Add Codecov coverage reporting

Release details

Pull request notes

Changes

  • Match the @haskou/value-objects CI pattern with Node 24.18.0, Yarn caching, and a combined lint and coverage step.
  • Upload coverage/lcov.info through codecov-action@v5 while retaining the metrics export and tarball checks.
  • Add the Codecov badge, link the published documentation, and document the release branches.
  • Ignore .npmrc so local configuration and tokens cannot enter Git.

Motivation

The repository generated coverage without sending it to Codecov. The README also omitted the release branch convention and linked the documentation through a repository path.

Impact

CI sends each coverage report to Codecov through the CODECOV_TOKEN secret. A Codecov outage will not block the pipeline.

Merging this feat/* branch triggers the corresponding minor release.

Validation

  • yarn format:check
  • yarn test:coverage: 39 suites, 81 tests, and 100% coverage
  • yarn test:package
  • yarn pages:build