@http-forge/core 0.1.0 → 0.2.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 (135) hide show
  1. package/README.md +217 -43
  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 +45 -0
  10. package/dist/collection/folder-collection-store.d.ts +175 -0
  11. package/dist/collection/folder-io.d.ts +113 -0
  12. package/dist/collection/interfaces.d.ts +32 -0
  13. package/dist/collection/json-collection-loader.d.ts +95 -0
  14. package/dist/{services → collection}/parser-registry.d.ts +1 -2
  15. package/dist/config/config-service.d.ts +79 -0
  16. package/dist/config/config.interface.d.ts +140 -0
  17. package/dist/config/default-config.d.ts +29 -0
  18. package/dist/config/index.d.ts +6 -0
  19. package/dist/container.d.ts +26 -19
  20. package/dist/{implementations → cookie}/cookie-jar.d.ts +2 -3
  21. package/dist/cookie/cookie-service.d.ts +98 -0
  22. package/dist/{implementations → cookie}/cookie-utils.d.ts +1 -2
  23. package/dist/cookie/in-memory-cookie-jar.d.ts +44 -0
  24. package/dist/{interfaces/cookie.d.ts → cookie/interfaces.d.ts} +22 -3
  25. package/dist/cookie/persistent-cookie-jar.d.ts +35 -0
  26. package/dist/di/core-bootstrap.d.ts +25 -0
  27. package/dist/di/index.d.ts +11 -0
  28. package/dist/di/platform-adapters.d.ts +53 -0
  29. package/dist/di/service-container.d.ts +97 -0
  30. package/dist/di/service-identifiers.d.ts +34 -0
  31. package/dist/environment/environment-config-service.d.ts +98 -0
  32. package/dist/environment/environment-file-loader.d.ts +42 -0
  33. package/dist/{services → environment}/environment-resolver.d.ts +6 -5
  34. package/dist/{services → environment}/forge-env.d.ts +1 -2
  35. package/dist/environment/interfaces.d.ts +139 -0
  36. package/dist/environment/variable-interpolator.d.ts +100 -0
  37. package/dist/execution/collection-request-executor-interfaces.d.ts +36 -0
  38. package/dist/execution/collection-request-executor.d.ts +78 -0
  39. package/dist/{services → execution}/request-executor.d.ts +23 -11
  40. package/dist/execution/request-preparer-interfaces.d.ts +36 -0
  41. package/dist/execution/request-preparer.d.ts +35 -0
  42. package/dist/graphql/graphql-completion-provider.d.ts +39 -0
  43. package/dist/graphql/graphql-schema-service.d.ts +89 -0
  44. package/dist/{interfaces/history.d.ts → history/history-interfaces.d.ts} +29 -6
  45. package/dist/history/request-history-service-interfaces.d.ts +43 -0
  46. package/dist/history/request-history-service.d.ts +133 -0
  47. package/dist/{implementations → history}/request-history.d.ts +2 -3
  48. package/dist/{implementations → http}/fetch-http-client.d.ts +4 -5
  49. package/dist/http/http-request-service.d.ts +36 -0
  50. package/dist/{implementations → http}/interceptor-chain.d.ts +1 -2
  51. package/dist/http/interfaces.d.ts +25 -0
  52. package/dist/http/merge-request-settings.d.ts +12 -0
  53. package/dist/{implementations → http}/native-http-client.d.ts +6 -15
  54. package/dist/{implementations → http}/request-preprocessor.d.ts +1 -2
  55. package/dist/{services → http}/url-builder.d.ts +7 -10
  56. package/dist/import-export/import-postman-environment.d.ts +21 -0
  57. package/dist/import-export/rest-client-export.d.ts +35 -0
  58. package/dist/index.d.ts +94 -6
  59. package/dist/index.js +262 -35
  60. package/dist/index.mjs +262 -35
  61. package/dist/openapi/example-generator.d.ts +26 -0
  62. package/dist/openapi/history-analyzer.d.ts +29 -0
  63. package/dist/openapi/index.d.ts +16 -0
  64. package/dist/openapi/interfaces.d.ts +42 -0
  65. package/dist/openapi/openapi-exporter.d.ts +73 -0
  66. package/dist/openapi/openapi-importer.d.ts +72 -0
  67. package/dist/openapi/ref-resolver.d.ts +28 -0
  68. package/dist/openapi/schema-inference-service.d.ts +40 -0
  69. package/dist/openapi/schema-inferrer.d.ts +26 -0
  70. package/dist/openapi/script-analyzer.d.ts +41 -0
  71. package/dist/parsers/http-forge-parser.d.ts +2 -3
  72. package/dist/parsers/index.d.ts +0 -1
  73. package/dist/{implementations → platform}/data-file-parser.d.ts +0 -1
  74. package/dist/{implementations → platform}/node-file-system.d.ts +1 -2
  75. package/dist/script/interfaces.d.ts +161 -0
  76. package/dist/script/module-loader.d.ts +115 -0
  77. package/dist/script/request-script-session.d.ts +73 -0
  78. package/dist/script/script-executor.d.ts +60 -0
  79. package/dist/script/script-factories.d.ts +94 -0
  80. package/dist/script/script-utils.d.ts +42 -0
  81. package/dist/test-suite/index.d.ts +10 -0
  82. package/dist/test-suite/interfaces.d.ts +164 -0
  83. package/dist/test-suite/result-storage-service.d.ts +70 -0
  84. package/dist/test-suite/result-storage.d.ts +296 -0
  85. package/dist/test-suite/statistics-service.d.ts +51 -0
  86. package/dist/test-suite/test-suite-service.d.ts +97 -0
  87. package/dist/test-suite/test-suite-store.d.ts +155 -0
  88. package/dist/types/console-service.d.ts +40 -0
  89. package/dist/types/platform.d.ts +206 -0
  90. package/dist/{interfaces → types}/types.d.ts +289 -12
  91. package/dist/utils/dynamic-variables.d.ts +38 -0
  92. package/dist/utils/expression-evaluator.d.ts +34 -0
  93. package/dist/utils/filter-engine.d.ts +47 -0
  94. package/dist/utils/helpers.d.ts +47 -0
  95. package/package.json +12 -4
  96. package/dist/container.d.ts.map +0 -1
  97. package/dist/implementations/cookie-jar.d.ts.map +0 -1
  98. package/dist/implementations/cookie-utils.d.ts.map +0 -1
  99. package/dist/implementations/data-file-parser.d.ts.map +0 -1
  100. package/dist/implementations/fetch-http-client.d.ts.map +0 -1
  101. package/dist/implementations/index.d.ts +0 -22
  102. package/dist/implementations/index.d.ts.map +0 -1
  103. package/dist/implementations/interceptor-chain.d.ts.map +0 -1
  104. package/dist/implementations/module-loader.d.ts +0 -74
  105. package/dist/implementations/module-loader.d.ts.map +0 -1
  106. package/dist/implementations/native-http-client.d.ts.map +0 -1
  107. package/dist/implementations/node-file-system.d.ts.map +0 -1
  108. package/dist/implementations/request-history.d.ts.map +0 -1
  109. package/dist/implementations/request-preprocessor.d.ts.map +0 -1
  110. package/dist/implementations/variable-interpolator.d.ts +0 -55
  111. package/dist/implementations/variable-interpolator.d.ts.map +0 -1
  112. package/dist/implementations/vm2-script-runner.d.ts +0 -76
  113. package/dist/implementations/vm2-script-runner.d.ts.map +0 -1
  114. package/dist/index.d.ts.map +0 -1
  115. package/dist/interfaces/cookie.d.ts.map +0 -1
  116. package/dist/interfaces/history.d.ts.map +0 -1
  117. package/dist/interfaces/index.d.ts +0 -170
  118. package/dist/interfaces/index.d.ts.map +0 -1
  119. package/dist/interfaces/types.d.ts.map +0 -1
  120. package/dist/parsers/http-forge-parser.d.ts.map +0 -1
  121. package/dist/parsers/index.d.ts.map +0 -1
  122. package/dist/services/collection-loader.d.ts.map +0 -1
  123. package/dist/services/environment-resolver.d.ts.map +0 -1
  124. package/dist/services/folder-collection-loader.d.ts +0 -91
  125. package/dist/services/folder-collection-loader.d.ts.map +0 -1
  126. package/dist/services/forge-env.d.ts.map +0 -1
  127. package/dist/services/index.d.ts +0 -20
  128. package/dist/services/index.d.ts.map +0 -1
  129. package/dist/services/parser-registry.d.ts.map +0 -1
  130. package/dist/services/request-executor.d.ts.map +0 -1
  131. package/dist/services/script-pipeline.d.ts +0 -43
  132. package/dist/services/script-pipeline.d.ts.map +0 -1
  133. package/dist/services/script-session.d.ts +0 -66
  134. package/dist/services/script-session.d.ts.map +0 -1
  135. package/dist/services/url-builder.d.ts.map +0 -1
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Collection Request Executor
3
+ *
4
+ * Executes a single collection request with full Postman parity:
5
+ * - Script execution order: Collection → Folder(s) → Request (pre-request)
6
+ * - Script execution order: Request → Folder(s) → Collection (post-response)
7
+ * - Supports nested folder scripts (multiple levels)
8
+ * - JavaScript variables declared in pre-request are accessible in post-response (shared VM session)
9
+ *
10
+ * Extracted from extension's request-execution/collection-request-executor.ts.
11
+ * Platform-independent — no vscode dependency.
12
+ */
13
+ import { IEnvironmentConfigService } from '../environment/interfaces';
14
+ import { IHttpRequestService } from '../http/interfaces';
15
+ import { ICookieJar, IScriptExecutor } from '../script/interfaces';
16
+ import { ExecutionRequest, ExecutionResult, PreparedRequest, RequestScripts } from '../types/types';
17
+ import { ConsoleOutputCallback, ICollectionRequestExecutor } from './collection-request-executor-interfaces';
18
+ import { IRequestPreparer } from './request-preparer-interfaces';
19
+ /**
20
+ * Enhanced implementation with Postman parity.
21
+ * Supports: pre-request scripts, post-response scripts, cookies, settings,
22
+ * collection/folder scripts.
23
+ */
24
+ export declare class CollectionRequestExecutor implements ICollectionRequestExecutor {
25
+ private readonly httpService;
26
+ private readonly scriptExecutor;
27
+ private readonly envConfigService;
28
+ private readonly requestPreparer;
29
+ private readonly environment;
30
+ private readonly cookieJar?;
31
+ private readonly collectionScripts?;
32
+ private readonly folderScriptsChain?;
33
+ private readonly onConsoleOutput?;
34
+ private readonly collectionName?;
35
+ private readonly iteration?;
36
+ 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
+ /**
39
+ * Execute a request with full Postman parity.
40
+ */
41
+ execute(request: ExecutionRequest, variables: Record<string, string>, signal?: AbortSignal): Promise<ExecutionResult>;
42
+ protected executeWithSession(request: ExecutionRequest, variables: Record<string, string>, signal: AbortSignal | undefined, startTime: number): Promise<ExecutionResult>;
43
+ /**
44
+ * Collect pre-request scripts in order: Collection → Folder(s) → Request
45
+ */
46
+ private collectPreRequestScripts;
47
+ /**
48
+ * Collect post-response scripts in order: Request → Folder(s) → Collection
49
+ */
50
+ private collectPostResponseScripts;
51
+ /**
52
+ * Handle execution errors — returns a failed ExecutionResult.
53
+ *
54
+ * The response body is set according to `errorBodyFormat`:
55
+ * - `'text'` → plain-text error message (default, safe for CLI / headless)
56
+ * - `'html'` → styled HTML suitable for a webview Response tab
57
+ * - `'both'` → HTML body **and** `error` field with plain-text message
58
+ *
59
+ * Protected so subclasses can override error formatting entirely.
60
+ */
61
+ protected handleError(request: ExecutionRequest, prepared: PreparedRequest | null, error: any, startTime: number): ExecutionResult;
62
+ /**
63
+ * The format used for error response bodies.
64
+ *
65
+ * Override in a subclass (or set via constructor option) to switch formats:
66
+ * - `'text'` — plain text (default)
67
+ * - `'html'` — HTML for webview display
68
+ * - `'both'` — HTML body + plain `error` field
69
+ */
70
+ protected get errorBodyFormat(): 'text' | 'html' | 'both';
71
+ /**
72
+ * Build a styled HTML string from an error message and optional stack trace.
73
+ * Useful for rendering errors in a webview Response tab.
74
+ *
75
+ * Static so callers can use it independently of an executor instance.
76
+ */
77
+ static formatErrorAsHtml(message: string, stack?: string): string;
78
+ }
@@ -4,10 +4,11 @@
4
4
  * Single Responsibility: Orchestrate the complete request execution flow
