@http-forge/core 0.6.32 → 0.6.36-beta.1

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 (100) hide show
  1. package/README.md +51 -0
  2. package/dist/__tests__/api-discovery/golden-utils.d.ts +10 -0
  3. package/dist/index.d.ts +49 -22
  4. package/dist/index.js +456 -480
  5. package/dist/index.mjs +456 -480
  6. package/dist/infrastructure/ai/ai-context.d.ts +109 -0
  7. package/dist/infrastructure/ai/ai-provider.d.ts +1 -1
  8. package/dist/infrastructure/ai/ai-utils.d.ts +38 -0
  9. package/dist/infrastructure/ai/http-providers.d.ts +34 -0
  10. package/dist/infrastructure/api-discovery/analyzer/component-analyzer.d.ts +60 -0
  11. package/dist/infrastructure/api-discovery/analyzer/express-component-analyzer.d.ts +14 -0
  12. package/dist/infrastructure/api-discovery/analyzer/fastify-component-analyzer.d.ts +14 -0
  13. package/dist/infrastructure/api-discovery/analyzer/index.d.ts +11 -0
  14. package/dist/infrastructure/api-discovery/analyzer/lambda-component-analyzer.d.ts +18 -0
  15. package/dist/infrastructure/api-discovery/api-discovery-service.d.ts +49 -0
  16. package/dist/infrastructure/api-discovery/auth-validation.d.ts +34 -0
  17. package/dist/infrastructure/api-discovery/drift-engine.d.ts +139 -0
  18. package/dist/infrastructure/api-discovery/fastapi/fastapi-discovery-provider.d.ts +19 -0
  19. package/dist/infrastructure/api-discovery/fastapi/fastapi-parser.d.ts +60 -0
  20. package/dist/infrastructure/api-discovery/framework-detector.d.ts +8 -0
  21. package/dist/infrastructure/api-discovery/index.d.ts +29 -0
  22. package/dist/infrastructure/api-discovery/path-utils.d.ts +17 -0
  23. package/dist/infrastructure/api-discovery/project-name.d.ts +2 -0
  24. package/dist/infrastructure/api-discovery/provider.d.ts +29 -0
  25. package/dist/infrastructure/api-discovery/providers/express-discovery-provider.d.ts +13 -0
  26. package/dist/infrastructure/api-discovery/providers/fastify-discovery-provider.d.ts +13 -0
  27. package/dist/infrastructure/api-discovery/providers/lambda-discovery-provider.d.ts +19 -0
  28. package/dist/infrastructure/api-discovery/providers/nest-discovery-provider.d.ts +12 -0
  29. package/dist/infrastructure/api-discovery/seed-loader.d.ts +11 -0
  30. package/dist/infrastructure/api-discovery/source-files.d.ts +1 -0
  31. package/dist/infrastructure/api-discovery/spring/controller-visitor.d.ts +141 -0
  32. package/dist/infrastructure/api-discovery/spring/endpoint-parser.d.ts +51 -0
  33. package/dist/infrastructure/api-discovery/spring/file-utils.d.ts +28 -0
  34. package/dist/infrastructure/api-discovery/spring/model.d.ts +84 -0
  35. package/dist/infrastructure/api-discovery/spring/schema-generator.d.ts +65 -0
  36. package/dist/infrastructure/api-discovery/spring/spring-discovery-provider.d.ts +30 -0
  37. package/dist/infrastructure/api-discovery/spring/spring-types.d.ts +27 -0
  38. package/dist/infrastructure/api-discovery/test-generator.d.ts +69 -0
  39. package/dist/infrastructure/api-discovery/types.d.ts +154 -0
  40. package/dist/infrastructure/api-discovery/workflow-discovery.d.ts +55 -0
  41. package/dist/infrastructure/architect/api-architect-service.d.ts +85 -0
  42. package/dist/infrastructure/architect/architect-prompt.d.ts +22 -0
  43. package/dist/infrastructure/architect/collection-to-endpoints.d.ts +13 -0
  44. package/dist/infrastructure/architect/index.d.ts +10 -0
  45. package/dist/infrastructure/collection/collection-service.d.ts +1 -5
  46. package/dist/infrastructure/collection/json-collection-loader.d.ts +0 -8
  47. package/dist/infrastructure/cookie/cookie-service.d.ts +2 -13
  48. package/dist/infrastructure/cookie/cookie-utils.d.ts +5 -0
  49. package/dist/infrastructure/docs/index.d.ts +5 -0
  50. package/dist/infrastructure/docs/release-notes.d.ts +51 -0
  51. package/dist/infrastructure/environment/environment-config-service.d.ts +0 -1
  52. package/dist/infrastructure/environment/variable-interpolator.d.ts +9 -0
  53. package/dist/infrastructure/http/header-utils.d.ts +13 -0
  54. package/dist/infrastructure/http/http-request-service.d.ts +3 -3
  55. package/dist/infrastructure/http/interceptor-chain.d.ts +35 -16
  56. package/dist/infrastructure/http/native-http-client.d.ts +0 -10
  57. package/dist/infrastructure/openapi/interfaces.d.ts +14 -0
  58. package/dist/infrastructure/openapi/openapi-exporter.d.ts +11 -91
  59. package/dist/infrastructure/openapi/openapi-importer.d.ts +19 -0
  60. package/dist/infrastructure/openapi/openapi-operation-builder.d.ts +36 -0
  61. package/dist/infrastructure/openapi/openapi-schema-merger.d.ts +33 -0
  62. package/dist/infrastructure/openapi/openapi-spec-writer.d.ts +27 -0
  63. package/dist/infrastructure/openapi/openapi-utils.d.ts +62 -0
  64. package/dist/infrastructure/parsers/har-parser.d.ts +63 -0
  65. package/dist/infrastructure/parsers/index.d.ts +2 -0
  66. package/dist/infrastructure/review/index.d.ts +5 -0
  67. package/dist/infrastructure/review/review-engine.d.ts +95 -0
  68. package/dist/infrastructure/script/crypto-js-compat.d.ts +123 -0
  69. package/dist/infrastructure/script/request-object-factory.d.ts +54 -0
  70. package/dist/infrastructure/script/request-script-session.d.ts +0 -5
  71. package/dist/infrastructure/script/script-executor.d.ts +4 -33
  72. package/dist/infrastructure/script/script-factories.d.ts +13 -0
  73. package/dist/infrastructure/script/variable-scopes.d.ts +101 -0
  74. package/dist/infrastructure/test-suite/interfaces.d.ts +6 -0
  75. package/dist/infrastructure/test-suite/result-storage-service.d.ts +6 -1
  76. package/dist/infrastructure/test-suite/result-storage.d.ts +14 -1
  77. package/dist/runtime/collection-traversal.d.ts +32 -0
  78. package/dist/runtime/direct-execution.d.ts +7 -0
  79. package/dist/runtime/execution-helpers.d.ts +30 -0
  80. package/dist/runtime/mcp-dispatcher.d.ts +10 -34
  81. package/dist/runtime/mcp-handlers/ai.d.ts +6 -0
  82. package/dist/runtime/mcp-handlers/collection.d.ts +5 -0
  83. package/dist/runtime/mcp-handlers/discovery.d.ts +12 -0
  84. package/dist/runtime/mcp-handlers/environment-management.d.ts +6 -0
  85. package/dist/runtime/mcp-handlers/environment.d.ts +5 -0
  86. package/dist/runtime/mcp-handlers/execution.d.ts +6 -0
  87. package/dist/runtime/mcp-handlers/helpers.d.ts +43 -0
  88. package/dist/runtime/mcp-handlers/inspection.d.ts +5 -0
  89. package/dist/runtime/mcp-handlers/registry.d.ts +12 -0
  90. package/dist/runtime/mcp-handlers/request.d.ts +5 -0
  91. package/dist/runtime/mcp-handlers/review.d.ts +10 -0
  92. package/dist/runtime/mcp-handlers/run-status.d.ts +5 -0
  93. package/dist/runtime/mcp-handlers/suite.d.ts +6 -0
  94. package/dist/runtime/mcp-handlers/types.d.ts +59 -0
  95. package/dist/runtime/mcp-prompts.d.ts +16 -2
  96. package/dist/runtime/mcp-tool-schemas.d.ts +8 -0
  97. package/dist/runtime/suite-executor.d.ts +20 -0
  98. package/dist/types/types.d.ts +0 -9
  99. package/dist/utils/env-hints.d.ts +17 -0
  100. package/package.json +16 -6
