@http-forge/core 0.1.0 → 0.2.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.
Files changed (128) hide show
  1. package/README.md +194 -41
  2. package/dist/auth/interfaces.d.ts +63 -0
  3. package/dist/auth/oauth2-token-manager.d.ts +103 -0
  4. package/dist/collection/collection-loader-factory.d.ts +20 -0
  5. package/dist/{services → collection}/collection-loader.d.ts +3 -3
  6. package/dist/collection/collection-service-interfaces.d.ts +119 -0
  7. package/dist/collection/collection-service.d.ts +75 -0
  8. package/dist/collection/collection-store.d.ts +109 -0
  9. package/dist/collection/folder-collection-loader.d.ts +256 -0
  10. package/dist/collection/folder-collection-store.d.ts +168 -0
  11. package/dist/collection/interfaces.d.ts +32 -0
  12. package/dist/collection/json-collection-loader.d.ts +95 -0
  13. package/dist/{services → collection}/parser-registry.d.ts +1 -2
  14. package/dist/config/config-service.d.ts +79 -0
  15. package/dist/config/config.interface.d.ts +140 -0
  16. package/dist/config/default-config.d.ts +29 -0
  17. package/dist/config/index.d.ts +6 -0
  18. package/dist/container.d.ts +22 -14
  19. package/dist/{implementations → cookie}/cookie-jar.d.ts +2 -3
  20. package/dist/cookie/cookie-service.d.ts +98 -0
  21. package/dist/{implementations → cookie}/cookie-utils.d.ts +1 -2
  22. package/dist/cookie/in-memory-cookie-jar.d.ts +44 -0
  23. package/dist/{interfaces/cookie.d.ts → cookie/interfaces.d.ts} +22 -3
  24. package/dist/cookie/persistent-cookie-jar.d.ts +35 -0
  25. package/dist/environment/environment-config-service.d.ts +95 -0
  26. package/dist/{services → environment}/environment-resolver.d.ts +6 -5
  27. package/dist/{services → environment}/forge-env.d.ts +1 -2
  28. package/dist/environment/interfaces.d.ts +139 -0
  29. package/dist/environment/variable-interpolator.d.ts +100 -0
  30. package/dist/execution/collection-request-executor-interfaces.d.ts +36 -0
  31. package/dist/execution/collection-request-executor.d.ts +78 -0
  32. package/dist/{services → execution}/request-executor.d.ts +23 -11
  33. package/dist/execution/request-preparer-interfaces.d.ts +36 -0
  34. package/dist/execution/request-preparer.d.ts +35 -0
  35. package/dist/graphql/graphql-completion-provider.d.ts +39 -0
  36. package/dist/graphql/graphql-schema-service.d.ts +89 -0
  37. package/dist/{interfaces/history.d.ts → history/history-interfaces.d.ts} +29 -6
  38. package/dist/history/request-history-service-interfaces.d.ts +43 -0
  39. package/dist/history/request-history-service.d.ts +133 -0
  40. package/dist/{implementations → history}/request-history.d.ts +2 -3
  41. package/dist/{implementations → http}/fetch-http-client.d.ts +4 -5
  42. package/dist/http/http-request-service.d.ts +36 -0
  43. package/dist/{implementations → http}/interceptor-chain.d.ts +1 -2
  44. package/dist/http/interfaces.d.ts +25 -0
  45. package/dist/http/merge-request-settings.d.ts +12 -0
  46. package/dist/{implementations → http}/native-http-client.d.ts +6 -15
  47. package/dist/{implementations → http}/request-preprocessor.d.ts +1 -2
  48. package/dist/{services → http}/url-builder.d.ts +7 -10
  49. package/dist/import-export/import-postman-environment.d.ts +21 -0
  50. package/dist/import-export/rest-client-export.d.ts +35 -0
  51. package/dist/index.d.ts +88 -6
  52. package/dist/index.js +262 -35
  53. package/dist/index.mjs +262 -35
  54. package/dist/openapi/example-generator.d.ts +26 -0
  55. package/dist/openapi/history-analyzer.d.ts +29 -0
  56. package/dist/openapi/index.d.ts +16 -0
  57. package/dist/openapi/interfaces.d.ts +42 -0
  58. package/dist/openapi/openapi-exporter.d.ts +73 -0
  59. package/dist/openapi/openapi-importer.d.ts +72 -0
  60. package/dist/openapi/ref-resolver.d.ts +28 -0
  61. package/dist/openapi/schema-inference-service.d.ts +40 -0
  62. package/dist/openapi/schema-inferrer.d.ts +26 -0
  63. package/dist/openapi/script-analyzer.d.ts +41 -0
  64. package/dist/parsers/http-forge-parser.d.ts +2 -3
  65. package/dist/parsers/index.d.ts +0 -1
  66. package/dist/{implementations → platform}/data-file-parser.d.ts +0 -1
  67. package/dist/{implementations → platform}/node-file-system.d.ts +1 -2
  68. package/dist/script/interfaces.d.ts +149 -0
  69. package/dist/script/module-loader.d.ts +115 -0
  70. package/dist/script/request-script-session.d.ts +70 -0
  71. package/dist/script/script-executor.d.ts +60 -0
  72. package/dist/script/script-factories.d.ts +83 -0
  73. package/dist/script/script-utils.d.ts +41 -0
  74. package/dist/test-suite/index.d.ts +10 -0
  75. package/dist/test-suite/interfaces.d.ts +164 -0
  76. package/dist/test-suite/result-storage-service.d.ts +70 -0
  77. package/dist/test-suite/result-storage.d.ts +296 -0
  78. package/dist/test-suite/statistics-service.d.ts +51 -0
  79. package/dist/test-suite/test-suite-service.d.ts +97 -0
  80. package/dist/test-suite/test-suite-store.d.ts +155 -0
  81. package/dist/types/console-service.d.ts +40 -0
  82. package/dist/types/platform.d.ts +206 -0
  83. package/dist/{interfaces → types}/types.d.ts +282 -12
  84. package/dist/utils/dynamic-variables.d.ts +38 -0
  85. package/dist/utils/expression-evaluator.d.ts +34 -0
  86. package/dist/utils/filter-engine.d.ts +47 -0
  87. package/dist/utils/helpers.d.ts +47 -0
  88. package/package.json +11 -3
  89. package/dist/container.d.ts.map +0 -1
  90. package/dist/implementations/cookie-jar.d.ts.map +0 -1
  91. package/dist/implementations/cookie-utils.d.ts.map +0 -1
  92. package/dist/implementations/data-file-parser.d.ts.map +0 -1
  93. package/dist/implementations/fetch-http-client.d.ts.map +0 -1
  94. package/dist/implementations/index.d.ts +0 -22
  95. package/dist/implementations/index.d.ts.map +0 -1
  96. package/dist/implementations/interceptor-chain.d.ts.map +0 -1
  97. package/dist/implementations/module-loader.d.ts +0 -74
  98. package/dist/implementations/module-loader.d.ts.map +0 -1
  99. package/dist/implementations/native-http-client.d.ts.map +0 -1
  100. package/dist/implementations/node-file-system.d.ts.map +0 -1
  101. package/dist/implementations/request-history.d.ts.map +0 -1
  102. package/dist/implementations/request-preprocessor.d.ts.map +0 -1
  103. package/dist/implementations/variable-interpolator.d.ts +0 -55
  104. package/dist/implementations/variable-interpolator.d.ts.map +0 -1
  105. package/dist/implementations/vm2-script-runner.d.ts +0 -76
  106. package/dist/implementations/vm2-script-runner.d.ts.map +0 -1
  107. package/dist/index.d.ts.map +0 -1
  108. package/dist/interfaces/cookie.d.ts.map +0 -1
  109. package/dist/interfaces/history.d.ts.map +0 -1
  110. package/dist/interfaces/index.d.ts +0 -170
  111. package/dist/interfaces/index.d.ts.map +0 -1
  112. package/dist/interfaces/types.d.ts.map +0 -1
  113. package/dist/parsers/http-forge-parser.d.ts.map +0 -1
  114. package/dist/parsers/index.d.ts.map +0 -1
  115. package/dist/services/collection-loader.d.ts.map +0 -1
  116. package/dist/services/environment-resolver.d.ts.map +0 -1
  117. package/dist/services/folder-collection-loader.d.ts +0 -91
  118. package/dist/services/folder-collection-loader.d.ts.map +0 -1
  119. package/dist/services/forge-env.d.ts.map +0 -1
  120. package/dist/services/index.d.ts +0 -20
  121. package/dist/services/index.d.ts.map +0 -1
  122. package/dist/services/parser-registry.d.ts.map +0 -1
  123. package/dist/services/request-executor.d.ts.map +0 -1
  124. package/dist/services/script-pipeline.d.ts +0 -43
  125. package/dist/services/script-pipeline.d.ts.map +0 -1
  126. package/dist/services/script-session.d.ts +0 -66
  127. package/dist/services/script-session.d.ts.map +0 -1
  128. package/dist/services/url-builder.d.ts.map +0 -1
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Example Generator
3
+ *
4
+ * Generates example values from JSON Schema definitions.
5
+ * Handles allOf (flatten + merge), oneOf/anyOf (first variant),
6
+ * discriminator injection, enum, formats, readOnly omission.
7
+ */
8
+ import { JSONSchema7 } from '../types/types';
9
+ export declare class ExampleGenerator {
10
+ /**
11
+ * Generate an example value from a JSON Schema.
12
+ */
13
+ generate(schema: JSONSchema7, options?: {
14
+ omitReadOnly?: boolean;
15
+ components?: Record<string, JSONSchema7>;
16
+ }): any;
17
+ private generateString;
18
+ private generateInteger;
19
+ private generateNumber;
20
+ private generateArray;
21
+ private generateObject;
22
+ private generateFromAllOf;
23
+ private generateFromOneOfAnyOf;
24
+ private guessDiscriminatorValue;
25
+ private resolveLocalRef;
26
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * History Analyzer
3
+ *
4
+ * Reads FullResponse files from history and shared-history directories
5
+ * to build response schemas by inferring from actual response data.
6
+ */
7
+ import { IRequestHistoryService } from '../history/request-history-service-interfaces';
8
+ import { ResponseSchemaDefinition } from '../types/types';
9
+ import { SchemaInferrer } from './schema-inferrer';
10
+ export declare class HistoryAnalyzer {
11
+ private historyService;
12
+ private inferrer;
13
+ constructor(historyService: IRequestHistoryService, inferrer: SchemaInferrer);
14
+ /**
15
+ * Analyze all available history for a request.
16
+ * Groups responses by status code, infers schema per group.
17
+ */
18
+ analyze(collectionId: string, requestId: string, options?: {
19
+ environment?: string;
20
+ maxSamples?: number;
21
+ }): Promise<ResponseSchemaDefinition>;
22
+ private buildResponseDefinition;
23
+ private inferBodySchema;
24
+ private extractContentType;
25
+ private isJsonContentType;
26
+ private findConsistentHeaders;
27
+ private inferHeaderSchema;
28
+ private tryParseJson;
29
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * OpenAPI Services
3
+ *
4
+ * Complete OpenAPI 3.0 import/export functionality with schema inference.
5
+ */
6
+ export { ExampleGenerator } from './example-generator';
7
+ export { HistoryAnalyzer } from './history-analyzer';
8
+ export { RefResolver } from './ref-resolver';
9
+ export { SchemaInferrer } from './schema-inferrer';
10
+ export { ScriptAnalyzer } from './script-analyzer';
11
+ export type { ScriptAnalysisResult } from './script-analyzer';
12
+ export { SchemaInferenceService } from './schema-inference-service';
13
+ export { OpenApiExporter } from './openapi-exporter';
14
+ export type { OpenApiExportOptions } from './openapi-exporter';
15
+ export { OpenApiImporter } from './openapi-importer';
16
+ export type { OpenApiImportOptions } from './openapi-importer';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * OpenAPI Service Interfaces
3
+ *
4
+ * DI abstractions for OpenAPI-related services.
5
+ * The concrete implementations live in services/openapi/.
6
+ */
7
+ import type { OpenApiExportOptions } from './openapi-exporter';
8
+ import type { OpenApiImportOptions } from './openapi-importer';
9
+ import type { Collection } from '../collection/collection-service-interfaces';
10
+ import type { BodySchemaDefinition, JSONSchema7, KeyValueEntry, ResponseSchemaDefinition } from '../types/types';
11
+ /**
12
+ * Schema inference service interface
13
+ */
14
+ export interface ISchemaInferenceService {
15
+ infer(collectionId: string, requestId: string, existingSchema?: ResponseSchemaDefinition, options?: {
16
+ environment?: string;
17
+ postResponseScript?: string;
18
+ }): Promise<ResponseSchemaDefinition>;
19
+ inferBodySchema(bodyContent: any, bodyType?: string, bodyFormat?: string, formDataEntries?: KeyValueEntry[], existingSchema?: BodySchemaDefinition): Promise<BodySchemaDefinition | undefined>;
20
+ }
21
+ /**
22
+ * OpenAPI exporter service interface
23
+ */
24
+ export interface IOpenApiExporter {
25
+ export(collectionId: string, options: OpenApiExportOptions): Promise<string>;
26
+ }
27
+ /**
28
+ * OpenAPI importer service interface
29
+ */
30
+ export interface IOpenApiImporter {
31
+ import(filePath: string, options?: OpenApiImportOptions): Promise<{
32
+ collection: Collection;
33
+ environmentCreated?: string;
34
+ }>;
35
+ }
36
+ /**
37
+ * Schema inferrer interface (low-level)
38
+ */
39
+ export interface ISchemaInferrer {
40
+ inferFromValue(value: any): JSONSchema7;
41
+ mergeSchemas(a: JSONSchema7, b: JSONSchema7): JSONSchema7;
42
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * OpenAPI 3.0 Exporter
3
+ *
4
+ * Generates a valid OpenAPI 3.0.3 document from an HTTP Forge collection.
5
+ * Implements all mapping rules per the solution document §4.3.2.
6
+ */
7
+ import { ICollectionService } from '../collection/interfaces';
8
+ import { IEnvironmentConfigService } from '../environment/interfaces';
9
+ 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
+ }
23
+ export declare class OpenApiExporter {
24
+ private collectionService;
25
+ private envConfigService;
26
+ private inferenceService;
27
+ private inferrer;
28
+ constructor(collectionService: ICollectionService, envConfigService: IEnvironmentConfigService, inferenceService: SchemaInferenceService);
29
+ /**
30
+ * Export a collection as an OpenAPI 3.0.3 document.
31
+ */
32
+ export(collectionId: string, options: OpenApiExportOptions): Promise<string>;
33
+ private buildInfo;
34
+ private buildServers;
35
+ private processItems;
36
+ private processRequest;
37
+ private normalizeUrl;
38
+ private generateOperationId;
39
+ private collectOperationIds;
40
+ private toCamelCase;
41
+ private buildParameters;
42
+ private buildKeyValueParam;
43
+ /**
44
+ * Parse a Cookie header value into individual in:cookie parameters.
45
+ */
46
+ private parseCookieHeader;
47
+ /**
48
+ * Infer a type from a string value (for path/query params without explicit type).
49
+ */
50
+ private inferTypeFromValue;
51
+ /**
52
+ * Coerce a string value to the appropriate JS type for the 'example' field.
53
+ */
54
+ private coerceExample;
55
+ private buildRequestBody;
56
+ private getContentType;
57
+ private tryParseBodyContent;
58
+ private buildFormDataSchemaFromBody;
59
+ private buildResponses;
60
+ private buildOperationSecurity;
61
+ private mapAuthToSecurityScheme;
62
+ private parseScopes;
63
+ /**
64
+ * When multiple operations share structurally identical schemas,
65
+ * promote them to components/schemas and replace with $ref.
66
+ */
67
+ private deduplicateComponents;
68
+ private trackSchema;
69
+ private replaceInlineSchema;
70
+ private sanitizeComponentName;
71
+ private cleanSummary;
72
+ private hasDeprecatedPrefix;
73
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * OpenAPI 3.0 Importer
3
+ *
4
+ * Parses an OpenAPI 3.0 spec and creates a fully hydrated HTTP Forge collection.
5
+ * Implements all mapping rules per the solution document §4.4.2.
6
+ */
7
+ import { Collection, ICollectionService } from '../collection/interfaces';
8
+ import { IEnvironmentConfigService } from '../environment/interfaces';
9
+ export interface OpenApiImportOptions {
10
+ /** Base environment name to create with server URL */
11
+ environmentName?: string;
12
+ /** Collection name override */
13
+ collectionName?: string;
14
+ }
15
+ export declare class OpenApiImporter {
16
+ private collectionService;
17
+ private envConfigService;
18
+ private exampleGenerator;
19
+ private refResolver;
20
+ constructor(collectionService: ICollectionService, envConfigService: IEnvironmentConfigService);
21
+ /**
22
+ * Import an OpenAPI spec file and create an HTTP Forge collection.
23
+ */
24
+ import(filePath: string, options?: OpenApiImportOptions): Promise<{
25
+ collection: Collection;
26
+ environmentCreated?: string;
27
+ }>;
28
+ private processOperation;
29
+ /**
30
+ * Convert OpenAPI path parameters from {param} to :param syntax.
31
+ */
32
+ private convertPathParams;
33
+ private processParameters;
34
+ /**
35
+ * Generate an example value string for a parameter from its schema.
36
+ */
37
+ private generateExampleForParam;
38
+ private processRequestBody;
39
+ /**
40
+ * Select the primary content type from available options.
41
+ */
42
+ private selectPrimaryContentType;
43
+ /**
44
+ * Map an OpenAPI content type to HTTP Forge body type/format.
45
+ */
46
+ private mapContentTypeToBodyType;
47
+ /**
48
+ * Generate body content from an OpenAPI media type object.
49
+ */
50
+ private generateBodyContent;
51
+ /**
52
+ * Build form data entries from an object schema.
53
+ */
54
+ private buildFormDataEntries;
55
+ /**
56
+ * Build body.schema.json from the requestBody.
57
+ */
58
+ private buildBodySchema;
59
+ private processResponses;
60
+ private mapSecurityToAuth;
61
+ private createEnvironmentFromServers;
62
+ /**
63
+ * Extract component schemas referenced by a given schema.
64
+ * Walks $ref pointers and collects the referenced definitions.
65
+ */
66
+ private extractUsedComponents;
67
+ /**
68
+ * Extract the component name from a $ref pointer.
69
+ * "#/components/schemas/User" → "User"
70
+ */
71
+ private extractRefName;
72
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Ref Resolver
3
+ *
4
+ * Wrapper around @apidevtools/json-schema-ref-parser for resolving
5
+ * $ref pointers in OpenAPI specifications before import processing.
6
+ *
7
+ * Handles:
8
+ * - Internal $ref (same document)
9
+ * - External file $ref
10
+ * - External URL $ref
11
+ * - Circular $ref (break cycle with { type: "object" } placeholder)
12
+ */
13
+ export declare class RefResolver {
14
+ /**
15
+ * Resolve all $ref pointers in an OpenAPI document.
16
+ * Returns a fully dereferenced (inline) copy of the spec.
17
+ */
18
+ resolve(spec: any): Promise<any>;
19
+ /**
20
+ * Bundle all $ref pointers — resolves external refs but keeps
21
+ * internal $ref pointers intact.
22
+ */
23
+ bundle(spec: any): Promise<any>;
24
+ /**
25
+ * Parse and resolve an OpenAPI file from disk.
26
+ */
27
+ resolveFile(filePath: string): Promise<any>;
28
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Schema Inference Service
3
+ *
4
+ * Orchestrates all inference sources (history, scripts, user edits)
5
+ * to produce unified response and body schemas.
6
+ *
7
+ * Merge priority (highest → lowest):
8
+ * 1. User-edited schema — never overwritten, only augmented
9
+ * 2. History data — real response bodies provide the most accurate schemas
10
+ * 3. Script hints — field paths and types from post-response scripts
11
+ */
12
+ import { BodySchemaDefinition, KeyValueEntry, ResponseSchemaDefinition } from '../types/types';
13
+ import { HistoryAnalyzer } from './history-analyzer';
14
+ import { SchemaInferrer } from './schema-inferrer';
15
+ import { ScriptAnalyzer } from './script-analyzer';
16
+ export declare class SchemaInferenceService {
17
+ private historyAnalyzer;
18
+ private scriptAnalyzer;
19
+ private inferrer;
20
+ constructor(historyAnalyzer: HistoryAnalyzer, scriptAnalyzer: ScriptAnalyzer, inferrer: SchemaInferrer);
21
+ /**
22
+ * Infer a complete response schema for a request by combining
23
+ * history data, script analysis, and any existing schema.
24
+ */
25
+ infer(collectionId: string, requestId: string, existingSchema?: ResponseSchemaDefinition, options?: {
26
+ environment?: string;
27
+ postResponseScript?: string;
28
+ }): Promise<ResponseSchemaDefinition>;
29
+ /**
30
+ * Infer a body schema from the request's body content.
31
+ */
32
+ inferBodySchema(bodyContent: any, bodyType?: string, bodyFormat?: string, formDataEntries?: KeyValueEntry[], existingSchema?: BodySchemaDefinition): Promise<BodySchemaDefinition | undefined>;
33
+ private buildFormDataSchema;
34
+ private mergeResponseSchemas;
35
+ private applyScriptHints;
36
+ private augmentSchemaWithHints;
37
+ private ensureFieldPath;
38
+ private mergeResponseDefinitions;
39
+ private mergeBodySchemaWithExisting;
40
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Schema Inferrer
3
+ *
4
+ * Core utility that generates JSON Schema (OAS 3.0 compatible) from sample JSON values.
5
+ * Supports recursive inference, format detection, schema merging, and nullable semantics.
6
+ */
7
+ import { JSONSchema7 } from '../types/types';
8
+ export declare class SchemaInferrer {
9
+ /**
10
+ * Infer a JSON Schema from a sample value.
11
+ * Recursively walks objects and arrays.
12
+ * Uses OAS 3.0 nullable semantics (nullable: true instead of type array).
13
+ */
14
+ inferFromValue(value: any): JSONSchema7;
15
+ /**
16
+ * Merge two schemas — broadens types, unions properties.
17
+ * Used when aggregating multiple response samples.
18
+ */
19
+ mergeSchemas(a: JSONSchema7, b: JSONSchema7): JSONSchema7;
20
+ private inferStringFormat;
21
+ private inferStringSchema;
22
+ private inferArraySchema;
23
+ private inferObjectSchema;
24
+ private mergeObjectSchemas;
25
+ private mergeArraySchemas;
26
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Script Analyzer
3
+ *
4
+ * Static analysis of post-response scripts to extract response field expectations.
5
+ * Uses regex-based pattern matching (not full AST) since post-response scripts
6
+ * are typically simple assertion chains.
7
+ */
8
+ /**
9
+ * Result of analyzing a post-response script.
10
+ */
11
+ export interface ScriptAnalysisResult {
12
+ /** Dot-separated field paths: ["data.users[].id", "data.users[].name"] */
13
+ fieldPaths: string[];
14
+ /** Type hints from assertions: { "data.count": "number", "data.active": "boolean" } */
15
+ typeHints: Record<string, string>;
16
+ /** Value hints from equality assertions: { "data.status": "ok" } */
17
+ valueHints: Record<string, any>;
18
+ /** Expected status codes from pm.response.to.have.status(N) */
19
+ expectedStatuses: number[];
20
+ }
21
+ export declare class ScriptAnalyzer {
22
+ /**
23
+ * Parse a post-response script to discover expected response fields
24
+ * and their types from assertion patterns.
25
+ */
26
+ analyze(scriptSource: string): ScriptAnalysisResult;
27
+ /**
28
+ * Strip single-line and multi-line comments from source code.
29
+ */
30
+ private stripComments;
31
+ private extractFieldPaths;
32
+ private extractTypeAssertions;
33
+ private extractEqualityAssertions;
34
+ private extractBooleanAssertions;
35
+ private extractLengthAssertions;
36
+ private extractStatusAssertions;
37
+ private normalizeFieldPath;
38
+ private isCommonMethodCall;
39
+ private mapAssertionType;
40
+ private parseAssertionValue;
41
+ }
@@ -4,8 +4,8 @@
4
4
  * Single Responsibility: Parse HTTP Forge collection format (.forge.json)
5
5
  * Dependency Inversion: Implements ICollectionParser interface
6
6
  */
7
- import { ICollectionParser } from '../interfaces';
8
- import { UnifiedCollection } from '../interfaces/types';
7
+ import { ICollectionParser } from '../collection/interfaces';
8
+ import { UnifiedCollection } from '../types/types';
9
9
  /**
10
10
  * Parser for HTTP Forge native collection format
11
11
  */
@@ -32,4 +32,3 @@ export declare class HttpForgeParser implements ICollectionParser {
32
32
  */
33
33
  private convertRequest;
34
34
  }
35
- //# sourceMappingURL=http-forge-parser.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Export all parser implementations
5
5
  */
6
6
  export { HttpForgeParser } from './http-forge-parser';
7
- //# sourceMappingURL=index.d.ts.map
@@ -68,4 +68,3 @@ export declare class DataFileParser implements IDataFileParser {
68
68
  */
69
69
  private parseCsvLine;
70
70
  }
71
- //# sourceMappingURL=data-file-parser.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * Single Responsibility: File operations using Node.js fs module
5
5
  * Dependency Inversion: Implements IFileSystem interface
6
6
  */
7
- import { IFileSystem } from '../interfaces';
7
+ import { IFileSystem } from '../types/platform';
8
8
  /**
9
9
  * Node.js implementation of IFileSystem.
10
10
  * Uses Node.js fs/promises for all operations.
@@ -49,4 +49,3 @@ export declare class NodeFileSystem implements IFileSystem {
49
49
  */
50
50
  private matchPattern;
51
51
  }
52
- //# sourceMappingURL=node-file-system.d.ts.map
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Script Execution Interfaces
3
+ *
4
+ * Defines abstractions for the session-based script execution architecture.
5
+ * Matches the VS Code extension's interfaces for consistency.
6
+ *
7
+ * Dependency Inversion: Define abstractions for request execution components
8
+ * Interface Segregation: Each interface has a focused purpose
9
+ */
10
+ import { Cookie } from '../cookie/interfaces';
11
+ import { PreparedRequest, RequestAuth, RequestBody, RequestScripts, RequestSettings, ScriptInfo, TestAssertion } from '../types/types';
12
+ export type { Cookie, ScriptInfo };
13
+ /**
14
+ * Cookie Jar Interface
15
+ * Single Responsibility: Manage cookies for HTTP requests
16
+ */
17
+ export interface ICookieJar {
18
+ get(name: string, domain?: string): Cookie | undefined;
19
+ getCookiesForDomain(domain: string): Cookie[];
20
+ getAll(domain?: string): Cookie[];
21
+ has(name: string, domain?: string): boolean;
22
+ set(cookie: Cookie): void;
23
+ delete(name: string, domain?: string, path?: string): boolean;
24
+ setCookiesFromResponse(url: string, headers: Record<string, string | string[]>): void;
25
+ getCookieHeader(url: string): string | undefined;
26
+ clear(): void;
27
+ flush?(): Promise<void>;
28
+ }
29
+ /**
30
+ * Request context for test scripts
31
+ */
32
+ export interface RequestContext {
33
+ url: string;
34
+ method: string;
35
+ headers?: Record<string, string>;
36
+ body?: RequestBody | null;
37
+ bodyContentType?: string;
38
+ params?: Record<string, string>;
39
+ query?: Record<string, string>;
40
+ settings?: RequestSettings;
41
+ scripts?: RequestScripts;
42
+ auth?: RequestAuth;
43
+ }
44
+ /**
45
+ * Response context for test scripts
46
+ */
47
+ export interface ResponseContext {
48
+ executedRequest: PreparedRequest;
49
+ status: number;
50
+ statusText: string;
51
+ headers: Record<string, string>;
52
+ body: any;
53
+ cookies?: Record<string, string>;
54
+ responseTime?: number;
55
+ responseSize?: number;
56
+ }
57
+ /**
58
+ * Common script execution context (shared between pre-request and test scripts)
59
+ */
60
+ export interface CommonScriptContext {
61
+ variables: Record<string, string>;
62
+ collectionVariables?: Record<string, string>;
63
+ globals?: Record<string, string>;
64
+ sessionVariables?: Record<string, string>;
65
+ environmentVariables?: Record<string, string>;
66
+ environmentName?: string;
67
+ sendRequest?: (options: any) => Promise<any>;
68
+ info?: ScriptInfo;
69
+ iteration?: number;
70
+ iterationCount?: number;
71
+ onSessionChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
72
+ onEnvironmentChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
73
+ }
74
+ /**
75
+ * Script execution context for pre-request scripts
76
+ */
77
+ export interface PreRequestScriptContext extends CommonScriptContext {
78
+ request: RequestContext;
79
+ cookieJar?: ICookieJar;
80
+ }
81
+ /**
82
+ * Script execution result for pre-request scripts
83
+ */
84
+ export interface PreRequestScriptResult {
85
+ success: boolean;
86
+ error?: string;
87
+ modifiedRequest?: {
88
+ url?: string;
89
+ method?: string;
90
+ headers?: Record<string, string>;
91
+ body?: RequestBody | null;
92
+ params?: Record<string, string>;
93
+ query?: Record<string, string>;
94
+ };
95
+ modifiedVariables?: Record<string, string>;
96
+ modifiedCollectionVariables?: Record<string, string>;
97
+ modifiedGlobals?: Record<string, string>;
98
+ modifiedSessionVariables?: Record<string, string>;
99
+ modifiedEnvironmentVariables?: Record<string, string>;
100
+ consoleOutput?: string[];
101
+ }
102
+ /**
103
+ * Script execution result for post-response scripts
104
+ */
105
+ export interface PostResponseScriptResult {
106
+ testResults: TestAssertion[];
107
+ consoleOutput?: string[];
108
+ modifiedEnvironmentVariables?: Record<string, string>;
109
+ modifiedSessionVariables?: Record<string, string>;
110
+ }
111
+ /**
112
+ * Test script execution context
113
+ */
114
+ export interface TestScriptContext extends CommonScriptContext {
115
+ request: RequestContext;
116
+ response: ResponseContext;
117
+ }
118
+ /**
119
+ * Script Executor Interface
120
+ * Single Responsibility: Create request execution sessions
121
+ * Open/Closed: Can be extended with new execution strategies
122
+ */
123
+ export interface IScriptExecutor {
124
+ /**
125
+ * Create a request execution session that shares VM context between pre-request and post-response
126
+ * This enables JavaScript variables declared in pre-request to be accessible in post-response
127
+ * (Postman-compatible behavior)
128
+ */
129
+ createRequestSession(context: PreRequestScriptContext): IRequestScriptSession;
130
+ }
131
+ /**
132
+ * Request Script Session Interface
133
+ * Represents a shared VM context for a single request's pre-request and post-response scripts
134
+ * JavaScript variables declared in pre-request will be accessible in post-response
135
+ */
136
+ export interface IRequestScriptSession {
137
+ /**
138
+ * Execute pre-request scripts in the shared session
139
+ */
140
+ executePreRequest(script: string | string[]): Promise<PreRequestScriptResult>;
141
+ /**
142
+ * Update the session with response data and execute post-response scripts
143
+ */
144
+ executePostResponse(script: string | string[], responseContext: ResponseContext): Promise<PostResponseScriptResult>;
145
+ /**
146
+ * Clean up the session (optional - for resource management)
147
+ */
148
+ dispose?(): void;
149
+ }