5
5
  * Facade Pattern: Provides simplified interface to complex subsystem
6
6
  */
7
- import { IHttpClient, IRequestPreprocessor } from '../interfaces';
8
- import { HttpRequest, HttpResponse, RequestOverrides, ScriptResult, UnifiedCollection, UnifiedRequest } from '../interfaces/types';
9
- import { IForgeEnv } from './forge-env';
10
- import { ScriptPipeline } from './script-pipeline';
7
+ import { IForgeEnv } from '../environment/forge-env';
8
+ import { IRequestPreprocessor } from '../http/request-preprocessor';
9
+ import { IScriptExecutor } from '../script/interfaces';
10
+ import { IHttpClient } from '../types/platform';
11
+ import { HttpRequest, HttpResponse, RequestOverrides, ScriptResult, UnifiedCollection, UnifiedRequest } from '../types/types';
11
12
  /**
12
13
  * Options for request execution
13
14
  */
@@ -24,6 +25,10 @@ export interface ExecuteOptions {
24
25
  additionalVariables?: Record<string, string>;
25
26
  /** Timeout override */
26
27
  timeout?: number;
28
+ /** Callback when scripts modify session variables */
29
+ onSessionChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
30
+ /** Callback when scripts modify environment variables */
31
+ onEnvironmentChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
27
32
  }
