deepsource-mcp-server
Version:
Model Context Protocol server for DeepSource
98 lines (97 loc) • 2.72 kB
TypeScript
/**
* @fileoverview IssueCount value object
*
* This module defines the IssueCount value object which represents
* counts of issues with validation for non-negative values.
*/
import { ValueObject } from '../shared/value-object.js';
/**
* Properties for the IssueCount value object
*/
interface IssueCountProps {
count: number;
category?: string;
}
/**
* Value object representing a count of issues
*
* Ensures that issue counts are always non-negative integers.
* Can optionally include a category for the issues being counted.
*
* @example
* ```typescript
* const criticalIssues = IssueCount.create(5, 'critical');
* const totalIssues = IssueCount.create(23);
*
* const combined = criticalIssues.add(totalIssues);
* console.log(combined.count); // 28
* ```
*/
export declare class IssueCount extends ValueObject<IssueCountProps> {
private constructor();
/**
* Creates a new IssueCount instance
*
* @param count - The number of issues
* @param category - Optional category of issues
* @returns A new IssueCount instance
* @throws Error if count is negative or not an integer
*/
static create(count: number, category?: string): IssueCount;
/**
* Creates a zero count
*
* @param category - Optional category of issues
* @returns A new IssueCount instance with zero count
*/
static zero(category?: string): IssueCount;
/**
* Gets the count value
*/
get count(): number;
/**
* Gets the category, if specified
*/
get category(): string | undefined;
/**
* Checks if the count is zero
*/
get isZero(): boolean;
/**
* Checks if the count is positive (greater than zero)
*/
get isPositive(): boolean;
/**
* Adds another issue count to this one
*
* @param other - The other issue count to add
* @returns A new IssueCount with the sum
*/
add(other: IssueCount): IssueCount;
/**
* Subtracts another issue count from this one
*
* @param other - The other issue count to subtract
* @returns A new IssueCount with the difference
* @throws Error if the result would be negative
*/
subtract(other: IssueCount): IssueCount;
/**
* Increments the count by one
*
* @returns A new IssueCount with count increased by one
*/
increment(): IssueCount;
/**
* Decrements the count by one
*
* @returns A new IssueCount with count decreased by one
* @throws Error if the count is already zero
*/
decrement(): IssueCount;
/**
* Returns a string representation of the issue count
*/
toString(): string;
}
export {};