@http-forge/core 0.6.1 → 0.6.2-2.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +223 -251
  2. package/dist/di/platform-adapters.d.ts +11 -4
  3. package/dist/index.d.ts +13 -2
  4. package/dist/index.js +499 -283
  5. package/dist/index.mjs +498 -282
  6. package/dist/infrastructure/ai/ai-provider.d.ts +16 -0
  7. package/dist/infrastructure/analysis/ai-env-suggester.d.ts +22 -0
  8. package/dist/infrastructure/analysis/collection-enhancer.d.ts +23 -0
  9. package/dist/infrastructure/analysis/env-suggester.d.ts +57 -0
  10. package/dist/infrastructure/collection/collection-store.d.ts +1 -1
  11. package/dist/infrastructure/config/config-service.d.ts +20 -1
  12. package/dist/infrastructure/config/config.interface.d.ts +26 -2
  13. package/dist/infrastructure/config/default-config.d.ts +4 -2
  14. package/dist/infrastructure/environment/environment-config-service.d.ts +2 -1
  15. package/dist/infrastructure/execution/collection-request-executor.d.ts +3 -2
  16. package/dist/infrastructure/execution/request-executor.d.ts +5 -0
  17. package/dist/infrastructure/execution/request-preparer.d.ts +1 -0
  18. package/dist/infrastructure/http/native-http-client.d.ts +6 -1
  19. package/dist/infrastructure/openapi/openapi-exporter.d.ts +5 -0
  20. package/dist/infrastructure/parsers/curl-parser.d.ts +61 -0
  21. package/dist/infrastructure/script/expect-chain.d.ts +120 -0
  22. package/dist/infrastructure/script/interfaces.d.ts +3 -0
  23. package/dist/infrastructure/script/json-schema-validator.d.ts +9 -0
  24. package/dist/infrastructure/script/module-loader.d.ts +1 -1
  25. package/dist/infrastructure/script/script-factories.d.ts +10 -73
  26. package/dist/infrastructure/test-suite/interfaces.d.ts +103 -6
  27. package/dist/infrastructure/test-suite/result-storage.d.ts +6 -0
  28. package/dist/infrastructure/test-suite/statistics-service.d.ts +1 -1
  29. package/dist/infrastructure/test-suite/test-suite-service.d.ts +2 -2
  30. package/dist/infrastructure/test-suite/test-suite-store.d.ts +27 -9
  31. package/dist/runtime/mcp-collection-utils.d.ts +29 -1
  32. package/dist/runtime/mcp-prompts.d.ts +39 -0
  33. package/dist/runtime/mcp-run-store.d.ts +11 -1
  34. package/dist/runtime/mcp-tool-builder.d.ts +6 -0
  35. package/dist/runtime/mcp-tool-name.d.ts +4 -5
  36. package/dist/runtime/mcp-tool-schemas.d.ts +45 -0
  37. package/dist/runtime/node-bootstrap.d.ts +9 -0
  38. package/dist/runtime/runtime-contracts.d.ts +14 -0
  39. package/dist/types/types.d.ts +67 -1
  40. package/dist/utils/typed-value.d.ts +14 -0
  41. package/package.json +20 -6
