@http-forge/core 0.1.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 +500 -0
- package/dist/container.d.ts +146 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/implementations/cookie-jar.d.ts +97 -0
- package/dist/implementations/cookie-jar.d.ts.map +1 -0
- package/dist/implementations/cookie-utils.d.ts +78 -0
- package/dist/implementations/cookie-utils.d.ts.map +1 -0
- package/dist/implementations/data-file-parser.d.ts +71 -0
- package/dist/implementations/data-file-parser.d.ts.map +1 -0
- package/dist/implementations/fetch-http-client.d.ts +19 -0
- package/dist/implementations/fetch-http-client.d.ts.map +1 -0
- package/dist/implementations/index.d.ts +22 -0
- package/dist/implementations/index.d.ts.map +1 -0
- package/dist/implementations/interceptor-chain.d.ts +262 -0
- package/dist/implementations/interceptor-chain.d.ts.map +1 -0
- package/dist/implementations/module-loader.d.ts +74 -0
- package/dist/implementations/module-loader.d.ts.map +1 -0
- package/dist/implementations/native-http-client.d.ts +72 -0
- package/dist/implementations/native-http-client.d.ts.map +1 -0
- package/dist/implementations/node-file-system.d.ts +52 -0
- package/dist/implementations/node-file-system.d.ts.map +1 -0
- package/dist/implementations/request-history.d.ts +73 -0
- package/dist/implementations/request-history.d.ts.map +1 -0
- package/dist/implementations/request-preprocessor.d.ts +78 -0
- package/dist/implementations/request-preprocessor.d.ts.map +1 -0
- package/dist/implementations/variable-interpolator.d.ts +55 -0
- package/dist/implementations/variable-interpolator.d.ts.map +1 -0
- package/dist/implementations/vm2-script-runner.d.ts +76 -0
- package/dist/implementations/vm2-script-runner.d.ts.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.mjs +46 -0
- package/dist/interfaces/cookie.d.ts +101 -0
- package/dist/interfaces/cookie.d.ts.map +1 -0
- package/dist/interfaces/history.d.ts +117 -0
- package/dist/interfaces/history.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +170 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/types.d.ts +308 -0
- package/dist/interfaces/types.d.ts.map +1 -0
- package/dist/parsers/http-forge-parser.d.ts +35 -0
- package/dist/parsers/http-forge-parser.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +7 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/services/collection-loader.d.ts +52 -0
- package/dist/services/collection-loader.d.ts.map +1 -0
- package/dist/services/environment-resolver.d.ts +91 -0
- package/dist/services/environment-resolver.d.ts.map +1 -0
- package/dist/services/folder-collection-loader.d.ts +91 -0
- package/dist/services/folder-collection-loader.d.ts.map +1 -0
- package/dist/services/forge-env.d.ts +166 -0
- package/dist/services/forge-env.d.ts.map +1 -0
- package/dist/services/index.d.ts +20 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/parser-registry.d.ts +49 -0
- package/dist/services/parser-registry.d.ts.map +1 -0
- package/dist/services/request-executor.d.ts +86 -0
- package/dist/services/request-executor.d.ts.map +1 -0
- package/dist/services/script-pipeline.d.ts +43 -0
- package/dist/services/script-pipeline.d.ts.map +1 -0
- package/dist/services/script-session.d.ts +66 -0
- package/dist/services/script-session.d.ts.map +1 -0
- package/dist/services/url-builder.d.ts +60 -0
- package/dist/services/url-builder.d.ts.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie Jar - In-Memory Cookie Storage
|
|
3
|
+
*
|
|
4
|
+
* Extracted and adapted from VS Code plugin: src/services/cookie-service.ts
|
|
5
|
+
* Core package version - no VS Code dependency, no persistence (memory only)
|
|
6
|
+
*
|
|
7
|
+
* The logic is 100% equivalent to the plugin's CookieService, but:
|
|
8
|
+
* - Removed vscode.ExtensionContext dependency
|
|
9
|
+
* - Removed persistence (saveCookies/loadCookies)
|
|
10
|
+
* - Made all operations synchronous (no VS Code globalState)
|
|
11
|
+
*
|
|
12
|
+
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
13
|
+
*/
|
|
14
|
+
import { Cookie, ICookieJar } from '../interfaces/cookie';
|
|
15
|
+
/**
|
|
16
|
+
* In-memory cookie storage
|
|
17
|
+
* Equivalent to plugin's CookieService but without VS Code persistence
|
|
18
|
+
*/
|
|
19
|
+
export declare class CookieJar implements ICookieJar {
|
|
20
|
+
private cookies;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a unique key for a cookie
|
|
23
|
+
* Same implementation as plugin's CookieService.getCookieKey
|
|
24
|
+
*/
|
|
25
|
+
private getCookieKey;
|
|
26
|
+
/**
|
|
27
|
+
* Get a cookie by name
|
|
28
|
+
* Same implementation as plugin's CookieService.get
|
|
29
|
+
*/
|
|
30
|
+
get(name: string, domain?: string): Cookie | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Set a cookie
|
|
33
|
+
* Same implementation as plugin's CookieService.set (minus persistence)
|
|
34
|
+
*/
|
|
35
|
+
set(cookie: Cookie): void;
|
|
36
|
+
/**
|
|
37
|
+
* Set multiple cookies from a response
|
|
38
|
+
* Same implementation as plugin's CookieService.setFromResponse (minus persistence)
|
|
39
|
+
*/
|
|
40
|
+
setFromResponse(cookies: Cookie[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a cookie exists
|
|
43
|
+
* Same implementation as plugin's CookieService.has
|
|
44
|
+
*/
|
|
45
|
+
has(name: string, domain?: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Delete a cookie
|
|
48
|
+
* Same implementation as plugin's CookieService.delete (minus persistence)
|
|
49
|
+
*/
|
|
50
|
+
delete(name: string, domain?: string, path?: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Get all cookies, optionally filtered by domain
|
|
53
|
+
* Same implementation as plugin's CookieService.getAll
|
|
54
|
+
*/
|
|
55
|
+
getAll(domain?: string): Cookie[];
|
|
56
|
+
/**
|
|
57
|
+
* Get cookies formatted for HTTP Cookie header
|
|
58
|
+
* Same implementation as plugin's CookieService.getCookieHeader
|
|
59
|
+
*/
|
|
60
|
+
getCookieHeader(domain?: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Clear all cookies
|
|
63
|
+
* Same implementation as plugin's CookieService.clear (minus persistence)
|
|
64
|
+
*/
|
|
65
|
+
clear(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Clear cookies for a specific domain
|
|
68
|
+
* Same implementation as plugin's CookieService.clearDomain (minus persistence)
|
|
69
|
+
*/
|
|
70
|
+
clearDomain(domain: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Parse Set-Cookie headers from response
|
|
73
|
+
* Same implementation as plugin's CookieService.parseCookieHeaders
|
|
74
|
+
*/
|
|
75
|
+
parseCookieHeaders(headers: Record<string, string | string[]>, domain?: string): Cookie[];
|
|
76
|
+
/**
|
|
77
|
+
* Check if a cookie is expired
|
|
78
|
+
* Delegates to CookieUtils (same as plugin)
|
|
79
|
+
*/
|
|
80
|
+
private isExpired;
|
|
81
|
+
/**
|
|
82
|
+
* Check if a domain matches a cookie domain
|
|
83
|
+
* Delegates to CookieUtils (same as plugin)
|
|
84
|
+
*/
|
|
85
|
+
private domainMatches;
|
|
86
|
+
/**
|
|
87
|
+
* Get cookie count
|
|
88
|
+
* Same as plugin's CookieService.count
|
|
89
|
+
*/
|
|
90
|
+
get count(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Clean expired cookies
|
|
93
|
+
* Same implementation as plugin's CookieService.cleanExpiredCookies
|
|
94
|
+
*/
|
|
95
|
+
cleanExpiredCookies(): void;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=cookie-jar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-jar.d.ts","sourceRoot":"","sources":["../../src/implementations/cookie-jar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;GAGG;AACH,qBAAa,SAAU,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ts
|
|
5
|
+
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
6
|
+
*
|
|
7
|
+
* Single Responsibility: Cookie parsing, formatting, and validation
|
|
8
|
+
*/
|
|
9
|
+
import { Cookie } from '../interfaces/cookie';
|
|
10
|
+
export declare class CookieUtils {
|
|
11
|
+
/**
|
|
12
|
+
* Parse a single Set-Cookie header value
|
|
13
|
+
*
|
|
14
|
+
* Implementation extracted 100% from plugin's CookieUtils.parseSetCookie
|
|
15
|
+
*
|
|
16
|
+
* @param cookieStr - Set-Cookie header value
|
|
17
|
+
* @param defaultDomain - Domain to use if not specified in cookie
|
|
18
|
+
* @returns Parsed cookie or null if invalid
|
|
19
|
+
*/
|
|
20
|
+
static parseSetCookie(cookieStr: string, defaultDomain?: string): Cookie | null;
|
|
21
|
+
/**
|
|
22
|
+
* Parse Set-Cookie headers from response
|
|
23
|
+
*
|
|
24
|
+
* Implementation extracted 100% from plugin's CookieUtils.parseCookieHeaders
|
|
25
|
+
*
|
|
26
|
+
* @param headers - Response headers
|
|
27
|
+
* @param defaultDomain - Domain to use for cookies without domain attribute
|
|
28
|
+
* @returns Array of parsed cookies
|
|
29
|
+
*/
|
|
30
|
+
static parseCookieHeaders(headers: Record<string, string | string[]>, defaultDomain?: string): Cookie[];
|
|
31
|
+
/**
|
|
32
|
+
* Format cookies as HTTP Cookie header value
|
|
33
|
+
*
|
|
34
|
+
* Implementation extracted 100% from plugin's CookieUtils.formatCookieHeader
|
|
35
|
+
*
|
|
36
|
+
* @param cookies - Cookies to format
|
|
37
|
+
* @returns Cookie header value (e.g., "name1=value1; name2=value2")
|
|
38
|
+
*/
|
|
39
|
+
static formatCookieHeader(cookies: Cookie[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* Check if a cookie is expired
|
|
42
|
+
*
|
|
43
|
+
* Implementation extracted 100% from plugin's CookieUtils.isExpired
|
|
44
|
+
*
|
|
45
|
+
* @param cookie - Cookie to check
|
|
46
|
+
* @returns true if expired, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
static isExpired(cookie: Cookie): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a request domain matches a cookie domain
|
|
51
|
+
*
|
|
52
|
+
* Implementation extracted 100% from plugin's CookieUtils.domainMatches
|
|
53
|
+
*
|
|
54
|
+
* @param requestDomain - Domain of the request (e.g., "api.example.com")
|
|
55
|
+
* @param cookieDomain - Domain of the cookie (e.g., "example.com" or "*")
|
|
56
|
+
* @returns true if the cookie should be sent with the request
|
|
57
|
+
*/
|
|
58
|
+
static domainMatches(requestDomain: string, cookieDomain: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Extract domain from URL
|
|
61
|
+
*
|
|
62
|
+
* Implementation extracted 100% from plugin's CookieUtils.extractDomain
|
|
63
|
+
*
|
|
64
|
+
* @param url - URL to extract domain from
|
|
65
|
+
* @returns Domain (hostname) or empty string if invalid URL
|
|
66
|
+
*/
|
|
67
|
+
static extractDomain(url: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Extract path from URL
|
|
70
|
+
*
|
|
71
|
+
* Implementation extracted 100% from plugin's CookieUtils.extractPath
|
|
72
|
+
*
|
|
73
|
+
* @param url - URL to extract path from
|
|
74
|
+
* @returns Path or '/' if invalid URL
|
|
75
|
+
*/
|
|
76
|
+
static extractPath(url: string): string;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=cookie-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-utils.d.ts","sourceRoot":"","sources":["../../src/implementations/cookie-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,qBAAa,WAAW;IACpB;;;;;;;;OAQG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkD/E;;;;;;;;OAQG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAsBvG;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM;IAIpD;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAezC;;;;;;;;OAQG;IACH,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IAiB1E;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQzC;;;;;;;OAOG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAO1C"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data File Parser
|
|
3
|
+
*
|
|
4
|
+
* Extracted 100% from VS Code plugin: src/services/request-execution/data-file-parser.ts
|
|
5
|
+
*
|
|
6
|
+
* Single Responsibility: Parse data files (JSON/CSV) into row data
|
|
7
|
+
* Used by collection runner for data-driven testing
|
|
8
|
+
*
|
|
9
|
+
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Data file parser interface
|
|
13
|
+
* Same as plugin's IDataFileParser
|
|
14
|
+
*/
|
|
15
|
+
export interface IDataFileParser {
|
|
16
|
+
/**
|
|
17
|
+
* Parse file content based on file extension
|
|
18
|
+
*/
|
|
19
|
+
parse(content: string, filePath: string): any[];
|
|
20
|
+
/**
|
|
21
|
+
* Parse JSON content into data rows
|
|
22
|
+
*/
|
|
23
|
+
parseJson(content: string): any[];
|
|
24
|
+
/**
|
|
25
|
+
* Parse CSV content into data rows
|
|
26
|
+
*/
|
|
27
|
+
parseCsv(content: string): any[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Default implementation of data file parser
|
|
31
|
+
* Same implementation as plugin's DataFileParser class
|
|
32
|
+
* Supports JSON and CSV file formats
|
|
33
|
+
*/
|
|
34
|
+
export declare class DataFileParser implements IDataFileParser {
|
|
35
|
+
/**
|
|
36
|
+
* Parse file content based on file extension
|
|
37
|
+
* Same implementation as plugin
|
|
38
|
+
*
|
|
39
|
+
* @param content - File content as string
|
|
40
|
+
* @param filePath - File path (used to determine format)
|
|
41
|
+
* @returns Array of data row objects
|
|
42
|
+
*/
|
|
43
|
+
parse(content: string, filePath: string): any[];
|
|
44
|
+
/**
|
|
45
|
+
* Parse JSON content into data rows
|
|
46
|
+
* Same implementation as plugin
|
|
47
|
+
*
|
|
48
|
+
* @param content - JSON string content
|
|
49
|
+
* @returns Array of data row objects
|
|
50
|
+
* @throws Error if JSON is invalid
|
|
51
|
+
*/
|
|
52
|
+
parseJson(content: string): any[];
|
|
53
|
+
/**
|
|
54
|
+
* Parse CSV content into data rows
|
|
55
|
+
* Same implementation as plugin
|
|
56
|
+
* First row is treated as headers
|
|
57
|
+
*
|
|
58
|
+
* @param content - CSV string content
|
|
59
|
+
* @returns Array of data row objects
|
|
60
|
+
*/
|
|
61
|
+
parseCsv(content: string): any[];
|
|
62
|
+
/**
|
|
63
|
+
* Parse a single CSV line, handling quoted values
|
|
64
|
+
* Same implementation as plugin
|
|
65
|
+
*
|
|
66
|
+
* @param line - CSV line to parse
|
|
67
|
+
* @returns Array of string values
|
|
68
|
+
*/
|
|
69
|
+
private parseCsvLine;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=data-file-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-file-parser.d.ts","sourceRoot":"","sources":["../../src/implementations/data-file-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;IAEhD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,qBAAa,cAAe,YAAW,eAAe;IAClD;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,EAAE;IAUtD;;;;;;;OAOG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE;IASxC;;;;;;;OAOG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE;IAwBvC;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;CA+BvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch HTTP Client Implementation
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: Execute HTTP requests using fetch API
|
|
5
|
+
* Dependency Inversion: Implements IHttpClient interface
|
|
6
|
+
*/
|
|
7
|
+
import { IHttpClient } from '../interfaces';
|
|
8
|
+
import { HttpRequest, HttpResponse } from '../interfaces/types';
|
|
9
|
+
/**
|
|
10
|
+
* HTTP client implementation using Node.js native fetch.
|
|
11
|
+
* Requires Node.js 18+.
|
|
12
|
+
*/
|
|
13
|
+
export declare class FetchHttpClient implements IHttpClient {
|
|
14
|
+
/**
|
|
15
|
+
* Execute an HTTP request
|
|
16
|
+
*/
|
|
17
|
+
execute(request: HttpRequest): Promise<HttpResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fetch-http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-http-client.d.ts","sourceRoot":"","sources":["../../src/implementations/fetch-http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,eAAgB,YAAW,WAAW;IAC/C;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CA+E7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Implementations
|
|
3
|
+
*
|
|
4
|
+
* Export all implementation classes
|
|
5
|
+
*/
|
|
6
|
+
export { FetchHttpClient } from './fetch-http-client';
|
|
7
|
+
export { DEFAULT_REQUEST_SETTINGS, NativeHttpClient } from './native-http-client';
|
|
8
|
+
export type { HttpResponseWithCookies } from './native-http-client';
|
|
9
|
+
export { CookieJar } from './cookie-jar';
|
|
10
|
+
export { CookieUtils } from './cookie-utils';
|
|
11
|
+
export { RequestPreprocessor } from './request-preprocessor';
|
|
12
|
+
export type { IRequestPreprocessor } from './request-preprocessor';
|
|
13
|
+
export { InterceptorChain, LoggingRequestInterceptor, RetryErrorInterceptor, TimingResponseInterceptor } from './interceptor-chain';
|
|
14
|
+
export type { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor, InterceptorContext } from './interceptor-chain';
|
|
15
|
+
export { DataFileParser } from './data-file-parser';
|
|
16
|
+
export type { IDataFileParser } from './data-file-parser';
|
|
17
|
+
export { RequestHistoryStore } from './request-history';
|
|
18
|
+
export { ModuleLoader } from './module-loader';
|
|
19
|
+
export { VM2ScriptRunner } from './vm2-script-runner';
|
|
20
|
+
export { NodeFileSystem } from './node-file-system';
|
|
21
|
+
export { VariableInterpolator } from './variable-interpolator';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/implementations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClF,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EAAE,qBAAqB,EAAE,yBAAyB,EAC9E,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACR,iBAAiB,EACjB,iBAAiB,EAAE,mBAAmB,EACtC,oBAAoB,EAAE,kBAAkB,EAC3C,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request/Response Interceptors
|
|
3
|
+
*
|
|
4
|
+
* Extracted 100% from VS Code plugin: src/services/interceptors.ts
|
|
5
|
+
*
|
|
6
|
+
* Open/Closed Principle: New interceptors can be added without modifying existing code
|
|
7
|
+
*
|
|
8
|
+
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
9
|
+
*
|
|
10
|
+
* This module provides extension points for:
|
|
11
|
+
* - Pre-request processing (modify request before sending)
|
|
12
|
+
* - Post-response processing (modify response after receiving)
|
|
13
|
+
* - Error handling
|
|
14
|
+
*/
|
|
15
|
+
import { HttpRequest, HttpResponse } from '../interfaces/types';
|
|
16
|
+
/**
|
|
17
|
+
* Context passed to interceptors
|
|
18
|
+
* Same as plugin's InterceptorContext
|
|
19
|
+
*/
|
|
20
|
+
export interface InterceptorContext {
|
|
21
|
+
/**
|
|
22
|
+
* Current environment name
|
|
23
|
+
*/
|
|
24
|
+
environment?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Collection ID if request is from a collection
|
|
27
|
+
*/
|
|
28
|
+
collectionId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Request ID if request is from a collection
|
|
31
|
+
*/
|
|
32
|
+
requestId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Additional metadata
|
|
35
|
+
*/
|
|
36
|
+
metadata?: Record<string, any>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Request interceptor interface
|
|
40
|
+
* Same as plugin's IRequestInterceptor
|
|
41
|
+
* Implement this to modify requests before they are sent
|
|
42
|
+
*/
|
|
43
|
+
export interface IRequestInterceptor {
|
|
44
|
+
/**
|
|
45
|
+
* Unique name for this interceptor
|
|
46
|
+
*/
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Priority (lower = runs first)
|
|
50
|
+
*/
|
|
51
|
+
readonly priority?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Intercept and optionally modify the request
|
|
54
|
+
* Return the modified options or the original options
|
|
55
|
+
* Throw an error to abort the request
|
|
56
|
+
*/
|
|
57
|
+
intercept(request: HttpRequest, context: InterceptorContext): Promise<HttpRequest> | HttpRequest;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Response interceptor interface
|
|
61
|
+
* Same as plugin's IResponseInterceptor
|
|
62
|
+
* Implement this to modify responses after they are received
|
|
63
|
+
*/
|
|
64
|
+
export interface IResponseInterceptor {
|
|
65
|
+
/**
|
|
66
|
+
* Unique name for this interceptor
|
|
67
|
+
*/
|
|
68
|
+
readonly name: string;
|
|
69
|
+
/**
|
|
70
|
+
* Priority (lower = runs first)
|
|
71
|
+
*/
|
|
72
|
+
readonly priority?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Intercept and optionally modify the response
|
|
75
|
+
* Return the modified response or the original response
|
|
76
|
+
* Throw an error to indicate response processing failure
|
|
77
|
+
*/
|
|
78
|
+
intercept(response: HttpResponse, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse> | HttpResponse;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Error interceptor interface
|
|
82
|
+
* Same as plugin's IErrorInterceptor
|
|
83
|
+
* Implement this to handle errors during request/response processing
|
|
84
|
+
*/
|
|
85
|
+
export interface IErrorInterceptor {
|
|
86
|
+
/**
|
|
87
|
+
* Unique name for this interceptor
|
|
88
|
+
*/
|
|
89
|
+
readonly name: string;
|
|
90
|
+
/**
|
|
91
|
+
* Priority (lower = runs first)
|
|
92
|
+
*/
|
|
93
|
+
readonly priority?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Handle an error
|
|
96
|
+
* Can return a response to recover, or re-throw to propagate
|
|
97
|
+
*/
|
|
98
|
+
handle(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | void> | HttpResponse | void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Interceptor chain interface
|
|
102
|
+
* Same as plugin's IInterceptorChain
|
|
103
|
+
* Defines the contract for managing and executing interceptors
|
|
104
|
+
*/
|
|
105
|
+
export interface IInterceptorChain {
|
|
106
|
+
/**
|
|
107
|
+
* Register a request interceptor
|
|
108
|
+
*/
|
|
109
|
+
addRequestInterceptor(interceptor: IRequestInterceptor): this;
|
|
110
|
+
/**
|
|
111
|
+
* Register a response interceptor
|
|
112
|
+
*/
|
|
113
|
+
addResponseInterceptor(interceptor: IResponseInterceptor): this;
|
|
114
|
+
/**
|
|
115
|
+
* Register an error interceptor
|
|
116
|
+
*/
|
|
117
|
+
addErrorInterceptor(interceptor: IErrorInterceptor): this;
|
|
118
|
+
/**
|
|
119
|
+
* Remove a request interceptor by name
|
|
120
|
+
*/
|
|
121
|
+
removeRequestInterceptor(name: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Remove a response interceptor by name
|
|
124
|
+
*/
|
|
125
|
+
removeResponseInterceptor(name: string): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Remove an error interceptor by name
|
|
128
|
+
*/
|
|
129
|
+
removeErrorInterceptor(name: string): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Execute request interceptors
|
|
132
|
+
*/
|
|
133
|
+
executeRequestInterceptors(request: HttpRequest, context: InterceptorContext): Promise<HttpRequest>;
|
|
134
|
+
/**
|
|
135
|
+
* Execute response interceptors
|
|
136
|
+
*/
|
|
137
|
+
executeResponseInterceptors(response: HttpResponse, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Execute error interceptors
|
|
140
|
+
*/
|
|
141
|
+
executeErrorInterceptors(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | undefined>;
|
|
142
|
+
/**
|
|
143
|
+
* Clear all interceptors
|
|
144
|
+
*/
|
|
145
|
+
clear(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Get registered interceptor names
|
|
148
|
+
*/
|
|
149
|
+
getRegisteredInterceptors(): {
|
|
150
|
+
request: string[];
|
|
151
|
+
response: string[];
|
|
152
|
+
error: string[];
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Interceptor chain manager
|
|
157
|
+
* Same implementation as plugin's InterceptorChain class
|
|
158
|
+
*
|
|
159
|
+
* Manages registration and execution of interceptors
|
|
160
|
+
* Open/Closed: New interceptors can be registered without modifying this class
|
|
161
|
+
*/
|
|
162
|
+
export declare class InterceptorChain implements IInterceptorChain {
|
|
163
|
+
private requestInterceptors;
|
|
164
|
+
private responseInterceptors;
|
|
165
|
+
private errorInterceptors;
|
|
166
|
+
/**
|
|
167
|
+
* Register a request interceptor
|
|
168
|
+
* Same implementation as plugin
|
|
169
|
+
*/
|
|
170
|
+
addRequestInterceptor(interceptor: IRequestInterceptor): this;
|
|
171
|
+
/**
|
|
172
|
+
* Register a response interceptor
|
|
173
|
+
* Same implementation as plugin
|
|
174
|
+
*/
|
|
175
|
+
addResponseInterceptor(interceptor: IResponseInterceptor): this;
|
|
176
|
+
/**
|
|
177
|
+
* Register an error interceptor
|
|
178
|
+
* Same implementation as plugin
|
|
179
|
+
*/
|
|
180
|
+
addErrorInterceptor(interceptor: IErrorInterceptor): this;
|
|
181
|
+
/**
|
|
182
|
+
* Remove a request interceptor by name
|
|
183
|
+
* Same implementation as plugin
|
|
184
|
+
*/
|
|
185
|
+
removeRequestInterceptor(name: string): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Remove a response interceptor by name
|
|
188
|
+
* Same implementation as plugin
|
|
189
|
+
*/
|
|
190
|
+
removeResponseInterceptor(name: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Remove an error interceptor by name
|
|
193
|
+
* Same implementation as plugin
|
|
194
|
+
*/
|
|
195
|
+
removeErrorInterceptor(name: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Execute request interceptors
|
|
198
|
+
* Same implementation as plugin
|
|
199
|
+
*/
|
|
200
|
+
executeRequestInterceptors(request: HttpRequest, context: InterceptorContext): Promise<HttpRequest>;
|
|
201
|
+
/**
|
|
202
|
+
* Execute response interceptors
|
|
203
|
+
* Same implementation as plugin
|
|
204
|
+
*/
|
|
205
|
+
executeResponseInterceptors(response: HttpResponse, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Execute error interceptors
|
|
208
|
+
* Same implementation as plugin
|
|
209
|
+
* Returns a response if any interceptor recovers, undefined otherwise
|
|
210
|
+
*/
|
|
211
|
+
executeErrorInterceptors(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | undefined>;
|
|
212
|
+
/**
|
|
213
|
+
* Clear all interceptors
|
|
214
|
+
* Same implementation as plugin
|
|
215
|
+
*/
|
|
216
|
+
clear(): void;
|
|
217
|
+
/**
|
|
218
|
+
* Get registered interceptor names (for debugging)
|
|
219
|
+
* Same implementation as plugin
|
|
220
|
+
*/
|
|
221
|
+
getRegisteredInterceptors(): {
|
|
222
|
+
request: string[];
|
|
223
|
+
response: string[];
|
|
224
|
+
error: string[];
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Sort interceptors by priority
|
|
228
|
+
* Same implementation as plugin
|
|
229
|
+
*/
|
|
230
|
+
private sortByPriority;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Logging request interceptor
|
|
234
|
+
* Logs all outgoing requests
|
|
235
|
+
*/
|
|
236
|
+
export declare class LoggingRequestInterceptor implements IRequestInterceptor {
|
|
237
|
+
readonly name = "logging";
|
|
238
|
+
readonly priority = 1000;
|
|
239
|
+
intercept(request: HttpRequest, _context: InterceptorContext): HttpRequest;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Timing response interceptor
|
|
243
|
+
* Adds timing information to response metadata
|
|
244
|
+
*/
|
|
245
|
+
export declare class TimingResponseInterceptor implements IResponseInterceptor {
|
|
246
|
+
readonly name = "timing";
|
|
247
|
+
readonly priority = 1;
|
|
248
|
+
intercept(response: HttpResponse, _request: HttpRequest, _context: InterceptorContext): HttpResponse;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Retry error interceptor
|
|
252
|
+
* Can retry failed requests (example implementation)
|
|
253
|
+
*/
|
|
254
|
+
export declare class RetryErrorInterceptor implements IErrorInterceptor {
|
|
255
|
+
readonly name = "retry";
|
|
256
|
+
readonly priority = 1;
|
|
257
|
+
private maxRetries;
|
|
258
|
+
private retryableErrors;
|
|
259
|
+
constructor(maxRetries?: number, retryableErrors?: string[]);
|
|
260
|
+
handle(error: Error, _request: HttpRequest, _context: InterceptorContext): void;
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=interceptor-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor-chain.d.ts","sourceRoot":"","sources":["../../src/implementations/interceptor-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CACL,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,kBAAkB,GAC5B,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CACL,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,kBAAkB,GAC5B,OAAO,CAAC,YAAY,CAAC,GA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AE,MAAM,EAAE,CAAC;QAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;KACnB;IAQD;;;OAGG;IACH,OAAO,CAAC,cAAc;CAGzB;AAOD;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IACjE,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,QAAQ,QAAQ;IAEzB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,GAAG,WAAW;CAI7E;AAED;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,oBAAoB;IAClE,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,GAAG,YAAY;CAGvG;AAED;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC3D,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAW;gBAEtB,UAAU,SAAI,EAAE,eAAe,WAA8B;IAKzE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,GAAG,IAAI;CAYlF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module Loader Implementation
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: Load custom modules from workspace for script execution
|
|
5
|
+
*
|
|
6
|
+
* Provides consistent module loading behavior across all packages:
|
|
7
|
+
* - VS Code Extension
|
|
8
|
+
* - @http-forge/standalone
|
|
9
|
+
* - @http-forge/playwright
|
|
10
|
+
*
|
|
11
|
+
* All packages provide the same forgeRoot path, resulting in identical behavior.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* ModuleLoader handles loading custom modules from the workspace's modules/ folder.
|
|
15
|
+
*
|
|
16
|
+
* Directory structure:
|
|
17
|
+
* ```
|
|
18
|
+
* http-forge/ ← forgeRoot
|
|
19
|
+
* ├── collections/
|
|
20
|
+
* ├── environments/
|
|
21
|
+
* └── modules/ ← Custom modules live here
|
|
22
|
+
* ├── package.json ← Declares dependencies
|
|
23
|
+
* ├── global-setup.js ← Global exports injected into sandbox
|
|
24
|
+
* └── auth-helpers.js ← User's custom code
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class ModuleLoader {
|
|
28
|
+
private availableModules;
|
|
29
|
+
private customModulesRequire?;
|
|
30
|
+
private globalSetupExports?;
|
|
31
|
+
private modulesPath;
|
|
32
|
+
private initialized;
|
|
33
|
+
/**
|
|
34
|
+
* Built-in modules always available in scripts
|
|
35
|
+
*/
|
|
36
|
+
private readonly builtinModules;
|
|
37
|
+
constructor(forgeRoot: string);
|
|
38
|
+
/**
|
|
39
|
+
* Initialize module loading from the modules/ folder
|
|
40
|
+
*/
|
|
41
|
+
private initialize;
|
|
42
|
+
/**
|
|
43
|
+
* Load available modules from package.json dependencies
|
|
44
|
+
*/
|
|
45
|
+
private loadAvailableModules;
|
|
46
|
+
/**
|
|
47
|
+
* Load global-setup.js if it exists
|
|
48
|
+
* Exports from this file are injected into the VM sandbox as `global`
|
|
49
|
+
*/
|
|
50
|
+
private loadGlobalSetup;
|
|
51
|
+
/**
|
|
52
|
+
* Create require function for use in VM sandbox
|
|
53
|
+
*
|
|
54
|
+
* Resolution order:
|
|
55
|
+
* 1. Built-in modules (lodash, moment, crypto, etc.)
|
|
56
|
+
* 2. Relative paths (./helpers, ../utils)
|
|
57
|
+
* 3. Workspace dependencies from modules/package.json
|
|
58
|
+
*/
|
|
59
|
+
createRequireFunction(): (moduleName: string) => any;
|
|
60
|
+
/**
|
|
61
|
+
* Get global setup exports for sandbox injection
|
|
62
|
+
* Returns undefined if no global-setup.js exists
|
|
63
|
+
*/
|
|
64
|
+
getGlobalSetupExports(): Record<string, any> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Check if custom modules are available
|
|
67
|
+
*/
|
|
68
|
+
hasCustomModules(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Get list of available module names (built-ins + workspace)
|
|
71
|
+
*/
|
|
72
|
+
getAvailableModules(): string[];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=module-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../src/implementations/module-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,oBAAoB,CAAC,CAAc;IAC3C,OAAO,CAAC,kBAAkB,CAAC,CAAsB;IACjD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAkB;IAErC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAQ7B;gBAEU,SAAS,EAAE,MAAM;IAK7B;;OAEG;IACH,OAAO,CAAC,UAAU;IA4BlB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAgBvB;;;;;;;OAOG;IACH,qBAAqB,IAAI,CAAC,UAAU,EAAE,MAAM,KAAK,GAAG;IAyCpD;;;OAGG;IACH,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;IAIxD;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,mBAAmB,IAAI,MAAM,EAAE;CAMlC"}
|