Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (semver) strings, specifically focusing on the "Range" resource and the "Outside Range" operation. It checks whether a given version is outside a specified version range in a particular direction (either higher or lower). This is useful in scenarios such as validating software versions against allowed ranges, enforcing version constraints in deployment pipelines, or filtering versions that fall outside supported boundaries.

For example, you might use this node to verify if a software version is greater than all versions in a supported range before allowing an upgrade, or to check if a version is lower than a minimum required version.

Properties

Name Meaning
Version The specific version string to check against the range (e.g., "1.2.3").
Range The semver range string defining the acceptable version interval (e.g., "^1.2.0").
Direction The direction to check if the version is outside the range: "Higher (>)" or "Lower (<)".
Options Additional options affecting parsing and matching behavior:
- Loose Whether to use loose parsing for version strings (true/false).
- Include Prerelease Whether to include prerelease versions when matching the range (true/false).
- RTL (Right to Left) (Not applicable for this operation; shown only for coercion resource).

Output

The output JSON contains the following fields:

  • operation: The operation performed, here always "outside".
  • version: The input version string checked.
  • range: The version range string used for comparison.
  • hilo: The direction checked (">" for higher, "<" for lower).
  • result: A boolean indicating whether the version is outside the specified range in the given direction.

Example output JSON:

{
  "operation": "outside",
  "version": "1.3.0",
  "range": "^1.2.0",
  "hilo": ">",
  "result": true
}

This means version "1.3.0" is outside the range "^1.2.0" in the higher direction.

Dependencies

  • Uses the external semver library for semantic version parsing and comparison.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials needed.

Troubleshooting

  • Invalid version or range strings: If the version or range strings are malformed or invalid, the node may throw errors or return unexpected results. Ensure inputs conform to valid semver formats.
  • Loose parsing option: If versions do not strictly follow semver, enabling the "Loose" option can help parse non-standard version strings.
  • Prerelease handling: By default, prerelease versions are excluded from range matching unless "Include Prerelease" is enabled.
  • Direction mismatch: Make sure the "Direction" property correctly reflects the intended check (higher or lower); otherwise, results may be misleading.

Common error messages typically relate to invalid version or range inputs and can be resolved by verifying the correctness of these strings.

Links and References

Discussion