@http-forge/core 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +217 -43
  2. package/dist/auth/interfaces.d.ts +63 -0
  3. package/dist/auth/oauth2-token-manager.d.ts +103 -0
  4. package/dist/collection/collection-loader-factory.d.ts +20 -0
  5. package/dist/{services → collection}/collection-loader.d.ts +3 -3
  6. package/dist/collection/collection-service-interfaces.d.ts +119 -0
  7. package/dist/collection/collection-service.d.ts +75 -0
  8. package/dist/collection/collection-store.d.ts +109 -0
  9. package/dist/collection/folder-collection-loader.d.ts +45 -0
  10. package/dist/collection/folder-collection-store.d.ts +175 -0
  11. package/dist/collection/folder-io.d.ts +113 -0
  12. package/dist/collection/interfaces.d.ts +32 -0
  13. package/dist/collection/json-collection-loader.d.ts +95 -0
  14. package/dist/{services → collection}/parser-registry.d.ts +1 -2
  15. package/dist/config/config-service.d.ts +79 -0
  16. package/dist/config/config.interface.d.ts +140 -0
  17. package/dist/config/default-config.d.ts +29 -0
  18. package/dist/config/index.d.ts +6 -0
  19. package/dist/container.d.ts +26 -19
  20. package/dist/{implementations → cookie}/cookie-jar.d.ts +2 -3
  21. package/dist/cookie/cookie-service.d.ts +98 -0
  22. package/dist/{implementations → cookie}/cookie-utils.d.ts +1 -2
  23. package/dist/cookie/in-memory-cookie-jar.d.ts +44 -0
  24. package/dist/{interfaces/cookie.d.ts → cookie/interfaces.d.ts} +22 -3
  25. package/dist/cookie/persistent-cookie-jar.d.ts +35 -0
  26. package/dist/di/core-bootstrap.d.ts +25 -0
  27. package/dist/di/index.d.ts +11 -0
  28. package/dist/di/platform-adapters.d.ts +53 -0
  29. package/dist/di/service-container.d.ts +97 -0
  30. package/dist/di/service-identifiers.d.ts +34 -0
  31. package/dist/environment/environment-config-service.d.ts +98 -0
  32. package/dist/environment/environment-file-loader.d.ts +42 -0
  33. package/dist/{services → environment}/environment-resolver.d.ts +6 -5
  34. package/dist/{services → environment}/forge-env.d.ts +1 -2
  35. package/dist/environment/interfaces.d.ts +139 -0
  36. package/dist/environment/variable-interpolator.d.ts +100 -0
  37. package/dist/execution/collection-request-executor-interfaces.d.ts +36 -0
  38. package/dist/execution/collection-request-executor.d.ts +78 -0
  39. package/dist/{services → execution}/request-executor.d.ts +23 -11
  40. package/dist/execution/request-preparer-interfaces.d.ts +36 -0
  41. package/dist/execution/request-preparer.d.ts +35 -0
  42. package/dist/graphql/graphql-completion-provider.d.ts +39 -0
  43. package/dist/graphql/graphql-schema-service.d.ts +89 -0
  44. package/dist/{interfaces/history.d.ts → history/history-interfaces.d.ts} +29 -6
  45. package/dist/history/request-history-service-interfaces.d.ts +43 -0
  46. package/dist/history/request-history-service.d.ts +133 -0
  47. package/dist/{implementations → history}/request-history.d.ts +2 -3
  48. package/dist/{implementations → http}/fetch-http-client.d.ts +4 -5
  49. package/dist/http/http-request-service.d.ts +36 -0
  50. package/dist/{implementations → http}/interceptor-chain.d.ts +1 -2
  51. package/dist/http/interfaces.d.ts +25 -0
  52. package/dist/http/merge-request-settings.d.ts +12 -0
  53. package/dist/{implementations → http}/native-http-client.d.ts +6 -15
  54. package/dist/{implementations → http}/request-preprocessor.d.ts +1 -2
  55. package/dist/{services → http}/url-builder.d.ts +7 -10
  56. package/dist/import-export/import-postman-environment.d.ts +21 -0
  57. package/dist/import-export/rest-client-export.d.ts +35 -0
  58. package/dist/index.d.ts +94 -6
  59. package/dist/index.js +262 -35
  60. package/dist/index.mjs +262 -35
  61. package/dist/openapi/example-generator.d.ts +26 -0
  62. package/dist/openapi/history-analyzer.d.ts +29 -0
  63. package/dist/openapi/index.d.ts +16 -0
  64. package/dist/openapi/interfaces.d.ts +42 -0
  65. package/dist/openapi/openapi-exporter.d.ts +73 -0
  66. package/dist/openapi/openapi-importer.d.ts +72 -0
  67. package/dist/openapi/ref-resolver.d.ts +28 -0
  68. package/dist/openapi/schema-inference-service.d.ts +40 -0
  69. package/dist/openapi/schema-inferrer.d.ts +26 -0
  70. package/dist/openapi/script-analyzer.d.ts +41 -0
  71. package/dist/parsers/http-forge-parser.d.ts +2 -3
  72. package/dist/parsers/index.d.ts +0 -1
  73. package/dist/{implementations → platform}/data-file-parser.d.ts +0 -1
  74. package/dist/{implementations → platform}/node-file-system.d.ts +1 -2
  75. package/dist/script/interfaces.d.ts +161 -0
  76. package/dist/script/module-loader.d.ts +115 -0
  77. package/dist/script/request-script-session.d.ts +73 -0
  78. package/dist/script/script-executor.d.ts +60 -0
  79. package/dist/script/script-factories.d.ts +94 -0
  80. package/dist/script/script-utils.d.ts +42 -0
  81. package/dist/test-suite/index.d.ts +10 -0
  82. package/dist/test-suite/interfaces.d.ts +164 -0
  83. package/dist/test-suite/result-storage-service.d.ts +70 -0
  84. package/dist/test-suite/result-storage.d.ts +296 -0
  85. package/dist/test-suite/statistics-service.d.ts +51 -0
  86. package/dist/test-suite/test-suite-service.d.ts +97 -0
  87. package/dist/test-suite/test-suite-store.d.ts +155 -0
  88. package/dist/types/console-service.d.ts +40 -0
  89. package/dist/types/platform.d.ts +206 -0
  90. package/dist/{interfaces → types}/types.d.ts +289 -12
  91. package/dist/utils/dynamic-variables.d.ts +38 -0
  92. package/dist/utils/expression-evaluator.d.ts +34 -0
  93. package/dist/utils/filter-engine.d.ts +47 -0
  94. package/dist/utils/helpers.d.ts +47 -0
  95. package/package.json +12 -4
  96. package/dist/container.d.ts.map +0 -1
  97. package/dist/implementations/cookie-jar.d.ts.map +0 -1
  98. package/dist/implementations/cookie-utils.d.ts.map +0 -1
  99. package/dist/implementations/data-file-parser.d.ts.map +0 -1
  100. package/dist/implementations/fetch-http-client.d.ts.map +0 -1
  101. package/dist/implementations/index.d.ts +0 -22
  102. package/dist/implementations/index.d.ts.map +0 -1
  103. package/dist/implementations/interceptor-chain.d.ts.map +0 -1
  104. package/dist/implementations/module-loader.d.ts +0 -74
  105. package/dist/implementations/module-loader.d.ts.map +0 -1
  106. package/dist/implementations/native-http-client.d.ts.map +0 -1
  107. package/dist/implementations/node-file-system.d.ts.map +0 -1
  108. package/dist/implementations/request-history.d.ts.map +0 -1
  109. package/dist/implementations/request-preprocessor.d.ts.map +0 -1
  110. package/dist/implementations/variable-interpolator.d.ts +0 -55
  111. package/dist/implementations/variable-interpolator.d.ts.map +0 -1
  112. package/dist/implementations/vm2-script-runner.d.ts +0 -76
  113. package/dist/implementations/vm2-script-runner.d.ts.map +0 -1
  114. package/dist/index.d.ts.map +0 -1
  115. package/dist/interfaces/cookie.d.ts.map +0 -1
  116. package/dist/interfaces/history.d.ts.map +0 -1
  117. package/dist/interfaces/index.d.ts +0 -170
  118. package/dist/interfaces/index.d.ts.map +0 -1
  119. package/dist/interfaces/types.d.ts.map +0 -1
  120. package/dist/parsers/http-forge-parser.d.ts.map +0 -1
  121. package/dist/parsers/index.d.ts.map +0 -1
  122. package/dist/services/collection-loader.d.ts.map +0 -1
  123. package/dist/services/environment-resolver.d.ts.map +0 -1
  124. package/dist/services/folder-collection-loader.d.ts +0 -91
  125. package/dist/services/folder-collection-loader.d.ts.map +0 -1
  126. package/dist/services/forge-env.d.ts.map +0 -1
  127. package/dist/services/index.d.ts +0 -20
  128. package/dist/services/index.d.ts.map +0 -1
  129. package/dist/services/parser-registry.d.ts.map +0 -1
  130. package/dist/services/request-executor.d.ts.map +0 -1
  131. package/dist/services/script-pipeline.d.ts +0 -43
  132. package/dist/services/script-pipeline.d.ts.map +0 -1
  133. package/dist/services/script-session.d.ts +0 -66
  134. package/dist/services/script-session.d.ts.map +0 -1
  135. package/dist/services/url-builder.d.ts.map +0 -1
