@http-forge/core 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.js +116 -116
- package/dist/index.mjs +114 -114
- package/dist/infrastructure/collection/collection-service.d.ts +3 -0
- package/dist/infrastructure/collection/collection-store.d.ts +5 -1
- package/dist/infrastructure/collection/folder-collection-store.d.ts +4 -0
- package/dist/infrastructure/collection/folder-io.d.ts +1 -0
- package/dist/infrastructure/collection/json-collection-loader.d.ts +5 -0
- package/dist/types/collection.d.ts +2 -0
- package/package.json +1 -1
- package/dist/application/dto/index.d.ts +0 -8
- package/dist/application/dto/request-dtos.d.ts +0 -105
- package/dist/application/dto/response-dtos.d.ts +0 -185
- package/dist/application/events/application-events.d.ts +0 -53
- package/dist/application/events/index.d.ts +0 -6
- package/dist/application/index.d.ts +0 -25
- package/dist/application/mappers/collection-mapper.d.ts +0 -39
- package/dist/application/mappers/execution-result-mapper.d.ts +0 -16
- package/dist/application/mappers/index.d.ts +0 -9
- package/dist/application/mappers/request-mapper.d.ts +0 -29
- package/dist/application/queries/get-request-schema.query.d.ts +0 -32
- package/dist/application/queries/index.d.ts +0 -6
- package/dist/application/use-cases/create-request.use-case.d.ts +0 -23
- package/dist/application/use-cases/delete-request.use-case.d.ts +0 -15
- package/dist/application/use-cases/execute-request.use-case.d.ts +0 -46
- package/dist/application/use-cases/export-collection.use-case.d.ts +0 -22
- package/dist/application/use-cases/get-collection.use-case.d.ts +0 -13
- package/dist/application/use-cases/index.d.ts +0 -12
- package/dist/application/use-cases/list-requests.use-case.d.ts +0 -14
- package/dist/application/use-cases/load-collection.use-case.d.ts +0 -30
- package/dist/application/use-cases/save-collection.use-case.d.ts +0 -25
- package/dist/application/use-cases/update-request.use-case.d.ts +0 -17
- package/dist/domain/errors/domain-errors.d.ts +0 -52
- package/dist/domain/errors/index.d.ts +0 -4
- package/dist/domain/index.d.ts +0 -24
- package/dist/domain/models/execution.d.ts +0 -88
- package/dist/domain/models/index.d.ts +0 -4
- package/dist/domain/services/domain-events.d.ts +0 -60
- package/dist/domain/services/execution-planner.domain-service.d.ts +0 -40
- package/dist/domain/services/index.d.ts +0 -9
- package/dist/domain/services/schema-inference.domain-service.d.ts +0 -54
- package/dist/domain/value-objects/entity-id.d.ts +0 -26
- package/dist/domain/value-objects/http-method.d.ts +0 -30
- package/dist/domain/value-objects/index.d.ts +0 -9
- package/dist/domain/value-objects/request-url.d.ts +0 -28
- package/dist/infrastructure/adapters/index.d.ts +0 -5
- package/dist/infrastructure/adapters/logger.adapter.d.ts +0 -25
- package/dist/infrastructure/adapters/node-file-system.adapter.d.ts +0 -18
- package/dist/infrastructure/di/complete-bootstrap.d.ts +0 -24
- package/dist/infrastructure/di/index.d.ts +0 -6
- package/dist/infrastructure/di/infrastructure-di-config.d.ts +0 -33
- package/dist/infrastructure/di/simple-event-publisher.d.ts +0 -17
- package/dist/infrastructure/environment/interfaces.d.ts +0 -139
- package/dist/infrastructure/http/index.d.ts +0 -4
- package/dist/infrastructure/http/node-http-executor.adapter.d.ts +0 -25
- package/dist/infrastructure/index.d.ts +0 -31
- package/dist/infrastructure/persistence/file-system-history-loader.d.ts +0 -31
- package/dist/infrastructure/persistence/index.d.ts +0 -6
- package/dist/infrastructure/repositories/file-system/fs-collection-repository.d.ts +0 -72
- package/dist/infrastructure/repositories/file-system/fs-environment-file-loader.adapter.d.ts +0 -41
- package/dist/infrastructure/repositories/file-system/fs-environment-repository.d.ts +0 -34
- package/dist/infrastructure/repositories/file-system/fs-request-repository.d.ts +0 -31
- package/dist/infrastructure/repositories/file-system/index.d.ts +0 -7
- package/dist/infrastructure/repositories/in-memory/in-memory-collection-repository.d.ts +0 -18
- package/dist/infrastructure/repositories/in-memory/in-memory-environment-repository.d.ts +0 -25
- package/dist/infrastructure/repositories/in-memory/in-memory-request-repository.d.ts +0 -25
- package/dist/infrastructure/repositories/in-memory/index.d.ts +0 -7
- package/dist/infrastructure/script/index.d.ts +0 -4
- package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +0 -19
- package/dist/infrastructure/test-suite/index.d.ts +0 -10
- package/dist/ports/executors/index.d.ts +0 -5
- package/dist/ports/external/file-system.interface.d.ts +0 -44
- package/dist/ports/external/http-client.interface.d.ts +0 -25
- package/dist/ports/external/index.d.ts +0 -7
- package/dist/ports/index.d.ts +0 -17
- package/dist/ports/parsers/index.d.ts +0 -4
- package/dist/ports/repositories/collection-repository.interface.d.ts +0 -32
- package/dist/ports/repositories/environment-repository.interface.d.ts +0 -31
- package/dist/ports/repositories/index.d.ts +0 -6
- package/dist/ports/repositories/request-repository.interface.d.ts +0 -32
- package/dist/ports/storage/cache-store.interface.d.ts +0 -26
- package/dist/ports/storage/history-loader.interface.d.ts +0 -37
- package/dist/ports/storage/index.d.ts +0 -5
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execute Request Use Case - Main business workflow
|
|
3
|
-
*
|
|
4
|
-
* Orchestrates:
|
|
5
|
-
* 1. Load request from repository
|
|
6
|
-
* 2. Prepare execution environment
|
|
7
|
-
* 3. Call domain services for planning
|
|
8
|
-
* 4. Execute HTTP request via infrastructure
|
|
9
|
-
* 5. Handle scripts and variable updates
|
|
10
|
-
* 6. Publish events
|
|
11
|
-
*/
|
|
12
|
-
import { IRequestRepository } from '../../ports/repositories/request-repository.interface';
|
|
13
|
-
import { IEnvironmentRepository } from '../../ports/repositories/environment-repository.interface';
|
|
14
|
-
import { IHttpExecutor } from '../../ports/executors/http-executor.interface';
|
|
15
|
-
import { IScriptExecutor } from '../../ports/executors/script-executor.interface';
|
|
16
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
17
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
18
|
-
import { ExecuteRequestInput } from '../dto/request-dtos';
|
|
19
|
-
import { ExecuteRequestOutput } from '../dto/response-dtos';
|
|
20
|
-
/**
|
|
21
|
-
* Options for request execution (backward compat alias)
|
|
22
|
-
*/
|
|
23
|
-
export type ExecuteRequestOptions = ExecuteRequestInput;
|
|
24
|
-
/**
|
|
25
|
-
* Use Case: Execute a request
|
|
26
|
-
*
|
|
27
|
-
* This is the main business workflow
|
|
28
|
-
*/
|
|
29
|
-
export declare class ExecuteRequestUseCase {
|
|
30
|
-
private requestRepository;
|
|
31
|
-
private environmentRepository;
|
|
32
|
-
private httpExecutor;
|
|
33
|
-
private scriptExecutor;
|
|
34
|
-
private eventPublisher;
|
|
35
|
-
private logger;
|
|
36
|
-
private planner;
|
|
37
|
-
constructor(requestRepository: IRequestRepository, environmentRepository: IEnvironmentRepository, httpExecutor: IHttpExecutor, scriptExecutor: IScriptExecutor, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
38
|
-
/**
|
|
39
|
-
* Execute a request from a collection
|
|
40
|
-
*/
|
|
41
|
-
execute(options: ExecuteRequestInput): Promise<ExecuteRequestOutput>;
|
|
42
|
-
/**
|
|
43
|
-
* Determine overall execution status
|
|
44
|
-
*/
|
|
45
|
-
private determineStatus;
|
|
46
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Export Collection Use Case
|
|
3
|
-
*/
|
|
4
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
5
|
-
import { IFileSystem } from '../../ports/external/file-system.interface';
|
|
6
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
7
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
8
|
-
import { ExportCollectionInput } from '../dto/request-dtos';
|
|
9
|
-
import { ExportCollectionOutput } from '../dto/response-dtos';
|
|
10
|
-
export type { ExportCollectionInput } from '../dto/request-dtos';
|
|
11
|
-
export declare class ExportCollectionUseCase {
|
|
12
|
-
private collectionRepository;
|
|
13
|
-
private fileSystem;
|
|
14
|
-
private eventPublisher;
|
|
15
|
-
private logger;
|
|
16
|
-
constructor(collectionRepository: ICollectionRepository, fileSystem: IFileSystem, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
17
|
-
execute(input: ExportCollectionInput): Promise<ExportCollectionOutput>;
|
|
18
|
-
private toPostman;
|
|
19
|
-
private toOpenAPI;
|
|
20
|
-
private convertItems;
|
|
21
|
-
private extractPaths;
|
|
22
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get Collection Use Case
|
|
3
|
-
*/
|
|
4
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
5
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
6
|
-
import { GetCollectionInput } from '../dto/request-dtos';
|
|
7
|
-
import { GetCollectionOutput } from '../dto/response-dtos';
|
|
8
|
-
export declare class GetCollectionUseCase {
|
|
9
|
-
private collectionRepository;
|
|
10
|
-
private logger;
|
|
11
|
-
constructor(collectionRepository: ICollectionRepository, logger: ILogger);
|
|
12
|
-
execute(input: GetCollectionInput): Promise<GetCollectionOutput>;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application Use Cases
|
|
3
|
-
*/
|
|
4
|
-
export * from './execute-request.use-case';
|
|
5
|
-
export * from './load-collection.use-case';
|
|
6
|
-
export * from './save-collection.use-case';
|
|
7
|
-
export * from './create-request.use-case';
|
|
8
|
-
export * from './update-request.use-case';
|
|
9
|
-
export * from './delete-request.use-case';
|
|
10
|
-
export * from './list-requests.use-case';
|
|
11
|
-
export * from './get-collection.use-case';
|
|
12
|
-
export * from './export-collection.use-case';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List Requests Use Case
|
|
3
|
-
*/
|
|
4
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
5
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
6
|
-
import { ListRequestsInput } from '../dto/request-dtos';
|
|
7
|
-
import { ListRequestsOutput } from '../dto/response-dtos';
|
|
8
|
-
export declare class ListRequestsUseCase {
|
|
9
|
-
private collectionRepository;
|
|
10
|
-
private logger;
|
|
11
|
-
constructor(collectionRepository: ICollectionRepository, logger: ILogger);
|
|
12
|
-
execute(input: ListRequestsInput): Promise<ListRequestsOutput>;
|
|
13
|
-
private collectRequests;
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load Collection Use Case
|
|
3
|
-
*
|
|
4
|
-
* Loads a collection from file and parses it
|
|
5
|
-
* Returns FULL collection with ALL metadata preserved (headers, query, scripts, etc.)
|
|
6
|
-
*/
|
|
7
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
8
|
-
import { IFileSystem } from '../../ports/external/file-system.interface';
|
|
9
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
10
|
-
import { ICollectionParser } from '../../ports/parsers/collection-parser.interface';
|
|
11
|
-
import { LoadCollectionInput } from '../dto/request-dtos';
|
|
12
|
-
import { LoadCollectionOutput } from '../dto/response-dtos';
|
|
13
|
-
/**
|
|
14
|
-
* Use Case: Load collection from file
|
|
15
|
-
*/
|
|
16
|
-
export declare class LoadCollectionUseCase {
|
|
17
|
-
private fileSystem;
|
|
18
|
-
private collectionParser;
|
|
19
|
-
private eventPublisher;
|
|
20
|
-
private logger;
|
|
21
|
-
constructor(fileSystem: IFileSystem, collectionParser: ICollectionParser, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
22
|
-
/**
|
|
23
|
-
* Load collection from file path
|
|
24
|
-
*/
|
|
25
|
-
execute(input: LoadCollectionInput): Promise<LoadCollectionOutput>;
|
|
26
|
-
/**
|
|
27
|
-
* Count total requests recursively
|
|
28
|
-
*/
|
|
29
|
-
private countRequests;
|
|
30
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Save Collection Use Case
|
|
3
|
-
*
|
|
4
|
-
* Saves a collection to file
|
|
5
|
-
*/
|
|
6
|
-
import { IFileSystem } from '../../ports/external/file-system.interface';
|
|
7
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
8
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
9
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
10
|
-
import { SaveCollectionInput } from '../dto/request-dtos';
|
|
11
|
-
import { SaveCollectionOutput } from '../dto/response-dtos';
|
|
12
|
-
/**
|
|
13
|
-
* Use Case: Save collection to file
|
|
14
|
-
*/
|
|
15
|
-
export declare class SaveCollectionUseCase {
|
|
16
|
-
private fileSystem;
|
|
17
|
-
private collectionRepository;
|
|
18
|
-
private eventPublisher;
|
|
19
|
-
private logger;
|
|
20
|
-
constructor(fileSystem: IFileSystem, collectionRepository: ICollectionRepository, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
21
|
-
/**
|
|
22
|
-
* Save collection to file
|
|
23
|
-
*/
|
|
24
|
-
execute(input: SaveCollectionInput): Promise<SaveCollectionOutput>;
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Update Request Use Case
|
|
3
|
-
* Supports updating all request fields including enabled/disabled headers and schemas
|
|
4
|
-
*/
|
|
5
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
6
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
7
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
8
|
-
import { UpdateRequestInput } from '../dto/request-dtos';
|
|
9
|
-
import { UpdateRequestOutput } from '../dto/response-dtos';
|
|
10
|
-
export type { UpdateRequestInput } from '../dto/request-dtos';
|
|
11
|
-
export declare class UpdateRequestUseCase {
|
|
12
|
-
private collectionRepository;
|
|
13
|
-
private eventPublisher;
|
|
14
|
-
private logger;
|
|
15
|
-
constructor(collectionRepository: ICollectionRepository, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
16
|
-
execute(input: UpdateRequestInput): Promise<UpdateRequestOutput>;
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Errors - Business-specific exceptions
|
|
3
|
-
*
|
|
4
|
-
* Use these instead of generic Error for domain-level problems
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Base domain error
|
|
8
|
-
*/
|
|
9
|
-
export declare class DomainError extends Error {
|
|
10
|
-
readonly code: string;
|
|
11
|
-
readonly message: string;
|
|
12
|
-
readonly details?: Record<string, any> | undefined;
|
|
13
|
-
constructor(code: string, message: string, details?: Record<string, any> | undefined);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Collection not found
|
|
17
|
-
*/
|
|
18
|
-
export declare class CollectionNotFoundError extends DomainError {
|
|
19
|
-
constructor(collectionId: string);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Request not found
|
|
23
|
-
*/
|
|
24
|
-
export declare class RequestNotFoundError extends DomainError {
|
|
25
|
-
constructor(requestId: string);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Invalid request - validation failed
|
|
29
|
-
*/
|
|
30
|
-
export declare class InvalidRequestError extends DomainError {
|
|
31
|
-
constructor(message: string);
|
|
32
|
-
constructor(requestId: string, reason: string);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Execution failed - HTTP or script error
|
|
36
|
-
*/
|
|
37
|
-
export declare class ExecutionError extends DomainError {
|
|
38
|
-
readonly originalError?: Error | undefined;
|
|
39
|
-
constructor(requestId: string, reason: string, originalError?: Error | undefined);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Script error - pre/post script failed
|
|
43
|
-
*/
|
|
44
|
-
export declare class ScriptExecutionError extends DomainError {
|
|
45
|
-
constructor(requestId: string, stage: 'pre' | 'post', reason: string);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Variable interpolation failed
|
|
49
|
-
*/
|
|
50
|
-
export declare class VariableResolutionError extends DomainError {
|
|
51
|
-
constructor(variableName: string, reason: string);
|
|
52
|
-
}
|
package/dist/domain/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Layer - Business logic (Clean Architecture)
|
|
3
|
-
*
|
|
4
|
-
* Contains:
|
|
5
|
-
* - Domain models (pure data structures)
|
|
6
|
-
* - Domain services (pure business logic)
|
|
7
|
-
* - Domain errors (business exceptions)
|
|
8
|
-
* - Domain events (event publishing)
|
|
9
|
-
*
|
|
10
|
-
* Constraints:
|
|
11
|
-
* - ZERO external dependencies
|
|
12
|
-
* - NO platform-specific code
|
|
13
|
-
* - NO persistence concerns
|
|
14
|
-
* - Fully testable without mocks
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* - Imported by application layer
|
|
18
|
-
* - Used for business rule validation
|
|
19
|
-
* - Should be framework-agnostic
|
|
20
|
-
*/
|
|
21
|
-
export * from './models';
|
|
22
|
-
export * from './services';
|
|
23
|
-
export * from './errors';
|
|
24
|
-
export * from './value-objects';
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution Domain Models - Core execution data structures
|
|
3
|
-
*
|
|
4
|
-
* These are pure domain models independent of storage or UI concerns
|
|
5
|
-
*/
|
|
6
|
-
import { HttpRequest, HttpResponse } from '../../types/types';
|
|
7
|
-
/**
|
|
8
|
-
* Execution context - captures state during request execution
|
|
9
|
-
*/
|
|
10
|
-
export interface IExecutionContext {
|
|
11
|
-
requestId: string;
|
|
12
|
-
collectionId: string;
|
|
13
|
-
variables: Record<string, any>;
|
|
14
|
-
environment: Record<string, any>;
|
|
15
|
-
cookies: Record<string, string>;
|
|
16
|
-
metadata?: {
|
|
17
|
-
userId?: string;
|
|
18
|
-
timestamp?: Date;
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Execution plan - describes how to execute a request
|
|
24
|
-
*/
|
|
25
|
-
export interface IExecutionPlan {
|
|
26
|
-
requestId: string;
|
|
27
|
-
request: HttpRequest;
|
|
28
|
-
preScripts?: string[];
|
|
29
|
-
postScripts?: string[];
|
|
30
|
-
scripts?: {
|
|
31
|
-
preRequest?: string;
|
|
32
|
-
postResponse?: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Execution result - outcome of request execution
|
|
37
|
-
*/
|
|
38
|
-
export interface IExecutionResult {
|
|
39
|
-
/** Request ID */
|
|
40
|
-
requestId: string;
|
|
41
|
-
/** HTTP response */
|
|
42
|
-
response: HttpResponse;
|
|
43
|
-
/** Execution time (ms) */
|
|
44
|
-
duration: number;
|
|
45
|
-
/** Pre-request script result */
|
|
46
|
-
preScriptResult?: {
|
|
47
|
-
success: boolean;
|
|
48
|
-
output: any;
|
|
49
|
-
errors: string[];
|
|
50
|
-
};
|
|
51
|
-
/** Post-response script result */
|
|
52
|
-
postScriptResult?: {
|
|
53
|
-
success: boolean;
|
|
54
|
-
output: any;
|
|
55
|
-
errors: string[];
|
|
56
|
-
assertions?: AssertionResult[];
|
|
57
|
-
};
|
|
58
|
-
/** Variable changes during execution */
|
|
59
|
-
variableChanges?: Record<string, any>;
|
|
60
|
-
/** Execution status */
|
|
61
|
-
status: 'success' | 'failed' | 'partial';
|
|
62
|
-
/** Error message if execution failed */
|
|
63
|
-
error?: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Test assertion result
|
|
67
|
-
*/
|
|
68
|
-
export interface AssertionResult {
|
|
69
|
-
name: string;
|
|
70
|
-
passed: boolean;
|
|
71
|
-
expected: any;
|
|
72
|
-
actual: any;
|
|
73
|
-
message?: string;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Execution metrics
|
|
77
|
-
*/
|
|
78
|
-
export interface IExecutionMetrics {
|
|
79
|
-
requestId: string;
|
|
80
|
-
duration: number;
|
|
81
|
-
httpStatus: number;
|
|
82
|
-
success: boolean;
|
|
83
|
-
timestamp: Date;
|
|
84
|
-
size?: {
|
|
85
|
-
requestBytes?: number;
|
|
86
|
-
responseBytes?: number;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Events - Events published by domain to application layer
|
|
3
|
-
*
|
|
4
|
-
* Domain events decouple domain logic from side effects
|
|
5
|
-
*/
|
|
6
|
-
import { IExecutionResult } from '../models/execution';
|
|
7
|
-
/**
|
|
8
|
-
* Base domain event
|
|
9
|
-
*/
|
|
10
|
-
export declare abstract class DomainEvent {
|
|
11
|
-
readonly aggregateId: string;
|
|
12
|
-
readonly eventType: string;
|
|
13
|
-
readonly occurredAt: Date;
|
|
14
|
-
constructor(aggregateId: string, eventType: string);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* RequestExecuted - Published when a request is successfully executed
|
|
18
|
-
*/
|
|
19
|
-
export declare class RequestExecutedEvent extends DomainEvent {
|
|
20
|
-
readonly collectionId: string;
|
|
21
|
-
readonly result: IExecutionResult;
|
|
22
|
-
constructor(requestId: string, collectionId: string, result: IExecutionResult);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* RequestExecutionFailed - Published when request execution fails
|
|
26
|
-
*/
|
|
27
|
-
export declare class RequestExecutionFailedEvent extends DomainEvent {
|
|
28
|
-
readonly collectionId: string;
|
|
29
|
-
readonly error: Error;
|
|
30
|
-
readonly stage: 'preparation' | 'execution' | 'script';
|
|
31
|
-
constructor(requestId: string, collectionId: string, error: Error, stage: 'preparation' | 'execution' | 'script');
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* VariableUpdated - Published when execution changes variables
|
|
35
|
-
*/
|
|
36
|
-
export declare class VariableUpdatedEvent extends DomainEvent {
|
|
37
|
-
readonly variables: Record<string, any>;
|
|
38
|
-
readonly changes: Record<string, any>;
|
|
39
|
-
constructor(variables: Record<string, any>, changes: Record<string, any>);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* CookieUpdated - Published when HTTP response sets cookies
|
|
43
|
-
*/
|
|
44
|
-
export declare class CookieUpdatedEvent extends DomainEvent {
|
|
45
|
-
readonly cookies: Record<string, string>;
|
|
46
|
-
constructor(cookies: Record<string, string>);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Domain event publisher abstraction
|
|
50
|
-
*/
|
|
51
|
-
export interface IDomainEventPublisher {
|
|
52
|
-
/**
|
|
53
|
-
* Publish domain event
|
|
54
|
-
*/
|
|
55
|
-
publish(event: DomainEvent): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Subscribe to events
|
|
58
|
-
*/
|
|
59
|
-
subscribe(eventType: string, handler: (event: DomainEvent) => Promise<void>): void;
|
|
60
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution Planner Domain Service - Pure business logic for execution planning
|
|
3
|
-
*
|
|
4
|
-
* No external dependencies - only domain models and exceptions
|
|
5
|
-
* All logic is deterministic and testable without mocks
|
|
6
|
-
*/
|
|
7
|
-
import { UnifiedRequest } from '../../types/types';
|
|
8
|
-
import { IExecutionContext, IExecutionPlan } from '../models/execution';
|
|
9
|
-
/**
|
|
10
|
-
* Domain service for planning HTTP request execution
|
|
11
|
-
* Encapsulates rules for:
|
|
12
|
-
* - Request validation
|
|
13
|
-
* - Script preparation
|
|
14
|
-
* - Variable interpolation
|
|
15
|
-
*/
|
|
16
|
-
export declare class ExecutionPlannerDomainService {
|
|
17
|
-
/**
|
|
18
|
-
* Validate request before execution
|
|
19
|
-
*/
|
|
20
|
-
validateRequest(request: UnifiedRequest): void;
|
|
21
|
-
/**
|
|
22
|
-
* Create execution plan from request and context
|
|
23
|
-
*
|
|
24
|
-
* Pure logic - no side effects
|
|
25
|
-
*/
|
|
26
|
-
createExecutionPlan(request: UnifiedRequest, context: IExecutionContext): IExecutionPlan;
|
|
27
|
-
/**
|
|
28
|
-
* Check if request requires script execution
|
|
29
|
-
*/
|
|
30
|
-
hasScripts(request: UnifiedRequest): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Check if request requires variable interpolation
|
|
33
|
-
*/
|
|
34
|
-
needsVariableInterpolation(request: UnifiedRequest): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Build execution context from request and environment
|
|
37
|
-
*/
|
|
38
|
-
buildExecutionContext(requestId: string, collectionId: string, variables: Record<string, any>, environment: Record<string, any>, cookies?: Record<string, string>): IExecutionContext;
|
|
39
|
-
private kvArrayToRecord;
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Services - Pure business logic
|
|
3
|
-
*
|
|
4
|
-
* Services contain only domain rules, no infrastructure concerns
|
|
5
|
-
* Zero external dependencies - fully testable without mocks
|
|
6
|
-
*/
|
|
7
|
-
export * from './execution-planner.domain-service';
|
|
8
|
-
export * from './schema-inference.domain-service';
|
|
9
|
-
export * from './domain-events';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema Inference Domain Service - Pure business logic for schema analysis
|
|
3
|
-
*
|
|
4
|
-
* Merges information from multiple sources to infer response schema
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Response schema representation
|
|
8
|
-
*/
|
|
9
|
-
export interface ResponseSchema {
|
|
10
|
-
type?: string;
|
|
11
|
-
properties?: Record<string, unknown>;
|
|
12
|
-
required?: string[];
|
|
13
|
-
description?: string;
|
|
14
|
-
example?: unknown;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Script hints extracted from post-response script
|
|
18
|
-
*/
|
|
19
|
-
export interface ScriptHints {
|
|
20
|
-
propertyAccess: string[];
|
|
21
|
-
assertions: string[];
|
|
22
|
-
dataExtracted: string[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Schema validation result
|
|
26
|
-
*/
|
|
27
|
-
export interface ValidationResult {
|
|
28
|
-
valid: boolean;
|
|
29
|
-
errors: string[];
|
|
30
|
-
warnings: string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Domain service for schema inference
|
|
34
|
-
* Pure logic for merging and validating schemas
|
|
35
|
-
*/
|
|
36
|
-
export declare class SchemaInferenceDomainService {
|
|
37
|
-
/**
|
|
38
|
-
* Merge multiple schemas into a final schema
|
|
39
|
-
* Priority: user-edited > inferred from history > script hints
|
|
40
|
-
*/
|
|
41
|
-
mergeResponseSchemas(userEdited: ResponseSchema | null, inferredFromHistory: ResponseSchema | null, scriptHints: ScriptHints | null): ResponseSchema;
|
|
42
|
-
/**
|
|
43
|
-
* Validate schema is well-formed
|
|
44
|
-
*/
|
|
45
|
-
validateSchema(schema: ResponseSchema): ValidationResult;
|
|
46
|
-
/**
|
|
47
|
-
* Extract property hints from script accesses
|
|
48
|
-
*/
|
|
49
|
-
private buildPropertiesFromHints;
|
|
50
|
-
/**
|
|
51
|
-
* Merge two schemas using set union logic
|
|
52
|
-
*/
|
|
53
|
-
private mergeSchemas;
|
|
54
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EntityId Value Object
|
|
3
|
-
*
|
|
4
|
-
* Base class for typed entity identifiers (RequestId, CollectionId).
|
|
5
|
-
* Prevents accidentally passing a collection ID where a request ID is expected.
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class EntityId {
|
|
8
|
-
readonly value: string;
|
|
9
|
-
constructor(value: string);
|
|
10
|
-
equals(other: EntityId): boolean;
|
|
11
|
-
toString(): string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* RequestId — uniquely identifies a request within a collection
|
|
15
|
-
*/
|
|
16
|
-
export declare class RequestId extends EntityId {
|
|
17
|
-
static create(id: string): RequestId;
|
|
18
|
-
static generate(): RequestId;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* CollectionId — uniquely identifies a collection
|
|
22
|
-
*/
|
|
23
|
-
export declare class CollectionId extends EntityId {
|
|
24
|
-
static create(id: string): CollectionId;
|
|
25
|
-
static generate(): CollectionId;
|
|
26
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HttpMethod Value Object
|
|
3
|
-
*
|
|
4
|
-
* Ensures only valid HTTP methods are used throughout the domain.
|
|
5
|
-
* Immutable — validated at construction time.
|
|
6
|
-
*/
|
|
7
|
-
declare const VALID_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT"];
|
|
8
|
-
export type HttpMethodValue = typeof VALID_METHODS[number];
|
|
9
|
-
export declare class HttpMethod {
|
|
10
|
-
readonly value: HttpMethodValue;
|
|
11
|
-
private constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Create an HttpMethod from a string.
|
|
14
|
-
* Normalizes to uppercase and validates.
|
|
15
|
-
*/
|
|
16
|
-
static create(method: string): HttpMethod;
|
|
17
|
-
/**
|
|
18
|
-
* Create without validation (for trusted internal data).
|
|
19
|
-
*/
|
|
20
|
-
static fromTrusted(method: HttpMethodValue): HttpMethod;
|
|
21
|
-
equals(other: HttpMethod): boolean;
|
|
22
|
-
toString(): string;
|
|
23
|
-
/** Whether this method typically has a request body */
|
|
24
|
-
get hasBody(): boolean;
|
|
25
|
-
/** Whether this method is considered safe (no side effects) */
|
|
26
|
-
get isSafe(): boolean;
|
|
27
|
-
/** Whether this method is idempotent */
|
|
28
|
-
get isIdempotent(): boolean;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Value Objects
|
|
3
|
-
*
|
|
4
|
-
* Immutable, validated building blocks for the domain model.
|
|
5
|
-
* These enforce business invariants at construction time.
|
|
6
|
-
*/
|
|
7
|
-
export { HttpMethod, type HttpMethodValue } from './http-method';
|
|
8
|
-
export { RequestUrl } from './request-url';
|
|
9
|
-
export { EntityId, RequestId, CollectionId } from './entity-id';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RequestUrl Value Object
|
|
3
|
-
*
|
|
4
|
-
* Validates and normalizes request URLs.
|
|
5
|
-
* Supports both absolute URLs and URL templates with variables (e.g. {{baseUrl}}/users).
|
|
6
|
-
*/
|
|
7
|
-
export declare class RequestUrl {
|
|
8
|
-
readonly value: string;
|
|
9
|
-
private constructor();
|
|
10
|
-
/**
|
|
11
|
-
* Create a RequestUrl from a string.
|
|
12
|
-
* Allows variable templates like {{baseUrl}}/path.
|
|
13
|
-
*/
|
|
14
|
-
static create(url: string): RequestUrl;
|
|
15
|
-
/**
|
|
16
|
-
* Create without validation (for trusted internal data).
|
|
17
|
-
*/
|
|
18
|
-
static fromTrusted(url: string): RequestUrl;
|
|
19
|
-
/** Whether the URL contains template variables */
|
|
20
|
-
get hasVariables(): boolean;
|
|
21
|
-
/** Extract variable names from the URL template */
|
|
22
|
-
get variableNames(): string[];
|
|
23
|
-
/** Get the protocol if present */
|
|
24
|
-
get protocol(): string | undefined;
|
|
25
|
-
equals(other: RequestUrl): boolean;
|
|
26
|
-
toString(): string;
|
|
27
|
-
private static isValidUrl;
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Console Logger Adapter - ILogger implementation
|
|
3
|
-
*/
|
|
4
|
-
import { ILogger, LogLevel } from '../../ports/external/logger.interface';
|
|
5
|
-
/**
|
|
6
|
-
* Simple console-based logger implementation
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConsoleLoggerAdapter implements ILogger {
|
|
9
|
-
private minLevel;
|
|
10
|
-
constructor(minLevel?: LogLevel);
|
|
11
|
-
debug(message: string, context?: Record<string, any>): void;
|
|
12
|
-
info(message: string, context?: Record<string, any>): void;
|
|
13
|
-
warn(message: string, context?: Record<string, any>): void;
|
|
14
|
-
error(message: string, error?: Error | Record<string, any>): void;
|
|
15
|
-
private canLog;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Silent logger - no output
|
|
19
|
-
*/
|
|
20
|
-
export declare class SilentLoggerAdapter implements ILogger {
|
|
21
|
-
debug(): void;
|
|
22
|
-
info(): void;
|
|
23
|
-
warn(): void;
|
|
24
|
-
error(): void;
|
|
25
|
-
}
|