This commit is contained in:
2025-12-11 13:50:38 +01:00
parent e4c1be628d
commit c7e5de40d6
212 changed files with 2965 additions and 763 deletions

View File

@@ -1,3 +1,4 @@
import type { IDomainValidationService } from '@gridpilot/shared/domain';
import { Result } from '../../../shared/result/Result';
/**
@@ -24,6 +25,12 @@ export interface PageStateValidationResult {
unexpectedSelectors?: string[];
}
export interface PageStateValidationInput {
actualState: (selector: string) => boolean;
validation: PageStateValidation;
realMode?: boolean;
}
/**
* Domain service for validating page state during wizard navigation.
*
@@ -32,7 +39,18 @@ export interface PageStateValidationResult {
* Clean Architecture: This is pure domain logic with no infrastructure dependencies.
* It validates state based on selector presence/absence without knowing HOW to check them.
*/
export class PageStateValidator {
export class PageStateValidator
implements
IDomainValidationService<PageStateValidationInput, PageStateValidationResult, Error>
{
validate(input: PageStateValidationInput): Result<PageStateValidationResult, Error> {
const { actualState, validation, realMode } = input;
if (typeof realMode === 'boolean') {
return this.validateStateEnhanced(actualState, validation, realMode);
}
return this.validateState(actualState, validation);
}
/**
* Validate that the page state matches expected conditions.
*