@@ -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';
@@ -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 { IDataFileParser, IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IRequestPreprocessor, IResponseInterceptor } from './implementations';
8
- import { ICollectionLoader, ICookieJar, IFileSystem, IHttpClient, IRequestHistory, IScriptRunner, IVariableInterpolator } from './interfaces';
9
- import { HttpRequest, HttpResponse, RequestSettings, UnifiedCollection, UnifiedRequest } from './interfaces/types';
10
- import { EnvironmentConfig, EnvironmentResolver, ForgeEnv, ParserRegistry, RequestExecutor, ScriptPipeline } from './services';
7
+ import { ICollectionLoader } from './collection/interfaces';
8
+ import { ParserRegistry } from './collection/parser-registry';
9
+ import { ICookieService } from './cookie/interfaces';
10
+ import { EnvironmentResolver, EnvironmentStoreConfig } from './environment/environment-resolver';
11
+ import { ForgeEnv } from './environment/forge-env';
12
+ import { IVariableInterpolator } from './environment/interfaces';
13
+ import { RequestExecutor } from './execution/request-executor';
14
+ import { IRequestHistory } from './history/history-interfaces';
15
+ import { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor } from './http/interceptor-chain';
16
+ import { IRequestPreprocessor } from './http/request-preprocessor';
17
+ import { IDataFileParser } from './platform/data-file-parser';
18
+ import { IScriptExecutor } from './script/interfaces';
19
+ import { IFileSystem, IHttpClient } from './types/platform';
20
+ import { HttpRequest, HttpResponse, RequestSettings, UnifiedCollection, UnifiedRequest } from './types/types';
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?: ICookieJar;
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 runner implementation */
44
- scriptRunner?: IScriptRunner;
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?: 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 scriptRunner: IScriptRunner;
87
+ readonly scriptExecutor: IScriptExecutor;
78
88
  readonly interpolator: IVariableInterpolator;
