@http-forge/core 0.2.0 → 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/README.md +25 -4
- 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 +34 -18
- package/dist/di/core-bootstrap.d.ts +25 -0
- package/dist/di/index.d.ts +19 -0
- package/dist/di/platform-adapters.d.ts +66 -0
- package/dist/di/service-container.d.ts +97 -0
- package/dist/di/service-identifiers.d.ts +34 -0
- 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 +90 -84
- package/dist/index.js +187 -187
- package/dist/index.mjs +187 -187
- 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/infrastructure/collection/folder-collection-loader.d.ts +45 -0
- package/dist/{collection → infrastructure/collection}/folder-collection-store.d.ts +9 -2
- package/dist/infrastructure/collection/folder-io.d.ts +113 -0
- 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 +6 -3
- package/dist/infrastructure/environment/environment-file-loader.d.ts +42 -0
- 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 +3 -3
- package/dist/{execution → infrastructure/execution}/request-executor.d.ts +4 -4
- package/dist/{execution → infrastructure/execution}/request-preparer-interfaces.d.ts +2 -2
- package/dist/{execution → infrastructure/execution}/request-preparer.d.ts +5 -5
- 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 +13 -1
- package/dist/{script → infrastructure/script}/request-script-session.d.ts +3 -0
- package/dist/{script → infrastructure/script}/script-factories.d.ts +15 -4
- package/dist/{script → infrastructure/script}/script-utils.d.ts +3 -2
- 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 +27 -7
- package/package.json +2 -2
- package/dist/collection/folder-collection-loader.d.ts +0 -256
- 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 +1 -1
- 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 +1 -1
- package/dist/{cookie → infrastructure/cookie}/interfaces.d.ts +0 -0
- package/dist/{cookie → infrastructure/cookie}/persistent-cookie-jar.d.ts +1 -1
- 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}/script-executor.d.ts +1 -1
- /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
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Single Responsibility: Execute HTTP requests using fetch API
|
|
5
5
|
* Dependency Inversion: Implements IHttpClient interface
|
|
6
6
|
*/
|
|
7
|
-
import { IHttpClient } from '
|
|
8
|
-
import { HttpRequest, HttpResponse } from '
|
|
7
|
+
import { IHttpClient } from '../../types/platform';
|
|
8
|
+
import { HttpRequest, HttpResponse } from '../../types/types';
|
|
9
9
|
/**
|
|
10
10
|
* HTTP client implementation using Node.js native fetch.
|
|
11
11
|
* Requires Node.js 18+.
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* - Open/Closed: Extended through interceptor chain
|
|
16
16
|
* - Dependency Inversion: Depends on IHttpClient, IUrlBuilder, IInterceptorChain, IRequestPreprocessor
|
|
17
17
|
*/
|
|
18
|
+
import type { IHttpClient } from '../../types/platform';
|
|
19
|
+
import { HttpRequestOptions, HttpResponse } from '../../types/types';
|
|
18
20
|
import { IInterceptorChain } from './interceptor-chain';
|
|
19
|
-
import { HttpRequestOptions, HttpResponse } from '../types/types';
|
|
20
|
-
import type { IHttpClient } from '../types/platform';
|
|
21
21
|
import { IHttpRequestService } from './interfaces';
|
|
22
22
|
import { IUrlBuilder } from './url-builder';
|
|
23
23
|
export declare class HttpRequestService implements IHttpRequestService {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - Post-response processing (modify response after receiving)
|
|
13
13
|
* - Error handling
|
|
14
14
|
*/
|
|
15
|
-
import { HttpRequest, HttpResponse } from '
|
|
15
|
+
import { HttpRequest, HttpResponse } from '../../types/types';
|
|
16
16
|
/**
|
|
17
17
|
* Context passed to interceptors
|
|
18
18
|
* Same as plugin's InterceptorContext
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This is the high-level service interface that consumers use.
|
|
8
8
|
* It delegates to IHttpClient for actual network calls and IUrlBuilder for URL construction.
|
|
9
9
|
*/
|
|
10
|
-
import { HttpRequestOptions, HttpResponse } from '
|
|
10
|
+
import { HttpRequestOptions, HttpResponse } from '../../types/types';
|
|
11
11
|
/**
|
|
12
12
|
* Full HTTP request service interface.
|
|
13
13
|
* Combines execution + URL building in a single facade.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Merges user-provided request settings with defaults.
|
|
5
5
|
* Extracted from extension's utils/merge-request-settings.ts.
|
|
6
6
|
*/
|
|
7
|
-
import { RequestSettings } from '
|
|
7
|
+
import { RequestSettings } from '../../types/types';
|
|
8
8
|
/**
|
|
9
9
|
* Merge user-provided RequestSettings with defaults.
|
|
10
10
|
* Idempotent and safe to call from multiple layers.
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* - Request cancellation via AbortSignal
|
|
15
15
|
* - Cookie parsing from Set-Cookie headers
|
|
16
16
|
*/
|
|
17
|
-
import { IHttpClient } from '
|
|
18
|
-
import { HttpRequest, HttpResponse, RequestSettings } from '
|
|
17
|
+
import { IHttpClient } from '../../types/platform';
|
|
18
|
+
import { HttpRequest, HttpResponse, RequestSettings } from '../../types/types';
|
|
19
19
|
/**
|
|
20
20
|
* Default request settings
|
|
21
21
|
* Same as plugin's DEFAULT_REQUEST_SETTINGS from shared/constants.ts
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node HTTP Executor Adapter - Implements IHttpExecutor
|
|
3
|
+
*
|
|
4
|
+
* Wraps existing InterceptorChain and CookieService to conform to port interface
|
|
5
|
+
*/
|
|
6
|
+
import { IHttpExecutor, IExecutionPlan } from '../../ports/executors/http-executor.interface';
|
|
7
|
+
import { HttpRequest, HttpResponse } from '../../types/types';
|
|
8
|
+
import type { IInterceptorChain } from './interceptor-chain';
|
|
9
|
+
import type { ICookieService } from '../cookie/interfaces';
|
|
10
|
+
/**
|
|
11
|
+
* Adapter that implements IHttpExecutor using existing infrastructure
|
|
12
|
+
*/
|
|
13
|
+
export declare class NodeHttpExecutorAdapter implements IHttpExecutor {
|
|
14
|
+
private interceptorChain;
|
|
15
|
+
private cookieJar;
|
|
16
|
+
constructor(interceptorChain: IInterceptorChain, cookieJar: ICookieService);
|
|
17
|
+
/**
|
|
18
|
+
* Prepare request for execution
|
|
19
|
+
*/
|
|
20
|
+
prepare(plan: IExecutionPlan): Promise<HttpRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* Execute prepared HTTP request
|
|
23
|
+
*/
|
|
24
|
+
execute(prepared: HttpRequest): Promise<HttpResponse>;
|
|
25
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Single Responsibility: Handles request preparation (header sanitization, body encoding)
|
|
7
7
|
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
8
8
|
*/
|
|
9
|
-
import { RequestBody } from '
|
|
9
|
+
import { RequestBody } from '../../types/types';
|
|
10
10
|
/**
|
|
11
11
|
* Request Preprocessor Interface
|
|
12
12
|
* Same as plugin's IRequestPreprocessor
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Pure function — no platform dependencies.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
export type { ImportedEnvironment } from '
|
|
9
|
+
import { ImportedEnvironment } from '../../types/environment-config';
|
|
10
|
+
import { IFileSystem } from '../../types/platform';
|
|
11
|
+
export type { ImportedEnvironment } from '../../types/environment-config';
|
|
12
12
|
/**
|
|
13
13
|
* Parse Postman environment JSON content.
|
|
14
14
|
* Supports both standard and nested Postman export formats.
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Pure functions for exporting collections to REST Client format (.http files).
|
|
5
5
|
* No VS Code dependency — uses only Node.js fs/path and core types.
|
|
6
6
|
*/
|
|
7
|
-
import type { Collection, CollectionItem, ICollectionService } from '
|
|
8
|
-
import type { IEnvironmentConfigService } from '
|
|
9
|
-
import type { RequestScripts } from '
|
|
7
|
+
import type { Collection, CollectionItem, ICollectionService } from '../../types/collection';
|
|
8
|
+
import type { IEnvironmentConfigService } from '../../types/environment-config';
|
|
9
|
+
import type { RequestScripts } from '../../types/types';
|
|
10
10
|
/**
|
|
11
11
|
* Write an env file given an object of key/value pairs. Existing file is overwritten.
|
|
12
12
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure Layer - Implementations and Adapters
|
|
3
|
+
*
|
|
4
|
+
* Contains:
|
|
5
|
+
* - Repository implementations (file-system, in-memory, cloud)
|
|
6
|
+
* - HTTP executor implementations
|
|
7
|
+
* - Script executor implementations
|
|
8
|
+
* - Storage implementations (history, cache)
|
|
9
|
+
* - Parser implementations
|
|
10
|
+
* - External adapters (FileSystem, HTTP client, Logger)
|
|
11
|
+
* - DI configuration
|
|
12
|
+
*
|
|
13
|
+
* Constraints:
|
|
14
|
+
* - Depends on Ports and Domain layers
|
|
15
|
+
* - NO direct dependencies on Application layer
|
|
16
|
+
* - Contains all platform-specific code
|
|
17
|
+
* - All implementations must conform to port interfaces
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* - Imported during bootstrap phase
|
|
21
|
+
* - Never imported by domain layer
|
|
22
|
+
* - Imported by application layer only through ports
|
|
23
|
+
*/
|
|
24
|
+
export * from './adapters';
|
|
25
|
+
export * from './repositories/in-memory';
|
|
26
|
+
export * from './repositories/file-system';
|
|
27
|
+
export * from './http';
|
|
28
|
+
export * from './script';
|
|
29
|
+
export * from './persistence';
|
|
30
|
+
export * from './parsers';
|
|
31
|
+
export * from './di';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Handles allOf (flatten + merge), oneOf/anyOf (first variant),
|
|
6
6
|
* discriminator injection, enum, formats, readOnly omission.
|
|
7
7
|
*/
|
|
8
|
-
import { JSONSchema7 } from '
|
|
8
|
+
import { JSONSchema7 } from '../../types/types';
|
|
9
9
|
export declare class ExampleGenerator {
|
|
10
10
|
/**
|
|
11
11
|
* Generate an example value from a JSON Schema.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* to build response schemas by inferring from actual response data.
|
|
6
6
|
*/
|
|
7
7
|
import { IRequestHistoryService } from '../history/request-history-service-interfaces';
|
|
8
|
-
import { ResponseSchemaDefinition } from '
|
|
8
|
+
import { ResponseSchemaDefinition } from '../../types/types';
|
|
9
9
|
import { SchemaInferrer } from './schema-inferrer';
|
|
10
10
|
export declare class HistoryAnalyzer {
|
|
11
11
|
private historyService;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* DI abstractions for OpenAPI-related services.
|
|
5
5
|
* The concrete implementations live in services/openapi/.
|
|
6
6
|
*/
|
|
7
|
+
import type { Collection } from '../../types/collection';
|
|
8
|
+
import type { BodySchemaDefinition, JSONSchema7, KeyValueEntry, ResponseSchemaDefinition } from '../../types/types';
|
|
7
9
|
import type { OpenApiExportOptions } from './openapi-exporter';
|
|
8
10
|
import type { OpenApiImportOptions } from './openapi-importer';
|
|
9
|
-
import type { Collection } from '../collection/collection-service-interfaces';
|
|
10
|
-
import type { BodySchemaDefinition, JSONSchema7, KeyValueEntry, ResponseSchemaDefinition } from '../types/types';
|
|
11
11
|
/**
|
|
12
12
|
* Schema inference service interface
|
|
13
13
|
*/
|
|
@@ -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 '
|
|
8
|
-
import { IEnvironmentConfigService } from '
|
|
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 '
|
|
8
|
-
import { IEnvironmentConfigService } from '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
8
|
-
import { UnifiedCollection } from '
|
|
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,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
|
+
}
|
|
@@ -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 '
|
|
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,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
|
+
}
|