@@ -3,28 +3,25 @@
3
3
  *
4
4
  * Generates a valid OpenAPI 3.0.3 document from an HTTP Forge collection.
5
5
  * Implements all mapping rules per the solution document §4.3.2.
6
+ *
7
+ * Orchestrates the export pipeline across focused collaborators:
8
+ * - OpenApiOperationBuilder: request → operation mapping
9
+ * - OpenApiSchemaMerger: reconciliation of colliding path+method variants
10
+ * - OpenApiSpecWriter: component deduplication, finalization, serialization
11
+ * - openapi-utils: pure mapping helpers
6
12
  */
7
13
  import { ICollectionService } from '../../types/collection';
8
14
  import { IEnvironmentConfigService } from '../../types/environment-config';
9
15
  import { SchemaInferenceService } from './schema-inference-service';
10
- export interface OpenApiExportOptions {
11
- format: 'json' | 'yaml';
12
- /** Environment name(s) to use for server URL resolution */
13
- environments?: string[];
14
- /** Include inferred response schemas from history */
15
- inferFromHistory?: boolean;
16
- /** OpenAPI info metadata overrides */
17
- info?: {
18
- title?: string;
19
- version?: string;
20
- description?: string;
21
- };
22
- }
16
+ import { OpenApiExportOptions } from './openapi-utils';
17
+ export type { OpenApiExportOptions } from './openapi-utils';
23
18
  export declare class OpenApiExporter {
24
19
  private collectionService;
25
20
  private envConfigService;
26
21
  private inferenceService;
27
- private inferrer;
22
+ private readonly merger;
23
+ private readonly operationBuilder;
24
+ private readonly specWriter;
28
25
  constructor(collectionService: ICollectionService, envConfigService: IEnvironmentConfigService, inferenceService: SchemaInferenceService);
29
26
  /**
30
27
  * Export a collection as an OpenAPI 3.0.3 document.
@@ -34,83 +31,6 @@ export declare class OpenApiExporter {
34
31
  private buildServers;
35
32
  private processItems;
36
33
  private processRequest;
37
- /**
38
- * Merge a new operation into an existing one at the same path+method.
39
- * - Parameters: union enum values for same-name params; append new params
40
- * - Description: append the variant name
41
- * - Tags: union
42
- * - Responses: merge (new status codes added, existing kept)
43
- */
44
- private mergeOperation;
45
- /**
46
- * Merge parameter schemas when the same parameter appears in colliding operations.
47
- *
48
- * Strategy: if both variants use the SAME constraint kind (both enum, both pattern,
49
- * both numeric range, etc.) they are merged in-place (union enum, widen range, etc.).
50
- * If they use DIFFERENT constraint kinds the schemas are incompatible,
51
- * so we wrap them in `oneOf` — each variant keeps its own self-consistent schema.
52
- *
53
- * Description and examples are always accumulated.
54
- */
55
- private mergeParameterSchema;
56
- /** Identify the primary constraint kind of a schema. */
57
- private getConstraintKind;
58
- /** Merge constraints when both schemas use the same kind. */
59
- private mergeSameKindConstraints;
60
- /** Build a self-contained variant schema from constraint properties. */
61
- private buildVariantSchema;
62
- /** Remove constraint properties from a schema (keeps type, oneOf, etc.). */
63
- private stripConstraints;
64
- /** Extract constraint properties from a schema into a new object. */
65
- private extractConstraints;
66
- /** Widen the type field if the incoming type differs. */
67
- private widenType;
68
- private normalizeUrl;
69
- private generateOperationId;
70
- private collectOperationIds;
71
- private toCamelCase;
72
- private buildParameters;
73
- private buildKeyValueParam;
74
- /**
75
- * Parse a Cookie header value into individual in:cookie parameters.
76
- */
77
- private parseCookieHeader;
78
- /**
79
- * Infer a type from a string value (for path/query params without explicit type).
80
- */
81
- private inferTypeFromValue;
82
- /**
83
- * Coerce a string value to the appropriate JS type for the 'example' field.
84
- * Sanitizes {{varName}} placeholders to <varName> before coercion.
85
- */
86
- private coerceExample;
87
- /** Replace {{varName}} placeholders with <varName> so they don't appear raw in examples. */
88
- private sanitizeEnvVar;
89
- /** Recursively sanitize {{varName}} placeholders in string values of a parsed example object. */
90
- private sanitizeObjectExamples;
91
- private buildRequestBody;
92
- private getContentType;
93
- private tryParseBodyContent;
94
- private buildFormDataSchemaFromBody;
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;
101
- private buildOperationSecurity;
102
- private mapAuthToSecurityScheme;
103
- private parseScopes;
104
- /**
105
- * When multiple operations share structurally identical schemas,
106
- * promote them to components/schemas and replace with $ref.
107
- */
108
- private deduplicateComponents;
109
- private trackSchema;
110
- private replaceInlineSchema;
111
- private sanitizeComponentName;
112
- private cleanSummary;
113
- private hasDeprecatedPrefix;
114
34
  /**
115
35
  * For each host variable found in request URLs (e.g. {{dcqHost}}),
116
36
  * attempt to resolve it from the configured environments and add it
@@ -25,6 +25,25 @@ export declare class OpenApiImporter {
25
25
  collection: Collection;
26
26
  environmentCreated?: string;
27
27
  }>;
28
+ /**
29
+ * Import an OpenAPI spec fetched from a URL (e.g. a public schema endpoint
30
+ * or an OpenAPI-introspection endpoint). Uses the Node 18+ global `fetch`.
31
+ */
32
+ importFromUrl(url: string, options?: OpenApiImportOptions): Promise<{
33
+ collection: Collection;
34
+ environmentCreated?: string;
35
+ }>;
36
+ /**
37
+ * Import an OpenAPI spec from an in-memory string (JSON or YAML).
38
+ */
39
+ importFromString(rawContent: string, options?: OpenApiImportOptions): Promise<{
40
+ collection: Collection;
41
+ environmentCreated?: string;
42
+ }>;
43
+ /** Parse YAML/JSON raw content into a spec object (format-inferred). */
44
+ private parseSpec;
45
+ /** Shared import path after the spec object has been produced. */
46
+ private importFromSpec;
28
47
  private processOperation;
29
48
  /**
30
49
  * Convert OpenAPI path parameters from {param} to :param syntax.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * OpenAPI export — request → operation mapping.
3
+ *
4
+ * Maps a single collection request (params, query, headers, body, responses,
5
+ * auth) into an OpenAPI operation object. Pure with respect to the returned
6
+ * operation; mutation of shared export state (tags, securitySchemes) is
7
+ * performed through the explicitly-passed collections.
8
+ */
9
+ import { Collection, CollectionRequestItem } from '../../types/collection';
10
+ import { RequestAuth } from '../../types/types';
11
+ import { SchemaInferrer } from './schema-inferrer';
12
+ import { OpenApiExportOptions } from './openapi-utils';
13
+ export declare class OpenApiOperationBuilder {
14
+ private inferrer;
15
+ constructor(inferrer: SchemaInferrer);
16
+ /**
17
+ * Build a single OpenAPI operation from a collection request.
18
+ * Registers any discovered security schemes / tags into the shared maps.
19
+ */
20
+ buildOperation(request: CollectionRequestItem, method: string, path: string, spec: any, securitySchemes: Map<string, any>, tags: Set<string>, parentTag: string | undefined, collection: Collection, options: OpenApiExportOptions): Promise<any>;
21
+ private generateOperationId;
22
+ private collectOperationIds;
23
+ private buildRequestBody;
24
+ private buildResponses;
25
+ /**
26
+ * Map operation-level response definitions (from metadata) to OpenAPI format.
27
+ * Converts OperationResponse[] indexed by status code into OpenAPI responses object.
28
+ */
29
+ private mapResponseDefinitions;
30
+ private buildOperationSecurity;
31
+ mapAuthToSecurityScheme(auth: RequestAuth): {
32
+ schemeName: string;
33
+ scheme: any;
34
+ requirement: any;
35
+ } | undefined;
36
+ }
@@ -0,0 +1,33 @@
1
+ export declare class OpenApiSchemaMerger {
2
+ /**
3
+ * Merge a new operation into an existing one at the same path+method.
4
+ * - Parameters: union enum values for same-name params; append new params
5
+ * - Description: append the variant name
6
+ * - Tags: union
7
+ * - Responses: merge (new status codes added, existing kept)
8
+ */
9
+ mergeOperation(existing: any, incoming: any, incomingName: string): void;
10
+ /**
11
+ * Merge parameter schemas when the same parameter appears in colliding operations.
12
+ *
13
+ * Strategy: if both variants use the SAME constraint kind (both enum, both pattern,
14
+ * both numeric range, etc.) they are merged in-place (union enum, widen range, etc.).
15
+ * If they use DIFFERENT constraint kinds the schemas are incompatible,
16
+ * so we wrap them in `oneOf` — each variant keeps its own self-consistent schema.
17
+ *
18
+ * Description and examples are always accumulated.
19
+ */
20
+ mergeParameterSchema(existing: any, incoming: any, variantName: string): void;
21
+ /** Identify the primary constraint kind of a schema. */
22
+ getConstraintKind(schema: any): 'enum' | 'pattern' | 'range' | 'length' | 'format' | 'oneOf' | 'array' | 'none';
23
+ /** Merge constraints when both schemas use the same kind. */
24
+ mergeSameKindConstraints(es: any, is: any, kind: string): void;
25
+ /** Build a self-contained variant schema from constraint properties. */
26
+ buildVariantSchema(schema: any): any;
27
+ /** Remove constraint properties from a schema (keeps type, oneOf, etc.). */
28
+ stripConstraints(schema: any): void;
29
+ /** Extract constraint properties from a schema into a new object. */
30
+ extractConstraints(schema: any): any;
31
+ /** Widen the type field if the incoming type differs. */
32
+ widenType(es: any, is: any): void;
33
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * OpenAPI export — spec finalization and serialization.
3
+ *
4
+ * Post-processes a fully-populated OpenAPI document:
5
+ * - promotes structurally-identical inline schemas into components/schemas
6
+ * - installs collected security schemes and tags
7
+ * - removes empty component sections
8
+ * - serializes to JSON or YAML
9
+ *
10
+ * Stateless and pure with respect to its inputs (mutating only the `spec`
11
+ * object it is given to finalize).
12
+ */
13
+ import { OpenApiExportOptions } from './openapi-utils';
14
+ export declare class OpenApiSpecWriter {
15
+ /**
16
+ * Finalize the collected spec state into a serialized document string.
17
+ */
18
+ finalize(spec: any, securitySchemes: Map<string, any>, tags: Set<string>, options: OpenApiExportOptions): string;
19
+ /**
20
+ * When multiple operations share structurally identical schemas,
21
+ * promote them to components/schemas and replace with $ref.
22
+ */
23
+ private deduplicateComponents;
24
+ private trackSchema;
25
+ private replaceInlineSchema;
26
+ private sanitizeComponentName;
27
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * OpenAPI export — pure mapping helpers.
3
+ *
4
+ * Stateless functions shared by the operation builder (URL normalization,
5
+ * type/example coercion, request body parsing, key-value params, cookie
6
+ * parsing, operation-id casing). Kept free of class state so they are trivial
7
+ * to unit-test and reuse.
8
+ */
9
+ import type { CollectionRequestItem } from '../../types/collection';
10
+ import type { JSONSchema7, KeyValueEntry } from '../../types/types';
11
+ export interface OpenApiExportOptions {
12
+ format: 'json' | 'yaml';
13
+ /** Environment name(s) to use for server URL resolution */
14
+ environments?: string[];
15
+ /** Include inferred response schemas from history */
16
+ inferFromHistory?: boolean;
17
+ /** OpenAPI info metadata overrides */
18
+ info?: {
19
+ title?: string;
20
+ version?: string;
21
+ description?: string;
22
+ };
23
+ }
24
+ /** Headers excluded from 'in: header' parameters on export */
25
+ export declare const EXCLUDED_HEADERS: Set<string>;
26
+ /** Normalize a collection request URL into an OpenAPI path + optional host var. */
27
+ export declare function normalizeUrl(url: string): {
28
+ path: string;
29
+ hostVar: string | null;
30
+ };
31
+ /** Infer a JSON schema type from a primitive string value. */
32
+ export declare function inferTypeFromValue(value: string): string;
33
+ /** Widen the numeric type pair 'integer'/'number' to 'number'. Returns 'number' or undefined. */
34
+ export declare function widenNumericType(a: string | undefined, b: string | undefined): string | undefined;
35
+ /** Replace {{varName}} placeholders with <varName> so they don't appear raw in examples. */
36
+ export declare function sanitizeEnvVar(value: string): string;
37
+ /**
38
+ * Coerce a string value to the appropriate JS type for the 'example' field.
39
+ * Sanitizes {{varName}} placeholders to <varName> before coercion.
40
+ */
41
+ export declare function coerceExample(value: string, type: string): any;
42
+ /** Recursively sanitize {{varName}} placeholders in string values of a parsed example object. */
43
+ export declare function sanitizeObjectExamples(value: any): any;
44
+ /** Try to parse a request body's content into structured data (sanitized). */
45
+ export declare function tryParseBodyContent(body: any): any;
46
+ /** Map a request body's type/format to an OpenAPI content type. */
47
+ export declare function getContentType(body: any): string;
48
+ /** Build an object schema from form-data / urlencoded entries. */
49
+ export declare function buildFormDataSchemaFromBody(body: any): JSONSchema7;
50
+ /** Build a query/header parameter object from a key-value entry. */
51
+ export declare function buildKeyValueParam(entry: KeyValueEntry, location: 'query' | 'header'): any;
52
+ /** Parse a Cookie header value into individual in:cookie parameters. */
53
+ export declare function parseCookieHeader(value: string): any[];
54
+ /** Build an OpenAPI path/query/header/cookie parameter list from a request. */
55
+ export declare function buildParameters(request: CollectionRequestItem): any[];
56
+ /** camelCase a request name for use as an OpenAPI operationId. */
57
+ export declare function toCamelCase(str: string): string;
58
+ /** Strip a [DEPRECATED] prefix from a request name. */
59
+ export declare function cleanSummary(name: string): string;
60
+ export declare function hasDeprecatedPrefix(name: string): boolean;
61
+ /** Parse a whitespace-separated OAuth2 scope string into a scope map. */
62
+ export declare function parseScopes(scopeStr: string): Record<string, string>;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * HAR (HTTP Archive) Parser
3
+ *
4
+ * Parses a HAR 1.2 archive into HTTP Forge requests. Extracts method, URL,
5
+ * headers, query params, cookies, postData body, and a response-time hint from
6
+ * each `log.entries[]` network transaction.
7
+ *
8
+ * Platform-independent: pure string/JSON handling, no Node.js or VS Code dep.
9
+ */
10
+ import type { RequestBody, UnifiedCollection } from '../../types/types';
11
+ /** Structured representation of a single HAR entry converted to a request. */
12
+ export interface ParsedHarRequest {
13
+ name: string;
14
+ method: string;
15
+ url: string;
16
+ headers: Array<{
17
+ key: string;
18
+ value: string;
19
+ enabled: boolean;
20
+ }>;
21
+ query: Array<{
22
+ key: string;
23
+ value: string;
24
+ enabled: boolean;
25
+ }>;
26
+ cookies: Array<{
27
+ key: string;
28
+ value: string;
29
+ enabled: boolean;
30
+ }>;
31
+ /** Parsed postData body, or null when no body is present. */
32
+ body: RequestBody | null;
33
+ /** Observed response status from the HAR entry (if any). */
34
+ responseStatus?: number;
35
+ /** Observed response time in ms (if any). */
36
+ responseTimeMs?: number;
37
+ /** HAR content type of the response body (if any). */
38
+ responseContentType?: string;
39
+ }
40
+ export interface HarImportOptions {
41
+ /** Collection name override (default: "Imported from HAR"). */
42
+ collectionName?: string;
43
+ /** Skip entries that failed (HTTP 4xx/5xx). Default: false. */
44
+ skipFailed?: boolean;
45
+ /** Only include entries whose URL hostname matches this value. */
46
+ filterHost?: string;
47
+ }
48
+ /** Data extracted from a parsed HAR body, when it looks like JSON. */
49
+ export interface HarJsonBody {
50
+ parsed: unknown;
51
+ text: string;
52
+ }
53
+ /**
54
+ * Parse a HAR archive (as an object or a JSON string) into HTTP Forge
55
+ * requests. Returns the flattened requests and a unified collection with the
56
+ * entries grouped by top-level hostname folders.
57
+ */
58
+ export declare function parseHar(har: string | Record<string, any>, options?: HarImportOptions): {
59
+ requests: ParsedHarRequest[];
60
+ collection: UnifiedCollection;
61
+ };
62
+ /** Parse a HAR archive's entry list into a unified collection directly. */
63
+ export declare function harToCollection(har: string | Record<string, any>, options?: HarImportOptions): UnifiedCollection;
@@ -5,3 +5,5 @@
5
5
  */
6
6
  export * from './collection-parser.adapter';
7
7
  export { HttpForgeParser } from './http-forge-parser';
8
+ export { harToCollection, parseHar } from './har-parser';
9
+ export type { HarImportOptions, HarJsonBody, ParsedHarRequest } from './har-parser';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Review module barrel (Phase 3, Layer 7).
3
+ */
4
+ export { reviewSuiteRun, toReviewRequestResults, } from './review-engine';
5
+ export type { ReviewFinding, ReviewOptions, ReviewReport, ReviewRequestResult, ReviewSeverity, } from './review-engine';
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Review Engine
3
+ *
4
+ * Single Responsibility: Run the deterministic review rules over a suite +
5
+ * run-results pair (Phase 3, Layer 7) and produce a structured ReviewReport.
6
+ *
7
+ * Determinism contract (from the plan): rules are pure, repeatable functions —
8
+ * the same suite + run-results always yield the same findings. This is what
9
+ * makes the review gate CI-usable (a reviewer that depends on an LLM is
10
+ * non-deterministic and unreviewable). An LLM may ENRICH the report later
11
+ * (see mcp-prompts buildReviewSuitePrompt), but it never IS the rules.
12
+ *
13
+ * The engine deliberately has zero `vscode` imports and depends only on the
14
+ * normalized inputs below so CLI/MCP/CI all share the same implementation.
15
+ */
16
+ import type { TestSuite } from '../test-suite/interfaces';
17
+ export type ReviewSeverity = 'error' | 'warn' | 'info';
18
+ /**
19
+ * A single request-level result. The run stores use `responseStatus` on failed
20
+ * results and `status` elsewhere, and may split failed tests into `failedTests`,
21
+ * so both shapes are accepted and normalized here.
22
+ */
23
+ export interface ReviewRequestResult {
24
+ name: string;
25
+ method?: string;
26
+ url?: string;
27
+ /** Numeric HTTP status (accepts either storage shape). */
28
+ status?: number;
29
+ responseStatus?: number;
30
+ /** Raw response body (string or parsed). */
31
+ body?: unknown;
32
+ requestBody?: unknown;
33
+ /** Transport/script-level error (request never produced a response). */
34
+ error?: string;
35
+ /** Response time in milliseconds. */
36
+ duration?: number;
37
+ assertions?: Array<{
38
+ name: string;
39
+ passed: boolean;
40
+ message?: string;
41
+ }>;
42
+ /** Alternative shape used by direct-execution failed results. */
43
+ failedTests?: Array<{
44
+ name: string;
45
+ message?: string;
46
+ }>;
47
+ }
48
+ export interface ReviewFinding {
49
+ /** Stable rule id (used by CI gates and the LLM-enrichment step). */
50
+ rule: string;
51
+ severity: ReviewSeverity;
52
+ /** Short headline, safe to render as a list item. */
53
+ title: string;
54
+ /** Human-readable detail. */
55
+ message: string;
56
+ /** The affected request, when the finding is request-scoped. */
57
+ requestName?: string;
58
+ /** Concrete remediation, when known. */
59
+ suggestion?: string;
60
+ }
61
+ export interface ReviewOptions {
62
+ /** Responses slower than this (ms) are flagged slow-response. Default 2000. */
63
+ slowResponseMs?: number;
64
+ /** When a request has no assertions, skip the missing-assertions warning. */
65
+ allowNoAssertions?: boolean;
66
+ }
67
+ export interface ReviewReport {
68
+ suiteId?: string;
69
+ suiteName?: string;
70
+ runId?: string;
71
+ generatedAt: number;
72
+ summary: {
73
+ errors: number;
74
+ warnings: number;
75
+ infos: number;
76
+ total: number;
77
+ pass: boolean;
78
+ };
79
+ findings: ReviewFinding[];
80
+ rulesRun: string[];
81
+ }
82
+ /**
83
+ * Review a suite run: run every deterministic rule over the normalized
84
+ * request results and summarize into a ReviewReport.
85
+ *
86
+ * `suite` is optional — run-results alone produce a valid review. When
87
+ * provided, its id/name are carried into the report and its request nodes are
88
+ * used to annotate assertion coverage (see `annotateSuiteCoverage`).
89
+ */
90
+ export declare function reviewSuiteRun(suite: TestSuite | undefined, results: ReviewRequestResult[], options?: ReviewOptions): ReviewReport;
91
+ /**
92
+ * Normalize an McpRunRecord-style run into ReviewRequestResult[].
93
+ * Accepts both a full record ({ allResults }) and a bare array.
94
+ */
95
+ export declare function toReviewRequestResults(run: unknown): ReviewRequestResult[];
@@ -0,0 +1,123 @@
1
+ /**
2
+ * CryptoJS compatibility layer
3
+ *
4
+ * Single Responsibility: Provide a CryptoJS-compatible API surface for the
5
+ * script sandbox (hashes, HMACs, AES/DES/TripleDES ciphers, encodings, PBKDF2).
6
+ *
7
+ * Uses Node's crypto module underneath, with a WordArray representation that
8
+ * behaves like CryptoJS's intermediate data type.
9
+ */
10
+ /**
11
+ * CryptoJS-compatible WordArray representation.
12
+ *
13
+ * CryptoJS uses a custom WordArray type as intermediate data representation.
14
+ * We represent it as a tagged Buffer wrapper so all encrypt/decrypt flows work.
15
+ */
16
+ declare class CryptoWordArray {
17
+ private _buffer;
18
+ constructor(data: string | Buffer);
19
+ toString(encoder?: {
20
+ stringify: (wa: CryptoWordArray) => string;
21
+ }): string;
22
+ toBuffer(): Buffer;
23
+ /** Create from hex string */
24
+ static fromHex(hex: string): CryptoWordArray;
25
+ /** Create from base64 string */
26
+ static fromBase64(b64: string): CryptoWordArray;
27
+ /** Create from utf8 string */
28
+ static fromUtf8(str: string): CryptoWordArray;
29
+ }
30
+ /**
31
+ * CryptoJS Factory - Creates CryptoJS-compatible object
32
+ *
33
+ * Supports:
34
+ * - Hash: MD5, SHA1, SHA224, SHA256, SHA384, SHA512, SHA3, RIPEMD160
35
+ * - HMAC: HmacMD5, HmacSHA1, HmacSHA256, HmacSHA512
36
+ * - Encryption: AES, DES, TripleDES (passphrase and raw key modes)
37
+ * - Encoding: Base64, Hex, Utf8, Utf16, Latin1
38
+ * - Key derivation: PBKDF2
39
+ * - WordArray creation from lib.WordArray.create / lib.WordArray.random
40
+ */
41
+ export declare function createCryptoJS(): {
42
+ MD5: (message: string | CryptoWordArray) => CryptoWordArray;
43
+ SHA1: (message: string | CryptoWordArray) => CryptoWordArray;
44
+ SHA224: (message: string | CryptoWordArray) => CryptoWordArray;
45
+ SHA256: (message: string | CryptoWordArray) => CryptoWordArray;
46
+ SHA384: (message: string | CryptoWordArray) => CryptoWordArray;
47
+ SHA512: (message: string | CryptoWordArray) => CryptoWordArray;
48
+ SHA3: (message: string | CryptoWordArray) => CryptoWordArray;
49
+ RIPEMD160: (message: string | CryptoWordArray) => CryptoWordArray;
50
+ HmacMD5: (message: string | CryptoWordArray, key: string | CryptoWordArray) => CryptoWordArray;
51
+ HmacSHA1: (message: string | CryptoWordArray, key: string | CryptoWordArray) => CryptoWordArray;
52
+ HmacSHA256: (message: string | CryptoWordArray, key: string | CryptoWordArray) => CryptoWordArray;
53
+ HmacSHA512: (message: string | CryptoWordArray, key: string | CryptoWordArray) => CryptoWordArray;
54
+ AES: {
55
+ encrypt(message: string | CryptoWordArray, key: string | CryptoWordArray, options?: any): any;
56
+ decrypt(ciphertext: string | any, key: string | CryptoWordArray, options?: any): CryptoWordArray;
57
+ };
58
+ DES: {
59
+ encrypt(message: string | CryptoWordArray, key: string | CryptoWordArray, options?: any): any;
60
+ decrypt(ciphertext: string | any, key: string | CryptoWordArray, options?: any): CryptoWordArray;
61
+ };
62
+ TripleDES: {
63
+ encrypt(message: string | CryptoWordArray, key: string | CryptoWordArray, options?: any): any;
64
+ decrypt(ciphertext: string | any, key: string | CryptoWordArray, options?: any): CryptoWordArray;
65
+ };
66
+ PBKDF2(password: string | CryptoWordArray, salt: string | CryptoWordArray, cfg?: {
67
+ keySize?: number;
68
+ iterations?: number;
69
+ hasher?: any;
70
+ }): CryptoWordArray;
71
+ enc: {
72
+ Base64: {
73
+ stringify: (wa: CryptoWordArray) => string;
74
+ parse: (str: string) => CryptoWordArray;
75
+ };
76
+ Utf8: {
77
+ stringify: (wa: CryptoWordArray) => string;
78
+ parse: (str: string) => CryptoWordArray;
79
+ };
80
+ Hex: {
81
+ stringify: (wa: CryptoWordArray) => string;
82
+ parse: (str: string) => CryptoWordArray;
83
+ };
84
+ Latin1: {
85
+ stringify: (wa: CryptoWordArray) => string;
86
+ parse: (str: string) => CryptoWordArray;
87
+ };
88
+ Utf16: {
89
+ stringify: (wa: CryptoWordArray) => string;
90
+ parse: (str: string) => CryptoWordArray;
91
+ };
92
+ Utf16BE: {
93
+ stringify: (wa: CryptoWordArray) => string;
94
+ parse: (str: string) => CryptoWordArray;
95
+ };
96
+ };
97
+ lib: {
98
+ WordArray: {
99
+ create: (data?: any) => CryptoWordArray;
100
+ random: (nBytes: number) => CryptoWordArray;
101
+ };
102
+ };
103
+ pad: {
104
+ Pkcs7: {
105
+ _name: string;
106
+ };
107
+ NoPadding: {
108
+ _name: string;
109
+ };
110
+ ZeroPadding: {
111
+ _name: string;
112
+ };
113
+ };
114
+ mode: {
115
+ CBC: {
116
+ _name: string;
117
+ };
118
+ ECB: {
119
+ _name: string;
120
+ };
121
+ };
122
+ };
123
+ export {};
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Request Object Factory
3
+ *
4
+ * Single Responsibility: Build the Postman-compatible pm.request object proxy
5
+ * with getters/setters for modification tracking.
6
+ *
7
+ * Maps HTTP Forge body types to Postman modes for script API compatibility.
8
+ */
9
+ export declare function createRequestObject(modifiedRequest: any, context: any): {
10
+ url: any;
11
+ method: string;
12
+ headers: any;
13
+ body: any;
14
+ params: any;
15
+ query: any;
16
+ auth: any;
17
+ certificate: any;
18
+ description: any;
19
+ name: string;
20
+ readonly id: any;
21
+ disabled: boolean;
22
+ readonly messages: any;
23
+ readonly methodPath: any;
24
+ readonly metadata: any;
25
+ getHeaders(options?: any): Record<string, string>;
26
+ addQueryParams(params: any[] | string): void;
27
+ removeQueryParams(params: string | string[] | any[]): void;
28
+ authorizeUsing(type: string | any, options?: any): void;
29
+ clone(): {
30
+ url: any;
31
+ method: any;
32
+ headers: any;
33
+ body: any;
34
+ params: any;
35
+ query: any;
36
+ auth: any;
37
+ certificate: any;
38
+ description: any;
39
+ name: any;
40
+ id: any;
41
+ disabled: any;
42
+ metadata: any;
43
+ messages: any;
44
+ methodPath: any;
45
+ };
46
+ describe(content: string, type?: string): void;
47
+ setHeader(name: string, value: string): void;
48
+ addHeader(header: string | {
49
+ key: string;
50
+ value: string;
51
+ }, value?: string): void;
52
+ removeHeader(name: string): void;
53
+ setBody(content: any, bodyType?: string, rawFormat?: string): void;
54
+ };
@@ -59,11 +59,6 @@ export declare class RequestScriptSession implements IRequestScriptSession {
59
59
  * Create shared context object that will be augmented with response data later
60
60
  */
61
61
  private createSharedContext;
62
- /**
63
- * Create request object with getters/setters for modification tracking
64
- * Maps HTTP Forge body types to Postman modes for script API compatibility
65
- */
66
- private createRequestObject;
67
62
  /**
68
63
  * Inject the legacy (pre-`pm.*`) Postman/Newman sandbox globals into the VM context.
69
64
  *