79
- readonly cookieJar: ICookieJar;
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("./services").ExecuteResult>;
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: EnvironmentConfig): void;
130
+ setEnvironmentConfig(config: EnvironmentStoreConfig): void;
122
131
  /**
123
132
  * Create a new container with custom options
124
133
  */
@@ -126,21 +135,19 @@ export declare class ForgeContainer {
126
135
  /**
127
136
  * Create a container by auto-loading environments from forgeRoot
128
137
  *
129
- * Reads `{forgeRoot}/environments/environments.json` and creates
130
- * a container with the environment configuration pre-loaded.
138
+ * Reads the multi-file environment folder format under
139
+ * `{forgeRoot}/environments/` (same format used by the VS Code extension).
140
+ * Falls back to the legacy single-file `environments.json` when the
141
+ * multi-file format is not detected.
131
142
  *
132
143
  * @param forgeRoot - Path to http-forge folder (default: './http-forge')
133
144
  * @param options - Additional container options
134
145
  *
135
146
  * @example
136
147
  * ```typescript
137
- * // Auto-load environments from ./http-forge/environments/environments.json
138
148
  * const forge = ForgeContainer.fromForgeRoot('./http-forge');
139
- *
140
- * // Switch environment
141
149
  * forge.forgeEnv.setActiveEnvironment('sit');
142
150
  * ```
143
151
  */
144
152
  static fromForgeRoot(forgeRoot?: string, options?: Omit<ForgeContainerOptions, 'forgeRoot' | 'environmentConfig'>): ForgeContainer;
145
153
  }
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, ICookieJar } from '../interfaces/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 ICookieJar {
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 { IKeyValueStore } from '../types/platform';
9
+ import { Cookie, ICookieParser, ICookieReader } from './interfaces';
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 '../interfaces/cookie';
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 { ICookieJar } from '../script/interfaces';
12
+ import type { Cookie } from './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 jar interface (memory-based, no persistence)
92
+ * Full cookie service interface
93
93
  * Core package version - no VS Code dependency
