@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.
- 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 +111 -111
- package/dist/index.mjs +117 -117
- 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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Client Port - Abstract HTTP operations
|
|
3
|
+
* Enables switching between fetch, Node.js fetch, Node.js http, etc.
|
|
4
|
+
*
|
|
5
|
+
* Implementations: NodeHttpClient, FetchHttpClient
|
|
6
|
+
*/
|
|
7
|
+
export interface IHttpClient {
|
|
8
|
+
/**
|
|
9
|
+
* Execute HTTP request
|
|
10
|
+
*/
|
|
11
|
+
execute(request: IHttpClientRequest): Promise<IHttpClientResponse>;
|
|
12
|
+
}
|
|
13
|
+
export interface IHttpClientRequest {
|
|
14
|
+
method: string;
|
|
15
|
+
url: string;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
body?: string | Buffer;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface IHttpClientResponse {
|
|
21
|
+
status: number;
|
|
22
|
+
statusText: string;
|
|
23
|
+
headers: Record<string, string | string[]>;
|
|
24
|
+
body: Buffer | string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Port - Abstract logging operations
|
|
3
|
+
*
|
|
4
|
+
* Implementations: ConsoleLogger, SilentLogger, CustomLogger
|
|
5
|
+
*/
|
|
6
|
+
export declare enum LogLevel {
|
|
7
|
+
DEBUG = "DEBUG",
|
|
8
|
+
INFO = "INFO",
|
|
9
|
+
WARN = "WARN",
|
|
10
|
+
ERROR = "ERROR"
|
|
11
|
+
}
|
|
12
|
+
export interface ILogger {
|
|
13
|
+
debug(message: string, context?: Record<string, any>): void;
|
|
14
|
+
info(message: string, context?: Record<string, any>): void;
|
|
15
|
+
warn(message: string, context?: Record<string, any>): void;
|
|
16
|
+
error(message: string, error?: Error | Record<string, any>): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ports Layer - Abstract interfaces (Hexagonal Architecture)
|
|
3
|
+
*
|
|
4
|
+
* Defines contracts for:
|
|
5
|
+
* - Data access (Repositories)
|
|
6
|
+
* - Execution (HTTP, Scripts)
|
|
7
|
+
* - Storage (History, Cache)
|
|
8
|
+
* - External systems (FileSystem, HTTP Client, Logger)
|
|
9
|
+
* - Parsing (Collection formats)
|
|
10
|
+
*
|
|
11
|
+
* Implementations are in the infrastructure layer
|
|
12
|
+
*/
|
|
13
|
+
export * from './external';
|
|
14
|
+
export * from './repositories';
|
|
15
|
+
export * from './executors';
|
|
16
|
+
export * from './storage';
|
|
17
|
+
export * from './parsers';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Parser Port - Abstract collection parsing
|
|
3
|
+
*
|
|
4
|
+
* Implementations: HttpForgeParser, PostmanParser, OpenAPIParser
|
|
5
|
+
*/
|
|
6
|
+
import { UnifiedCollection } from '../../types/types';
|
|
7
|
+
/**
|
|
8
|
+
* Collection Parser - Parses different collection formats
|
|
9
|
+
*/
|
|
10
|
+
export interface ICollectionParser {
|
|
11
|
+
/**
|
|
12
|
+
* Check if this parser can handle the content
|
|
13
|
+
*/
|
|
14
|
+
canHandle(content: string, format?: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Parse collection from content
|
|
17
|
+
*/
|
|
18
|
+
parse(content: string): Promise<UnifiedCollection>;
|
|
19
|
+
/**
|
|
20
|
+
* Supported formats (e.g., 'http-forge', 'postman', 'openapi')
|
|
21
|
+
*/
|
|
22
|
+
readonly supportedFormats: string[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection Repository Port - Abstract collection data access
|
|
3
|
+
* Enables switching between file-based, in-memory, cloud storage, etc.
|
|
4
|
+
*
|
|
5
|
+
* Implementations: FileSystemCollectionRepository, InMemoryCollectionRepository
|
|
6
|
+
*/
|
|
7
|
+
import { UnifiedCollection } from '../../types/types';
|
|
8
|
+
/**
|
|
9
|
+
* Repository for managing collections
|
|
10
|
+
*/
|
|
11
|
+
export interface ICollectionRepository {
|
|
12
|
+
/**
|
|
13
|
+
* Find collection by ID
|
|
14
|
+
*/
|
|
15
|
+
findById(id: string): Promise<UnifiedCollection | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Find all collections
|
|
18
|
+
*/
|
|
19
|
+
findAll(): Promise<UnifiedCollection[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Save or update collection
|
|
22
|
+
*/
|
|
23
|
+
save(id: string, collection: UnifiedCollection): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Delete collection by ID
|
|
26
|
+
*/
|
|
27
|
+
delete(id: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if collection exists
|
|
30
|
+
*/
|
|
31
|
+
exists(id: string): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Repository Port - Abstract environment data access
|
|
3
|
+
*
|
|
4
|
+
* Implementations: FileSystemEnvironmentRepository
|
|
5
|
+
*/
|
|
6
|
+
import { Environment } from '../../infrastructure/environment/environment-resolver';
|
|
7
|
+
/**
|
|
8
|
+
* Repository for managing environments
|
|
9
|
+
*/
|
|
10
|
+
export interface IEnvironmentRepository {
|
|
11
|
+
/**
|
|
12
|
+
* Find environment by ID/name
|
|
13
|
+
*/
|
|
14
|
+
findById(id: string): Promise<Environment | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Find active environment
|
|
17
|
+
*/
|
|
18
|
+
findActive(): Promise<Environment | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Find all environments
|
|
21
|
+
*/
|
|
22
|
+
findAll(): Promise<Environment[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Save or update environment
|
|
25
|
+
*/
|
|
26
|
+
save(environment: Environment): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete environment by ID
|
|
29
|
+
*/
|
|
30
|
+
delete(id: string): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request Repository Port - Abstract request data access
|
|
3
|
+
* Enables switching between file-based, in-memory, cloud storage, etc.
|
|
4
|
+
*
|
|
5
|
+
* Implementations: FileSystemRequestRepository, InMemoryRequestRepository
|
|
6
|
+
*/
|
|
7
|
+
import { UnifiedRequest } from '../../types/types';
|
|
8
|
+
/**
|
|
9
|
+
* Repository for managing individual requests
|
|
10
|
+
*/
|
|
11
|
+
export interface IRequestRepository {
|
|
12
|
+
/**
|
|
13
|
+
* Find request by ID
|
|
14
|
+
*/
|
|
15
|
+
findById(id: string): Promise<UnifiedRequest | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Find all requests in a collection
|
|
18
|
+
*/
|
|
19
|
+
findAll(collectionId: string): Promise<UnifiedRequest[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Save or update request
|
|
22
|
+
*/
|
|
23
|
+
save(request: UnifiedRequest): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Delete request by ID
|
|
26
|
+
*/
|
|
27
|
+
delete(id: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if request exists
|
|
30
|
+
*/
|
|
31
|
+
exists(id: string): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Store Port - Abstract caching
|
|
3
|
+
*
|
|
4
|
+
* Implementations: GraphQLSchemaCacheStore, MemoryCacheStore
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generic cache store
|
|
8
|
+
*/
|
|
9
|
+
export interface ICacheStore<T> {
|
|
10
|
+
/**
|
|
11
|
+
* Get value from cache
|
|
12
|
+
*/
|
|
13
|
+
get(key: string): Promise<T | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Set value in cache
|
|
16
|
+
*/
|
|
17
|
+
set(key: string, value: T, ttl?: number): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Delete value from cache
|
|
20
|
+
*/
|
|
21
|
+
delete(key: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Clear all cache
|
|
24
|
+
*/
|
|
25
|
+
clear(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History Loader Port - Abstract history loading
|
|
3
|
+
*
|
|
4
|
+
* Implementations: FileSystemHistoryLoader, InMemoryHistoryLoader
|
|
5
|
+
*/
|
|
6
|
+
import { HttpResponse } from '../../types/types';
|
|
7
|
+
/**
|
|
8
|
+
* History entry metadata
|
|
9
|
+
*/
|
|
10
|
+
export interface IHistoryEntry {
|
|
11
|
+
id: string;
|
|
12
|
+
requestId: string;
|
|
13
|
+
collectionId: string;
|
|
14
|
+
timestamp: Date;
|
|
15
|
+
status: number;
|
|
16
|
+
duration: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* History Loader - Loads request execution history
|
|
20
|
+
*/
|
|
21
|
+
export interface IHistoryLoader {
|
|
22
|
+
/**
|
|
23
|
+
* Load history entries for a request
|
|
24
|
+
*/
|
|
25
|
+
loadHistory(collectionId: string, requestId: string, options?: {
|
|
26
|
+
limit?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
}): Promise<IHistoryEntry[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Load full response from history
|
|
31
|
+
*/
|
|
32
|
+
loadFullResponse(collectionId: string, requestId: string, entryId: string): Promise<HttpResponse | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Save history entry
|
|
35
|
+
*/
|
|
36
|
+
saveEntry(collectionId: string, requestId: string, response: HttpResponse, duration: number): Promise<IHistoryEntry>;
|
|
37
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Collection
|
|
2
|
+
* Collection Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Migrated from src/collection/ for better organization
|
|
5
|
+
* These types define the contracts for collection management
|
|
6
6
|
*/
|
|
7
|
-
import { CollectionRequest, KeyValueEntry, RequestAuth, RequestScripts, RequestSettings } from '
|
|
7
|
+
import { CollectionRequest, KeyValueEntry, RequestAuth, RequestScripts, RequestSettings } from './types';
|
|
8
8
|
export type { CollectionRequest, KeyValueEntry, RequestAuth, RequestScripts, RequestSettings };
|
|
9
9
|
/**
|
|
10
10
|
* Request item in a collection - CollectionRequest with type discriminator
|
|
@@ -117,3 +117,18 @@ export interface ICollectionImportExport {
|
|
|
117
117
|
export interface ICollectionService extends ICollectionReader, ICollectionWriter, IRequestManager, IFolderManager, ICollectionVariableManager, ICollectionImportExport {
|
|
118
118
|
dispose(): void;
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Collection loader interface
|
|
122
|
+
*/
|
|
123
|
+
export interface ICollectionLoader {
|
|
124
|
+
load(filePath: string, options?: any): Promise<import('./types').UnifiedCollection> | import('./types').UnifiedCollection | undefined;
|
|
125
|
+
loadAll(): Promise<import('./types').UnifiedCollection[]> | import('./types').UnifiedCollection[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Collection parser interface (infrastructure-level)
|
|
129
|
+
* Different from ports/parsers/ICollectionParser
|
|
130
|
+
*/
|
|
131
|
+
export interface ICollectionParser {
|
|
132
|
+
canParse(content: string): boolean;
|
|
133
|
+
parse(content: string, filePath?: string): import('./types').UnifiedCollection;
|
|
134
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Migrated from src/environment/ for better organization
|
|
5
|
+
* These types define the contracts for environment management
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Environment configuration structure
|
|
9
|
+
*/
|
|
10
|
+
export interface EnvironmentConfig {
|
|
11
|
+
description?: string;
|
|
12
|
+
requiresConfirmation?: boolean;
|
|
13
|
+
variables?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Shared configuration file structure
|
|
17
|
+
*/
|
|
18
|
+
export interface SharedConfig {
|
|
19
|
+
environments: Record<string, EnvironmentConfig>;
|
|
20
|
+
globalVariables?: Record<string, string>;
|
|
21
|
+
defaultHeaders?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Local configuration file structure
|
|
25
|
+
*/
|
|
26
|
+
export interface LocalConfig {
|
|
27
|
+
credentials?: Record<string, {
|
|
28
|
+
variables?: Record<string, string>;
|
|
29
|
+
}>;
|
|
30
|
+
variables?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolved environment with all inherited values
|
|
34
|
+
*/
|
|
35
|
+
export interface ResolvedEnvironment {
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
requiresConfirmation?: boolean;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
variables: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Representation of an imported environment (from Postman)
|
|
44
|
+
*/
|
|
45
|
+
export interface ImportedEnvironment {
|
|
46
|
+
name: string;
|
|
47
|
+
variables: Record<string, string>;
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Import operations for environments
|
|
52
|
+
*/
|
|
53
|
+
export interface IEnvironmentImporter {
|
|
54
|
+
importPostmanEnvironmentFile(filePath: string): ImportedEnvironment | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read operations for environment configuration
|
|
58
|
+
*/
|
|
59
|
+
export interface IEnvironmentConfigReader {
|
|
60
|
+
getWorkspaceFolder(): string;
|
|
61
|
+
getRootPath(): string;
|
|
62
|
+
getEnvironmentNames(): string[];
|
|
63
|
+
getSelectedEnvironment(): string;
|
|
64
|
+
getSharedConfig(): SharedConfig | null;
|
|
65
|
+
getSharedConfigPath(): string;
|
|
66
|
+
getLocalConfig(): LocalConfig | null;
|
|
67
|
+
getLocalConfigPath(): string;
|
|
68
|
+
getEnvironmentConfigPath(envName: string): string;
|
|
69
|
+
getEnvLocalPath(envName: string): string;
|
|
70
|
+
getResolvedEnvironment(envName: string): ResolvedEnvironment | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Write operations for environment configuration
|
|
74
|
+
*/
|
|
75
|
+
export interface IEnvironmentConfigWriter {
|
|
76
|
+
saveSharedConfig(config: SharedConfig): void;
|
|
77
|
+
saveLocalConfig(config: LocalConfig): void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Environment selection operations
|
|
81
|
+
*/
|
|
82
|
+
export interface IEnvironmentSelector {
|
|
83
|
+
setSelectedEnvironment(envName: string): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Variable resolution operations
|
|
87
|
+
*/
|
|
88
|
+
export interface IVariableResolver {
|
|
89
|
+
resolveVariables(text: string, envName?: string): string;
|
|
90
|
+
resolveVariablesWithExtra(text: string, extraVariables: Record<string, string>, envName?: string): string;
|
|
91
|
+
resolveVariablesInObject<T extends Record<string, any>>(obj: T, envName?: string): T;
|
|
92
|
+
resolveVariablesInObjectWithExtra<T extends Record<string, any>>(obj: T, extraVariables: Record<string, string>, envName?: string): T;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Variable management operations (for scripts)
|
|
96
|
+
*/
|
|
97
|
+
export interface IVariableManager {
|
|
98
|
+
setEnvironmentVariable(key: string, value: unknown): void;
|
|
99
|
+
deleteEnvironmentVariable(key: string): void;
|
|
100
|
+
clearEnvironmentVariables(): void;
|
|
101
|
+
getEnvironmentVariableLocals(): Record<string, string>;
|
|
102
|
+
setGlobalVariable(key: string, value: unknown): void;
|
|
103
|
+
getGlobalVariable(key: string): string | undefined;
|
|
104
|
+
deleteGlobalVariable(key: string): void;
|
|
105
|
+
clearGlobalVariables(): void;
|
|
106
|
+
setSessionVariable(key: string, value: unknown): void;
|
|
107
|
+
deleteSessionVariable(key: string): Promise<void>;
|
|
108
|
+
clearSessionVariables(): Promise<void>;
|
|
109
|
+
getSessionVariables(): Record<string, string>;
|
|
110
|
+
getGlobalVariables(): Record<string, string>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Full environment configuration service interface
|
|
114
|
+
*/
|
|
115
|
+
export interface IEnvironmentConfigService extends IEnvironmentConfigReader, IEnvironmentConfigWriter, IEnvironmentSelector, IVariableResolver, IVariableManager {
|
|
116
|
+
loadConfigs(): void;
|
|
117
|
+
exportEnvironmentsToFolder(outDir: string, mergeGlobals?: boolean): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Interface for storing and retrieving environment variables
|
|
121
|
+
*/
|
|
122
|
+
export interface IEnvironmentStore {
|
|
123
|
+
get(key: string): string | undefined;
|
|
124
|
+
set(key: string, value: string): void;
|
|
125
|
+
getAll(): Record<string, string>;
|
|
126
|
+
getActive(): string | undefined;
|
|
127
|
+
setActive(name: string): void;
|
|
128
|
+
getVariables(environmentName?: string): Record<string, string>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Interface for interpolating variables in strings
|
|
132
|
+
* Handles {{variable}} syntax replacement
|
|
133
|
+
*/
|
|
134
|
+
export interface IVariableInterpolator {
|
|
135
|
+
interpolate(input: string, variables: Record<string, string>): string;
|
|
136
|
+
extractVariables(input: string): string[];
|
|
137
|
+
interpolateObject<T>(obj: T, variables: Record<string, string>): T;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* ForgeEnv type for environment representation
|
|
141
|
+
* @see src/infrastructure/environment/forge-env.ts for the canonical definition
|
|
142
|
+
*/
|
|
143
|
+
export type { IForgeEnv } from '../infrastructure/environment/forge-env';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Core data types used throughout the framework.
|
|
5
5
|
* Simplified design for maximum compatibility.
|
|
6
6
|
*/
|
|
7
|
-
import { ParsedCookie } from '../cookie/interfaces';
|
|
7
|
+
import { ParsedCookie } from '../infrastructure/cookie/interfaces';
|
|
8
8
|
export type { ParsedCookie };
|
|
9
9
|
/**
|
|
10
10
|
* Unified Collection - the common format all parsers produce
|
|
@@ -24,6 +24,8 @@ export interface UnifiedCollection {
|
|
|
24
24
|
filePath: string;
|
|
25
25
|
version?: string;
|
|
26
26
|
};
|
|
27
|
+
/** Metadata (parser info, load timestamps, etc.) */
|
|
28
|
+
meta?: Record<string, any>;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Unified Folder within a collection
|
|
@@ -39,6 +41,7 @@ export interface UnifiedFolder {
|
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Unified Request - normalized request format
|
|
44
|
+
* Supports full feature set from CollectionRequest with metadata preservation
|
|
42
45
|
*/
|
|
43
46
|
export interface UnifiedRequest {
|
|
44
47
|
type: 'request';
|
|
@@ -47,16 +50,26 @@ export interface UnifiedRequest {
|
|
|
47
50
|
description?: string;
|
|
48
51
|
method: string;
|
|
49
52
|
url: string;
|
|
50
|
-
/** Headers
|
|
51
|
-
headers:
|
|
52
|
-
/** Query parameters
|
|
53
|
-
query:
|
|
54
|
-
/** Path parameters */
|
|
55
|
-
params?: Record<string, string>;
|
|
53
|
+
/** Headers with per-header enabled/disabled flag and OpenAPI metadata */
|
|
54
|
+
headers: KeyValueEntry[];
|
|
55
|
+
/** Query parameters with per-item enabled/disabled flag and OpenAPI metadata */
|
|
56
|
+
query: KeyValueEntry[];
|
|
57
|
+
/** Path parameters with OpenAPI metadata */
|
|
58
|
+
params?: Record<string, string | PathParamEntry>;
|
|
56
59
|
body?: RequestBody;
|
|
60
|
+
/** Content-Type override for request body */
|
|
61
|
+
bodyContentType?: string;
|
|
57
62
|
auth?: CollectionAuth;
|
|
58
63
|
settings?: RequestSettings;
|
|
59
64
|
scripts?: CollectionScripts;
|
|
65
|
+
/** Mark request as disabled (not editable via UI) */
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
/** Mark request as deprecated */
|
|
68
|
+
deprecated?: boolean;
|
|
69
|
+
/** Response schema for validation */
|
|
70
|
+
responseSchema?: ResponseSchemaDefinition;
|
|
71
|
+
/** Body schema for validation */
|
|
72
|
+
bodySchema?: BodySchemaDefinition;
|
|
60
73
|
}
|
|
61
74
|
/**
|
|
62
75
|
* Collection-level scripts
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collection Domain Interfaces
|
|
3
|
-
*
|
|
4
|
-
* Re-exports from collection-service-interfaces.ts and collection-store.ts,
|
|
5
|
-
* plus inline interfaces for ICollectionLoader and ICollectionParser.
|
|
6
|
-
*/
|
|
7
|
-
import { UnifiedCollection } from '../types/types';
|
|
8
|
-
export * from './collection-service-interfaces';
|
|
9
|
-
export * from './collection-store';
|
|
10
|
-
/**
|
|
11
|
-
* Interface for loading collections from storage.
|
|
12
|
-
*
|
|
13
|
-
* Implementations:
|
|
14
|
-
* - CollectionLoader: Loads single-file collections (.forge.json)
|
|
15
|
-
* - FolderCollectionLoader: Loads folder-based collections
|
|
16
|
-
*/
|
|
17
|
-
export interface ICollectionLoader {
|
|
18
|
-
loadAll(): Promise<UnifiedCollection[]> | UnifiedCollection[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Interface for parsing collection files into unified format.
|
|
22
|
-
*
|
|
23
|
-
* Implementations:
|
|
24
|
-
* - HttpForgeParser: Parses .forge.json files
|
|
25
|
-
* - PostmanParser: Parses .postman_collection.json (future)
|
|
26
|
-
* - InsomniaParser: Parses Insomnia exports (future)
|
|
27
|
-
*/
|
|
28
|
-
export interface ICollectionParser {
|
|
29
|
-
readonly format: string;
|
|
30
|
-
canParse(content: string): boolean;
|
|
31
|
-
parse(content: string, filePath: string): UnifiedCollection;
|
|
32
|
-
}
|
package/dist/parsers/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|