This commit is contained in:
2025-12-16 11:52:26 +01:00
parent ce82b7822b
commit 9a891ac8b3
586 changed files with 1320 additions and 1563 deletions

View File

@@ -1,6 +1,6 @@
import type { LogLevel } from './LoggerLogLevel';
import type { LogContext } from './LoggerContext';
import type { Logger } from '@gridpilot/shared/logging/Logger';
import type { Logger } from '@core/shared/logging/Logger';
/**
* LoggerPort - Port interface for application-layer logging.

View File

@@ -2,7 +2,7 @@ import { OverlaySyncPort, OverlayAction, ActionAck } from '../ports/OverlaySyncP
import { AutomationEventPublisherPort, AutomationEvent } from '../ports/AutomationEventPublisherPort';
import { AutomationLifecycleEmitterPort, LifecycleCallback } from '../ports/AutomationLifecycleEmitterPort';
import { LoggerPort } from '../ports/LoggerPort';
import type { IAsyncApplicationService } from '@gridpilot/shared/application';
import type { IAsyncApplicationService } from '@core/shared/application';
type ConstructorArgs = {
lifecycleEmitter: AutomationLifecycleEmitterPort

View File

@@ -1,6 +1,6 @@
import { Result } from '../../../shared/result/Result';
import type { AuthenticationServicePort } from '../ports/AuthenticationServicePort';
import type { Logger } from '@gridpilot/shared/application/Logger';
import type { Logger } from '@core/shared/application/Logger';
/**
* Use case for initiating the manual login flow.

View File

@@ -1,4 +1,4 @@
import type { AsyncUseCase } from '@gridpilot/shared/application';
import type { AsyncUseCase } from '@core/shared/application';
import type { Logger } from '../../../shared/src/logging/Logger';
import { AutomationSession } from '../../domain/entities/AutomationSession';
import type { HostedSessionConfig } from '../../domain/types/HostedSessionConfig';

View File

@@ -1,5 +1,5 @@
import { randomUUID } from 'crypto';
import type { IEntity } from '@gridpilot/shared/domain';
import type { IEntity } from '@core/shared/domain';
import { StepId } from '../value-objects/StepId';
import { SessionState } from '../value-objects/SessionState';
import type { HostedSessionConfig } from '../types/HostedSessionConfig';

View File

@@ -1,4 +1,4 @@
import type { IDomainError } from '@gridpilot/shared/errors';
import type { IDomainError } from '@core/shared/errors';
/**
* Domain Error: AutomationDomainError

View File

@@ -1,4 +1,4 @@
import type { IDomainValidationService } from '@gridpilot/shared/domain';
import type { IDomainValidationService } from '@core/shared/domain';
import { Result } from '../../../shared/result/Result';
/**

View File

@@ -1,6 +1,6 @@
import { StepId } from '../value-objects/StepId';
import { SessionState } from '../value-objects/SessionState';
import type { IDomainValidationService } from '@gridpilot/shared/domain';
import type { IDomainValidationService } from '@core/shared/domain';
import { Result } from '../../../shared/result/Result';
export interface ValidationResult {

View File

@@ -1,5 +1,5 @@
import { AuthenticationState } from './AuthenticationState';
import type { IValueObject } from '@gridpilot/shared/domain';
import type { IValueObject } from '@core/shared/domain';
export interface BrowserAuthenticationStateProps {
cookiesValid: boolean;

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@gridpilot/shared/domain';
import type { IValueObject } from '@core/shared/domain';
export interface CheckoutPriceProps {
amountUsd: number;

View File

@@ -4,7 +4,7 @@
* Represents the lifetime of an authentication session with expiry tracking.
* Handles validation of session expiry dates with a configurable buffer window.
*/
import type { IValueObject } from '@gridpilot/shared/domain';
import type { IValueObject } from '@core/shared/domain';
export interface SessionLifetimeProps {
expiry: Date | null;

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@gridpilot/shared/domain';
import type { IValueObject } from '@core/shared/domain';
export type SessionStateValue =
| 'PENDING'

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@gridpilot/shared/domain';
import type { IValueObject } from '@core/shared/domain';
export interface StepIdProps {
value: number;

View File

@@ -1,4 +1,4 @@
import { AutomationEvent } from '@gridpilot/automation/application/ports/AutomationEventPublisherPort';
import { AutomationEvent } from '@core/automation/application/ports/AutomationEventPublisherPort';
export type LifecycleCallback = (event: AutomationEvent) => Promise<void> | void;

View File

@@ -1,5 +1,5 @@
import { Page } from 'playwright';
import { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import { LoggerPort } from '@core/automation/application/ports/LoggerPort';
export class AuthenticationGuard {
constructor(

View File

@@ -1,5 +1,5 @@
import type { Page } from 'playwright';
import type { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import type { LoggerPort } from '@core/automation/application/ports/LoggerPort';
import type { IPlaywrightAuthFlow } from './PlaywrightAuthFlow';
import { IRACING_URLS, IRACING_SELECTORS, IRACING_TIMEOUTS } from '../dom/IRacingSelectors';
import { AuthenticationGuard } from './AuthenticationGuard';

View File

@@ -23,7 +23,7 @@ import { PlaywrightBrowserSession } from './PlaywrightBrowserSession';
import { getFixtureForStep } from '../engine/FixtureServer';
import { BrowserModeConfigLoader, BrowserMode } from '../../../config/BrowserModeConfig';
import { getAutomationMode } from '../../../config/AutomationConfig';
import { PageStateValidator, PageStateValidation, PageStateValidationResult } from '@gridpilot/automation/domain/services/PageStateValidator';
import { PageStateValidator, PageStateValidation, PageStateValidationResult } from '@core/automation/domain/services/PageStateValidator';
import { IRacingDomNavigator } from '../dom/IRacingDomNavigator';
import { SafeClickService } from '../dom/SafeClickService';
import { IRacingDomInteractor } from '../dom/IRacingDomInteractor';

View File

@@ -4,7 +4,7 @@ import StealthPlugin from 'puppeteer-extra-plugin-stealth';
import * as fs from 'fs';
import * as path from 'path';
import type { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import type { LoggerPort } from '@core/automation/application/ports/LoggerPort';
import { BrowserModeConfigLoader, BrowserMode } from '../../../config/BrowserModeConfig';
import { getAutomationMode } from '../../../config/AutomationConfig';
import type { PlaywrightConfig } from './PlaywrightAutomationAdapter';

View File

@@ -1,5 +1,5 @@
import type { Page } from 'playwright';
import type { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import type { LoggerPort } from '@core/automation/application/ports/LoggerPort';
import { IRACING_SELECTORS, BLOCKED_KEYWORDS } from './IRacingSelectors';
import type { PlaywrightConfig } from '../core/PlaywrightAutomationAdapter';
import { PlaywrightBrowserSession } from '../core/PlaywrightBrowserSession';

View File

@@ -1,6 +1,6 @@
import type { LoggerPort } from '../../../application/ports/LoggerPort';
import type { LogContext } from '../../../application/ports/LoggerContext';
import type { Logger } from '@gridpilot/shared/logging/Logger';
import type { Logger } from '@core/shared/logging/Logger';
export class NoOpLogAdapter implements LoggerPort, Logger {
debug(_message: string, _context?: LogContext): void {}

View File

@@ -1,8 +1,8 @@
import type { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import type { LogContext } from '@gridpilot/automation/application/ports/LoggerContext';
import type { LogLevel } from '@gridpilot/automation/application/ports/LoggerLogLevel';
import type { LoggerPort } from '@core/automation/application/ports/LoggerPort';
import type { LogContext } from '@core/automation/application/ports/LoggerContext';
import type { LogLevel } from '@core/automation/application/ports/LoggerLogLevel';
import { loadLoggingConfig, type LoggingEnvironmentConfig } from '../../config/LoggingConfig';
import type { Logger } from '@gridpilot/shared/logging/Logger';
import type { Logger } from '@core/shared/logging/Logger';
const LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {
debug: 10,

View File

@@ -1,15 +0,0 @@
{
"name": "@gridpilot/automation",
"version": "0.1.0",
"main": "./index.ts",
"types": "./index.ts",
"type": "module",
"exports": {
"./domain/*": "./domain/*",
"./application/*": "./application/*",
"./infrastructure/adapters/automation": "./infrastructure/adapters/automation/index.ts",
"./infrastructure/config": "./infrastructure/config/index.ts",
"./infrastructure/*": "./infrastructure/*"
},
"dependencies": {}
}

View File

@@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "..",
"outDir": "dist",
"declaration": true,
"declarationMap": false
},
"include": ["**/*.ts"]
}