94
94
  */
95
- export interface ICookieJar extends ICookieReader, ICookieWriter, ICookieParser {
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
- //# sourceMappingURL=cookie.d.ts.map
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
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Persistent Cookie Jar
3
+ *
4
+ * Adapts an ICookieService to the ICookieJar interface with write-through caching.
5
+ *
6
+ * - Maintains a local in-memory cache reflecting immediate changes (set/delete).
7
+ * - Allows scripts to read their own cookie modifications within the same execution.
8
+ * - Batches and persists all changes to the underlying ICookieService after execution.
9
+ *
10
+ * Extracted from extension's request-execution/PersistentCookieJar.ts.
11
+ */
12
+ import { ICookieJar } from '../script/interfaces';
13
+ import { Cookie, IAsyncCookieService, ICookieService } from './interfaces';
14
+ export declare class PersistentCookieJar implements ICookieJar {
15
+ private cookieService;
16
+ /** Local cache that reflects script modifications */
17
+ private localCache;
18
+ /** Track pending operations to batch them after script execution */
19
+ private pendingOperations;
20
+ constructor(cookieService: ICookieService | IAsyncCookieService);
21
+ get(name: string, domain?: string): Cookie | undefined;
22
+ has(name: string, domain?: string): boolean;
23
+ set(cookie: Cookie): void;
24
+ delete(name: string, domain?: string, path?: string): boolean;
25
+ getAll(domain?: string): Cookie[];
26
+ getCookiesForDomain(domain: string): Cookie[];
27
+ setCookiesFromResponse(url: string, headers: Record<string, string | string[]>): Promise<void>;
28
+ getCookieHeader(url: string): string | undefined;
29
+ clear(): void;
30
+ /**
31
+ * Flush all pending cookie operations to the underlying service.
32
+ * Should be called after script execution completes.
33
+ */
34
+ flush(): Promise<void>;
35
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Core Service Bootstrap
3
+ *
4
+ * Registers all platform-agnostic services in the ServiceContainer.
5
+ * The host environment (VS Code, CLI, etc.) only needs to provide
6
+ * PlatformAdapters — the actual service wiring lives here.
7
+ *
8
+ * This is the single source of truth for service dependencies.
9
+ */
10
+ import type { PlatformAdapters } from './platform-adapters';
11
+ import type { ServiceContainer } from './service-container';
12
+ /**
13
+ * Register all platform-agnostic core services in the container.
14
+ *
15
+ * @param container - The service container to register into
16
+ * @param adapters - Platform-specific adapters provided by the host
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const container = ServiceContainer.instance;
21
+ * container.clear();
22
+ * registerCoreServices(container, adapters);
23
+ * ```
24
+ */
25
+ export declare function registerCoreServices(container: ServiceContainer, adapters: PlatformAdapters): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dependency Injection
3
+ *
4
+ * Provides a generic, platform-agnostic DI container and service bootstrap.
5
+ * Host environments (VS Code, CLI, etc.) only need to supply PlatformAdapters.
6
+ */
7
+ export { registerCoreServices } from './core-bootstrap';
8
+ export type { PlatformAdapters } from './platform-adapters';
9
+ export { getServiceContainer, ServiceContainer } from './service-container';
10
+ export { ServiceIdentifiers } from './service-identifiers';
11
+ export type { ServiceIdentifier } from './service-identifiers';