@http-forge/core 0.2.1 → 0.2.3

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.
Files changed (165) hide show
  1. package/dist/application/dto/index.d.ts +8 -0
  2. package/dist/application/dto/request-dtos.d.ts +105 -0
  3. package/dist/application/dto/response-dtos.d.ts +185 -0
  4. package/dist/application/events/application-events.d.ts +53 -0
  5. package/dist/application/events/index.d.ts +6 -0
  6. package/dist/application/index.d.ts +25 -0
  7. package/dist/application/mappers/collection-mapper.d.ts +39 -0
  8. package/dist/application/mappers/execution-result-mapper.d.ts +16 -0
  9. package/dist/application/mappers/index.d.ts +9 -0
  10. package/dist/application/mappers/request-mapper.d.ts +29 -0
  11. package/dist/application/queries/get-request-schema.query.d.ts +32 -0
  12. package/dist/application/queries/index.d.ts +6 -0
  13. package/dist/application/use-cases/create-request.use-case.d.ts +23 -0
  14. package/dist/application/use-cases/delete-request.use-case.d.ts +15 -0
  15. package/dist/application/use-cases/execute-request.use-case.d.ts +46 -0
  16. package/dist/application/use-cases/export-collection.use-case.d.ts +22 -0
  17. package/dist/application/use-cases/get-collection.use-case.d.ts +13 -0
  18. package/dist/application/use-cases/index.d.ts +12 -0
  19. package/dist/application/use-cases/list-requests.use-case.d.ts +14 -0
  20. package/dist/application/use-cases/load-collection.use-case.d.ts +30 -0
  21. package/dist/application/use-cases/save-collection.use-case.d.ts +25 -0
  22. package/dist/application/use-cases/update-request.use-case.d.ts +17 -0
  23. package/dist/container.d.ts +30 -13
  24. package/dist/di/index.d.ts +8 -0
  25. package/dist/di/platform-adapters.d.ts +14 -1
  26. package/dist/di/service-container.d.ts +12 -12
  27. package/dist/di/service-identifiers.d.ts +1 -1
  28. package/dist/domain/errors/domain-errors.d.ts +52 -0
  29. package/dist/domain/errors/index.d.ts +4 -0
  30. package/dist/domain/index.d.ts +24 -0
  31. package/dist/domain/models/execution.d.ts +88 -0
  32. package/dist/domain/models/index.d.ts +4 -0
  33. package/dist/domain/services/domain-events.d.ts +60 -0
  34. package/dist/domain/services/execution-planner.domain-service.d.ts +40 -0
  35. package/dist/domain/services/index.d.ts +9 -0
  36. package/dist/domain/services/schema-inference.domain-service.d.ts +54 -0
  37. package/dist/domain/value-objects/entity-id.d.ts +26 -0
  38. package/dist/domain/value-objects/http-method.d.ts +30 -0
  39. package/dist/domain/value-objects/index.d.ts +9 -0
  40. package/dist/domain/value-objects/request-url.d.ts +28 -0
  41. package/dist/index.d.ts +86 -86
  42. package/dist/index.js +111 -111
  43. package/dist/index.mjs +117 -117
  44. package/dist/infrastructure/adapters/index.d.ts +5 -0
  45. package/dist/infrastructure/adapters/logger.adapter.d.ts +25 -0
  46. package/dist/infrastructure/adapters/node-file-system.adapter.d.ts +18 -0
  47. package/dist/{auth → infrastructure/auth}/interfaces.d.ts +1 -1
  48. package/dist/{auth → infrastructure/auth}/oauth2-token-manager.d.ts +3 -3
  49. package/dist/{collection → infrastructure/collection}/collection-loader.d.ts +3 -3
  50. package/dist/{collection → infrastructure/collection}/collection-service.d.ts +2 -2
  51. package/dist/{collection → infrastructure/collection}/collection-store.d.ts +2 -2
  52. package/dist/{collection → infrastructure/collection}/folder-collection-loader.d.ts +2 -2
  53. package/dist/{collection → infrastructure/collection}/folder-collection-store.d.ts +1 -1
  54. package/dist/{collection → infrastructure/collection}/folder-io.d.ts +1 -1
  55. package/dist/{collection → infrastructure/collection}/json-collection-loader.d.ts +1 -1
  56. package/dist/{collection → infrastructure/collection}/parser-registry.d.ts +1 -1
  57. package/dist/{config → infrastructure/config}/config-service.d.ts +1 -1
  58. package/dist/{cookie → infrastructure/cookie}/cookie-service.d.ts +1 -1
  59. package/dist/infrastructure/di/complete-bootstrap.d.ts +24 -0
  60. package/dist/infrastructure/di/index.d.ts +6 -0
  61. package/dist/infrastructure/di/infrastructure-di-config.d.ts +33 -0
  62. package/dist/infrastructure/di/simple-event-publisher.d.ts +17 -0
  63. package/dist/{environment → infrastructure/environment}/environment-config-service.d.ts +2 -2
  64. package/dist/{environment → infrastructure/environment}/environment-resolver.d.ts +1 -1
  65. package/dist/{environment → infrastructure/environment}/forge-env.d.ts +1 -1
  66. package/dist/{environment → infrastructure/environment}/variable-interpolator.d.ts +1 -1
  67. package/dist/{execution → infrastructure/execution}/collection-request-executor-interfaces.d.ts +1 -1
  68. package/dist/{execution → infrastructure/execution}/collection-request-executor.d.ts +2 -2
  69. package/dist/{execution → infrastructure/execution}/request-executor.d.ts +2 -2
  70. package/dist/{execution → infrastructure/execution}/request-preparer-interfaces.d.ts +2 -2
  71. package/dist/{execution → infrastructure/execution}/request-preparer.d.ts +3 -3
  72. package/dist/{graphql → infrastructure/graphql}/graphql-schema-service.d.ts +1 -1
  73. package/dist/{history → infrastructure/history}/history-interfaces.d.ts +1 -1
  74. package/dist/{history → infrastructure/history}/request-history.d.ts +1 -1
  75. package/dist/{http → infrastructure/http}/fetch-http-client.d.ts +2 -2
  76. package/dist/{http → infrastructure/http}/http-request-service.d.ts +2 -2
  77. package/dist/infrastructure/http/index.d.ts +4 -0
  78. package/dist/{http → infrastructure/http}/interceptor-chain.d.ts +1 -1
  79. package/dist/{http → infrastructure/http}/interfaces.d.ts +1 -1
  80. package/dist/{http → infrastructure/http}/merge-request-settings.d.ts +1 -1
  81. package/dist/{http → infrastructure/http}/native-http-client.d.ts +2 -2
  82. package/dist/infrastructure/http/node-http-executor.adapter.d.ts +25 -0
  83. package/dist/{http → infrastructure/http}/request-preprocessor.d.ts +1 -1
  84. package/dist/{import-export → infrastructure/import-export}/import-postman-environment.d.ts +3 -3
  85. package/dist/{import-export → infrastructure/import-export}/rest-client-export.d.ts +3 -3
  86. package/dist/infrastructure/index.d.ts +31 -0
  87. package/dist/{openapi → infrastructure/openapi}/example-generator.d.ts +1 -1
  88. package/dist/{openapi → infrastructure/openapi}/history-analyzer.d.ts +1 -1
  89. package/dist/{openapi → infrastructure/openapi}/interfaces.d.ts +2 -2
  90. package/dist/{openapi → infrastructure/openapi}/openapi-exporter.d.ts +2 -2
  91. package/dist/{openapi → infrastructure/openapi}/openapi-importer.d.ts +2 -2
  92. package/dist/{openapi → infrastructure/openapi}/schema-inference-service.d.ts +1 -1
  93. package/dist/{openapi → infrastructure/openapi}/schema-inferrer.d.ts +1 -1
  94. package/dist/infrastructure/parsers/collection-parser.adapter.d.ts +32 -0
  95. package/dist/{parsers → infrastructure/parsers}/http-forge-parser.d.ts +2 -2
  96. package/dist/infrastructure/parsers/index.d.ts +7 -0
  97. package/dist/infrastructure/persistence/file-system-history-loader.d.ts +31 -0
  98. package/dist/infrastructure/persistence/index.d.ts +6 -0
  99. package/dist/{platform → infrastructure/platform}/node-file-system.d.ts +1 -1
  100. package/dist/infrastructure/repositories/file-system/fs-collection-repository.d.ts +72 -0
  101. package/dist/infrastructure/repositories/file-system/fs-environment-file-loader.adapter.d.ts +41 -0
  102. package/dist/infrastructure/repositories/file-system/fs-environment-repository.d.ts +34 -0
  103. package/dist/infrastructure/repositories/file-system/fs-request-repository.d.ts +31 -0
  104. package/dist/infrastructure/repositories/file-system/index.d.ts +7 -0
  105. package/dist/infrastructure/repositories/in-memory/in-memory-collection-repository.d.ts +18 -0
  106. package/dist/infrastructure/repositories/in-memory/in-memory-environment-repository.d.ts +25 -0
  107. package/dist/infrastructure/repositories/in-memory/in-memory-request-repository.d.ts +25 -0
  108. package/dist/infrastructure/repositories/in-memory/index.d.ts +7 -0
  109. package/dist/infrastructure/script/index.d.ts +4 -0
  110. package/dist/{script → infrastructure/script}/interfaces.d.ts +1 -1
  111. package/dist/{script → infrastructure/script}/script-utils.d.ts +1 -1
  112. package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +19 -0
  113. package/dist/{test-suite → infrastructure/test-suite}/result-storage-service.d.ts +1 -1
  114. package/dist/{test-suite → infrastructure/test-suite}/result-storage.d.ts +1 -1
  115. package/dist/{test-suite → infrastructure/test-suite}/test-suite-service.d.ts +1 -1
  116. package/dist/{test-suite → infrastructure/test-suite}/test-suite-store.d.ts +1 -1
  117. package/dist/ports/executors/http-executor.interface.d.ts +34 -0
  118. package/dist/ports/executors/index.d.ts +5 -0
  119. package/dist/ports/executors/script-executor.interface.d.ts +43 -0
  120. package/dist/ports/external/file-system.interface.d.ts +44 -0
  121. package/dist/ports/external/http-client.interface.d.ts +25 -0
  122. package/dist/ports/external/index.d.ts +7 -0
  123. package/dist/ports/external/logger.interface.d.ts +17 -0
  124. package/dist/ports/index.d.ts +17 -0
  125. package/dist/ports/parsers/collection-parser.interface.d.ts +23 -0
  126. package/dist/ports/parsers/index.d.ts +4 -0
  127. package/dist/ports/repositories/collection-repository.interface.d.ts +32 -0
  128. package/dist/ports/repositories/environment-repository.interface.d.ts +31 -0
  129. package/dist/ports/repositories/index.d.ts +6 -0
  130. package/dist/ports/repositories/request-repository.interface.d.ts +32 -0
  131. package/dist/ports/storage/cache-store.interface.d.ts +26 -0
  132. package/dist/ports/storage/history-loader.interface.d.ts +37 -0
  133. package/dist/ports/storage/index.d.ts +5 -0
  134. package/dist/{collection/collection-service-interfaces.d.ts → types/collection.d.ts} +19 -4
  135. package/dist/types/environment-config.d.ts +143 -0
  136. package/dist/types/types.d.ts +20 -7
  137. package/package.json +1 -1
  138. package/dist/collection/interfaces.d.ts +0 -32
  139. package/dist/parsers/index.d.ts +0 -6
  140. /package/dist/{collection → infrastructure/collection}/collection-loader-factory.d.ts +0 -0
  141. /package/dist/{config → infrastructure/config}/config.interface.d.ts +0 -0
  142. /package/dist/{config → infrastructure/config}/default-config.d.ts +0 -0
  143. /package/dist/{config → infrastructure/config}/index.d.ts +0 -0
  144. /package/dist/{cookie → infrastructure/cookie}/cookie-jar.d.ts +0 -0
  145. /package/dist/{cookie → infrastructure/cookie}/cookie-utils.d.ts +0 -0
  146. /package/dist/{cookie → infrastructure/cookie}/in-memory-cookie-jar.d.ts +0 -0
  147. /package/dist/{cookie → infrastructure/cookie}/interfaces.d.ts +0 -0
  148. /package/dist/{cookie → infrastructure/cookie}/persistent-cookie-jar.d.ts +0 -0
  149. /package/dist/{environment → infrastructure/environment}/environment-file-loader.d.ts +0 -0
  150. /package/dist/{environment → infrastructure/environment}/interfaces.d.ts +0 -0
  151. /package/dist/{graphql → infrastructure/graphql}/graphql-completion-provider.d.ts +0 -0
  152. /package/dist/{history → infrastructure/history}/request-history-service-interfaces.d.ts +0 -0
  153. /package/dist/{history → infrastructure/history}/request-history-service.d.ts +0 -0
  154. /package/dist/{http → infrastructure/http}/url-builder.d.ts +0 -0
  155. /package/dist/{openapi → infrastructure/openapi}/index.d.ts +0 -0
  156. /package/dist/{openapi → infrastructure/openapi}/ref-resolver.d.ts +0 -0
  157. /package/dist/{openapi → infrastructure/openapi}/script-analyzer.d.ts +0 -0
  158. /package/dist/{platform → infrastructure/platform}/data-file-parser.d.ts +0 -0
  159. /package/dist/{script → infrastructure/script}/module-loader.d.ts +0 -0
  160. /package/dist/{script → infrastructure/script}/request-script-session.d.ts +0 -0
  161. /package/dist/{script → infrastructure/script}/script-executor.d.ts +0 -0
  162. /package/dist/{script → infrastructure/script}/script-factories.d.ts +0 -0
  163. /package/dist/{test-suite → infrastructure/test-suite}/index.d.ts +0 -0
  164. /package/dist/{test-suite → infrastructure/test-suite}/interfaces.d.ts +0 -0
  165. /package/dist/{test-suite → infrastructure/test-suite}/statistics-service.d.ts +0 -0
