@http-forge/core 0.1.0 → 0.2.0
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 +194 -41
- package/dist/auth/interfaces.d.ts +63 -0
- package/dist/auth/oauth2-token-manager.d.ts +103 -0
- package/dist/collection/collection-loader-factory.d.ts +20 -0
- package/dist/{services → collection}/collection-loader.d.ts +3 -3
- package/dist/collection/collection-service-interfaces.d.ts +119 -0
- package/dist/collection/collection-service.d.ts +75 -0
- package/dist/collection/collection-store.d.ts +109 -0
- package/dist/collection/folder-collection-loader.d.ts +256 -0
- package/dist/collection/folder-collection-store.d.ts +168 -0
- package/dist/collection/interfaces.d.ts +32 -0
- package/dist/collection/json-collection-loader.d.ts +95 -0
- package/dist/{services → collection}/parser-registry.d.ts +1 -2
- package/dist/config/config-service.d.ts +79 -0
- package/dist/config/config.interface.d.ts +140 -0
- package/dist/config/default-config.d.ts +29 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/container.d.ts +22 -14
- package/dist/{implementations → cookie}/cookie-jar.d.ts +2 -3
- package/dist/cookie/cookie-service.d.ts +98 -0
- package/dist/{implementations → cookie}/cookie-utils.d.ts +1 -2
- package/dist/cookie/in-memory-cookie-jar.d.ts +44 -0
- package/dist/{interfaces/cookie.d.ts → cookie/interfaces.d.ts} +22 -3
- package/dist/cookie/persistent-cookie-jar.d.ts +35 -0
- package/dist/environment/environment-config-service.d.ts +95 -0
- package/dist/{services → environment}/environment-resolver.d.ts +6 -5
- package/dist/{services → environment}/forge-env.d.ts +1 -2
- package/dist/environment/interfaces.d.ts +139 -0
- package/dist/environment/variable-interpolator.d.ts +100 -0
- package/dist/execution/collection-request-executor-interfaces.d.ts +36 -0
- package/dist/execution/collection-request-executor.d.ts +78 -0
- package/dist/{services → execution}/request-executor.d.ts +23 -11
- package/dist/execution/request-preparer-interfaces.d.ts +36 -0
- package/dist/execution/request-preparer.d.ts +35 -0
- package/dist/graphql/graphql-completion-provider.d.ts +39 -0
- package/dist/graphql/graphql-schema-service.d.ts +89 -0
- package/dist/{interfaces/history.d.ts → history/history-interfaces.d.ts} +29 -6
- package/dist/history/request-history-service-interfaces.d.ts +43 -0
- package/dist/history/request-history-service.d.ts +133 -0
- package/dist/{implementations → history}/request-history.d.ts +2 -3
- package/dist/{implementations → http}/fetch-http-client.d.ts +4 -5
- package/dist/http/http-request-service.d.ts +36 -0
- package/dist/{implementations → http}/interceptor-chain.d.ts +1 -2
- package/dist/http/interfaces.d.ts +25 -0
- package/dist/http/merge-request-settings.d.ts +12 -0
- package/dist/{implementations → http}/native-http-client.d.ts +6 -15
- package/dist/{implementations → http}/request-preprocessor.d.ts +1 -2
- package/dist/{services → http}/url-builder.d.ts +7 -10
- package/dist/import-export/import-postman-environment.d.ts +21 -0
- package/dist/import-export/rest-client-export.d.ts +35 -0
- package/dist/index.d.ts +88 -6
- package/dist/index.js +262 -35
- package/dist/index.mjs +262 -35
- package/dist/openapi/example-generator.d.ts +26 -0
- package/dist/openapi/history-analyzer.d.ts +29 -0
- package/dist/openapi/index.d.ts +16 -0
- package/dist/openapi/interfaces.d.ts +42 -0
- package/dist/openapi/openapi-exporter.d.ts +73 -0
- package/dist/openapi/openapi-importer.d.ts +72 -0
- package/dist/openapi/ref-resolver.d.ts +28 -0
- package/dist/openapi/schema-inference-service.d.ts +40 -0
- package/dist/openapi/schema-inferrer.d.ts +26 -0
- package/dist/openapi/script-analyzer.d.ts +41 -0
- package/dist/parsers/http-forge-parser.d.ts +2 -3
- package/dist/parsers/index.d.ts +0 -1
- package/dist/{implementations → platform}/data-file-parser.d.ts +0 -1
- package/dist/{implementations → platform}/node-file-system.d.ts +1 -2
- package/dist/script/interfaces.d.ts +149 -0
- package/dist/script/module-loader.d.ts +115 -0
- package/dist/script/request-script-session.d.ts +70 -0
- package/dist/script/script-executor.d.ts +60 -0
- package/dist/script/script-factories.d.ts +83 -0
- package/dist/script/script-utils.d.ts +41 -0
- package/dist/test-suite/index.d.ts +10 -0
- package/dist/test-suite/interfaces.d.ts +164 -0
- package/dist/test-suite/result-storage-service.d.ts +70 -0
- package/dist/test-suite/result-storage.d.ts +296 -0
- package/dist/test-suite/statistics-service.d.ts +51 -0
- package/dist/test-suite/test-suite-service.d.ts +97 -0
- package/dist/test-suite/test-suite-store.d.ts +155 -0
- package/dist/types/console-service.d.ts +40 -0
- package/dist/types/platform.d.ts +206 -0
- package/dist/{interfaces → types}/types.d.ts +282 -12
- package/dist/utils/dynamic-variables.d.ts +38 -0
- package/dist/utils/expression-evaluator.d.ts +34 -0
- package/dist/utils/filter-engine.d.ts +47 -0
- package/dist/utils/helpers.d.ts +47 -0
- package/package.json +11 -3
- package/dist/container.d.ts.map +0 -1
- package/dist/implementations/cookie-jar.d.ts.map +0 -1
- package/dist/implementations/cookie-utils.d.ts.map +0 -1
- package/dist/implementations/data-file-parser.d.ts.map +0 -1
- package/dist/implementations/fetch-http-client.d.ts.map +0 -1
- package/dist/implementations/index.d.ts +0 -22
- package/dist/implementations/index.d.ts.map +0 -1
- package/dist/implementations/interceptor-chain.d.ts.map +0 -1
- package/dist/implementations/module-loader.d.ts +0 -74
- package/dist/implementations/module-loader.d.ts.map +0 -1
- package/dist/implementations/native-http-client.d.ts.map +0 -1
- package/dist/implementations/node-file-system.d.ts.map +0 -1
- package/dist/implementations/request-history.d.ts.map +0 -1
- package/dist/implementations/request-preprocessor.d.ts.map +0 -1
- package/dist/implementations/variable-interpolator.d.ts +0 -55
- package/dist/implementations/variable-interpolator.d.ts.map +0 -1
- package/dist/implementations/vm2-script-runner.d.ts +0 -76
- package/dist/implementations/vm2-script-runner.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/cookie.d.ts.map +0 -1
- package/dist/interfaces/history.d.ts.map +0 -1
- package/dist/interfaces/index.d.ts +0 -170
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/types.d.ts.map +0 -1
- package/dist/parsers/http-forge-parser.d.ts.map +0 -1
- package/dist/parsers/index.d.ts.map +0 -1
- package/dist/services/collection-loader.d.ts.map +0 -1
- package/dist/services/environment-resolver.d.ts.map +0 -1
- package/dist/services/folder-collection-loader.d.ts +0 -91
- package/dist/services/folder-collection-loader.d.ts.map +0 -1
- package/dist/services/forge-env.d.ts.map +0 -1
- package/dist/services/index.d.ts +0 -20
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/parser-registry.d.ts.map +0 -1
- package/dist/services/request-executor.d.ts.map +0 -1
- package/dist/services/script-pipeline.d.ts +0 -43
- package/dist/services/script-pipeline.d.ts.map +0 -1
- package/dist/services/script-session.d.ts +0 -66
- package/dist/services/script-session.d.ts.map +0 -1
- package/dist/services/url-builder.d.ts.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Collection Loader
|
|
3
|
+
*
|
|
4
|
+
* Loads collections from single JSON files (legacy format)
|
|
5
|
+
* Each collection is stored as a single .json file
|
|
6
|
+
*
|
|
7
|
+
* For JSON format, all item-level operations fall back to saving the entire collection
|
|
8
|
+
* since everything is in one file anyway.
|
|
9
|
+
*/
|
|
10
|
+
import type { Collection, CollectionItem, RequestScripts } from './collection-service-interfaces';
|
|
11
|
+
import type { CollectionMetadata, ICollectionStore } from './collection-store';
|
|
12
|
+
/**
|
|
13
|
+
* Loads collections from JSON files
|
|
14
|
+
* Format: collections/{collection-id}.json
|
|
15
|
+
*/
|
|
16
|
+
export declare class JsonCollectionLoader implements ICollectionStore {
|
|
17
|
+
private collectionsDir;
|
|
18
|
+
private cache;
|
|
19
|
+
constructor(collectionsDir: string);
|
|
20
|
+
/**
|
|
21
|
+
* Ensure collections directory exists
|
|
22
|
+
*/
|
|
23
|
+
private ensureDirectory;
|
|
24
|
+
/**
|
|
25
|
+
* Load all collections from disk
|
|
26
|
+
*/
|
|
27
|
+
loadAll(): Collection[];
|
|
28
|
+
/**
|
|
29
|
+
* Load a single collection by ID
|
|
30
|
+
*/
|
|
31
|
+
load(id: string): Collection | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Save a collection
|
|
34
|
+
*/
|
|
35
|
+
save(collection: Collection): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete a collection
|
|
38
|
+
*/
|
|
39
|
+
delete(id: string): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Check if a collection exists
|
|
42
|
+
*/
|
|
43
|
+
exists(id: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Get the file path for a collection
|
|
46
|
+
*/
|
|
47
|
+
getCollectionPath(id: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new collection
|
|
50
|
+
*/
|
|
51
|
+
create(name: string, id?: string): Promise<Collection>;
|
|
52
|
+
/**
|
|
53
|
+
* Save scripts for a specific item
|
|
54
|
+
* In JSON format, scripts are embedded in the collection JSON
|
|
55
|
+
*/
|
|
56
|
+
saveScripts(collectionId: string, itemId: string, scripts: RequestScripts): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Load scripts for a specific item
|
|
59
|
+
*/
|
|
60
|
+
loadScripts(collectionId: string, itemId: string): RequestScripts | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Update collection metadata
|
|
63
|
+
*/
|
|
64
|
+
updateCollectionMetadata(collectionId: string, updates: Partial<CollectionMetadata>): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Save/update a single item
|
|
67
|
+
* For JSON format: saves entire collection
|
|
68
|
+
*/
|
|
69
|
+
saveItem(collectionId: string, item: CollectionItem, parentId?: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Delete a single item
|
|
72
|
+
*/
|
|
73
|
+
deleteItem(collectionId: string, itemId: string): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Update a single item
|
|
76
|
+
*/
|
|
77
|
+
updateItem(collectionId: string, itemId: string, updates: Partial<CollectionItem>): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Move an item to a new parent
|
|
80
|
+
*/
|
|
81
|
+
moveItem(collectionId: string, itemId: string, newParentId?: string): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Reorder items within a parent (collection or folder)
|
|
84
|
+
* For JSON format, just reorder the items array and save
|
|
85
|
+
*/
|
|
86
|
+
reorderItems(collectionId: string, parentId: string | undefined, orderedItemIds: string[]): Promise<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Find an item by ID in the collection tree
|
|
89
|
+
*/
|
|
90
|
+
private findItemById;
|
|
91
|
+
/**
|
|
92
|
+
* Delete an item by ID from the collection tree
|
|
93
|
+
*/
|
|
94
|
+
private deleteItemById;
|
|
95
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Open/Closed Principle: New parsers can be added without modifying existing code
|
|
5
5
|
* Single Responsibility: Manage collection parser registration and lookup
|
|
6
6
|
*/
|
|
7
|
-
import { ICollectionParser } from '
|
|
7
|
+
import { ICollectionParser } from './interfaces';
|
|
8
8
|
/**
|
|
9
9
|
* Registry for collection parsers
|
|
10
10
|
* Allows registering parsers for different collection formats
|
|
@@ -46,4 +46,3 @@ export declare class ParserRegistry {
|
|
|
46
46
|
*/
|
|
47
47
|
clear(): void;
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=parser-registry.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Forge Configuration Service
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: Manages loading and accessing configuration
|
|
5
|
+
* from http-forge.config.json
|
|
6
|
+
*
|
|
7
|
+
* Platform-agnostic — uses IFileWatcherFactory and INotificationService
|
|
8
|
+
* instead of VS Code APIs.
|
|
9
|
+
*/
|
|
10
|
+
import { IFileWatcherFactory, INotificationService } from '../types/platform';
|
|
11
|
+
import type { EnvironmentsConfig, HttpForgeConfig, IConfigService, ProxyConfig, RequestConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
12
|
+
/**
|
|
13
|
+
* Configuration Service Implementation
|
|
14
|
+
*
|
|
15
|
+
* Loads configuration from http-forge.config.json in workspace root.
|
|
16
|
+
* Falls back to default values for missing fields.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ConfigService implements IConfigService {
|
|
19
|
+
private workspacePath;
|
|
20
|
+
private fileWatcherFactory?;
|
|
21
|
+
private notifications?;
|
|
22
|
+
private config;
|
|
23
|
+
private configPath;
|
|
24
|
+
private fileWatcher?;
|
|
25
|
+
constructor(workspacePath: string, fileWatcherFactory?: IFileWatcherFactory | undefined, notifications?: INotificationService | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* Load configuration from file, merging with defaults
|
|
28
|
+
*/
|
|
29
|
+
private loadConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Merge user configuration with defaults
|
|
32
|
+
*/
|
|
33
|
+
private mergeWithDefaults;
|
|
34
|
+
/**
|
|
35
|
+
* Setup file watcher for configuration changes
|
|
36
|
+
*/
|
|
37
|
+
private setupFileWatcher;
|
|
38
|
+
getConfig(): HttpForgeConfig;
|
|
39
|
+
getStorageConfig(): StorageConfig;
|
|
40
|
+
getRequestConfig(): RequestConfig;
|
|
41
|
+
getScriptsConfig(): ScriptsConfig;
|
|
42
|
+
getRunnerConfig(): RunnerConfig;
|
|
43
|
+
getEnvironmentsConfig(): EnvironmentsConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Path where REST-Client export files should be saved. The returned
|
|
46
|
+
* string is an absolute path, resolved against the workspace when a
|
|
47
|
+
* relative value is configured.
|
|
48
|
+
*/
|
|
49
|
+
getRestClientExportPath(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to merge global variables into each environment export.
|
|
52
|
+
*/
|
|
53
|
+
getRestClientMergeGlobals(): boolean;
|
|
54
|
+
getProxyConfig(): ProxyConfig | null;
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a path relative to workspace
|
|
57
|
+
*/
|
|
58
|
+
private resolvePath;
|
|
59
|
+
getRootPath(): string;
|
|
60
|
+
getCollectionsPath(): string;
|
|
61
|
+
getEnvironmentsPath(): string;
|
|
62
|
+
getFlowsPath(): string;
|
|
63
|
+
getHistoryPath(): string;
|
|
64
|
+
getResultsPath(): string;
|
|
65
|
+
getSuitesPath(): string;
|
|
66
|
+
getModulePaths(): string[];
|
|
67
|
+
getWorkspacePath(): string;
|
|
68
|
+
reload(): void;
|
|
69
|
+
configExists(): boolean;
|
|
70
|
+
createDefaultConfig(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Create sample environment files
|
|
73
|
+
*/
|
|
74
|
+
private createSampleEnvironments;
|
|
75
|
+
/**
|
|
76
|
+
* Dispose resources
|
|
77
|
+
*/
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Forge Configuration Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Defines the structure of http-forge.config.json
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Storage configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface StorageConfig {
|
|
10
|
+
/** Storage format: 'folder' for directory structure, 'json' for single files */
|
|
11
|
+
format: 'folder' | 'json';
|
|
12
|
+
/** Root directory for HTTP Forge data (relative to workspace) */
|
|
13
|
+
root: string;
|
|
14
|
+
/** Directory for request history (relative to workspace, typically gitignored) */
|
|
15
|
+
history: string;
|
|
16
|
+
/** Directory for test results (relative to workspace, typically gitignored) */
|
|
17
|
+
results: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Request configuration
|
|
21
|
+
*/
|
|
22
|
+
export interface RequestConfig {
|
|
23
|
+
/** Request timeout in milliseconds */
|
|
24
|
+
timeout: number;
|
|
25
|
+
/** Whether to automatically follow redirects */
|
|
26
|
+
followRedirects: boolean;
|
|
27
|
+
/** Maximum number of redirects to follow */
|
|
28
|
+
maxRedirects: number;
|
|
29
|
+
/** Whether to verify SSL certificates */
|
|
30
|
+
strictSSL: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Script configuration
|
|
34
|
+
*/
|
|
35
|
+
export interface ScriptsConfig {
|
|
36
|
+
/** Paths to search for importable modules (relative to workspace) */
|
|
37
|
+
modulePaths: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Runner configuration
|
|
41
|
+
*/
|
|
42
|
+
export interface RunnerConfig {
|
|
43
|
+
/** Number of days to retain test results */
|
|
44
|
+
resultsRetentionDays: number;
|
|
45
|
+
/** Number of result summaries per index page file */
|
|
46
|
+
indexPageSize: number;
|
|
47
|
+
/** Maximum number of recent errors to track */
|
|
48
|
+
recentErrorsLimit: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Environments configuration
|
|
52
|
+
*/
|
|
53
|
+
export interface EnvironmentsConfig {
|
|
54
|
+
/** Default environment to use */
|
|
55
|
+
default: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* REST-Client export configuration
|
|
59
|
+
*/
|
|
60
|
+
export interface RestClientExportConfig {
|
|
61
|
+
/** Output path for exported REST-Client files */
|
|
62
|
+
path?: string;
|
|
63
|
+
/** When exporting environments, merge global variables into each environment file */
|
|
64
|
+
mergeGlobals?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Proxy configuration
|
|
68
|
+
*/
|
|
69
|
+
export interface ProxyConfig {
|
|
70
|
+
/** HTTP proxy URL */
|
|
71
|
+
http?: string;
|
|
72
|
+
/** HTTPS proxy URL */
|
|
73
|
+
https?: string;
|
|
74
|
+
/** List of hosts to bypass proxy */
|
|
75
|
+
bypass?: string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Main HTTP Forge configuration (http-forge.config.json)
|
|
79
|
+
*/
|
|
80
|
+
export interface HttpForgeConfig {
|
|
81
|
+
/** Configuration version */
|
|
82
|
+
version: string;
|
|
83
|
+
/** Storage configuration */
|
|
84
|
+
storage: StorageConfig;
|
|
85
|
+
/** Request defaults */
|
|
86
|
+
request: RequestConfig;
|
|
87
|
+
/** Script configuration */
|
|
88
|
+
scripts: ScriptsConfig;
|
|
89
|
+
/** Test runner configuration */
|
|
90
|
+
runner: RunnerConfig;
|
|
91
|
+
/** Environment configuration */
|
|
92
|
+
environments: EnvironmentsConfig;
|
|
93
|
+
/** REST-Client export preferences */
|
|
94
|
+
restClientExport?: RestClientExportConfig;
|
|
95
|
+
/** Proxy configuration (optional) */
|
|
96
|
+
proxy?: ProxyConfig | null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Configuration service interface
|
|
100
|
+
*/
|
|
101
|
+
export interface IConfigService {
|
|
102
|
+
/** Get the full configuration */
|
|
103
|
+
getConfig(): HttpForgeConfig;
|
|
104
|
+
/** Get storage configuration */
|
|
105
|
+
getStorageConfig(): StorageConfig;
|
|
106
|
+
/** Get request configuration */
|
|
107
|
+
getRequestConfig(): RequestConfig;
|
|
108
|
+
/** Get scripts configuration */
|
|
109
|
+
getScriptsConfig(): ScriptsConfig;
|
|
110
|
+
/** Get runner configuration */
|
|
111
|
+
getRunnerConfig(): RunnerConfig;
|
|
112
|
+
/** Get environments configuration */
|
|
113
|
+
getEnvironmentsConfig(): EnvironmentsConfig;
|
|
114
|
+
/** Get proxy configuration */
|
|
115
|
+
getProxyConfig(): ProxyConfig | null;
|
|
116
|
+
/** Get the resolved root path for HTTP Forge data */
|
|
117
|
+
getRootPath(): string;
|
|
118
|
+
/** Get the resolved collections path */
|
|
119
|
+
getCollectionsPath(): string;
|
|
120
|
+
/** Get the resolved environments path */
|
|
121
|
+
getEnvironmentsPath(): string;
|
|
122
|
+
/** Get the resolved flows path */
|
|
123
|
+
getFlowsPath(): string;
|
|
124
|
+
/** Get the resolved history path */
|
|
125
|
+
getHistoryPath(): string;
|
|
126
|
+
/** Get the resolved results path */
|
|
127
|
+
getResultsPath(): string;
|
|
128
|
+
/** Get the resolved suites path */
|
|
129
|
+
getSuitesPath(): string;
|
|
130
|
+
/** Get resolved module paths for script imports */
|
|
131
|
+
getModulePaths(): string[];
|
|
132
|
+
/** Get the workspace root path */
|
|
133
|
+
getWorkspacePath(): string;
|
|
134
|
+
/** Reload configuration from disk */
|
|
135
|
+
reload(): void;
|
|
136
|
+
/** Check if configuration file exists */
|
|
137
|
+
configExists(): boolean;
|
|
138
|
+
/** Create default configuration file */
|
|
139
|
+
createDefaultConfig(): Promise<void>;
|
|
140
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Forge Default Configuration
|
|
3
|
+
*/
|
|
4
|
+
import { HttpForgeConfig } from './config.interface';
|
|
5
|
+
/**
|
|
6
|
+
* Default configuration values
|
|
7
|
+
* Used when http-forge.config.json doesn't exist or has missing fields
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_CONFIG: HttpForgeConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration file names
|
|
12
|
+
*/
|
|
13
|
+
export declare const CONFIG_FILES: {
|
|
14
|
+
/** Main configuration file */
|
|
15
|
+
config: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Directory names within the root
|
|
19
|
+
*/
|
|
20
|
+
export declare const ROOT_DIRECTORIES: {
|
|
21
|
+
/** Collections directory */
|
|
22
|
+
collections: string;
|
|
23
|
+
/** Environments directory */
|
|
24
|
+
environments: string;
|
|
25
|
+
/** Flows directory */
|
|
26
|
+
flows: string;
|
|
27
|
+
/** Suites directory */
|
|
28
|
+
suites: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Services
|
|
3
|
+
*/
|
|
4
|
+
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
5
|
+
export { CONFIG_FILES, DEFAULT_CONFIG, ROOT_DIRECTORIES } from './default-config';
|
|
6
|
+
export { ConfigService } from './config-service';
|
package/dist/container.d.ts
CHANGED
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
* Single Responsibility: Wire up all components with proper dependencies
|
|
5
5
|
* Factory Pattern: Creates configured instances of services
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { ICookieService } from './cookie/interfaces';
|
|
8
|
+
import { IDataFileParser } from './platform/data-file-parser';
|
|
9
|
+
import { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor } from './http/interceptor-chain';
|
|
10
|
+
import { IRequestPreprocessor } from './http/request-preprocessor';
|
|
11
|
+
import { IFileSystem, IHttpClient } from './types/platform';
|
|
12
|
+
import { ICollectionLoader } from './collection/interfaces';
|
|
13
|
+
import { IRequestHistory } from './history/history-interfaces';
|
|
14
|
+
import { IScriptExecutor } from './script/interfaces';
|
|
15
|
+
import { IVariableInterpolator } from './environment/interfaces';
|
|
16
|
+
import { HttpRequest, HttpResponse, RequestSettings, UnifiedCollection, UnifiedRequest } from './types/types';
|
|
17
|
+
import { EnvironmentResolver, EnvironmentStoreConfig } from './environment/environment-resolver';
|
|
18
|
+
import { ForgeEnv } from './environment/forge-env';
|
|
19
|
+
import { ParserRegistry } from './collection/parser-registry';
|
|
20
|
+
import { RequestExecutor } from './execution/request-executor';
|
|
11
21
|
/**
|
|
12
22
|
* Container configuration options
|
|
13
23
|
*/
|
|
@@ -31,7 +41,7 @@ export interface ForgeContainerOptions {
|
|
|
31
41
|
/** Enable cookie jar for automatic cookie management */
|
|
32
42
|
enableCookies?: boolean;
|
|
33
43
|
/** Custom cookie jar implementation */
|
|
34
|
-
cookieJar?:
|
|
44
|
+
cookieJar?: ICookieService;
|
|
35
45
|
/** Request interceptors to register */
|
|
36
46
|
requestInterceptors?: IRequestInterceptor[];
|
|
37
47
|
/** Response interceptors to register */
|
|
@@ -40,8 +50,8 @@ export interface ForgeContainerOptions {
|
|
|
40
50
|
errorInterceptors?: IErrorInterceptor[];
|
|
41
51
|
/** Custom interceptor chain (overrides individual interceptors) */
|
|
42
52
|
interceptorChain?: IInterceptorChain;
|
|
43
|
-
/** Custom script
|
|
44
|
-
|
|
53
|
+
/** Custom script executor implementation (vm-based, session architecture) */
|
|
54
|
+
scriptExecutor?: IScriptExecutor;
|
|
45
55
|
/** Script execution timeout (ms) */
|
|
46
56
|
scriptTimeout?: number;
|
|
47
57
|
/** Custom file system implementation */
|
|
@@ -59,7 +69,7 @@ export interface ForgeContainerOptions {
|
|
|
59
69
|
/** Custom request history implementation */
|
|
60
70
|
requestHistory?: IRequestHistory;
|
|
61
71
|
/** Environment configuration */
|
|
62
|
-
environmentConfig?:
|
|
72
|
+
environmentConfig?: EnvironmentStoreConfig;
|
|
63
73
|
}
|
|
64
74
|
/**
|
|
65
75
|
* Forge Container - Main entry point for HTTP Forge Core
|
|
@@ -74,9 +84,9 @@ export interface ForgeContainerOptions {
|
|
|
74
84
|
export declare class ForgeContainer {
|
|
75
85
|
readonly httpClient: IHttpClient;
|
|
76
86
|
readonly fileSystem: IFileSystem;
|
|
77
|
-
readonly
|
|
87
|
+
readonly scriptExecutor: IScriptExecutor;
|
|
78
88
|
readonly interpolator: IVariableInterpolator;
|
|
79
|
-
readonly cookieJar:
|
|
89
|
+
readonly cookieJar: ICookieService;
|
|
80
90
|
readonly interceptorChain: IInterceptorChain;
|
|
81
91
|
readonly preprocessor: IRequestPreprocessor;
|
|
82
92
|
readonly dataFileParser: IDataFileParser;
|
|
@@ -85,7 +95,6 @@ export declare class ForgeContainer {
|
|
|
85
95
|
readonly collectionLoader: ICollectionLoader;
|
|
86
96
|
readonly environmentStore: EnvironmentResolver;
|
|
87
97
|
readonly forgeEnv: ForgeEnv;
|
|
88
|
-
readonly scriptPipeline: ScriptPipeline;
|
|
89
98
|
readonly requestExecutor: RequestExecutor;
|
|
90
99
|
private readonly options;
|
|
91
100
|
constructor(options?: ForgeContainerOptions);
|
|
@@ -106,7 +115,7 @@ export declare class ForgeContainer {
|
|
|
106
115
|
/**
|
|
107
116
|
* Execute a request with full pipeline
|
|
108
117
|
*/
|
|
109
|
-
execute(request: UnifiedRequest, collection: UnifiedCollection, options?: any): Promise<import("
|
|
118
|
+
execute(request: UnifiedRequest, collection: UnifiedCollection, options?: any): Promise<import(".").ExecuteResult>;
|
|
110
119
|
/**
|
|
111
120
|
* Execute a simple HTTP request
|
|
112
121
|
*/
|
|
@@ -118,7 +127,7 @@ export declare class ForgeContainer {
|
|
|
118
127
|
/**
|
|
119
128
|
* Set environment configuration
|
|
120
129
|
*/
|
|
121
|
-
setEnvironmentConfig(config:
|
|
130
|
+
setEnvironmentConfig(config: EnvironmentStoreConfig): void;
|
|
122
131
|
/**
|
|
123
132
|
* Create a new container with custom options
|
|
124
133
|
*/
|
|
@@ -143,4 +152,3 @@ export declare class ForgeContainer {
|
|
|
143
152
|
*/
|
|
144
153
|
static fromForgeRoot(forgeRoot?: string, options?: Omit<ForgeContainerOptions, 'forgeRoot' | 'environmentConfig'>): ForgeContainer;
|
|
145
154
|
}
|
|
146
|
-
//# sourceMappingURL=container.d.ts.map
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
*
|
|
12
12
|
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
13
13
|
*/
|
|
14
|
-
import { Cookie,
|
|
14
|
+
import { Cookie, ICookieService } from './interfaces';
|
|
15
15
|
/**
|
|
16
16
|
* In-memory cookie storage
|
|
17
17
|
* Equivalent to plugin's CookieService but without VS Code persistence
|
|
18
18
|
*/
|
|
19
|
-
export declare class CookieJar implements
|
|
19
|
+
export declare class CookieJar implements ICookieService {
|
|
20
20
|
private cookies;
|
|
21
21
|
/**
|
|
22
22
|
* Generate a unique key for a cookie
|
|
@@ -94,4 +94,3 @@ export declare class CookieJar implements ICookieJar {
|
|
|
94
94
|
*/
|
|
95
95
|
cleanExpiredCookies(): void;
|
|
96
96
|
}
|
|
97
|
-
//# sourceMappingURL=cookie-jar.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie Service
|
|
3
|
+
*
|
|
4
|
+
* Manages cookies across HTTP Forge sessions.
|
|
5
|
+
* Platform-agnostic — uses IKeyValueStore for persistence
|
|
6
|
+
* instead of VS Code globalState.
|
|
7
|
+
*/
|
|
8
|
+
import { Cookie, ICookieParser, ICookieReader } from './interfaces';
|
|
9
|
+
import { IKeyValueStore } from '../types/platform';
|
|
10
|
+
/**
|
|
11
|
+
* Full cookie service interface (async write operations for platform persistence)
|
|
12
|
+
*/
|
|
13
|
+
export interface IAsyncCookieServiceFull extends ICookieReader, ICookieParser {
|
|
14
|
+
readonly count: number;
|
|
15
|
+
set(cookie: Cookie): Promise<void>;
|
|
16
|
+
setFromResponse(cookies: Cookie[]): Promise<void>;
|
|
17
|
+
delete(name: string, domain?: string, path?: string): Promise<boolean>;
|
|
18
|
+
clear(): Promise<void>;
|
|
19
|
+
clearDomain(domain: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Service for managing cookies across HTTP Forge sessions.
|
|
23
|
+
* Provides persistent cookie storage via IKeyValueStore.
|
|
24
|
+
*/
|
|
25
|
+
export declare class CookieService implements IAsyncCookieServiceFull {
|
|
26
|
+
private store;
|
|
27
|
+
private storeKey;
|
|
28
|
+
private cookies;
|
|
29
|
+
constructor(store: IKeyValueStore, storeKey?: string);
|
|
30
|
+
/**
|
|
31
|
+
* Load cookies from persistent storage
|
|
32
|
+
*/
|
|
33
|
+
private loadCookies;
|
|
34
|
+
/**
|
|
35
|
+
* Save cookies to persistent storage
|
|
36
|
+
*/
|
|
37
|
+
private saveCookies;
|
|
38
|
+
/**
|
|
39
|
+
* Generate a unique key for a cookie
|
|
40
|
+
*/
|
|
41
|
+
private getCookieKey;
|
|
42
|
+
/**
|
|
43
|
+
* Get a cookie by name
|
|
44
|
+
*/
|
|
45
|
+
get(name: string, domain?: string): Cookie | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Set a cookie
|
|
48
|
+
*/
|
|
49
|
+
set(cookie: Cookie): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Set multiple cookies from a response
|
|
52
|
+
*/
|
|
53
|
+
setFromResponse(cookies: Cookie[]): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a cookie exists
|
|
56
|
+
*/
|
|
57
|
+
has(name: string, domain?: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Delete a cookie
|
|
60
|
+
*/
|
|
61
|
+
delete(name: string, domain?: string, path?: string): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Get all cookies, optionally filtered by domain
|
|
64
|
+
*/
|
|
65
|
+
getAll(domain?: string): Cookie[];
|
|
66
|
+
/**
|
|
67
|
+
* Get cookies formatted for HTTP Cookie header
|
|
68
|
+
*/
|
|
69
|
+
getCookieHeader(domain?: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Clear all cookies
|
|
72
|
+
*/
|
|
73
|
+
clear(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Clear cookies for a specific domain
|
|
76
|
+
*/
|
|
77
|
+
clearDomain(domain: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Parse Set-Cookie headers from response
|
|
80
|
+
*/
|
|
81
|
+
parseCookieHeaders(headers: Record<string, string | string[]>, domain?: string): Cookie[];
|
|
82
|
+
/**
|
|
83
|
+
* Check if a cookie is expired
|
|
84
|
+
*/
|
|
85
|
+
private isExpired;
|
|
86
|
+
/**
|
|
87
|
+
* Clean expired cookies
|
|
88
|
+
*/
|
|
89
|
+
private cleanExpiredCookies;
|
|
90
|
+
/**
|
|
91
|
+
* Check if a domain matches a cookie domain
|
|
92
|
+
*/
|
|
93
|
+
private domainMatches;
|
|
94
|
+
/**
|
|
95
|
+
* Get cookie count
|
|
96
|
+
*/
|
|
97
|
+
get count(): number;
|
|
98
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Single Responsibility: Cookie parsing, formatting, and validation
|
|
8
8
|
*/
|
|
9
|
-
import { Cookie } from '
|
|
9
|
+
import { Cookie } from './interfaces';
|
|
10
10
|
export declare class CookieUtils {
|
|
11
11
|
/**
|
|
12
12
|
* Parse a single Set-Cookie header value
|
|
@@ -75,4 +75,3 @@ export declare class CookieUtils {
|
|
|
75
75
|
*/
|
|
76
76
|
static extractPath(url: string): string;
|
|
77
77
|
}
|
|
78
|
-
//# sourceMappingURL=cookie-utils.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Cookie Jar
|
|
3
|
+
*
|
|
4
|
+
* Lightweight ICookieJar implementation for isolated script execution contexts
|
|
5
|
+
* (e.g., test suite runs). All cookies are stored in-memory and lost when the
|
|
6
|
+
* instance is discarded.
|
|
7
|
+
*
|
|
8
|
+
* For persistent cookie handling (across requests in a session), use
|
|
9
|
+
* PersistentCookieJar which wraps an ICookieService backend.
|
|
10
|
+
*/
|
|
11
|
+
import type { Cookie } from './interfaces';
|
|
12
|
+
import type { ICookieJar } from '../script/interfaces';
|
|
13
|
+
export declare class InMemoryCookieJar implements ICookieJar {
|
|
14
|
+
private cookies;
|
|
15
|
+
/**
|
|
16
|
+
* Generate a unique key for a cookie (based on CookieService pattern)
|
|
17
|
+
*/
|
|
18
|
+
private getCookieKey;
|
|
19
|
+
/**
|
|
20
|
+
* Get cookies for a specific domain
|
|
21
|
+
*/
|
|
22
|
+
getCookiesForDomain(domain: string): Cookie[];
|
|
23
|
+
has(name: string, domain?: string): boolean;
|
|
24
|
+
get(name: string, domain?: string): Cookie | undefined;
|
|
25
|
+
set(cookie: Cookie): void;
|
|
26
|
+
delete(name: string, domain?: string, path?: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get all cookies, optionally filtered by domain
|
|
29
|
+
*/
|
|
30
|
+
getAll(domain?: string): Cookie[];
|
|
31
|
+
/**
|
|
32
|
+
* Add cookies from Set-Cookie headers
|
|
33
|
+
*/
|
|
34
|
+
setCookiesFromResponse(url: string, headers: Record<string, string | string[]>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get Cookie header value for a request URL
|
|
37
|
+
* Filters by domain and path matching
|
|
38
|
+
*/
|
|
39
|
+
getCookieHeader(url: string): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Clear all cookies
|
|
42
|
+
*/
|
|
43
|
+
clear(): void;
|
|
44
|
+
}
|
|
@@ -89,13 +89,32 @@ export interface ICookieWriter {
|
|
|
89
89
|
clearDomain(domain: string): void;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Full cookie
|
|
92
|
+
* Full cookie service interface
|
|
93
93
|
* Core package version - no VS Code dependency
|
|
94
94
|
*/
|
|
95
|
-
export interface
|
|
95
|
+
export interface ICookieService extends ICookieReader, ICookieWriter, ICookieParser {
|
|
96
96
|
/**
|
|
97
97
|
* Get cookie count
|
|
98
98
|
*/
|
|
99
99
|
readonly count: number;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Async cookie service interface for platform integrations that require
|
|
103
|
+
* asynchronous persistence (e.g., VS Code globalState, IndexedDB, etc.)
|
|
104
|
+
*
|
|
105
|
+
* Read operations remain synchronous (from in-memory cache).
|
|
106
|
+
* Write operations return Promises to allow async persistence after mutation.
|
|
107
|
+
*/
|
|
108
|
+
export interface IAsyncCookieService extends ICookieReader, ICookieParser {
|
|
109
|
+
readonly count: number;
|
|
110
|
+
/** Set a cookie (persists asynchronously) */
|
|
111
|
+
set(cookie: Cookie): Promise<void>;
|
|
112
|
+
/** Set multiple cookies from response headers (persists asynchronously) */
|
|
113
|
+
setFromResponse(cookies: Cookie[]): Promise<void>;
|
|
114
|
+
/** Delete a cookie (persists asynchronously) */
|
|
115
|
+
delete(name: string, domain?: string, path?: string): Promise<boolean>;
|
|
116
|
+
/** Clear all cookies (persists asynchronously) */
|
|
117
|
+
clear(): Promise<void>;
|
|
118
|
+
/** Clear cookies for a specific domain (persists asynchronously) */
|
|
119
|
+
clearDomain(domain: string): Promise<void>;
|
|
120
|
+
}
|