@http-forge/core 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/di/service-container.d.ts +4 -2
- package/dist/di/service-identifiers.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +265 -262
- package/dist/index.mjs +265 -262
- package/dist/infrastructure/security/sensitive-data-redactor.d.ts +11 -0
- package/dist/runtime/direct-execution.d.ts +27 -0
- package/dist/runtime/mcp-runtime.d.ts +19 -0
- package/dist/runtime/node-adapters.d.ts +24 -0
- package/dist/runtime/node-bootstrap.d.ts +29 -0
- package/dist/runtime/runtime-contracts.d.ts +125 -0
- package/package.json +5 -5
|
@@ -16,6 +16,17 @@ import { FullResultDetails } from '../test-suite/result-storage';
|
|
|
16
16
|
* Returns a shallow copy with sensitive header values replaced.
|
|
17
17
|
*/
|
|
18
18
|
export declare function redactHeaders(headers: Record<string, string | string[]>): Record<string, string | string[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Redact sensitive values from a cookie array.
|
|
21
|
+
* Cookies with sensitive names have their values replaced.
|
|
22
|
+
*/
|
|
23
|
+
export declare function redactCookies(cookies?: Array<{
|
|
24
|
+
name?: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
}>): Array<{
|
|
27
|
+
name?: string;
|
|
28
|
+
value?: string;
|
|
29
|
+
}>;
|
|
19
30
|
/**
|
|
20
31
|
* Redact sensitive query parameters from a URL string.
|
|
21
32
|
* E.g. `?token=abc&name=foo` → `?token=[REDACTED]&name=foo`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Direct Execution APIs
|
|
3
|
+
*
|
|
4
|
+
* Execute requests, collections, and suites without requiring MCP server.
|
|
5
|
+
* Uses shared execution logic from core executors.
|
|
6
|
+
*
|
|
7
|
+
* Used by:
|
|
8
|
+
* - CLI commands (run-request, run-collection, run-suite)
|
|
9
|
+
* - Third-party Node apps that want to execute HTTP Forge collections programmatically
|
|
10
|
+
*/
|
|
11
|
+
import type { RunCollectionOptions, RunRequestOptions, RunSuiteOptions } from './runtime-contracts';
|
|
12
|
+
/**
|
|
13
|
+
* Execute a single request without MCP server overhead.
|
|
14
|
+
* Returns typed result; never calls process.exit.
|
|
15
|
+
*/
|
|
16
|
+
export declare function runRequest(options: RunRequestOptions): Promise<unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Execute a collection without MCP server overhead.
|
|
19
|
+
* Runs all enabled requests in sequence.
|
|
20
|
+
* Returns typed result; never calls process.exit.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runCollection(options: RunCollectionOptions): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Execute a test suite without MCP server overhead.
|
|
25
|
+
* Returns typed result; never calls process.exit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runSuite(options: RunSuiteOptions): Promise<unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embeddable MCP Runtime
|
|
3
|
+
*
|
|
4
|
+
* Factory and lifecycle management for MCP runtime that can be embedded in Node.js apps.
|
|
5
|
+
* Supports:
|
|
6
|
+
* - In-process tool execution via executeTool()
|
|
7
|
+
* - Optional lightweight HTTP endpoint for external callers
|
|
8
|
+
*/
|
|
9
|
+
import type { McpRuntimeHandle, McpRuntimeOptions } from './runtime-contracts';
|
|
10
|
+
/**
|
|
11
|
+
* Create an embeddable MCP runtime instance.
|
|
12
|
+
*
|
|
13
|
+
* The returned handle provides lifecycle control and tool execution.
|
|
14
|
+
* Multiple instances can coexist with different ports and workspaces.
|
|
15
|
+
*
|
|
16
|
+
* @param options Configuration for the runtime
|
|
17
|
+
* @returns Handle for controlling the runtime
|
|
18
|
+
*/
|
|
19
|
+
export declare function createMcpRuntime(options: McpRuntimeOptions): Promise<McpRuntimeHandle>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Platform Adapters
|
|
3
|
+
*
|
|
4
|
+
* Implementations of platform abstractions for Node.js environments.
|
|
5
|
+
* Used by CLI and external third-party Node apps that don't have VS Code context.
|
|
6
|
+
*/
|
|
7
|
+
import type { IFileWatcher, IFileWatcherFactory, IKeyValueStore, INotificationService } from '../types/platform';
|
|
8
|
+
export declare class NodeFileWatcherFactory implements IFileWatcherFactory {
|
|
9
|
+
createFileWatcher(base: string, glob: string): IFileWatcher;
|
|
10
|
+
}
|
|
11
|
+
export declare class NodeKeyValueStore implements IKeyValueStore {
|
|
12
|
+
private data;
|
|
13
|
+
private storeFile;
|
|
14
|
+
constructor(storePath: string);
|
|
15
|
+
private load;
|
|
16
|
+
private save;
|
|
17
|
+
get<T>(key: string, defaultValue?: T): T | undefined;
|
|
18
|
+
update(key: string, value: unknown): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare class NodeNotificationService implements INotificationService {
|
|
21
|
+
showInformation(message: string): Promise<string | undefined>;
|
|
22
|
+
showWarning(message: string): Promise<string | undefined>;
|
|
23
|
+
showError(message: string): Promise<string | undefined>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* Initialize HTTP Forge core services for Node.js environments (CLI, third-party apps).
|
|
5
|
+
* Provides a factory that creates initialized service containers with Node-specific adapters.
|
|
6
|
+
*/
|
|
7
|
+
import { ServiceContainer } from '../di/service-container';
|
|
8
|
+
export interface NodeBootstrapOptions {
|
|
9
|
+
/** Workspace root folder path */
|
|
10
|
+
workspaceFolder: string;
|
|
11
|
+
/** Optional application info (name, version) */
|
|
12
|
+
appInfo?: {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bootstrap HTTP Forge core services for Node.js environment.
|
|
19
|
+
* Creates and initializes a service container with Node-native platform adapters.
|
|
20
|
+
*
|
|
21
|
+
* @param options Bootstrap configuration
|
|
22
|
+
* @returns Initialized service container ready for use
|
|
23
|
+
*/
|
|
24
|
+
export declare function bootstrapNodeRuntime(options: NodeBootstrapOptions): ServiceContainer;
|
|
25
|
+
/**
|
|
26
|
+
* Create and initialize service container for CLI or direct API use.
|
|
27
|
+
* This is a convenience wrapper that combines bootstrap and returns the container.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createNodeContainer(workspaceFolder: string): ServiceContainer;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Forge Runtime Contracts
|
|
3
|
+
*
|
|
4
|
+
* Public API surface for embeddable MCP runtime and direct execution.
|
|
5
|
+
* Used by CLI, third-party Node apps, and external integrations.
|
|
6
|
+
*
|
|
7
|
+
* Three consumption modes:
|
|
8
|
+
* 1. Embeddable MCP: createMcpRuntime() + lifecycle handle
|
|
9
|
+
* 2. Direct execution: runRequest/runCollection/runSuite without MCP
|
|
10
|
+
* 3. CLI: subcommands that use modes 1 and 2
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for creating an embeddable MCP runtime instance.
|
|
14
|
+
*/
|
|
15
|
+
export interface McpRuntimeOptions {
|
|
16
|
+
/** Workspace root folder path */
|
|
17
|
+
workspaceFolder: string;
|
|
18
|
+
/** Port to listen on (default: 3100) */
|
|
19
|
+
port?: number;
|
|
20
|
+
/** Host to bind to (default: 127.0.0.1) */
|
|
21
|
+
host?: string;
|
|
22
|
+
/** Config field overrides (e.g. { 'mcp.port': 3200 }) */
|
|
23
|
+
configOverrides?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Handle for controlling an embeddable MCP runtime instance.
|
|
27
|
+
*/
|
|
28
|
+
export interface McpRuntimeHandle {
|
|
29
|
+
/** Start the MCP server */
|
|
30
|
+
start(): Promise<void>;
|
|
31
|
+
/** Stop the MCP server */
|
|
32
|
+
stop(): Promise<void>;
|
|
33
|
+
/** Check if server is running */
|
|
34
|
+
isRunning(): boolean;
|
|
35
|
+
/** Get the port the server is listening on */
|
|
36
|
+
getPort(): number;
|
|
37
|
+
/** Execute a tool in-process (no protocol overhead) */
|
|
38
|
+
executeTool(name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Factory to create and manage embeddable MCP runtime instances.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createMcpRuntime(options: McpRuntimeOptions): Promise<McpRuntimeHandle>;
|
|
44
|
+
/**
|
|
45
|
+
* Options for directly executing a single request without MCP.
|
|
46
|
+
*/
|
|
47
|
+
export interface RunRequestOptions {
|
|
48
|
+
/** Workspace root folder path */
|
|
49
|
+
workspaceFolder: string;
|
|
50
|
+
/** Collection ID containing the request */
|
|
51
|
+
collectionId: string;
|
|
52
|
+
/** Request ID to execute */
|
|
53
|
+
requestId: string;
|
|
54
|
+
/** Environment name (defaults to currently selected) */
|
|
55
|
+
environment?: string;
|
|
56
|
+
/** Extra variables to inject into execution */
|
|
57
|
+
variables?: Record<string, unknown>;
|
|
58
|
+
/** Override or add request headers */
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
/** Override query parameters */
|
|
61
|
+
query?: Record<string, string>;
|
|
62
|
+
/** Replace request body (JSON string) */
|
|
63
|
+
body?: string;
|
|
64
|
+
/** Extra response fields to include: headers, cookies, tests, consoleOutput, report */
|
|
65
|
+
include?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for directly executing all requests in a collection without MCP.
|
|
69
|
+
*/
|
|
70
|
+
export interface RunCollectionOptions {
|
|
71
|
+
/** Workspace root folder path */
|
|
72
|
+
workspaceFolder: string;
|
|
73
|
+
/** Collection ID to execute */
|
|
74
|
+
collectionId: string;
|
|
75
|
+
/** Environment name (defaults to currently selected) */
|
|
76
|
+
environment?: string;
|
|
77
|
+
/** Extra variables injected into every request */
|
|
78
|
+
variables?: Record<string, unknown>;
|
|
79
|
+
/** Number of iterations (default: 1) */
|
|
80
|
+
iterations?: number;
|
|
81
|
+
/** Stop on first failure (default: false) */
|
|
82
|
+
stopOnError?: boolean;
|
|
83
|
+
/** Delay between requests in milliseconds (default: 0) */
|
|
84
|
+
delay?: number;
|
|
85
|
+
/** Extra response fields to include: perRequest, failedOnly, consoleOutput */
|
|
86
|
+
include?: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Options for directly executing a test suite without MCP.
|
|
90
|
+
*/
|
|
91
|
+
export interface RunSuiteOptions {
|
|
92
|
+
/** Workspace root folder path */
|
|
93
|
+
workspaceFolder: string;
|
|
94
|
+
/** Suite ID to execute */
|
|
95
|
+
suiteId: string;
|
|
96
|
+
/** Environment name (defaults to currently selected) */
|
|
97
|
+
environment?: string;
|
|
98
|
+
/** Extra variables injected into every request */
|
|
99
|
+
variables?: Record<string, unknown>;
|
|
100
|
+
/** Number of iterations (overrides suite default) */
|
|
101
|
+
iterations?: number;
|
|
102
|
+
/** Stop on first failure (overrides suite default) */
|
|
103
|
+
stopOnError?: boolean;
|
|
104
|
+
/** Delay between requests in ms (overrides suite default) */
|
|
105
|
+
delay?: number;
|
|
106
|
+
/** Run only requests whose names match one of these strings (case-insensitive) */
|
|
107
|
+
requestFilter?: string[];
|
|
108
|
+
/** Extra response fields to include: perRequest, failedOnly, consoleOutput */
|
|
109
|
+
include?: string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Execute a single request directly without MCP server.
|
|
113
|
+
* Returns typed result object; never calls process.exit.
|
|
114
|
+
*/
|
|
115
|
+
export declare function runRequest(options: RunRequestOptions): Promise<unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Execute a collection directly without MCP server.
|
|
118
|
+
* Returns typed result object; never calls process.exit.
|
|
119
|
+
*/
|
|
120
|
+
export declare function runCollection(options: RunCollectionOptions): Promise<unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Execute a test suite directly without MCP server.
|
|
123
|
+
* Returns typed result object; never calls process.exit.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runSuite(options: RunSuiteOptions): Promise<unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Headless HTTP testing engine with Postman collection support, dynamic variables, and script-based automation.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/hsl1230/http-forge",
|
|
47
|
+
"url": "git+https://github.com/hsl1230/http-forge.git",
|
|
48
48
|
"directory": "packages/core"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"moment": "^2.30.1",
|
|
58
58
|
"tv4": "^1.3.0",
|
|
59
|
-
"uuid": "^
|
|
59
|
+
"uuid": "^14.0.0",
|
|
60
60
|
"yaml": "^2.7.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@types/node": "^20.10.0",
|
|
65
65
|
"@types/tv4": "^1.2.33",
|
|
66
66
|
"@types/uuid": "^9.0.7",
|
|
67
|
-
"esbuild": "^0.
|
|
67
|
+
"esbuild": "^0.28.1",
|
|
68
68
|
"rimraf": "^5.0.5",
|
|
69
69
|
"tsup": "^8.0.1",
|
|
70
70
|
"typescript": "^5.3.0",
|
|
71
|
-
"vitest": "^
|
|
71
|
+
"vitest": "^4.1.9"
|
|
72
72
|
}
|
|
73
73
|
}
|