@@ -4,8 +4,8 @@
4
4
  * Generates a valid OpenAPI 3.0.3 document from an HTTP Forge collection.
5
5
  * Implements all mapping rules per the solution document §4.3.2.
6
6
  */
7
- import { ICollectionService } from '../collection/interfaces';
8
- import { IEnvironmentConfigService } from '../environment/interfaces';
7
+ import { ICollectionService } from '../../types/collection';
8
+ import { IEnvironmentConfigService } from '../../types/environment-config';
9
9
  import { SchemaInferenceService } from './schema-inference-service';
10
10
  export interface OpenApiExportOptions {
11
11
  format: 'json' | 'yaml';
@@ -4,8 +4,8 @@
4
4
  * Parses an OpenAPI 3.0 spec and creates a fully hydrated HTTP Forge collection.
5
5
  * Implements all mapping rules per the solution document §4.4.2.
6
6
  */
7
- import { Collection, ICollectionService } from '../collection/interfaces';
8
- import { IEnvironmentConfigService } from '../environment/interfaces';
7
+ import { Collection, ICollectionService } from '../../types/collection';
8
+ import { IEnvironmentConfigService } from '../../types/environment-config';
9
9
  export interface OpenApiImportOptions {
10
10
  /** Base environment name to create with server URL */
11
11
  environmentName?: string;
@@ -9,7 +9,7 @@
9
9
  * 2. History data — real response bodies provide the most accurate schemas
10
10
  * 3. Script hints — field paths and types from post-response scripts
11
11
  */
12
- import { BodySchemaDefinition, KeyValueEntry, ResponseSchemaDefinition } from '../types/types';
12
+ import { BodySchemaDefinition, KeyValueEntry, ResponseSchemaDefinition } from '../../types/types';
13
13
  import { HistoryAnalyzer } from './history-analyzer';
14
14
  import { SchemaInferrer } from './schema-inferrer';
15
15
  import { ScriptAnalyzer } from './script-analyzer';
@@ -4,7 +4,7 @@
4
4
  * Core utility that generates JSON Schema (OAS 3.0 compatible) from sample JSON values.
5
5
  * Supports recursive inference, format detection, schema merging, and nullable semantics.
6
6
  */
7
- import { JSONSchema7 } from '../types/types';
7
+ import { JSONSchema7 } from '../../types/types';
8
8
  export declare class SchemaInferrer {
9
9
  /**
10
10
  * Infer a JSON Schema from a sample value.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * HTTP Forge Collection Parser Adapter - Implements ICollectionParser
3
+ *
4
+ * Wraps existing HttpForgeParser to conform to the port interface
5
+ */
6
+ import { ICollectionParser } from '../../ports/parsers/collection-parser.interface';
7
+ import { UnifiedCollection } from '../../types/types';
8
+ /**
9
+ * Adapter that implements ICollectionParser for HTTP Forge format
10
+ */
11
+ export declare class HttpForgeCollectionParserAdapter implements ICollectionParser {
12
+ private parser;
13
+ get supportedFormats(): string[];
14
+ canHandle(content: string, format?: string): boolean;
15
+ parse(content: string): Promise<UnifiedCollection>;
16
+ }
17
+ /**
18
+ * Collection Parser Registry - Manages multiple parsers
19
+ *
20
+ * Implements ICollectionParser by delegating to registered parsers
21
+ */
22
+ export declare class CollectionParserRegistry implements ICollectionParser {
23
+ private parsers;
24
+ constructor(initialParsers?: ICollectionParser[]);
25
+ /**
26
+ * Register a parser
27
+ */
28
+ register(parser: ICollectionParser): void;
29
+ get supportedFormats(): string[];
30
+ canHandle(content: string, format?: string): boolean;
31
+ parse(content: string, format?: string): Promise<UnifiedCollection>;
32
+ }
@@ -4,8 +4,8 @@
4
4
  * Single Responsibility: Parse HTTP Forge collection format (.forge.json)
5
5
  * Dependency Inversion: Implements ICollectionParser interface
6
6
  */
7
- import { ICollectionParser } from '../collection/interfaces';
8
- import { UnifiedCollection } from '../types/types';
7
+ import { ICollectionParser } from '../../types/collection';
8
+ import { UnifiedCollection } from '../../types/types';
9
9
  /**
10
10
  * Parser for HTTP Forge native collection format
11
11
  */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Parser Infrastructure Implementations
3
+ *
4
+ * Collection format parsers for different formats
5
+ */
6
+ export * from './collection-parser.adapter';
7
+ export { HttpForgeParser } from './http-forge-parser';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * File System History Loader Implementation
3
+ *
4
+ * Implements IHistoryLoader using file-based storage
5
+ * Compatible with existing RequestHistoryService
6
+ */
7
+ import { IHistoryLoader, IHistoryEntry } from '../../ports/storage/history-loader.interface';
8
+ import { HttpResponse } from '../../types/types';
9
+ import { IFileSystem } from '../../ports/external/file-system.interface';
10
+ /**
11
+ * File system implementation of IHistoryLoader
12
+ * Stores execution history in timestamped files
13
+ */
14
+ export declare class FileSystemHistoryLoader implements IHistoryLoader {
15
+ private fileSystem;
16
+ private basePath;
17
+ private readonly historyDir;
18
+ private readonly manifestFile;
19
+ private readonly responseExt;
20
+ constructor(fileSystem: IFileSystem, basePath: string);
21
+ loadHistory(collectionId: string, requestId: string, options?: {
22
+ limit?: number;
23
+ offset?: number;
24
+ }): Promise<IHistoryEntry[]>;
25
+ loadFullResponse(collectionId: string, requestId: string, entryId: string): Promise<HttpResponse | null>;
26
+ saveEntry(collectionId: string, requestId: string, response: HttpResponse, duration: number): Promise<IHistoryEntry>;
27
+ /**
28
+ * Generate unique entry ID
29
+ */
30
+ private generateEntryId;
31
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Persistence Infrastructure Implementations
3
+ *
4
+ * Includes history storage, caching, and other persistence concerns
5
+ */
6
+ export * from './file-system-history-loader';
@@ -4,7 +4,7 @@
4
4
  * Single Responsibility: File operations using Node.js fs module
5
5
  * Dependency Inversion: Implements IFileSystem interface
6
6
  */
7
- import { IFileSystem } from '../types/platform';
7
+ import { IFileSystem } from '../../types/platform';
8
8
  /**
9
9
  * Node.js implementation of IFileSystem.
10
10
  * Uses Node.js fs/promises for all operations.
@@ -0,0 +1,72 @@
1
+ /**
2
+ * File System Collection Repository
3
+ *
4
+ * Implements ICollectionRepository using the FolderCollectionStore.
5
+ *
6
+ * Delegates to FolderCollectionStore for all disk operations,
7
+ * converting between UnifiedCollection (repository contract) and
8
+ * Collection (internal format).
9
+ *
10
+ * This ensures a single source of truth for folder-based storage
11
+ * while supporting both the legacy CollectionService and new use-case architecture.
12
+ */
13
+ import { ICollectionRepository } from '../../../ports/repositories/collection-repository.interface';
14
+ import { UnifiedCollection } from '../../../types/types';
15
+ /**
16
+ * File system collection repository implementation using FolderCollectionStore
17
+ */
18
+ export declare class FileSystemCollectionRepository implements ICollectionRepository {
19
+ private store;
20
+ constructor(basePath: string);
21
+ /**
22
+ * Find collection by ID
23
+ */
24
+ findById(id: string): Promise<UnifiedCollection | null>;
25
+ /**
26
+ * Find all collections
27
+ */
28
+ findAll(): Promise<UnifiedCollection[]>;
29
+ /**
30
+ * Save or update collection
31
+ */
32
+ save(id: string, collection: UnifiedCollection): Promise<void>;
33
+ /**
34
+ * Delete collection
35
+ */
36
+ delete(id: string): Promise<void>;
37
+ /**
38
+ * Check if collection exists
39
+ */
40
+ exists(id: string): Promise<boolean>;
41
+ /**
42
+ * Convert internal Collection to UnifiedCollection
43
+ */
44
+ private toUnifiedCollection;
45
+ /**
46
+ * Convert UnifiedCollection to internal Collection
47
+ */
48
+ private toCollection;
49
+ /**
50
+ * Normalize auth object to remove oauth2 type if present
51
+ * Converts RequestAuth to CollectionAuth by removing oauth2-specific fields
52
+ */
53
+ private normalizeAuth;
54
+ /**
55
+ * Recursively convert items from internal format to unified
56
+ * PRESERVES: enabled flags, metadata on headers/query, all request fields
57
+ */
58
+ private itemsToUnified;
59
+ /**
60
+ * Recursively convert items from unified format to internal
61
+ * PRESERVES: enabled flags, metadata, all request fields
62
+ */
63
+ private itemsFromUnified;
64
+ /**
65
+ * Convert variables Record to unified format
66
+ */
67
+ private recordToUnified;
68
+ /**
69
+ * Convert variables from unified format to Record
70
+ */
71
+ private unifiedToRecord;
72
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * File System Environment File Loader Adapter
3
+ *
4
+ * Loads environment configuration files from disk
5
+ * Wraps the legacy environment-file-loader functionality
6
+ */
7
+ import { IFileSystem } from '../../../ports/external/file-system.interface';
8
+ import { ILogger } from '../../../ports/external/logger.interface';
9
+ export interface EnvironmentFileConfig {
10
+ name: string;
11
+ variables: Record<string, string>;
12
+ [key: string]: any;
13
+ }
14
+ export interface EnvironmentLoadResult {
15
+ environments: Record<string, EnvironmentFileConfig>;
16
+ globalVariables?: Record<string, string>;
17
+ }
18
+ /**
19
+ * Adapter: Load environment files from file system
20
+ */
21
+ export declare class FileSystemEnvironmentFileLoaderAdapter {
22
+ private fileSystem;
23
+ private logger;
24
+ constructor(fileSystem: IFileSystem, logger: ILogger);
25
+ /**
26
+ * Load single environment file
27
+ */
28
+ loadEnvironmentFile(filePath: string): Promise<EnvironmentFileConfig>;
29
+ /**
30
+ * Load all environment files from directory
31
+ */
32
+ loadEnvironmentDirectory(dirPath: string): Promise<EnvironmentLoadResult>;
33
+ /**
34
+ * Write environment file
35
+ */
36
+ saveEnvironmentFile(filePath: string, config: EnvironmentFileConfig): Promise<void>;
37
+ /**
38
+ * Delete environment file
39
+ */
40
+ deleteEnvironmentFile(filePath: string): Promise<void>;
41
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * File System Environment Repository Implementation
3
+ *
4
+ * Implements IEnvironmentRepository using folder-based storage
5
+ * Compatible with existing EnvironmentResolver and environment-file-loader
6
+ */
7
+ import { IEnvironmentRepository } from '../../../ports/repositories/environment-repository.interface';
8
+ import { Environment } from '../../environment/environment-resolver';
9
+ import { IFileSystem } from '../../../ports/external/file-system.interface';
10
+ /**
11
+ * File system implementation of IEnvironmentRepository
12
+ * Stores environments in a dedicated directory
13
+ */
14
+ export declare class FileSystemEnvironmentRepository implements IEnvironmentRepository {
15
+ private fileSystem;
16
+ private basePath;
17
+ private readonly environmentsDir;
18
+ private readonly environmentExt;
19
+ private activeEnvironmentId;
20
+ constructor(fileSystem: IFileSystem, basePath: string);
21
+ findById(id: string): Promise<Environment | null>;
22
+ findActive(): Promise<Environment | null>;
23
+ findAll(): Promise<Environment[]>;
24
+ save(environment: Environment): Promise<void>;
25
+ delete(id: string): Promise<void>;
26
+ /**
27
+ * Set environment as active
28
+ */
29
+ setActive(id: string): void;
30
+ /**
31
+ * Build file path for environment
32
+ */
33
+ private buildEnvironmentPath;
34
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * File System Request Repository Implementation
3
+ *
4
+ * Implements IRequestRepository using folder-based storage
5
+ * Compatible with existing FolderCollectionStore and folder-io
6
+ */
7
+ import { IRequestRepository } from '../../../ports/repositories/request-repository.interface';
8
+ import { UnifiedRequest } from '../../../types/types';
9
+ import { IFileSystem } from '../../../ports/external/file-system.interface';
10
+ /**
11
+ * File system implementation of IRequestRepository
12
+ * Stores requests as .json files in collection directories
13
+ */
14
+ export declare class FileSystemRequestRepository implements IRequestRepository {
15
+ private fileSystem;
16
+ private collectionsBasePath;
17
+ private readonly requestsDir;
18
+ private readonly requestExt;
19
+ constructor(fileSystem: IFileSystem, collectionsBasePath: string);
20
+ findById(id: string): Promise<UnifiedRequest | null>;
21
+ findAll(collectionId: string): Promise<UnifiedRequest[]>;
22
+ save(request: UnifiedRequest): Promise<void>;
23
+ delete(id: string): Promise<void>;
24
+ exists(id: string): Promise<boolean>;
25
+ /**
26
+ * Build file path for a request
27
+ * Assumes request ID contains collection ID in some form
28
+ * or that we have configuration for this
29
+ */
30
+ private buildRequestPath;
31
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * File System Repository Implementations
3
+ */
4
+ export * from './fs-request-repository';
5
+ export * from './fs-environment-repository';
6
+ export * from './fs-collection-repository';
7
+ export * from './fs-environment-file-loader.adapter';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * In-Memory Collection Repository
3
+ *
4
+ * Useful for testing and development
5
+ */
6
+ import { ICollectionRepository } from '../../../ports/repositories/collection-repository.interface';
7
+ import { UnifiedCollection } from '../../../types/types';
8
+ /**
9
+ * In-memory collection repository implementation
10
+ */
11
+ export declare class InMemoryCollectionRepository implements ICollectionRepository {
12
+ private collections;
13
+ findById(id: string): Promise<UnifiedCollection | null>;
14
+ findAll(filter?: any): Promise<UnifiedCollection[]>;
15
+ save(id: string, collection: UnifiedCollection): Promise<void>;
16
+ delete(id: string): Promise<void>;
17
+ exists(id: string): Promise<boolean>;
18
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * In-Memory Environment Repository Implementation
3
+ */
4
+ import { Environment } from '../../environment/environment-resolver';
5
+ import { IEnvironmentRepository } from '../../../ports/repositories/environment-repository.interface';
6
+ /**
7
+ * In-memory implementation of IEnvironmentRepository
8
+ */
9
+ export declare class InMemoryEnvironmentRepository implements IEnvironmentRepository {
10
+ private environments;
11
+ private activeId;
12
+ findById(id: string): Promise<Environment | null>;
13
+ findActive(): Promise<Environment | null>;
14
+ findAll(): Promise<Environment[]>;
15
+ save(environment: Environment): Promise<void>;
16
+ delete(id: string): Promise<void>;
17
+ /**
18
+ * Set active environment
19
+ */
20
+ setActive(id: string): void;
21
+ /**
22
+ * Clear all environments
23
+ */
24
+ clear(): void;
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * In-Memory Request Repository Implementation
3
+ */
4
+ import { UnifiedRequest } from '../../../types/types';
5
+ import { IRequestRepository } from '../../../ports/repositories/request-repository.interface';
6
+ /**
7
+ * In-memory implementation of IRequestRepository
8
+ * Useful for testing and as a fallback
9
+ */
10
+ export declare class InMemoryRequestRepository implements IRequestRepository {
11
+ private requests;
12
+ findById(id: string): Promise<UnifiedRequest | null>;
13
+ findAll(collectionId: string): Promise<UnifiedRequest[]>;
14
+ save(request: UnifiedRequest): Promise<void>;
15
+ delete(id: string): Promise<void>;
16
+ exists(id: string): Promise<boolean>;
17
+ /**
18
+ * Clear all requests (useful for testing)
19
+ */
20
+ clear(): void;
21
+ /**
22
+ * Pre-populate requests (useful for testing)
23
+ */
24
+ addRequests(...requests: UnifiedRequest[]): void;
25
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * In-Memory Repository Implementations
3
+ * Useful for testing and as fallbacks
4
+ */
5
+ export * from './in-memory-request-repository';
6
+ export * from './in-memory-environment-repository';
7
+ export * from './in-memory-collection-repository';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Script Infrastructure Adapters and Implementations
3
+ */
4
+ export * from './vm-script-executor.adapter';
@@ -8,7 +8,7 @@
8
8
  * Interface Segregation: Each interface has a focused purpose
9
9
  */
10
10
  import { Cookie } from '../cookie/interfaces';
11
- import { PreparedRequest, RequestAuth, RequestBody, RequestScripts, RequestSettings, ScriptInfo, TestAssertion } from '../types/types';
11
+ import { PreparedRequest, RequestAuth, RequestBody, RequestScripts, RequestSettings, ScriptInfo, TestAssertion } from '../../types/types';
12
12
  export type { Cookie, ScriptInfo };
13
13
  /**
14
14
  * Cookie Jar Interface
@@ -4,7 +4,7 @@
4
4
  * Single Responsibility: Pure utility functions for script execution
5
5
  * These are stateless helper functions with no side effects
6
6
  */
7
- import { TestAssertion } from '../types/types';
7
+ import { TestAssertion } from '../../types/types';
8
8
  /**
9
9
  * Console message structure for script output
10
10
  */
@@ -0,0 +1,19 @@
1
+ /**
2
+ * VM Script Executor Adapter - Implements IScriptExecutor (port)
3
+ *
4
+ * Wraps existing ScriptExecutor to conform to the new port interface.
5
+ * The legacy ScriptExecutor uses `createRequestSession()` pattern;
6
+ * this adapter translates to the simpler `executePreRequest` / `executePostResponse` port API.
7
+ */
8
+ import { IScriptExecutor as IScriptExecutorPort, IScriptSession, IScriptResult } from '../../ports/executors/script-executor.interface';
9
+ import { HttpResponse } from '../../types/types';
10
+ import { ScriptExecutor } from './script-executor';
11
+ /**
12
+ * Adapter that implements ports/IScriptExecutor using the legacy ScriptExecutor
13
+ */
14
+ export declare class VmScriptExecutorAdapter implements IScriptExecutorPort {
15
+ private scriptExecutor;
16
+ constructor(scriptExecutor: ScriptExecutor);
17
+ executePreRequest(session: IScriptSession, script: string): Promise<IScriptResult>;
18
+ executePostResponse(session: IScriptSession, script: string, response: HttpResponse): Promise<IScriptResult>;
19
+ }
@@ -8,7 +8,7 @@
8
8
  * - On-demand result loading
9
9
  */
10
10
  import { IConfigService } from '../config';
11
- import { ExecutionResult } from '../types/types';
11
+ import { ExecutionResult } from '../../types/types';
12
12
  import { FullResultDetails, IndexPage, IResultStorageService, RecentError, RequestStats, ResultSummary, RunConfig, RunManifest, RunStats } from './result-storage';
13
13
  /**
14
14
  * File-based Result Storage Service for Test Suite
@@ -5,7 +5,7 @@
5
5
  * - Interface Segregation: Separate interfaces for different concerns
6
6
  * - Dependency Inversion: Define abstractions for storage operations
7
7
  */
8
- import { ExecutionResult } from '../types/types';
8
+ import { ExecutionResult } from '../../types/types';
9
9
  /**
10
10
  * HTTP Method encoding for memory efficiency
11
11
  * Using numbers instead of strings saves ~5 bytes per summary
@@ -4,7 +4,7 @@
4
4
  * Manages CRUD operations for Test Suites.
5
5
  * Platform-agnostic version (no VS Code dependency).
6
6
  */
7
- import { ICollectionService } from '../collection/interfaces';
7
+ import { ICollectionService } from '../../types/collection';
8
8
  import { IConfigService } from '../config';
9
9
  import { ITestSuiteService, SuiteRequest, TestSuite } from './interfaces';
10
10
  /**
@@ -7,7 +7,7 @@
7
7
  * Single Responsibility: Maintain suite state and resolve requests from collections
8
8
  * Dependency Inversion: Depends on ICollectionService abstraction
9
9
  */
10
- import { CollectionRequest, ICollectionService, RequestScripts } from '../collection/interfaces';
10
+ import { CollectionRequest, ICollectionService, RequestScripts } from '../../types/collection';
11
11
  import { SuiteRequest, TestSuite } from './interfaces';
12
12
  /**
13
13
  * Cached request entry with full context
@@ -0,0 +1,34 @@
1
+ /**
2
+ * HTTP Executor Port - Abstract HTTP execution
3
+ * Hides HTTP client details and interceptors
4
+ *
5
+ * Implementations: NodeHttpExecutor, FetchHttpExecutor
6
+ */
7
+ import { HttpRequest, HttpResponse } from '../../types/types';
8
+ /**
9
+ * Execution plan that describes how to prepare and execute an HTTP request
10
+ */
11
+ export interface IExecutionPlan {
12
+ request: HttpRequest;
13
+ preScripts?: string[];
14
+ postScripts?: string[];
15
+ }
16
+ /**
17
+ * HTTP Executor - Handles HTTP request execution with interceptors and middleware
18
+ */
19
+ export interface IHttpExecutor {
20
+ /**
21
+ * Prepare request for execution
22
+ * - Apply interceptors
23
+ * - Add cookies
24
+ * - Resolve variables
25
+ */
26
+ prepare(plan: IExecutionPlan): Promise<HttpRequest>;
27
+ /**
28
+ * Execute prepared HTTP request
29
+ * - Send over network
30
+ * - Apply response interceptors
31
+ * - Save cookies
32
+ */
33
+ execute(prepared: HttpRequest): Promise<HttpResponse>;
34
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Executor Ports - Execution abstraction
3
+ */
4
+ export * from './http-executor.interface';
5
+ export * from './script-executor.interface';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Script Executor Port - Abstract script execution
3
+ * Hides VM and runtime details
4
+ *
5
+ * Implementations: VmScriptExecutor, NodeScriptExecutor
6
+ */
7
+ import { HttpResponse } from '../../types/types';
8
+ /**
9
+ * Script execution session - tracks state during execution
10
+ */
11
+ export interface IScriptSession {
12
+ variables: Record<string, any>;
13
+ environment: Record<string, any>;
14
+ cookies: Record<string, string>;
15
+ [key: string]: any;
16
+ }
17
+ /**
18
+ * Result of script execution
19
+ */
20
+ export interface IScriptResult {
21
+ success: boolean;
22
+ output: any;
23
+ errors: string[];
24
+ logs: string[];
25
+ variableChanges: Record<string, any>;
26
+ }
27
+ /**
28
+ * Script Executor - Handles pre-request and post-response scripts
29
+ */
30
+ export interface IScriptExecutor {
31
+ /**
32
+ * Execute pre-request script
33
+ * - Modifies request before sending
34
+ * - Can set variables, headers, etc.
35
+ */
36
+ executePreRequest(session: IScriptSession, script: string): Promise<IScriptResult>;
37
+ /**
38
+ * Execute post-response script
39
+ * - Processes response after receiving
40
+ * - Can validate, test, extract data
41
+ */
42
+ executePostResponse(session: IScriptSession, script: string, response: HttpResponse): Promise<IScriptResult>;
43
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * File System Port - Abstract file system operations
3
+ * Enables platform-agnostic code (Node.js, browser, etc.)
4
+ *
5
+ * Implementation: NodeFileSystem
6
+ */
7
+ export interface IFileSystem {
8
+ /**
9
+ * Check if a path exists (file or directory)
10
+ */
11
+ exists(path: string): Promise<boolean>;
12
+ /**
13
+ * Read file contents as UTF-8 string
14
+ */
15
+ readFile(path: string): Promise<string>;
16
+ /**
17
+ * Write file contents
18
+ */
19
+ writeFile(path: string, content: string): Promise<void>;
20
+ /**
21
+ * List directory contents
22
+ */
23
+ readDir(path: string): Promise<string[]>;
24
+ /**
25
+ * Create directory (recursively)
26
+ */
27
+ mkdir(path: string, options?: {
28
+ recursive?: boolean;
29
+ }): Promise<void>;
30
+ /**
31
+ * Delete file or empty directory
32
+ */
33
+ delete(path: string): Promise<void>;
34
+ /**
35
+ * Get file metadata
36
+ */
37
+ stat(path: string): Promise<FileStat>;
38
+ }
39
+ export interface FileStat {
40
+ isDirectory(): boolean;
41
+ isFile(): boolean;
42
+ size: number;
43
+ mtimeMs?: number;
44
+ }