28
33
  /**
29
34
  * Complete execution result
@@ -51,15 +56,17 @@ export interface ExecuteResult {
51
56
  export declare class RequestExecutor {
52
57
  private readonly httpClient;
53
58
  private readonly forgeEnv;
54
- private readonly scriptPipeline;
59
+ private readonly cookieJar?;
55
60
  private readonly preprocessor?;
56
- private moduleLoader?;
57
- constructor(httpClient: IHttpClient, forgeEnv: IForgeEnv, scriptPipeline: ScriptPipeline, preprocessor?: IRequestPreprocessor | undefined, options?: {
61
+ private scriptExecutor;
62
+ constructor(httpClient: IHttpClient, forgeEnv: IForgeEnv, cookieJar?: any | undefined, // ICookieJar - optional for cookie support in scripts
63
+ preprocessor?: IRequestPreprocessor | undefined, options?: {
58
64
  forgeRoot?: string;
65
+ scriptExecutor?: IScriptExecutor;
59
66
  });
60
67
  /**
61
68
  * Execute a request with full pipeline
62
- * Uses ScriptSession for shared VM context between pre-request and post-response scripts
69
+ * Uses RequestScriptSession for shared VM context between pre-request and post-response scripts
63
70
  */
64
71
  execute(request: UnifiedRequest, collection: UnifiedCollection, options?: ExecuteOptions): Promise<ExecuteResult>;
