@http-forge/core 0.2.1 → 0.2.2
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/dist/application/dto/index.d.ts +8 -0
- package/dist/application/dto/request-dtos.d.ts +105 -0
- package/dist/application/dto/response-dtos.d.ts +185 -0
- package/dist/application/events/application-events.d.ts +53 -0
- package/dist/application/events/index.d.ts +6 -0
- package/dist/application/index.d.ts +25 -0
- package/dist/application/mappers/collection-mapper.d.ts +39 -0
- package/dist/application/mappers/execution-result-mapper.d.ts +16 -0
- package/dist/application/mappers/index.d.ts +9 -0
- package/dist/application/mappers/request-mapper.d.ts +29 -0
- package/dist/application/queries/get-request-schema.query.d.ts +32 -0
- package/dist/application/queries/index.d.ts +6 -0
- package/dist/application/use-cases/create-request.use-case.d.ts +23 -0
- package/dist/application/use-cases/delete-request.use-case.d.ts +15 -0
- package/dist/application/use-cases/execute-request.use-case.d.ts +46 -0
- package/dist/application/use-cases/export-collection.use-case.d.ts +22 -0
- package/dist/application/use-cases/get-collection.use-case.d.ts +13 -0
- package/dist/application/use-cases/index.d.ts +12 -0
- package/dist/application/use-cases/list-requests.use-case.d.ts +14 -0
- package/dist/application/use-cases/load-collection.use-case.d.ts +30 -0
- package/dist/application/use-cases/save-collection.use-case.d.ts +25 -0
- package/dist/application/use-cases/update-request.use-case.d.ts +17 -0
- package/dist/container.d.ts +30 -13
- package/dist/di/index.d.ts +8 -0
- package/dist/di/platform-adapters.d.ts +14 -1
- package/dist/di/service-container.d.ts +12 -12
- package/dist/di/service-identifiers.d.ts +1 -1
- package/dist/domain/errors/domain-errors.d.ts +52 -0
- package/dist/domain/errors/index.d.ts +4 -0
- package/dist/domain/index.d.ts +24 -0
- package/dist/domain/models/execution.d.ts +88 -0
- package/dist/domain/models/index.d.ts +4 -0
- package/dist/domain/services/domain-events.d.ts +60 -0
- package/dist/domain/services/execution-planner.domain-service.d.ts +40 -0
- package/dist/domain/services/index.d.ts +9 -0
- package/dist/domain/services/schema-inference.domain-service.d.ts +54 -0
- package/dist/domain/value-objects/entity-id.d.ts +26 -0
- package/dist/domain/value-objects/http-method.d.ts +30 -0
- package/dist/domain/value-objects/index.d.ts +9 -0
- package/dist/domain/value-objects/request-url.d.ts +28 -0
- package/dist/index.d.ts +86 -86
- package/dist/index.js +110 -110
- package/dist/index.mjs +116 -116
- package/dist/infrastructure/adapters/index.d.ts +5 -0
- package/dist/infrastructure/adapters/logger.adapter.d.ts +25 -0
- package/dist/infrastructure/adapters/node-file-system.adapter.d.ts +18 -0
- package/dist/{auth → infrastructure/auth}/interfaces.d.ts +1 -1
- package/dist/{auth → infrastructure/auth}/oauth2-token-manager.d.ts +3 -3
- package/dist/{collection → infrastructure/collection}/collection-loader.d.ts +3 -3
- package/dist/{collection → infrastructure/collection}/collection-service.d.ts +2 -2
- package/dist/{collection → infrastructure/collection}/collection-store.d.ts +2 -2
- package/dist/{collection → infrastructure/collection}/folder-collection-loader.d.ts +2 -2
- package/dist/{collection → infrastructure/collection}/folder-collection-store.d.ts +1 -1
- package/dist/{collection → infrastructure/collection}/folder-io.d.ts +1 -1
- package/dist/{collection → infrastructure/collection}/json-collection-loader.d.ts +1 -1
- package/dist/{collection → infrastructure/collection}/parser-registry.d.ts +1 -1
- package/dist/{config → infrastructure/config}/config-service.d.ts +1 -1
- package/dist/{cookie → infrastructure/cookie}/cookie-service.d.ts +1 -1
- package/dist/infrastructure/di/complete-bootstrap.d.ts +24 -0
- package/dist/infrastructure/di/index.d.ts +6 -0
- package/dist/infrastructure/di/infrastructure-di-config.d.ts +33 -0
- package/dist/infrastructure/di/simple-event-publisher.d.ts +17 -0
- package/dist/{environment → infrastructure/environment}/environment-config-service.d.ts +2 -2
- package/dist/{environment → infrastructure/environment}/environment-resolver.d.ts +1 -1
- package/dist/{environment → infrastructure/environment}/forge-env.d.ts +1 -1
- package/dist/{environment → infrastructure/environment}/variable-interpolator.d.ts +1 -1
- package/dist/{execution → infrastructure/execution}/collection-request-executor-interfaces.d.ts +1 -1
- package/dist/{execution → infrastructure/execution}/collection-request-executor.d.ts +2 -2
- package/dist/{execution → infrastructure/execution}/request-executor.d.ts +2 -2
- package/dist/{execution → infrastructure/execution}/request-preparer-interfaces.d.ts +2 -2
- package/dist/{execution → infrastructure/execution}/request-preparer.d.ts +3 -3
- package/dist/{graphql → infrastructure/graphql}/graphql-schema-service.d.ts +1 -1
- package/dist/{history → infrastructure/history}/history-interfaces.d.ts +1 -1
- package/dist/{history → infrastructure/history}/request-history.d.ts +1 -1
- package/dist/{http → infrastructure/http}/fetch-http-client.d.ts +2 -2
- package/dist/{http → infrastructure/http}/http-request-service.d.ts +2 -2
- package/dist/infrastructure/http/index.d.ts +4 -0
- package/dist/{http → infrastructure/http}/interceptor-chain.d.ts +1 -1
- package/dist/{http → infrastructure/http}/interfaces.d.ts +1 -1
- package/dist/{http → infrastructure/http}/merge-request-settings.d.ts +1 -1
- package/dist/{http → infrastructure/http}/native-http-client.d.ts +2 -2
- package/dist/infrastructure/http/node-http-executor.adapter.d.ts +25 -0
- package/dist/{http → infrastructure/http}/request-preprocessor.d.ts +1 -1
- package/dist/{import-export → infrastructure/import-export}/import-postman-environment.d.ts +3 -3
- package/dist/{import-export → infrastructure/import-export}/rest-client-export.d.ts +3 -3
- package/dist/infrastructure/index.d.ts +31 -0
- package/dist/{openapi → infrastructure/openapi}/example-generator.d.ts +1 -1
- package/dist/{openapi → infrastructure/openapi}/history-analyzer.d.ts +1 -1
- package/dist/{openapi → infrastructure/openapi}/interfaces.d.ts +2 -2
- package/dist/{openapi → infrastructure/openapi}/openapi-exporter.d.ts +2 -2
- package/dist/{openapi → infrastructure/openapi}/openapi-importer.d.ts +2 -2
- package/dist/{openapi → infrastructure/openapi}/schema-inference-service.d.ts +1 -1
- package/dist/{openapi → infrastructure/openapi}/schema-inferrer.d.ts +1 -1
- package/dist/infrastructure/parsers/collection-parser.adapter.d.ts +32 -0
- package/dist/{parsers → infrastructure/parsers}/http-forge-parser.d.ts +2 -2
- package/dist/infrastructure/parsers/index.d.ts +7 -0
- package/dist/infrastructure/persistence/file-system-history-loader.d.ts +31 -0
- package/dist/infrastructure/persistence/index.d.ts +6 -0
- package/dist/{platform → infrastructure/platform}/node-file-system.d.ts +1 -1
- package/dist/infrastructure/repositories/file-system/fs-collection-repository.d.ts +72 -0
- package/dist/infrastructure/repositories/file-system/fs-environment-file-loader.adapter.d.ts +41 -0
- package/dist/infrastructure/repositories/file-system/fs-environment-repository.d.ts +34 -0
- package/dist/infrastructure/repositories/file-system/fs-request-repository.d.ts +31 -0
- package/dist/infrastructure/repositories/file-system/index.d.ts +7 -0
- package/dist/infrastructure/repositories/in-memory/in-memory-collection-repository.d.ts +18 -0
- package/dist/infrastructure/repositories/in-memory/in-memory-environment-repository.d.ts +25 -0
- package/dist/infrastructure/repositories/in-memory/in-memory-request-repository.d.ts +25 -0
- package/dist/infrastructure/repositories/in-memory/index.d.ts +7 -0
- package/dist/infrastructure/script/index.d.ts +4 -0
- package/dist/{script → infrastructure/script}/interfaces.d.ts +1 -1
- package/dist/{script → infrastructure/script}/script-utils.d.ts +1 -1
- package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +19 -0
- package/dist/{test-suite → infrastructure/test-suite}/result-storage-service.d.ts +1 -1
- package/dist/{test-suite → infrastructure/test-suite}/result-storage.d.ts +1 -1
- package/dist/{test-suite → infrastructure/test-suite}/test-suite-service.d.ts +1 -1
- package/dist/{test-suite → infrastructure/test-suite}/test-suite-store.d.ts +1 -1
- package/dist/ports/executors/http-executor.interface.d.ts +34 -0
- package/dist/ports/executors/index.d.ts +5 -0
- package/dist/ports/executors/script-executor.interface.d.ts +43 -0
- package/dist/ports/external/file-system.interface.d.ts +44 -0
- package/dist/ports/external/http-client.interface.d.ts +25 -0
- package/dist/ports/external/index.d.ts +7 -0
- package/dist/ports/external/logger.interface.d.ts +17 -0
- package/dist/ports/index.d.ts +17 -0
- package/dist/ports/parsers/collection-parser.interface.d.ts +23 -0
- package/dist/ports/parsers/index.d.ts +4 -0
- package/dist/ports/repositories/collection-repository.interface.d.ts +32 -0
- package/dist/ports/repositories/environment-repository.interface.d.ts +31 -0
- package/dist/ports/repositories/index.d.ts +6 -0
- package/dist/ports/repositories/request-repository.interface.d.ts +32 -0
- package/dist/ports/storage/cache-store.interface.d.ts +26 -0
- package/dist/ports/storage/history-loader.interface.d.ts +37 -0
- package/dist/ports/storage/index.d.ts +5 -0
- package/dist/{collection/collection-service-interfaces.d.ts → types/collection.d.ts} +19 -4
- package/dist/types/environment-config.d.ts +143 -0
- package/dist/types/types.d.ts +20 -7
- package/package.json +1 -1
- package/dist/collection/interfaces.d.ts +0 -32
- package/dist/parsers/index.d.ts +0 -6
- /package/dist/{collection → infrastructure/collection}/collection-loader-factory.d.ts +0 -0
- /package/dist/{config → infrastructure/config}/config.interface.d.ts +0 -0
- /package/dist/{config → infrastructure/config}/default-config.d.ts +0 -0
- /package/dist/{config → infrastructure/config}/index.d.ts +0 -0
- /package/dist/{cookie → infrastructure/cookie}/cookie-jar.d.ts +0 -0
- /package/dist/{cookie → infrastructure/cookie}/cookie-utils.d.ts +0 -0
- /package/dist/{cookie → infrastructure/cookie}/in-memory-cookie-jar.d.ts +0 -0
- /package/dist/{cookie → infrastructure/cookie}/interfaces.d.ts +0 -0
- /package/dist/{cookie → infrastructure/cookie}/persistent-cookie-jar.d.ts +0 -0
- /package/dist/{environment → infrastructure/environment}/environment-file-loader.d.ts +0 -0
- /package/dist/{environment → infrastructure/environment}/interfaces.d.ts +0 -0
- /package/dist/{graphql → infrastructure/graphql}/graphql-completion-provider.d.ts +0 -0
- /package/dist/{history → infrastructure/history}/request-history-service-interfaces.d.ts +0 -0
- /package/dist/{history → infrastructure/history}/request-history-service.d.ts +0 -0
- /package/dist/{http → infrastructure/http}/url-builder.d.ts +0 -0
- /package/dist/{openapi → infrastructure/openapi}/index.d.ts +0 -0
- /package/dist/{openapi → infrastructure/openapi}/ref-resolver.d.ts +0 -0
- /package/dist/{openapi → infrastructure/openapi}/script-analyzer.d.ts +0 -0
- /package/dist/{platform → infrastructure/platform}/data-file-parser.d.ts +0 -0
- /package/dist/{script → infrastructure/script}/module-loader.d.ts +0 -0
- /package/dist/{script → infrastructure/script}/request-script-session.d.ts +0 -0
- /package/dist/{script → infrastructure/script}/script-executor.d.ts +0 -0
- /package/dist/{script → infrastructure/script}/script-factories.d.ts +0 -0
- /package/dist/{test-suite → infrastructure/test-suite}/index.d.ts +0 -0
- /package/dist/{test-suite → infrastructure/test-suite}/interfaces.d.ts +0 -0
- /package/dist/{test-suite → infrastructure/test-suite}/statistics-service.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
package/dist/container.d.ts
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Forge Container - Dependency Injection Container
|
|
3
3
|
*
|
|
4
|
+
* ⚠️ @deprecated 此类用于向后兼容
|
|
5
|
+
* 新代码应使用 infrastructure/di/complete-bootstrap 中的 bootstrapComplete() 函数
|
|
6
|
+
*
|
|
7
|
+
* 向后兼容层:
|
|
8
|
+
* 此文件继续提供原有的 ForgeContainer 接口
|
|
9
|
+
* 内部实现现已迁移至三层架构 (Domain/Application/Infrastructure)
|
|
10
|
+
*
|
|
11
|
+
* 迁移指南:
|
|
12
|
+
* 旧代码:
|
|
13
|
+
* const container = new ForgeContainer(config);
|
|
14
|
+
*
|
|
15
|
+
* 新代码:
|
|
16
|
+
* import { ServiceContainer } from '@http-forge/core/di';
|
|
17
|
+
* import { bootstrapComplete } from '@http-forge/core/infrastructure/di';
|
|
18
|
+
*
|
|
19
|
+
* const container = new ServiceContainer();
|
|
20
|
+
* bootstrapComplete(container, { useFileSystem: true });
|
|
21
|
+
*
|
|
4
22
|
* Single Responsibility: Wire up all components with proper dependencies
|
|
5
23
|
* Factory Pattern: Creates configured instances of services
|
|
6
24
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { IScriptExecutor } from './script/interfaces';
|
|
25
|
+
import { ParserRegistry } from './infrastructure/collection/parser-registry';
|
|
26
|
+
import { ICookieService } from './infrastructure/cookie/interfaces';
|
|
27
|
+
import { EnvironmentResolver, EnvironmentStoreConfig } from './infrastructure/environment/environment-resolver';
|
|
28
|
+
import { ForgeEnv } from './infrastructure/environment/forge-env';
|
|
29
|
+
import { IVariableInterpolator } from './types/environment-config';
|
|
30
|
+
import { RequestExecutor } from './infrastructure/execution/request-executor';
|
|
31
|
+
import { IRequestHistory } from './infrastructure/history/history-interfaces';
|
|
32
|
+
import { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor } from './infrastructure/http/interceptor-chain';
|
|
33
|
+
import { IRequestPreprocessor } from './infrastructure/http/request-preprocessor';
|
|
34
|
+
import { IDataFileParser } from './infrastructure/platform/data-file-parser';
|
|
35
|
+
import { IScriptExecutor } from './infrastructure/script/interfaces';
|
|
19
36
|
import { IFileSystem, IHttpClient } from './types/platform';
|
|
20
37
|
import { HttpRequest, HttpResponse, RequestSettings, UnifiedCollection, UnifiedRequest } from './types/types';
|
|
21
38
|
/**
|
|
@@ -92,7 +109,7 @@ export declare class ForgeContainer {
|
|
|
92
109
|
readonly dataFileParser: IDataFileParser;
|
|
93
110
|
readonly requestHistory: IRequestHistory | null;
|
|
94
111
|
readonly parserRegistry: ParserRegistry;
|
|
95
|
-
readonly collectionLoader: ICollectionLoader;
|
|
112
|
+
readonly collectionLoader: import('./types/collection').ICollectionLoader;
|
|
96
113
|
readonly environmentStore: EnvironmentResolver;
|
|
97
114
|
readonly forgeEnv: ForgeEnv;
|
|
98
115
|
readonly requestExecutor: RequestExecutor;
|
package/dist/di/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dependency Injection
|
|
3
3
|
*
|
|
4
|
+
* ⚠️ @deprecated 此模块用于向后兼容
|
|
5
|
+
* 新代码应使用 infrastructure/di/complete-bootstrap 中的功能
|
|
6
|
+
*
|
|
4
7
|
* Provides a generic, platform-agnostic DI container and service bootstrap.
|
|
5
8
|
* Host environments (VS Code, CLI, etc.) only need to supply PlatformAdapters.
|
|
9
|
+
*
|
|
10
|
+
* 迁移指南:
|
|
11
|
+
* - 旧的 ServiceContainer 已被新的架构集成
|
|
12
|
+
* - 使用 bootstrapComplete() 替代 registerCoreServices()
|
|
13
|
+
* - 详见 ARCHITECTURE_IMPLEMENTATION.md
|
|
6
14
|
*/
|
|
7
15
|
export { registerCoreServices } from './core-bootstrap';
|
|
8
16
|
export type { PlatformAdapters } from './platform-adapters';
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
* without depending on any specific platform.
|
|
9
9
|
*/
|
|
10
10
|
import type { IConsoleService } from '../types/console-service';
|
|
11
|
-
import type { IApplicationInfo, IExternalBrowserService, IFileWatcherFactory, IKeyValueStore, INotificationService, ISecretStore } from '../types/platform';
|
|
11
|
+
import type { IApplicationInfo, IExternalBrowserService, IFileSystem, IFileWatcherFactory, IHttpClient, IKeyValueStore, INotificationService, ISecretStore } from '../types/platform';
|
|
12
|
+
import type { IHttpExecutor } from '../ports/executors/http-executor.interface';
|
|
13
|
+
import type { IScriptExecutor } from '../ports/executors/script-executor.interface';
|
|
14
|
+
import type { ILogger } from '../ports/external/logger.interface';
|
|
12
15
|
/**
|
|
13
16
|
* Platform adapters required by core service bootstrap.
|
|
14
17
|
*
|
|
@@ -50,4 +53,14 @@ export interface PlatformAdapters {
|
|
|
50
53
|
applicationInfo?: IApplicationInfo;
|
|
51
54
|
/** Structured logging service. Optional — a no-op console is used if absent. */
|
|
52
55
|
consoleService?: IConsoleService;
|
|
56
|
+
/** File system adapter */
|
|
57
|
+
fileSystem?: IFileSystem;
|
|
58
|
+
/** Logger adapter */
|
|
59
|
+
logger?: ILogger;
|
|
60
|
+
/** HTTP client adapter */
|
|
61
|
+
httpClient?: IHttpClient;
|
|
62
|
+
/** HTTP executor adapter */
|
|
63
|
+
httpExecutor?: IHttpExecutor;
|
|
64
|
+
/** Script executor adapter */
|
|
65
|
+
scriptExecutor?: IScriptExecutor;
|
|
53
66
|
}
|
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
* - Single Responsibility: Container only manages service lifecycle
|
|
10
10
|
* - Open/Closed: New services registered without modifying existing code
|
|
11
11
|
*/
|
|
12
|
-
import type { IAsyncCookieService } from '../cookie/interfaces';
|
|
13
|
-
import type { IRequestPreparer } from '../execution/request-preparer-interfaces';
|
|
14
|
-
import type { IRequestHistoryService } from '../history/request-history-service-interfaces';
|
|
15
|
-
import type { IHttpRequestService } from '../http/interfaces';
|
|
16
|
-
import type { IScriptExecutor } from '../script/interfaces';
|
|
12
|
+
import type { IAsyncCookieService } from '../infrastructure/cookie/interfaces';
|
|
13
|
+
import type { IRequestPreparer } from '../infrastructure/execution/request-preparer-interfaces';
|
|
14
|
+
import type { IRequestHistoryService } from '../infrastructure/history/request-history-service-interfaces';
|
|
15
|
+
import type { IHttpRequestService } from '../infrastructure/http/interfaces';
|
|
16
|
+
import type { IScriptExecutor } from '../infrastructure/script/interfaces';
|
|
17
17
|
import type { IConsoleService } from '../types/console-service';
|
|
18
18
|
import type { IHttpClient } from '../types/platform';
|
|
19
19
|
import type { ServiceIdentifier } from './service-identifiers';
|
|
20
|
-
import type { IOAuth2TokenManager } from '../auth/interfaces';
|
|
21
|
-
import type { ICollectionService } from '../
|
|
22
|
-
import type { IConfigService } from '../config';
|
|
23
|
-
import type { IEnvironmentConfigService } from '../environment
|
|
24
|
-
import type { IGraphQLSchemaService } from '../graphql/graphql-schema-service';
|
|
25
|
-
import type { IDataFileParser } from '../platform/data-file-parser';
|
|
26
|
-
import type { ICookieJar } from '../script/interfaces';
|
|
20
|
+
import type { IOAuth2TokenManager } from '../infrastructure/auth/interfaces';
|
|
21
|
+
import type { ICollectionService } from '../types/collection';
|
|
22
|
+
import type { IConfigService } from '../infrastructure/config';
|
|
23
|
+
import type { IEnvironmentConfigService } from '../types/environment-config';
|
|
24
|
+
import type { IGraphQLSchemaService } from '../infrastructure/graphql/graphql-schema-service';
|
|
25
|
+
import type { IDataFileParser } from '../infrastructure/platform/data-file-parser';
|
|
26
|
+
import type { ICookieJar } from '../infrastructure/script/interfaces';
|
|
27
27
|
/**
|
|
28
28
|
* Factory function type for creating services
|
|
29
29
|
*/
|
|
@@ -31,4 +31,4 @@ export declare const ServiceIdentifiers: {
|
|
|
31
31
|
readonly OpenApiExporter: symbol;
|
|
32
32
|
readonly OpenApiImporter: symbol;
|
|
33
33
|
};
|
|
34
|
-
export type ServiceIdentifier = typeof ServiceIdentifiers[keyof typeof ServiceIdentifiers];
|
|
34
|
+
export type ServiceIdentifier = typeof ServiceIdentifiers[keyof typeof ServiceIdentifiers] | string;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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';
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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';
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,9 @@
|
|
|
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';
|