@@ -0,0 +1,16 @@
1
+ /**
2
+ * AI Provider Interface
3
+ *
4
+ * Platform-agnostic abstraction for text-completion AI.
5
+ * Implementations:
6
+ * - VS Code extension: CopilotAiProvider (wraps vscode.lm)
7
+ * - CLI: OpenAiProvider / AnthropicProvider (plain HTTP)
8
+ */
9
+ /** Minimal interface required by all AI-powered core utilities. */
10
+ export interface IAiProvider {
11
+ /**
12
+ * Send a single user prompt and return the full completion text.
13
+ * Implementations should throw on hard failures; the caller handles retries.
14
+ */
15
+ complete(prompt: string): Promise<string>;
16
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * AI Environment Variable Suggester (platform-agnostic)
3
+ *
4
+ * Uses any IAiProvider to scan a collection for hardcoded values and produce
5
+ * EnvSuggestion objects — the same shape returned by the rule-based suggester
6
+ * in env-suggester.ts, so apply logic is shared.
7
+ *
8
+ * Platform-independent: no Node.js or VS Code dependency.
9
+ */
10
+ import type { Collection } from '../../types/collection';
11
+ import type { IAiProvider } from '../ai/ai-provider';
12
+ import type { EnvSuggestion } from './env-suggester';
13
+ /**
14
+ * Ask the AI to scan a collection for hardcoded values that should become
15
+ * environment variables. Returns suggestions in the same `EnvSuggestion` shape
16
+ * used by the rule-based detector so `applyEnvSuggestionsToItems` works for both.
17
+ *
18
+ * @param collection The collection to scan.
19
+ * @param aiProvider Any IAiProvider (Copilot, OpenAI, Anthropic, …).
20
+ * @returns Suggestions sorted by occurrence count descending.
21
+ */
22
+ export declare function scanCollectionForEnvVarsWithAi(collection: Collection, aiProvider: IAiProvider): Promise<EnvSuggestion[]>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * AI Collection Enhancer
3
+ *
4
+ * Post-import pass that uses an IAiProvider to:
5
+ * 1. Generate realistic request body examples (replacing schema-inferred placeholders)
6
+ * 2. Write a postResponse test script for each request (status checks + schema assertions)
7
+ *
8
+ * Platform-independent — no VS Code or Node.js-specific dependency.
9
+ * The caller supplies the AI provider implementation.
10
+ */
11
+ import type { Collection, ICollectionService } from '../../types/collection';
12
+ import type { IAiProvider } from '../ai/ai-provider';
13
+ /** Progress callback: (message, percentIncrement) */
14
+ export type EnhanceProgressCallback = (message: string, increment: number) => void;
15
+ /**
16
+ * Enhance a collection with AI-generated body examples and test scripts.
17
+ *
18
+ * @param collection The collection to enhance (mutated in place, then saved).
19
+ * @param collectionService Service used to persist the collection after enhancement.
20
+ * @param aiProvider AI backend to use (Copilot, OpenAI, Anthropic, …).
21
+ * @param onProgress Optional progress callback fired once per batch.
22
+ */
23
+ export declare function enhanceCollection(collection: Collection, collectionService: ICollectionService, aiProvider: IAiProvider, onProgress?: EnhanceProgressCallback): Promise<void>;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Environment Variable Suggester (rule-based)
3
+ *
4
+ * Scans an HTTP Forge collection for hardcoded values (auth tokens, API keys,
5
+ * shared base URLs, …) and suggests replacing them with environment variable
6
+ * placeholders (`{{VAR_NAME}}`).
7
+ *
8
+ * No AI dependency — detection is entirely heuristic:
9
+ * 1. `Authorization` header values (Bearer / Basic / Token / Digest)
10
+ * 2. Common sensitive header names (X-API-Key, X-Auth-Token, …)
11
+ * 3. Common sensitive query-param keys (api_key, access_token, …)
12
+ * 4. Shared base URL across ≥ 2 requests → BASE_URL
13
+ * 5. Long opaque strings (≥ 20 chars) in any header value
14
+ *
15
+ * Platform-independent (no Node.js or VS Code dependency).
16
+ */
17
+ import type { Collection, CollectionItem } from '../../types/collection';
18
+ /** A single detected hardcoded-value candidate. */
19
+ export interface EnvSuggestion {
20
+ /** Suggested variable name (e.g. `BEARER_TOKEN`). */
21
+ varName: string;
22
+ /** The hardcoded value found in the collection. */
23
+ value: string;
24
+ /** Human-readable explanation of why this was flagged. */
25
+ reason: string;
26
+ /** Every location where this value appears. */
27
+ occurrences: Array<{
28
+ requestId: string;
29
+ requestName: string;
30
+ field: string;
31
+ }>;
32
+ }
33
+ /**
34
+ * Scan a collection and return suggestions for replacing hardcoded values with
35
+ * environment variables.
36
+ *
37
+ * @param collection The collection to analyse.
38
+ * @param minOccurrences Only return suggestions seen in at least this many
39
+ * request locations (default: 1).
40
+ */
41
+ export declare function detectEnvSuggestions(collection: Collection, minOccurrences?: number): EnvSuggestion[];
42
+ /**
43
+ * Apply env-variable replacements to a collection's items in-place.
44
+ *
45
+ * For each suggestion, the hardcoded value is replaced with `{{VAR_NAME}}` in:
46
+ * - request URLs
47
+ * - header values (auth prefix like "Bearer " is preserved)
48
+ * - query-param values
49
+ *
50
+ * @param items The mutable `CollectionItem[]` to modify.
51
+ * @param suggestions Which replacements to apply.
52
+ * @returns Map of `varName → replacement count`.
53
+ */
54
+ export declare function applyEnvSuggestionsToItems(items: CollectionItem[], suggestions: Array<{
55
+ varName: string;
56
+ value: string;
57
+ }>): Record<string, number>;
@@ -110,4 +110,4 @@ export interface FolderMetadata {
110
110
  /**
111
111
  * Metadata stored in request.json (scripts stored separately in scripts/ directory)
112
112
  */
113
- export type RequestMetadata = Omit<CollectionRequest, 'scripts' | 'disabled' | 'bodyContentType'>;
113
+ export type RequestMetadata = Omit<CollectionRequest, 'scripts'>;
@@ -21,8 +21,9 @@ export declare class ConfigService implements IConfigService {
21
21
  private notifications?;
22
22
  private config;
23
23
  private configPath;
24
- private fileWatcher?;
24
+ private fileWatchers;
25
25
  constructor(workspacePath: string, fileWatcherFactory?: IFileWatcherFactory | undefined, notifications?: INotificationService | undefined);
26
+ private resolveConfigPath;
26
27
  /**
27
28
  * Load configuration from file, merging with defaults
28
29
  */
@@ -57,6 +58,24 @@ export declare class ConfigService implements IConfigService {
57
58
  * Resolve a path relative to workspace
58
59
  */
59
60
  private resolvePath;
61
+ /**
62
+ * Detect whether a root path contains folder-format collections.
63
+ * We require at least one collection folder with a collection.json file
64
+ * to avoid false positives on unrelated empty directories.
65
+ */
66
+ private hasFolderCollectionsAtRoot;
67
+ /**
68
+ * Returns true when a directory exists and contains at least one entry.
69
+ */
70
+ private hasAnyEntries;
71
+ /**
72
+ * Resolve storage root with backward compatibility for config-less workspaces.
73
+ *
74
+ * In v0.6.16 the default root changed to `.http-forge/assets`. If a workspace
75
+ * has no config file and existing collections were created under an older
76
+ * default location, prefer that legacy location so collections remain visible.
77
+ */
78
+ private resolveStorageRootPath;
60
79
  getRootPath(): string;
61
80
  getCollectionsPath(): string;
62
81
  getEnvironmentsPath(): string;
@@ -28,6 +28,27 @@ export interface RequestConfig {
28
28
  maxRedirects: number;
29
29
  /** Whether to verify SSL certificates */
30
30
  strictSSL: boolean;
31
+ /** Per-request TLS defaults (paths resolved relative to workspace root) */
32
+ tls?: {
33
+ caPath?: string;
34
+ certPath?: string;
35
+ keyPath?: string;
36
+ pfxPath?: string;
37
+ passphrase?: string;
38
+ servername?: string;
39
+ };
40
+ /** Host-based certificate mappings (Postman-style global certificates) */
41
+ certificates?: Array<{
42
+ host: string;
43
+ port?: number;
44
+ enabled?: boolean;
45
+ caPath?: string;
46
+ certPath?: string;
47
+ keyPath?: string;
48
+ pfxPath?: string;
49
+ passphrase?: string;
50
+ servername?: string;
51
+ }>;
31
52
  }
32
53
  /**
33
54
  * Script configuration
@@ -100,10 +121,13 @@ export interface McpCorsConfig {
100
121
  export type McpToolMode = 'flat' | 'drilldown' | 'auto';
101
122
  /**
102
123
  * MCP Server project-level configuration (stored in http-forge.config.json)
103
- *
104
- * Machine-specific settings (port, autoStart) remain in VS Code settings.
105
124
  */
106
125
  export interface McpConfig {
126
+ /**
127
+ * Port for the embedded MCP HTTP server. Defaults to 3100.
128
+ * Runtime callers can still override this via `createMcpRuntime({ port })`.
129
+ */
130
+ port: number;
107
131
  /**
108
132
  * Collection IDs or names to hide from MCP tools.
109
133
  * Empty array (default) = expose all collections.
@@ -11,8 +11,10 @@ export declare const DEFAULT_CONFIG: HttpForgeConfig;
11
11
  * Configuration file names
12
12
  */
13
13
  export declare const CONFIG_FILES: {
14
- /** Main configuration file */
15
- config: string;
14
+ /** Preferred main configuration file */
15
+ preferred: string;
16
+ /** Backward-compatible legacy configuration file */
17
+ legacy: string;
16
18
  };
17
19
  /**
18
20
  * Directory names within the root
@@ -13,6 +13,7 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
13
13
  private configService;
14
14
  private fileWatcherFactory?;
15
15
  private secretStore?;
16
+ private persistOverrides;
16
17
  private environmentsPath;
17
18
  private sharedConfigPath;
18
19
  private localConfigPath;
@@ -35,7 +36,7 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
35
36
  * Set by the extension host to refresh tree views and panels.
36
37
  */
37
38
  onEnvironmentsChanged?: () => void;
38
- constructor(workspaceFolder: string, workspaceStore: IKeyValueStore, configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined, secretStore?: ISecretStore | undefined);
39
+ constructor(workspaceFolder: string, workspaceStore: IKeyValueStore | undefined, configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined, secretStore?: ISecretStore | undefined, persistOverrides?: boolean);
39
40
  private setupFileWatcher;
40
41
  dispose(): void;
41
42
  getWorkspaceFolder(): string;
@@ -11,7 +11,7 @@
11
11
  * Platform-independent — no vscode dependency.
12
12
  */
13
13
  import { IEnvironmentConfigService } from '../../types/environment-config';
14
- import { ExecutionRequest, ExecutionResult, PreparedRequest, RequestScripts } from '../../types/types';
14
+ import { ExecutionRequest, ExecutionResult, PreparedRequest, RequestAuth, RequestScripts } from '../../types/types';
15
15
  import { IHttpRequestService } from '../http/interfaces';
16
16
  import { ICookieJar, IScriptExecutor } from '../script/interfaces';
17
17
  import { ConsoleOutputCallback, ICollectionRequestExecutor } from './collection-request-executor-interfaces';
@@ -32,9 +32,10 @@ export declare class CollectionRequestExecutor implements ICollectionRequestExec
32
32
  private readonly folderScriptsChain?;
33
33
  private readonly onConsoleOutput?;
34
34
  private readonly collectionName?;
35
+ private readonly collectionAuth?;
35
36
  private readonly iteration?;
36
37
  private readonly iterationCount?;
37
- constructor(httpService: IHttpRequestService, scriptExecutor: IScriptExecutor, envConfigService: IEnvironmentConfigService, requestPreparer: IRequestPreparer, environment: string, cookieJar?: ICookieJar | undefined, collectionScripts?: RequestScripts | undefined, folderScriptsChain?: (RequestScripts | RequestScripts[]) | undefined, onConsoleOutput?: ConsoleOutputCallback | undefined, collectionName?: string | undefined, iteration?: number | undefined, iterationCount?: number | undefined);
38
+ constructor(httpService: IHttpRequestService, scriptExecutor: IScriptExecutor, envConfigService: IEnvironmentConfigService, requestPreparer: IRequestPreparer, environment: string, cookieJar?: ICookieJar | undefined, collectionScripts?: RequestScripts | undefined, folderScriptsChain?: (RequestScripts | RequestScripts[]) | undefined, onConsoleOutput?: ConsoleOutputCallback | undefined, collectionName?: string | undefined, collectionAuth?: RequestAuth | undefined, iteration?: number | undefined, iterationCount?: number | undefined);
38
39
  /**
39
40
  * Execute a request with full Postman parity.
40
41
  */
@@ -85,6 +85,11 @@ export declare class RequestExecutor {
85
85
  * Handles both {{variable}} and :pathParam patterns in URL
86
86
  */
87
87
  private interpolateRequest;
88
+ /**
89
+ * Convert Postman form-data entries into a native FormData body so fetch can
90
+ * send a real multipart request with an auto-generated boundary.
91
+ */
92
+ private buildMultipartFormData;
88
93
  /**
89
94
  * Build script chain for a request
90
95
  * Returns scripts in execution order: collection → folders → request
@@ -34,4 +34,5 @@ export declare class RequestPreparer implements IRequestPreparer {
34
34
  prepareRequest(input: ExecutionRequest, environment: string, resolvedEnv: ResolvedEnvironment, extraVariables?: Record<string, string>): Promise<PreparedRequest>;
35
35
  private applyOAuth2;
36
36
  private applyApiKey;
37
+ private buildMultipartFormData;
37
38
  }
@@ -29,7 +29,8 @@ export declare const DEFAULT_REQUEST_SETTINGS: Required<RequestSettings>;
29
29
  export declare class NodeHttpClient implements IHttpClient {
30
30
  private settings;
31
31
  private version;
32
- constructor(defaultSettings?: Partial<RequestSettings>);
32
+ private readonly basePath;
33
+ constructor(defaultSettings?: Partial<RequestSettings>, basePath?: string);
33
34
  /**
34
35
  * Send an HTTP request
35
36
  */
@@ -45,6 +46,10 @@ export declare class NodeHttpClient implements IHttpClient {
45
46
  * Implementation extracted 100% from plugin's HttpRequestService.executeInternal
46
47
  */
47
48
  private executeInternal;
49
+ private resolveTlsSettings;
50
+ private findCertificateMapping;
51
+ private mappingMatchesHost;
52
+ private readOptionalFile;
48
53
  /**
49
54
  * Sanitize header value to remove/replace invalid characters
50
55
  * Same implementation as plugin's RequestPreprocessor.sanitizeHeaderValue
@@ -93,6 +93,11 @@ export declare class OpenApiExporter {
93
93
  private tryParseBodyContent;
94
94
  private buildFormDataSchemaFromBody;
95
95
  private buildResponses;
96
+ /**
97
+ * Map operation-level response definitions (from metadata) to OpenAPI format.
98
+ * Converts OperationResponse[] indexed by status code into OpenAPI responses object.
99
+ */
100
+ private mapResponseDefinitions;
96
101
  private buildOperationSecurity;
97
102
  private mapAuthToSecurityScheme;
98
103
  private parseScopes;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Curl Command Parser (rule-based)
3
+ *
4
+ * Parses a curl command string into a structured HTTP request definition.
5
+ * No AI dependency — works entirely with shell tokenization and flag matching.
6
+ * Platform-independent (no Node.js dependency).
7
+ *
8
+ * Supported curl flags:
9
+ * -X / --request HTTP method
10
+ * -H / --header Request headers
11
+ * -d / --data / --data-raw / --data-binary / --data-ascii Request body
12
+ * --json JSON body (also sets Content-Type: application/json)
13
+ * -u / --user Basic auth (user:pass → Authorization: Basic …)
14
+ * -b / --cookie Cookie string (added as Cookie header)
15
+ * --url Explicit URL
16
+ * -G / --get Force GET method
17
+ * -F / --form Form-data fields
18
+ * --data-urlencode URL-encoded body field
19
+ * -A / --user-agent User-Agent header
20
+ * -e / --referer Referer header
21
+ * Backslash-newline continuation is normalised to spaces before parsing.
22
+ */
23
+ /** Structured representation of a parsed curl command. */
24
+ export interface ParsedCurlRequest {
25
+ /** Suggested request name derived from the URL path segment. */
26
+ name: string;
27
+ method: string;
28
+ url: string;
29
+ /** Headers without curl-internal additions (Content-Type from --json, etc. are still included). */
30
+ headers: Array<{
31
+ key: string;
32
+ value: string;
33
+ enabled: boolean;
34
+ }>;
35
+ queryParams: Array<{
36
+ key: string;
37
+ value: string;
38
+ enabled: boolean;
39
+ }>;
40
+ /** Parsed body, or null when no body is present. */
41
+ body: {
42
+ type: 'raw';
43
+ format: 'json' | 'text';
44
+ content: string;
45
+ } | null;
46
+ /**
47
+ * Detected hardcoded values (tokens, API keys, base URLs) that are good
48
+ * environment-variable candidates.
49
+ */
50
+ suggestedVars: Array<{
51
+ key: string;
52
+ value: string;
53
+ }>;
54
+ }
55
+ /**
56
+ * Parse a curl command string into a structured HTTP request definition.
57
+ *
58
+ * @param cmd - Full curl command including the `curl` prefix (e.g. `"curl -X POST ..."`)
59
+ * @returns Parsed request with headers, query params, body, and suggested env variables.
60
+ */
61
+ export declare function parseCurlCommand(cmd: string): ParsedCurlRequest;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Chai/Postman-compatible expect chain.
3
+ *
4
+ * Implements the full Chai BDD expect surface plus Postman-specific
5
+ * extensions (`jsonSchema`). Organized by category for easy navigation.
6
+ */
7
+ /**
8
+ * Chai-style expect chain with Postman-compatible extensions.
9
+ * Mirrors the full Chai BDD `expect(...)` surface.
10
+ */
11
+ export interface ExpectChain {
12
+ _value: any;
13
+ _negated: boolean;
14
+ _deep: boolean;
15
+ to: ExpectChain;
16
+ be: ExpectChain;
17
+ been: ExpectChain;
18
+ is: ExpectChain;
19
+ that: ExpectChain;
20
+ which: ExpectChain;
21
+ and: ExpectChain;
22
+ has: ExpectChain;
23
+ have: ExpectChain;
24
+ with: ExpectChain;
25
+ at: ExpectChain;
26
+ of: ExpectChain;
27
+ same: ExpectChain;
28
+ but: ExpectChain;
29
+ does: ExpectChain;
30
+ still: ExpectChain;
31
+ also: ExpectChain;
32
+ /** Negates the next assertion. */
33
+ not: ExpectChain;
34
+ /** Use deep (structural) equality in equal/include/members/keys/property. */
35
+ deep: ExpectChain;
36
+ /** Enable dot- and bracket-notation path resolution in property/include. */
37
+ nested: ExpectChain;
38
+ /** Restrict property/include to own (non-inherited) properties. */
39
+ own: ExpectChain;
40
+ /** Require members to appear in order. */
41
+ ordered: ExpectChain;
42
+ /** Require *any* of the given keys to be present (use with keys). */
43
+ any: ExpectChain;
44
+ /** Require *all* of the given keys to be present (default; use with keys). */
45
+ all: ExpectChain;
46
+ /** When asserting on a function, target the function itself rather than its prototype. */
47
+ itself: ExpectChain;
48
+ ok: ExpectChain;
49
+ "true": ExpectChain;
50
+ "false": ExpectChain;
51
+ "null": ExpectChain;
52
+ "undefined": ExpectChain;
53
+ "NaN": ExpectChain;
54
+ exist: ExpectChain;
55
+ exists: ExpectChain;
56
+ empty: ExpectChain;
57
+ "arguments": ExpectChain;
58
+ "Arguments": ExpectChain;
59
+ extensible: ExpectChain;
60
+ sealed: ExpectChain;
61
+ frozen: ExpectChain;
62
+ finite: ExpectChain;
63
+ equal(expected: any): ExpectChain;
64
+ eq(expected: any): ExpectChain;
65
+ equals(expected: any): ExpectChain;
66
+ eql(expected: any): ExpectChain;
67
+ eqls(expected: any): ExpectChain;
68
+ include(value: any): ExpectChain;
69
+ includes(value: any): ExpectChain;
70
+ contain(value: any): ExpectChain;
71
+ contains(value: any): ExpectChain;
72
+ oneOf(values: any[]): ExpectChain;
73
+ property(name: string, value?: any): ExpectChain;
74
+ ownPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
75
+ haveOwnPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
76
+ keys(...args: any[]): ExpectChain;
77
+ key(...args: any[]): ExpectChain;
78
+ members(arr: any[]): ExpectChain;
79
+ string(substr: string): ExpectChain;
80
+ match(pattern: RegExp): ExpectChain;
81
+ matches(pattern: RegExp): ExpectChain;
82
+ a(type: string): ExpectChain;
83
+ an(type: string): ExpectChain;
84
+ length(len: number): ExpectChain;
85
+ lengthOf(len: number): ExpectChain;
86
+ satisfy(matcher: (value: any) => any): ExpectChain;
87
+ satisfies(matcher: (value: any) => any): ExpectChain;
88
+ jsonSchema(schema: any): ExpectChain;
89
+ above(num: number): ExpectChain;
90
+ gt(num: number): ExpectChain;
91
+ greaterThan(num: number): ExpectChain;
92
+ least(num: number): ExpectChain;
93
+ gte(num: number): ExpectChain;
94
+ greaterThanOrEqual(num: number): ExpectChain;
95
+ below(num: number): ExpectChain;
96
+ lt(num: number): ExpectChain;
97
+ lessThan(num: number): ExpectChain;
98
+ most(num: number): ExpectChain;
99
+ lte(num: number): ExpectChain;
100
+ lessThanOrEqual(num: number): ExpectChain;
101
+ within(start: number, end: number): ExpectChain;
102
+ closeTo(expected: number, delta: number): ExpectChain;
103
+ approximately(expected: number, delta: number): ExpectChain;
104
+ instanceOf(constructor: Function): ExpectChain;
105
+ "instanceof"(constructor: Function): ExpectChain;
106
+ "throw"(expected?: any): ExpectChain;
107
+ throws(expected?: any): ExpectChain;
108
+ "Throw"(expected?: any): ExpectChain;
109
+ respondTo(method: string): ExpectChain;
110
+ respondsTo(method: string): ExpectChain;
111
+ change(subject: any, prop?: string): ExpectChain;
112
+ changes(subject: any, prop?: string): ExpectChain;
113
+ increase(subject: any, prop?: string): ExpectChain;
114
+ increases(subject: any, prop?: string): ExpectChain;
115
+ decrease(subject: any, prop?: string): ExpectChain;
116
+ decreases(subject: any, prop?: string): ExpectChain;
117
+ /** Assert the magnitude of the preceding change/increase/decrease. */
118
+ by(delta: number): ExpectChain;
119
+ }
120
+ export declare function createExpectChain(value: any): ExpectChain;
@@ -24,6 +24,7 @@ export interface ICookieJar {
24
24
  setCookiesFromResponse(url: string, headers: Record<string, string | string[]>): void;
25
25
  getCookieHeader(url: string): string | undefined;
26
26
  clear(): void;
27
+ clearDomain?(domain: string): void;
27
28
  flush?(): Promise<void>;
28
29
  }
29
30
  /**
@@ -121,6 +122,8 @@ export interface PreRequestScriptResult {
121
122
  export interface PostResponseScriptResult {
122
123
  testResults: TestAssertion[];
123
124
  consoleOutput?: string[];
125
+ modifiedVariables?: Record<string, string>;
126
+ localVariables?: Record<string, string>;
124
127
  modifiedEnvironmentVariables?: Record<string, string>;
125
128
  modifiedGlobals?: Record<string, string>;
126
129
  modifiedCollectionVariables?: Record<string, string>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Minimal, dependency-free JSON Schema validator.
3
+ *
4
+ * Supports the common subset used in API tests (draft-04 style):
5
+ * `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
6
+ * (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
7
+ * Returns a list of human-readable error strings (empty when valid).
8
+ */
9
+ export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
@@ -39,7 +39,7 @@ export declare function createLodashShim(): any;
39
39
  *
40
40
  * Directory structure:
41
41
  * ```
42
- * http-forge-assets/modules/ ← modulePath
42
+ * .http-forge/assets/modules/ ← modulePath
43
43
  * ├── package.json ← Declares dependencies
44
44
  * ├── global-setup.js ← Global exports injected into sandbox
45
45
  * └── auth-helpers.js ← User's custom code
@@ -1,20 +1,17 @@
1
1
  /**
2
2
  * Script Factories
3
3
  *
4
- * Single Responsibility: Create objects used in script execution contexts
5
- * Open/Closed: New factory methods can be added without modifying existing ones
4
+ * Single Responsibility: Create objects used in script execution contexts.
5
+ *
6
+ * `validateJsonSchema` lives in ./json-schema-validator
7
+ * `ExpectChain` / `createExpectChain` live in ./expect-chain
8
+ * Both are re-exported here for backward compatibility.
6
9
  */
7
10
  import { Cookie } from '../cookie/interfaces';
8
11
  import { ResponseContext } from './interfaces';
9
- /**
10
- * Minimal, dependency-free JSON Schema validator.
11
- *
12
- * Supports the common subset used in API tests (draft-04 style):
13
- * `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
14
- * (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
15
- * Returns a list of human-readable error strings (empty when valid).
16
- */
17
- export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
12
+ export { createExpectChain } from './expect-chain';
13
+ export type { ExpectChain } from './expect-chain';
14
+ export { validateJsonSchema } from './json-schema-validator';
18
15
  /**
19
16
  * Response object interface for script context
20
17
  */
@@ -102,69 +99,9 @@ export interface CookieList extends Array<PostmanCookie> {
102
99
  count(): number;
103
100
  idx(index: number): PostmanCookie | undefined;
104
101
  }
105
- /**
106
- * Create a Postman-compatible CookieList from parsed cookies.
107
- */
108
102
  export declare function createCookieList(cookies: Cookie[]): CookieList;
109
103
  /**
110
- * Create response object with helper methods for script context
111
- * Provides Postman-compatible response API
104
+ * Create response object with helper methods for script context.
105
+ * Provides Postman-compatible response API.
112
106
  */
113
107
  export declare function createResponseObject(response: ResponseContext): ScriptResponse;
114
- /**
115
- * Expect chain interface for Chai-style assertions
116
- */
117
- export interface ExpectChain {
118
- _value: any;
119
- _negated: boolean;
120
- _deep: boolean;
121
- not: ExpectChain;
122
- to: ExpectChain;
123
- be: ExpectChain;
124
- have: ExpectChain;
125
- deep: ExpectChain;
126
- and: ExpectChain;
127
- that: ExpectChain;
128
- which: ExpectChain;
129
- is: ExpectChain;
130
- been: ExpectChain;
131
- has: ExpectChain;
132
- with: ExpectChain;
133
- at: ExpectChain;
134
- of: ExpectChain;
135
- same: ExpectChain;
136
- but: ExpectChain;
137
- does: ExpectChain;
138
- still: ExpectChain;
139
- also: ExpectChain;
140
- equal(expected: any): ExpectChain;
141
- eql(expected: any): ExpectChain;
142
- property(name: string, value?: any): ExpectChain;
143
- ok: ExpectChain;
144
- exist: ExpectChain;
145
- include(value: any): ExpectChain;
146
- contain(value: any): ExpectChain;
147
- oneOf(values: any[]): ExpectChain;
148
- match(pattern: RegExp): ExpectChain;
149
- above(num: number): ExpectChain;
150
- below(num: number): ExpectChain;
151
- greaterThan(num: number): ExpectChain;
152
- lessThan(num: number): ExpectChain;
153
- within(start: number, end: number): ExpectChain;
154
- a(type: string): ExpectChain;
155
- an(type: string): ExpectChain;
156
- true: ExpectChain;
157
- false: ExpectChain;
158
- null: ExpectChain;
159
- undefined: ExpectChain;
160
- empty: ExpectChain;
161
- length(len: number): ExpectChain;
162
- lengthOf(len: number): ExpectChain;
163
- members(arr: any[]): ExpectChain;
164
- keys(...args: any[]): ExpectChain;
165
- string(substr: string): ExpectChain;
166
- }
167
- /**
168
- * Create Chai-style expect chain for assertions
169
- */
170
- export declare function createExpectChain(value: any): ExpectChain;