65
72
  /**
@@ -79,8 +86,13 @@ export declare class RequestExecutor {
79
86
  */
80
87
  private interpolateRequest;
81
88
  /**
82
- * Create script context
89
+ * Build script chain for a request
90
+ * Returns scripts in execution order: collection → folders → request
83
91
  */
84
- private createScriptContext;
92
+ private buildScriptChain;
93
+ /**
94
+ * Find the folder path from collection root to a request
95
+ * Returns array of folders in order from root to parent
96
+ */
97
+ private findFolderPath;
85
98
  }
86
- //# sourceMappingURL=request-executor.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Request Preparer Interface
3
+ *
4
+ * Defines the contract for preparing HTTP requests before execution.
5
+ * Handles variable resolution, header merging, auth injection, body encoding.
6
+ *
7
+ * Used by both Request Tester (manual) and Collection Runner (batch).
8
+ */
9
+ import { ResolvedEnvironment } from '../environment/interfaces';
10
+ import { ExecutionRequest, PreparedRequest } from '../types/types';
11
+ /**
12
+ * Request Preparer Service Interface
13
+ *
14
+ * Extracted from extension's request-execution-handler.ts prepareRequest method.
15
+ * Shares request preparation logic between Request Tester and Collection Runner.
16
+ */
17
+ export interface IRequestPreparer {
18
+ /**
19
+ * Prepare a request for execution.
20
+ *
21
+ * Handles:
22
+ * - Variable resolution in params, query, headers, body, URL
23
+ * - Header merging (environment + request headers)
24
+ * - Authentication (Bearer, Basic, API Key, OAuth2)
25
+ * - Body encoding based on bodyType
26
+ * - Content-Type header auto-setting
27
+ * - URL building with path params, query params
28
+ *
29
+ * @param input - Request input data (ExecutionRequest format)
30
+ * @param environment - Environment name for variable resolution
31
+ * @param resolvedEnv - Resolved environment configuration
32
+ * @param extraVariables - Optional extra variables (for data files, script variables)
33
+ * @returns Prepared request ready for HTTP execution
34
+ */
35
+ prepareRequest(input: ExecutionRequest, environment: string, resolvedEnv: ResolvedEnvironment, extraVariables?: Record<string, string>): Promise<PreparedRequest>;
36
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Request Preparer
3
+ *
4
+ * Prepares HTTP requests for execution by resolving variables,
5
+ * merging headers, applying authentication, and encoding body.
6
+ *
7
+ * Extracted from extension's request-preparer.ts.
8
+ * Platform-independent — uses IApplicationInfo instead of vscode.extensions.
9
+ *
10
+ * Used by both Request Tester (manual) and Collection Runner (batch).
11
+ */
12
+ import { IOAuth2TokenManager } from '../auth/interfaces';
13
+ import { IEnvironmentConfigService, ResolvedEnvironment } from '../environment/interfaces';
14
+ import { IHttpRequestService } from '../http/interfaces';
15
+ import { IRequestPreprocessor } from '../http/request-preprocessor';
16
+ import { IApplicationInfo } from '../types/platform';
17
+ import { ExecutionRequest, PreparedRequest } from '../types/types';
18
+ import { IRequestPreparer } from './request-preparer-interfaces';
19
+ /**
20
+ * RequestPreparer implementation
21
+ *
22
+ * Logic extracted from extension's request-execution-handler.ts prepareRequest method.
23
+ * Shared by Request Tester (manual requests) and Collection Runner (batch requests).
24
+ */
25
+ export declare class RequestPreparer implements IRequestPreparer {
26
+ private readonly envConfigService;
27
+ private readonly httpService;
28
+ private readonly preprocessor;
29
+ private readonly tokenManager?;
30
+ private readonly appInfo?;
31
+ constructor(envConfigService: IEnvironmentConfigService, httpService: IHttpRequestService, preprocessor: IRequestPreprocessor, tokenManager?: IOAuth2TokenManager | undefined, appInfo?: IApplicationInfo | undefined);
32
+ prepareRequest(input: ExecutionRequest, environment: string, resolvedEnv: ResolvedEnvironment, extraVariables?: Record<string, string>): Promise<PreparedRequest>;
33
+ private applyOAuth2;
34
+ private applyApiKey;
35
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * GraphQL Completion Provider
3
+ *
4
+ * Single Responsibility: Parse GraphQL document context and produce completion items
5
+ * from a given schema. Pure logic — no VS Code or editor dependencies.
6
+ *
7
+ * This is a lightweight context parser using regex + brace counting — no graphql-js dependency.
8
+ *
9
+ * Completion Scenarios:
10
+ * - Root level: query, mutation, subscription, fragment keywords
11
+ * - Selection set: fields of the current parent type + __typename
12
+ * - Arguments: field argument names
13
+ * - Argument values: enum values for enum-typed arguments
14
+ * - Fragment spread: on TypeName, defined fragment names
15
+ * - Directives: @skip, @include, custom directives
16
+ * - Variable types: input types + scalars
17
+ */
18
+ import { GraphQLSchema } from './graphql-schema-service';
19
+ export type ContextType = 'root' | 'operation_name' | 'selection_set' | 'argument' | 'argument_value' | 'directive' | 'fragment_type' | 'variable_def';
20
+ export interface QueryContext {
21
+ contextType: ContextType;
22
+ fieldPath: string[];
23
+ parentType?: string;
24
+ inFragment?: boolean;
25
+ prefix: string;
26
+ currentField?: string;
27
+ currentArg?: string;
28
+ }
29
+ export interface CompletionItem {
30
+ label: string;
31
+ kind: 'field' | 'keyword' | 'argument' | 'enum' | 'type' | 'directive' | 'fragment' | 'snippet';
32
+ detail?: string;
33
+ description?: string;
34
+ insertText?: string;
35
+ deprecated?: boolean;
36
+ sortOrder?: number;
37
+ }
38
+ export declare function parseQueryContext(document: string, offset: number, schema?: GraphQLSchema): QueryContext;
39
+ export declare function getCompletions(schema: GraphQLSchema, context: QueryContext): CompletionItem[];
@@ -0,0 +1,89 @@
1
+ /**
2
+ * GraphQL Schema Service
3
+ *
4
+ * Single Responsibility: Fetch, parse, and cache GraphQL schemas via introspection.
5
+ *
6
+ * Features:
7
+ * - Execute standard introspection query against any GraphQL endpoint
8
+ * - Parse introspection result into typed schema representation
9
+ * - Cache schemas per-endpoint with timestamp
10
+ * - Extract operation names from GraphQL documents
11
+ * - Resolve variable types for operations
12
+ *
13
+ * Zero Dependencies: Uses only the project's IHttpClient abstraction.
14
+ */
15
+ import { IHttpClient } from '../types/platform';
16
+ export interface GraphQLField {
17
+ name: string;
18
+ type: string;
19
+ args: GraphQLArg[];
20
+ description?: string;
21
+ isDeprecated: boolean;
22
+ deprecationReason?: string;
23
+ }
24
+ export interface GraphQLArg {
25
+ name: string;
26
+ type: string;
27
+ defaultValue?: string;
28
+ description?: string;
29
+ }
30
+ export interface GraphQLEnumValue {
31
+ name: string;
32
+ description?: string;
33
+ isDeprecated: boolean;
34
+ deprecationReason?: string;
35
+ }
36
+ export interface GraphQLType {
37
+ name: string;
38
+ kind: 'OBJECT' | 'INPUT_OBJECT' | 'ENUM' | 'SCALAR' | 'INTERFACE' | 'UNION' | 'LIST' | 'NON_NULL';
39
+ fields: GraphQLField[];
40
+ inputFields: GraphQLArg[];
41
+ enumValues: GraphQLEnumValue[];
42
+ interfaces: string[];
43
+ possibleTypes: string[];
44
+ description?: string;
45
+ }
46
+ export interface GraphQLDirective {
47
+ name: string;
48
+ description?: string;
49
+ locations: string[];
50
+ args: GraphQLArg[];
51
+ }
52
+ export interface GraphQLSchema {
53
+ queryType: string;
54
+ mutationType?: string;
55
+ subscriptionType?: string;
56
+ types: Map<string, GraphQLType>;
57
+ directives: GraphQLDirective[];
58
+ fetchedAt: number;
59
+ endpointUrl: string;
60
+ }
61
+ export interface GraphQLOperation {
62
+ name: string;
63
+ type: 'query' | 'mutation' | 'subscription';
64
+ line: number;
65
+ }
66
+ export interface IGraphQLSchemaService {
67
+ fetchSchema(endpointUrl: string, headers?: Record<string, string>): Promise<GraphQLSchema>;
68
+ getCachedSchema(endpointUrl: string): GraphQLSchema | undefined;
69
+ extractOperations(document: string): GraphQLOperation[];
70
+ clearCache(endpointUrl?: string): void;
71
+ schemaToSerializable(schema: GraphQLSchema): any;
72
+ }
73
+ export declare class GraphQLSchemaService implements IGraphQLSchemaService {
74
+ private readonly httpClient;
75
+ private schemaCache;
76
+ constructor(httpClient: IHttpClient);
77
+ /**
78
+ * Execute introspection query and return parsed schema
79
+ */
80
+ fetchSchema(endpointUrl: string, headers?: Record<string, string>): Promise<GraphQLSchema>;
81
+ getCachedSchema(endpointUrl: string): GraphQLSchema | undefined;
82
+ extractOperations(document: string): GraphQLOperation[];
83
+ clearCache(endpointUrl?: string): void;
84
+ schemaToSerializable(schema: GraphQLSchema): any;
85
+ private parseSchema;
86
+ private parseField;
87
+ private parseArg;
88
+ private renderTypeRef;
89
+ }
@@ -4,7 +4,7 @@
4
4
  * Extracted from VS Code plugin: src/services/interfaces/request-history.interface.ts
5
5
  * Adapted for core package - storage-agnostic design
6
6
  */
7
- import { HttpRequest, HttpResponse } from './types';
7
+ import { HttpRequest, HttpResponse, RequestBody } from '../types/types';
8
8
  /**
9
9
  * History entry - records a single request execution
10
10
  */
@@ -14,7 +14,7 @@ export interface HistoryEntry {
14
14
  /** Timestamp of execution */
15
15
  timestamp: number;
16
16
  /** Associated ticket/issue number */
17
- ticket?: string;
17
+ ticket?: string | null;
18
18
  /** Git branch name */
19
19
  branch?: string;
20
20
  /** Environment used */
@@ -26,10 +26,34 @@ export interface HistoryEntry {
26
26
  url: string;
27
27
  method: string;
28
28
  headers: Record<string, string>;
29
- body?: any;
29
+ body?: RequestBody | any | null;
30
30
  params?: Record<string, string>;
31
31
  query?: Record<string, string>;
32
32
  };
33
+ /** Original request configuration (before variable resolution) */
34
+ originalConfig?: {
35
+ path: string;
36
+ params: Record<string, string>;
37
+ query: Record<string, string>;
38
+ headers: Record<string, string>;
39
+ body: RequestBody | null;
40
+ };
41
+ /** Request settings */
42
+ settings?: {
43
+ timeout?: number;
44
+ followRedirects?: boolean;
45
+ followOriginalMethod?: boolean;
46
+ followAuthHeader?: boolean;
47
+ maxRedirects?: number;
48
+ strictSSL?: boolean;
49
+ decompress?: boolean;
50
+ includeCookies?: boolean;
51
+ };
52
+ /** Scripts associated with request */
53
+ scripts?: {
54
+ preRequest?: string;
55
+ postResponse?: string;
56
+ };
33
57
  /** Response summary */
34
58
  response: {
35
59
  status: number;
@@ -46,7 +70,7 @@ export interface FullResponse {
46
70
  timestamp: number;
47
71
  status: number;
48
72
  statusText: string;
49
- headers: Record<string, string>;
73
+ headers: Record<string, string | string[]>;
50
74
  cookies: any[];
51
75
  body: any;
52
76
  time: number;
@@ -59,7 +83,7 @@ export interface RequestHistory {
59
83
  requestPath: string;
60
84
  requestId: string;
61
85
  method: string;
62
- entries: HistoryEntry[];
86
+ requests: HistoryEntry[];
63
87
  }
64
88
  /**
65
89
  * History read operations
@@ -114,4 +138,3 @@ export interface IRequestHistory extends IHistoryReader, IHistoryWriter {
114
138
  /** Maximum entries to keep per request (oldest removed when exceeded) */
115
139
  maxEntriesPerRequest: number;
116
140
  }
117
- //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Request History Service Interface
3
+ *
4
+ * Interface Segregation: Separated into focused sub-interfaces
5
+ * Dependency Inversion: Consumers depend on this abstraction
6
+ */
7
+ import { FullResponse, HistoryEntry, RequestHistory } from './history-interfaces';
8
+ export type { FullResponse, HistoryEntry, RequestHistory };
9
+ /**
10
+ * History read operations
11
+ */
12
+ export interface IHistoryReader {
13
+ loadHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
14
+ loadSharedHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
15
+ getEntriesForEnvironment(environment: string, storagePath: string, endpointId: string): HistoryEntry[];
16
+ getEntriesGroupedByTicket(environment: string, storagePath: string, endpointId: string): Map<string, HistoryEntry[]>;
17
+ getSharedEntriesGroupedByTicket(environment: string, storagePath: string, endpointId: string): Map<string, HistoryEntry[]>;
18
+ }
19
+ /**
20
+ * History write operations
21
+ */
22
+ export interface IHistoryWriter {
23
+ addEntry(environment: string, storagePath: string, endpointId: string, method: string, entry: Omit<HistoryEntry, 'id' | 'timestamp' | 'method'>): HistoryEntry;
24
+ deleteEntry(environment: string, storagePath: string, endpointId: string, entryId: string): boolean;
25
+ deleteSharedEntry(environment: string, storagePath: string, endpointId: string, entryId: string): boolean;
26
+ clearHistory(environment: string, storagePath: string, endpointId: string): void;
27
+ shareEntry(environment: string, storagePath: string, endpointId: string, entryId: string, tag: string): boolean;
28
+ moveSharedEntry(environment: string, storagePath: string, endpointId: string, entryId: string, tag: string): boolean;
29
+ renameSharedGroup(environment: string, storagePath: string, endpointId: string, oldTag: string, newTag: string): boolean;
30
+ }
31
+ /**
32
+ * Full response storage operations
33
+ */
34
+ export interface IResponseStorage {
35
+ saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
36
+ loadFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
37
+ loadSharedFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
38
+ }
39
+ /**
40
+ * Full request history service interface
41
+ */
42
+ export interface IRequestHistoryService extends IHistoryReader, IHistoryWriter, IResponseStorage {
43
+ }
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Request History Service - File-based Implementation
3
+ *
4
+ * Full-featured request history service with:
5
+ * - File-based persistence (JSON files on disk)
6
+ * - Shared history support (team-visible history)
7
+ * - Ticket/branch grouping
8
+ * - Separate full response file management
9
+ *
10
+ * Ported from VS Code extension's RequestHistoryService.
11
+ * No VS Code dependencies — uses only Node.js fs/path.
12
+ */
13
+ import { FullResponse, HistoryEntry, RequestHistory } from './history-interfaces';
14
+ import { IRequestHistoryService } from './request-history-service-interfaces';
15
+ /**
16
+ * File-based request history service.
17
+ *
18
+ * Path-helper methods are `protected` so consumers can subclass and
19
+ * override the directory layout if needed.
20
+ */
21
+ export declare class RequestHistoryService implements IRequestHistoryService {
22
+ protected historyPath: string;
23
+ protected sharedHistoryPath: string;
24
+ constructor(historyPath: string, sharedHistoryPath: string);
25
+ /**
26
+ * Get history folder path for environment
27
+ */
28
+ protected getEnvironmentHistoryPath(environment: string): string;
29
+ /**
30
+ * Get history folder path for a collection within an environment
31
+ */
32
+ protected getCollectionHistoryPath(environment: string, collectionPath: string): string;
33
+ /**
34
+ * Get request directory path
35
+ */
36
+ protected getRequestPath(environment: string, requestPath: string, requestId: string): string;
37
+ /**
38
+ * Get shared history folder path for environment
39
+ */
40
+ protected getSharedEnvironmentHistoryPath(environment: string): string;
41
+ /**
42
+ * Get shared history folder path for a collection within an environment
43
+ */
44
+ protected getSharedCollectionHistoryPath(environment: string, collectionPath: string): string;
45
+ /**
46
+ * Get shared request directory path
47
+ */
48
+ protected getSharedRequestPath(environment: string, requestPath: string, requestId: string): string;
49
+ /**
50
+ * Get history file path for a request
51
+ */
52
+ protected getHistoryFilePath(environment: string, requestPath: string, requestId: string): string;
53
+ /**
54
+ * Get shared history file path for a request
55
+ */
56
+ protected getSharedHistoryFilePath(environment: string, requestPath: string, requestId: string): string;
57
+ /**
58
+ * Get full response file path
59
+ */
60
+ protected getResponseFilePath(environment: string, requestPath: string, requestId: string, entryId: string): string;
61
+ /**
62
+ * Get shared full response file path
63
+ */
64
+ protected getSharedResponseFilePath(environment: string, requestPath: string, requestId: string, entryId: string): string;
65
+ /**
66
+ * Load history for a request
67
+ */
68
+ loadHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
69
+ /**
70
+ * Load shared history for a request
71
+ */
72
+ loadSharedHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
73
+ /**
74
+ * Get history entries for a specific environment / request
75
+ */
76
+ getEntriesForEnvironment(environment: string, requestPath: string, requestId: string): HistoryEntry[];
77
+ /**
78
+ * Get history entries grouped by ticket/branch
79
+ */
80
+ getEntriesGroupedByTicket(environment: string, requestPath: string, requestId: string): Map<string, HistoryEntry[]>;
81
+ /**
82
+ * Get shared history entries grouped by ticket/branch
83
+ */
84
+ getSharedEntriesGroupedByTicket(environment: string, requestPath: string, requestId: string): Map<string, HistoryEntry[]>;
85
+ /**
86
+ * Save history for a request (internal)
87
+ */
88
+ protected saveHistory(history: RequestHistory): void;
89
+ /**
90
+ * Save shared history for a request (internal)
91
+ */
92
+ protected saveSharedHistory(history: RequestHistory): void;
93
+ /**
94
+ * Add a new entry to the history
95
+ */
96
+ addEntry(environment: string, requestPath: string, requestId: string, method: string, entry: Omit<HistoryEntry, 'id' | 'timestamp' | 'method'>): HistoryEntry;
97
+ /**
98
+ * Delete a specific entry
99
+ */
100
+ deleteEntry(environment: string, requestPath: string, requestId: string, entryId: string): boolean;
101
+ /**
102
+ * Delete a specific entry from shared history
103
+ */
104
+ deleteSharedEntry(environment: string, requestPath: string, requestId: string, entryId: string): boolean;
105
+ /**
106
+ * Move entry to shared history and remove from local history
107
+ */
108
+ shareEntry(environment: string, requestPath: string, requestId: string, entryId: string, tag: string): boolean;
109
+ /**
110
+ * Move a shared history entry to another group tag
111
+ */
112
+ moveSharedEntry(environment: string, requestPath: string, requestId: string, entryId: string, tag: string): boolean;
113
+ /**
114
+ * Rename a shared history group tag
115
+ */
116
+ renameSharedGroup(environment: string, requestPath: string, requestId: string, oldTag: string, newTag: string): boolean;
117
+ /**
118
+ * Clear all history for a request
119
+ */
120
+ clearHistory(environment: string, requestPath: string, requestId: string): void;
121
+ /**
122
+ * Save full response to a separate file
123
+ */
124
+ saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
125
+ /**
126
+ * Load full response from file
127
+ */
128
+ loadFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
129
+ /**
130
+ * Load full response from shared history file
131
+ */
132
+ loadSharedFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
133
+ }
@@ -7,8 +7,8 @@
7
7
  * Based on VS Code plugin's RequestHistoryService logic,
8
8
  * but adapted for storage-agnostic design.
9
9
  */
10
- import { FullResponse, HistoryEntry, IRequestHistory } from '../interfaces/history';
11
- import { HttpRequest, HttpResponse } from '../interfaces/types';
10
+ import { HttpRequest, HttpResponse } from '../types/types';
11
+ import { FullResponse, HistoryEntry, IRequestHistory } from './history-interfaces';
12
12
  /**
13
13
  * In-memory request history storage
14
14
  *
@@ -70,4 +70,3 @@ export declare class RequestHistoryStore implements IRequestHistory {
70
70
  */
71
71
  clearAll(): void;
72
72
  }
73
- //# sourceMappingURL=request-history.d.ts.map
@@ -4,16 +4,15 @@
4
4
  * Single Responsibility: Execute HTTP requests using fetch API
5
5
  * Dependency Inversion: Implements IHttpClient interface
6
6
  */
7
- import { IHttpClient } from '../interfaces';
8
- import { HttpRequest, HttpResponse } from '../interfaces/types';
7
+ import { IHttpClient } from '../types/platform';
8
+ import { HttpRequest, HttpResponse } from '../types/types';
9
9
  /**
10
10
  * HTTP client implementation using Node.js native fetch.
11
11
  * Requires Node.js 18+.
12
12
  */
13
13
  export declare class FetchHttpClient implements IHttpClient {
14
14
  /**
15
- * Execute an HTTP request
15
+ * Send an HTTP request
16
16
  */
17
- execute(request: HttpRequest): Promise<HttpResponse>;
17
+ send(request: HttpRequest): Promise<HttpResponse>;
18
18
  }
19
- //# sourceMappingURL=fetch-http-client.d.ts.map