@http-forge/core 0.2.17 → 0.3.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 +43 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +398 -169
- package/dist/index.mjs +398 -169
- package/dist/infrastructure/config/config-service.d.ts +2 -1
- package/dist/infrastructure/config/config.interface.d.ts +40 -0
- package/dist/infrastructure/config/index.d.ts +1 -1
- package/dist/infrastructure/openapi/openapi-exporter.d.ts +12 -0
- package/dist/infrastructure/test-suite/html-report-generator.d.ts +20 -0
- package/dist/infrastructure/test-suite/result-storage-service.d.ts +2 -1
- package/dist/infrastructure/test-suite/result-storage.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -563,13 +563,50 @@ The core library includes full OpenAPI 3.0.3 import and export with constraint p
|
|
|
563
563
|
|
|
564
564
|
**Export** (`OpenApiExporter`):
|
|
565
565
|
- Generates OpenAPI 3.0.3 specs from collections
|
|
566
|
+
- **Host-variable server resolution** — Any `{{varName}}` that prefixes a request URL (e.g. `{{dcqHost}}/api/...`) is stripped from the path and resolved to a server URL entry. If the variable resolves in the active environment(s), a concrete `url` is added to `servers`. If unresolvable, an OAS server-variable entry is emitted: `url: '{varName}', variables: { varName: { default: '' } }`. This handles arbitrary host variables beyond `{{baseUrl}}`.
|
|
567
|
+
- **Environment variable placeholder sanitization** — `{{varName}}` tokens in parameter examples (path, query, header) and request body examples are replaced with `<varName>` so the exported spec contains readable human placeholders rather than raw template syntax.
|
|
566
568
|
- **Collision-aware merging**: When multiple requests normalize to the same path + HTTP method, they are merged into a single operation:
|
|
567
569
|
- Descriptions are appended, tags are unioned
|
|
568
570
|
- Parameters with the **same constraint kind** (both enum, both pattern, etc.) are merged in-place (union enum values, widen numeric ranges, alternation-join patterns)
|
|
569
571
|
- Parameters with **different constraint kinds** are wrapped in `oneOf` — each variant keeps its self-consistent schema
|
|
570
572
|
- All constraint fields round-trip without data loss
|
|
571
573
|
|
|
572
|
-
##
|
|
574
|
+
## � Exported Types
|
|
575
|
+
|
|
576
|
+
### Configuration
|
|
577
|
+
|
|
578
|
+
`HttpForgeConfig` is the shape of `http-forge.config.json`. Key sub-interfaces:
|
|
579
|
+
|
|
580
|
+
| Interface | Description |
|
|
581
|
+
|---|---|
|
|
582
|
+
| `StorageConfig` | Root/history/results paths |
|
|
583
|
+
| `RequestConfig` | Timeout, redirects, SSL |
|
|
584
|
+
| `ScriptsConfig` | Module search paths |
|
|
585
|
+
| `RunnerConfig` | Retention, index page size |
|
|
586
|
+
| `EnvironmentsConfig` | Default environment |
|
|
587
|
+
| `RestClientExportConfig` | REST Client export path/merge settings |
|
|
588
|
+
| `McpConfig` | MCP server project-level settings (see below) |
|
|
589
|
+
| `ProxyConfig` | HTTP/HTTPS proxy URLs |
|
|
590
|
+
|
|
591
|
+
**`McpConfig`** — controls what the HTTP Forge MCP server exposes to AI agents. All fields are optional; the service fills defaults automatically via `IConfigService.getMcpConfig()`.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
interface McpConfig {
|
|
595
|
+
excludedCollections: string[]; // IDs or names to hide (default: [] = expose all)
|
|
596
|
+
excludedSuites: string[]; // IDs or names to hide (default: [] = expose all)
|
|
597
|
+
toolPrefix: string; // Prefix for every tool name (default: "")
|
|
598
|
+
maxRequestsPerCall: number; // Safety cap per collection/suite call (default: 50)
|
|
599
|
+
cors: {
|
|
600
|
+
allowedOrigins: string[]; // CORS origins (default: ["http://localhost","http://127.0.0.1"])
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
Use `IConfigService.getMcpConfig()` to read the resolved config with all defaults applied.
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
## �🛠️ Use Cases
|
|
573
610
|
|
|
574
611
|
### CLI Tool
|
|
575
612
|
|
|
@@ -767,6 +804,11 @@ MIT © Henry Huang
|
|
|
767
804
|
- ✅ **`duplicateFolder(collectionId, folderId, newName)`** — Duplicates a folder within a collection, preserving all nested request content
|
|
768
805
|
- ✅ **`getItemPath(collectionId, itemId)`** — Resolves the disk path of a folder or request within a collection
|
|
769
806
|
|
|
807
|
+
### 0.2.6 (OpenAPI Export — Environment Variable Handling)
|
|
808
|
+
|
|
809
|
+
- ✅ **Host-variable URL stripping** — Any leading `{{varName}}` in a request URL (e.g. `{{dcqHost}}/DCQ/templates/GetEpg`) is now correctly stripped from the path. The variable name is resolved via `envConfigService.resolveVariables()` and the resulting URL is added to `servers`. When the variable cannot be resolved, an OAS server-variable entry (`url: '{varName}', variables: { varName: { default: '' } }`) is emitted instead. Previously, unknown host variables were converted to `/{varName}/...` path segments.
|
|
810
|
+
- ✅ **Example sanitization** — `{{varName}}` placeholders in parameter examples (path, query, header) and request body examples are replaced with `<varName>` so they render as readable human placeholders instead of raw template syntax in the exported spec.
|
|
811
|
+
|
|
770
812
|
### 0.2.5 (OpenAPI Constraint Round-Trip & Collision Merging)
|
|
771
813
|
|
|
772
814
|
- ✅ **Full parameter constraint round-trip** — OpenAPI import/export now preserves all schema constraint fields: `pattern`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `minLength`, `maxLength`, and `oneOf` on both `KeyValueEntry` and `PathParamEntry`
|
package/dist/index.d.ts
CHANGED
|
@@ -93,7 +93,8 @@ export { ExampleGenerator, HistoryAnalyzer, OpenApiExporter, OpenApiImporter, Re
|
|
|
93
93
|
export type { OpenApiExportOptions, OpenApiImportOptions, ScriptAnalysisResult } from './infrastructure/openapi';
|
|
94
94
|
export * from './infrastructure/openapi/interfaces';
|
|
95
95
|
export { CONFIG_FILES, ConfigService, DEFAULT_CONFIG, ROOT_DIRECTORIES } from './infrastructure/config';
|
|
96
|
-
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './infrastructure/config';
|
|
96
|
+
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, McpConfig, McpCorsConfig, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './infrastructure/config';
|
|
97
|
+
export { HtmlReportGenerator } from './infrastructure/test-suite/html-report-generator';
|
|
97
98
|
export { DEFAULT_SUITE_CONFIG } from './infrastructure/test-suite/interfaces';
|
|
98
99
|
export type { ErrorSummary, IStatisticsService, ITestSuiteService, RequestStatistics, RunStatistics, RunSummary, SuiteConfig, SuiteRequest, TestSuite } from './infrastructure/test-suite/interfaces';
|
|
99
100
|
export { buildResultFileName, expandSummary, HTTP_METHOD_MAP, HTTP_METHOD_REVERSE } from './infrastructure/test-suite/result-storage';
|