@http-forge/core 0.6.6 → 0.6.11
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 +51 -1054
- package/dist/index.js +245 -245
- package/dist/index.mjs +244 -244
- package/dist/infrastructure/execution/collection-request-executor.d.ts +3 -2
- package/dist/infrastructure/execution/request-executor.d.ts +5 -0
- package/dist/infrastructure/execution/request-preparer.d.ts +1 -0
- package/dist/infrastructure/openapi/openapi-exporter.d.ts +5 -0
- package/dist/infrastructure/script/script-factories.d.ts +17 -0
- package/dist/infrastructure/test-suite/test-suite-store.d.ts +5 -1
- package/dist/types/types.d.ts +37 -1
- package/package.json +16 -3
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -138,21 +138,38 @@ export interface ExpectChain {
|
|
|
138
138
|
still: ExpectChain;
|
|
139
139
|
also: ExpectChain;
|
|
140
140
|
equal(expected: any): ExpectChain;
|
|
141
|
+
eq(expected: any): ExpectChain;
|
|
142
|
+
equals(expected: any): ExpectChain;
|
|
141
143
|
eql(expected: any): ExpectChain;
|
|
144
|
+
eqls(expected: any): ExpectChain;
|
|
142
145
|
property(name: string, value?: any): ExpectChain;
|
|
143
146
|
ok: ExpectChain;
|
|
144
147
|
exist: ExpectChain;
|
|
145
148
|
include(value: any): ExpectChain;
|
|
149
|
+
includes(value: any): ExpectChain;
|
|
146
150
|
contain(value: any): ExpectChain;
|
|
151
|
+
contains(value: any): ExpectChain;
|
|
147
152
|
oneOf(values: any[]): ExpectChain;
|
|
148
153
|
match(pattern: RegExp): ExpectChain;
|
|
149
154
|
above(num: number): ExpectChain;
|
|
150
155
|
below(num: number): ExpectChain;
|
|
156
|
+
gt(num: number): ExpectChain;
|
|
157
|
+
lt(num: number): ExpectChain;
|
|
158
|
+
least(num: number): ExpectChain;
|
|
159
|
+
most(num: number): ExpectChain;
|
|
160
|
+
gte(num: number): ExpectChain;
|
|
161
|
+
lte(num: number): ExpectChain;
|
|
151
162
|
greaterThan(num: number): ExpectChain;
|
|
152
163
|
lessThan(num: number): ExpectChain;
|
|
164
|
+
closeTo(expected: number, delta: number): ExpectChain;
|
|
165
|
+
approximately(expected: number, delta: number): ExpectChain;
|
|
153
166
|
within(start: number, end: number): ExpectChain;
|
|
154
167
|
a(type: string): ExpectChain;
|
|
155
168
|
an(type: string): ExpectChain;
|
|
169
|
+
"throw"(expected?: any): ExpectChain;
|
|
170
|
+
throws(expected?: any): ExpectChain;
|
|
171
|
+
instanceOf(constructor: Function): ExpectChain;
|
|
172
|
+
"instanceof"(constructor: Function): ExpectChain;
|
|
156
173
|
true: ExpectChain;
|
|
157
174
|
false: ExpectChain;
|
|
158
175
|
null: ExpectChain;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Single Responsibility: Maintain suite state and resolve requests
|
|
9
9
|
* Dependency Inversion: Depends on ICollectionService abstraction
|
|
10
10
|
*/
|
|
11
|
-
import { CollectionRequest, ICollectionService, RequestScripts } from '../../types/collection';
|
|
11
|
+
import { CollectionRequest, ICollectionService, RequestAuth, RequestScripts } from '../../types/collection';
|
|
12
12
|
import { SuiteRequest, TestSuite } from './interfaces';
|
|
13
13
|
/**
|
|
14
14
|
* Cached request entry with full context
|
|
@@ -20,8 +20,12 @@ export interface SuiteRequestEntry {
|
|
|
20
20
|
suiteRequest: SuiteRequest;
|
|
21
21
|
/** Collection scripts */
|
|
22
22
|
collectionScripts?: RequestScripts;
|
|
23
|
+
/** Collection auth */
|
|
24
|
+
collectionAuth?: RequestAuth;
|
|
23
25
|
/** Folder scripts chain */
|
|
24
26
|
folderScriptsChain: RequestScripts[];
|
|
27
|
+
/** Folder auth chain */
|
|
28
|
+
folderAuthChain: RequestAuth[];
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Interface for TestSuiteStore
|
package/dist/types/types.d.ts
CHANGED
|
@@ -39,6 +39,24 @@ export interface UnifiedFolder {
|
|
|
39
39
|
scripts?: CollectionScripts;
|
|
40
40
|
items: (UnifiedFolder | UnifiedRequest)[];
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Operation example (for OpenAPI generation)
|
|
44
|
+
*/
|
|
45
|
+
export interface OperationExample {
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
value: any;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Operation response definition (for OpenAPI generation)
|
|
52
|
+
*/
|
|
53
|
+
export interface OperationResponse {
|
|
54
|
+
description: string;
|
|
55
|
+
contentType?: string;
|
|
56
|
+
schema?: JSONSchema7;
|
|
57
|
+
examples?: Record<string, any>;
|
|
58
|
+
headers?: Record<string, KeyValueEntry>;
|
|
59
|
+
}
|
|
42
60
|
/**
|
|
43
61
|
* Unified Request - normalized request format
|
|
44
62
|
* Supports full feature set from CollectionRequest with metadata preservation
|
|
@@ -71,6 +89,18 @@ export interface UnifiedRequest {
|
|
|
71
89
|
responseSchema?: ResponseSchemaDefinition;
|
|
72
90
|
/** Body schema for validation */
|
|
73
91
|
bodySchema?: BodySchemaDefinition;
|
|
92
|
+
/** Explicit OpenAPI operationId (e.g., from @Operation, @RequestMapping) */
|
|
93
|
+
operationId?: string;
|
|
94
|
+
/** Explicit OpenAPI summary, separate from name */
|
|
95
|
+
summary?: string;
|
|
96
|
+
/** Explicit OpenAPI tags (e.g., from @Tag, controller class) */
|
|
97
|
+
tags?: string[];
|
|
98
|
+
/** Request/response examples for OpenAPI */
|
|
99
|
+
examples?: OperationExample[];
|
|
100
|
+
/** Per-status-code response definitions */
|
|
101
|
+
responses?: Record<string, OperationResponse>;
|
|
102
|
+
/** Operation-level security requirements */
|
|
103
|
+
security?: Record<string, string[]>[];
|
|
74
104
|
}
|
|
75
105
|
/**
|
|
76
106
|
* Collection-level scripts
|
|
@@ -578,11 +608,17 @@ export interface CollectionRequest {
|
|
|
578
608
|
deprecated?: boolean;
|
|
579
609
|
responseSchema?: ResponseSchemaDefinition;
|
|
580
610
|
bodySchema?: BodySchemaDefinition;
|
|
611
|
+
operationId?: string;
|
|
612
|
+
summary?: string;
|
|
613
|
+
tags?: string[];
|
|
614
|
+
examples?: OperationExample[];
|
|
615
|
+
responses?: Record<string, OperationResponse>;
|
|
616
|
+
security?: Record<string, string[]>[];
|
|
581
617
|
}
|
|
582
618
|
/**
|
|
583
619
|
* Encoded request body ready for HTTP transmission
|
|
584
620
|
*/
|
|
585
|
-
export type RequestBodyEncoded = string | Buffer | null;
|
|
621
|
+
export type RequestBodyEncoded = string | Buffer | FormData | URLSearchParams | null;
|
|
586
622
|
/**
|
|
587
623
|
* Resolved body ready for HTTP transmission
|
|
588
624
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "Headless
|
|
3
|
+
"version": "0.6.11",
|
|
4
|
+
"description": "Headless Postman-compatible API testing engine for Node.js, CI/CD, OpenAPI workflows, and HTTP Forge automation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -27,18 +27,31 @@
|
|
|
27
27
|
"clean": "rimraf dist"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
|
+
"http-forge",
|
|
30
31
|
"http",
|
|
31
32
|
"api",
|
|
33
|
+
"api engine",
|
|
32
34
|
"testing",
|
|
35
|
+
"api testing",
|
|
33
36
|
"automation",
|
|
34
37
|
"postman",
|
|
38
|
+
"postman alternative",
|
|
39
|
+
"postman runtime",
|
|
35
40
|
"collection",
|
|
41
|
+
"openapi",
|
|
42
|
+
"openapi testing",
|
|
36
43
|
"scripting",
|
|
37
44
|
"variables",
|
|
38
45
|
"cookies",
|
|
39
46
|
"ci-cd",
|
|
47
|
+
"ci",
|
|
48
|
+
"cd",
|
|
40
49
|
"headless",
|
|
41
|
-
"
|
|
50
|
+
"headless api testing",
|
|
51
|
+
"nodejs",
|
|
52
|
+
"mcp",
|
|
53
|
+
"mcp server",
|
|
54
|
+
"runtime"
|
|
42
55
|
],
|
|
43
56
|
"author": "Henry Huang",
|
|
44
57
|
"license": "MIT",
|