@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,296 @@
1
+ /**
2
+ * Result Storage Interfaces for Test Suite
3
+ *
4
+ * SOLID Principles:
5
+ * - Interface Segregation: Separate interfaces for different concerns
6
+ * - Dependency Inversion: Define abstractions for storage operations
7
+ */
8
+ import { ExecutionResult } from '../types/types';
9
+ /**
10
+ * HTTP Method encoding for memory efficiency
11
+ * Using numbers instead of strings saves ~5 bytes per summary
12
+ */
13
+ export declare const HTTP_METHOD_MAP: Record<string, number>;
14
+ export declare const HTTP_METHOD_REVERSE: Record<number, string>;
15
+ /**
16
+ * Compact Summary for memory efficiency (~150 bytes vs ~450 bytes)
17
+ * Sent to webview during run - contains only essential display data
18
+ */
19
+ export interface ResultSummary {
20
+ /** Index within run (i) */
21
+ i: number;
22
+ /** Iteration 1-based (it) */
23
+ it: number;
24
+ /** Request name (n) */
25
+ n: string;
26
+ /** HTTP method code (m) - use HTTP_METHOD_REVERSE to decode */
27
+ m: number;
28
+ /** HTTP status code (s) */
29
+ s: number;
30
+ /** Duration in ms (d) */
31
+ d: number;
32
+ /** Passed (p) */
33
+ p: boolean;
34
+ /** Assertions passed count (ap) */
35
+ ap: number;
36
+ /** Assertions failed count (af) */
37
+ af: number;
38
+ /** Request ID (r) - used to rebuild filename */
39
+ r: string;
40
+ /** Error message if failed (e) - null if passed */
41
+ e: string | null;
42
+ }
43
+ /**
44
+ * Build result filename from summary components
45
+ */
46
+ export declare function buildResultFileName(index: number, iteration: number, requestId: string): string;
47
+ /**
48
+ * Helper to decode ResultSummary for display
49
+ */
50
+ export declare function expandSummary(s: ResultSummary): {
51
+ index: number;
52
+ iteration: number;
53
+ name: string;
54
+ method: string;
55
+ status: number;
56
+ duration: number;
57
+ passed: boolean;
58
+ assertionsPassed: number;
59
+ assertionsFailed: number;
60
+ requestId: string;
61
+ resultFile: string;
62
+ error: string | null;
63
+ };
64
+ /**
65
+ * Per-request aggregated statistics
66
+ */
67
+ export interface RequestStats {
68
+ /** Request name */
69
+ name: string;
70
+ /** Total executions */
71
+ count: number;
72
+ /** Passed executions */
73
+ passed: number;
74
+ /** Failed executions */
75
+ failed: number;
76
+ /** Total duration for averaging */
77
+ totalDuration: number;
78
+ /** Average duration */
79
+ avgDuration: number;
80
+ /** Minimum duration */
81
+ minDuration: number;
82
+ /** Maximum duration */
83
+ maxDuration: number;
84
+ /** 50th percentile */
85
+ p50?: number;
86
+ /** 90th percentile */
87
+ p90?: number;
88
+ /** 95th percentile */
89
+ p95?: number;
90
+ /** 99th percentile */
91
+ p99?: number;
92
+ }
93
+ /**
94
+ * Overall run statistics
95
+ */
96
+ export interface RunStats {
97
+ /** Total requests executed */
98
+ totalRequests: number;
99
+ /** Passed requests */
100
+ passed: number;
101
+ /** Failed requests */
102
+ failed: number;
103
+ /** Skipped requests */
104
+ skipped: number;
105
+ /** Total duration */
106
+ totalDuration: number;
107
+ /** Average duration */
108
+ avgDuration: number;
109
+ /** Minimum duration */
110
+ minDuration: number;
111
+ /** Maximum duration */
112
+ maxDuration: number;
113
+ }
114
+ /**
115
+ * Run configuration stored in manifest
116
+ */
117
+ export interface RunConfig {
118
+ /** Number of iterations */
119
+ iterations: number;
120
+ /** Delay between requests in ms */
121
+ delayBetweenRequests: number;
122
+ /** Whether to stop on error */
123
+ stopOnError: boolean;
124
+ }
125
+ /**
126
+ * Run manifest (metadata only - kept small)
127
+ */
128
+ export interface RunManifest {
129
+ /** Schema version */
130
+ version: string;
131
+ /** Unique run ID */
132
+ runId: string;
133
+ /** Suite ID */
134
+ suiteId: string;
135
+ /** Suite name */
136
+ suiteName: string;
137
+ /** Environment used */
138
+ environment: string;
139
+ /** Run start time */
140
+ startTime: string;
141
+ /** Run end time */
142
+ endTime?: string;
143
+ /** Run status */
144
+ status: 'running' | 'completed' | 'aborted' | 'error';
145
+ /** Run configuration */
146
+ config: RunConfig;
147
+ /** Aggregated statistics */
148
+ stats: RunStats;
149
+ /** Per-request statistics */
150
+ requestStats: Record<string, RequestStats>;
151
+ /** Total index pages */
152
+ totalIndexPages: number;
153
+ /** Summaries per index page */
154
+ indexPageSize: number;
155
+ }
156
+ /**
157
+ * Full result details (loaded on demand from file)
158
+ */
159
+ export interface FullResultDetails {
160
+ /** Result index */
161
+ index: number;
162
+ /** Iteration number */
163
+ iteration: number;
164
+ /** Request ID */
165
+ requestId: string;
166
+ /** Request name */
167
+ name: string;
168
+ /** HTTP method */
169
+ method: string;
170
+ /** Full URL */
171
+ url: string;
172
+ /** HTTP status code */
173
+ status: number;
174
+ /** HTTP status text */
175
+ statusText: string;
176
+ /** Duration in milliseconds */
177
+ duration: number;
178
+ /** Whether request passed */
179
+ passed: boolean;
180
+ /** Execution timestamp */
181
+ timestamp: number;
182
+ /** Request details */
183
+ request: {
184
+ headers: Record<string, string>;
185
+ body: any;
186
+ };
187
+ /** Response details */
188
+ response: {
189
+ headers: Record<string, string | string[]>;
190
+ body: any;
191
+ };
192
+ /** Test assertions */
193
+ assertions: Array<{
194
+ name: string;
195
+ passed: boolean;
196
+ message: string | null;
197
+ }>;
198
+ /** Error message */
199
+ error: string | null;
200
+ }
201
+ /**
202
+ * Index page containing summaries
203
+ */
204
+ export interface IndexPage {
205
+ /** Page number (1-based) */
206
+ page: number;
207
+ /** Starting index */
208
+ startIndex: number;
209
+ /** Number of summaries in this page */
210
+ count: number;
211
+ /** Summaries */
212
+ summaries: ResultSummary[];
213
+ }
214
+ /**
215
+ * Recent error for UI display
216
+ */
217
+ export interface RecentError {
218
+ /** Timestamp */
219
+ timestamp: number;
220
+ /** Iteration number */
221
+ iteration: number;
222
+ /** Request name */
223
+ requestName: string;
224
+ /** HTTP status */
225
+ status: number;
226
+ /** Error message */
227
+ error: string;
228
+ /** Result file reference */
229
+ resultFile: string;
230
+ }
231
+ /**
232
+ * Result Storage Service Interface
233
+ * Single Responsibility: Defines contract for result persistence
234
+ */
235
+ export interface IResultStorageService {
236
+ /**
237
+ * Get the base path for result storage
238
+ */
239
+ getBasePath(): string;
240
+ /**
241
+ * Initialize a new run
242
+ */
243
+ initializeRun(suiteId: string, suiteName: string, environment: string, config: RunConfig): Promise<string>;
244
+ /**
245
+ * Save a request result
246
+ * Returns lightweight summary for UI
247
+ */
248
+ saveResult(iteration: number, result: ExecutionResult): Promise<ResultSummary>;
249
+ /**
250
+ * Finalize run
251
+ */
252
+ finalizeRun(status: 'completed' | 'aborted' | 'error'): Promise<void>;
253
+ /**
254
+ * Get current run stats
255
+ */
256
+ getCurrentStats(): {
257
+ stats: RunStats;
258
+ requestStats: Record<string, RequestStats>;
259
+ recentErrors: RecentError[];
260
+ } | null;
261
+ /**
262
+ * Get current run ID
263
+ */
264
+ getCurrentRunId(): string | null;
265
+ /**
266
+ * Get current suite ID
267
+ */
268
+ getCurrentSuiteId(): string | null;
269
+ /**
270
+ * Get full result details from file
271
+ */
272
+ getResultDetails(suiteId: string, runId: string, resultFile: string): Promise<FullResultDetails>;
273
+ /**
274
+ * Get index page
275
+ */
276
+ getIndexPage(suiteId: string, runId: string, page: number): Promise<IndexPage>;
277
+ /**
278
+ * Get run manifest
279
+ */
280
+ getManifest(suiteId: string, runId: string): Promise<RunManifest>;
281
+ /**
282
+ * List all runs for a suite
283
+ */
284
+ listRuns(suiteId: string): Promise<RunManifest[]>;
285
+ /**
286
+ * Delete a run
287
+ */
288
+ deleteRun(suiteId: string, runId: string): Promise<void>;
289
+ /**
290
+ * Clean up old runs based on retention policy
291
+ */
292
+ cleanupOldRuns(): Promise<{
293
+ deleted: number;
294
+ freed: number;
295
+ }>;
296
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Statistics Service
3
+ *
4
+ * Real-time statistics calculation for Test Suite runs
5
+ * Calculates P50, P90, P95, P99 percentiles
6
+ */
7
+ import { ErrorSummary, IStatisticsService, RequestStatistics, RunStatistics, RunSummary } from './interfaces';
8
+ /**
9
+ * Service for calculating real-time run statistics
10
+ */
11
+ export declare class StatisticsService implements IStatisticsService {
12
+ private summary;
13
+ private byRequest;
14
+ private overall;
15
+ private errors;
16
+ private startTime;
17
+ constructor();
18
+ /**
19
+ * Create empty summary
20
+ */
21
+ private createEmptySummary;
22
+ /**
23
+ * Start a new run
24
+ */
25
+ start(): void;
26
+ /**
27
+ * Reset statistics for a new run
28
+ */
29
+ reset(): void;
30
+ /**
31
+ * Mark run as complete
32
+ */
33
+ complete(): void;
34
+ /**
35
+ * Add a result and update statistics
36
+ */
37
+ addResult(requestName: string, duration: number, passed: boolean, skipped: boolean, error?: string): void;
38
+ /**
39
+ * Get current statistics
40
+ */
41
+ getStatistics(): RunStatistics;
42
+ /**
43
+ * Get serializable statistics (for sending to webview or CLI)
44
+ */
45
+ getSerializableStatistics(): {
46
+ summary: RunSummary;
47
+ byRequest: Array<RequestStatistics>;
48
+ overall: RequestStatistics;
49
+ errors: ErrorSummary[];
50
+ };
51
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Test Suite Service
3
+ *
4
+ * Manages CRUD operations for Test Suites.
5
+ * Platform-agnostic version (no VS Code dependency).
6
+ */
7
+ import { ICollectionService } from '../collection/interfaces';
8
+ import { IConfigService } from '../config';
9
+ import { ITestSuiteService, SuiteRequest, TestSuite } from './interfaces';
10
+ /**
11
+ * Callback invoked when the suites on disk change.
12
+ */
13
+ export type SuitesChangedCallback = () => void;
14
+ /**
15
+ * Service for managing Test Suites
16
+ */
17
+ export declare class TestSuiteService implements ITestSuiteService {
18
+ private collectionService;
19
+ private configService;
20
+ readonly suitesDir: string;
21
+ protected suites: Map<string, TestSuite>;
22
+ /** Native file watcher (if watching is enabled) */
23
+ private fileWatcher;
24
+ /** Debounce timer for coalescing rapid change events */
25
+ private debounceTimer;
26
+ /** External listener notified after suites are reloaded */
27
+ private onSuitesChanged?;
28
+ constructor(collectionService: ICollectionService, configService: IConfigService, options?: {
29
+ watch?: boolean;
30
+ onSuitesChanged?: SuitesChangedCallback;
31
+ });
32
+ /**
33
+ * Ensure suites directory exists
34
+ */
35
+ private ensureSuitesDir;
36
+ /**
37
+ * Set up a file-system watcher on the suites directory.
38
+ * Uses Node.js `fs.watch` — no VS Code dependency.
39
+ * Changes are debounced so rapid edits trigger a single reload.
40
+ */
41
+ private setupFileWatcher;
42
+ /**
43
+ * Stop watching and release resources.
44
+ */
45
+ dispose(): void;
46
+ /**
47
+ * Load all suites from disk
48
+ */
49
+ loadSuites(): void;
50
+ /**
51
+ * Get all suites
52
+ */
53
+ getAllSuites(): Promise<TestSuite[]>;
54
+ /**
55
+ * Get a suite by ID
56
+ */
57
+ getSuite(id: string): Promise<TestSuite | undefined>;
58
+ /**
59
+ * Create a new suite
60
+ */
61
+ createSuite(name: string, requests?: SuiteRequest[]): Promise<TestSuite>;
62
+ /**
63
+ * Update an existing suite
64
+ */
65
+ updateSuite(suite: TestSuite): Promise<void>;
66
+ /**
67
+ * Delete a suite
68
+ */
69
+ deleteSuite(id: string): Promise<boolean>;
70
+ /**
71
+ * Create a temporary suite from a collection
72
+ */
73
+ createTempSuiteFromCollection(collectionId: string): Promise<TestSuite | undefined>;
74
+ /**
75
+ * Save a temporary suite as a permanent one
76
+ */
77
+ saveTempSuite(suite: TestSuite, name: string): Promise<TestSuite>;
78
+ /**
79
+ * Get all requests from all collections for the Add Request modal
80
+ */
81
+ getAllAvailableRequests(): Array<{
82
+ collectionId: string;
83
+ collectionName: string;
84
+ requestId: string;
85
+ name: string;
86
+ method: string;
87
+ folderPath: string;
88
+ }>;
89
+ /**
90
+ * Recursively extract requests from collection items
91
+ */
92
+ private extractRequestsFromCollection;
93
+ /**
94
+ * Save suite to disk
95
+ */
96
+ private saveSuiteToDisk;
97
+ }
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Test Suite Store
3
+ *
4
+ * Manages suite requests that can come from different collections.
5
+ * Resolves requests fresh from ICollectionService to ensure latest data.
6
+ *
7
+ * Single Responsibility: Maintain suite state and resolve requests from collections
8
+ * Dependency Inversion: Depends on ICollectionService abstraction
9
+ */
10
+ import { CollectionRequest, ICollectionService, RequestScripts } from '../collection/interfaces';
11
+ import { SuiteRequest, TestSuite } from './interfaces';
12
+ /**
13
+ * Cached request entry with full context
14
+ */
15
+ export interface SuiteRequestEntry {
16
+ /** The full request object from the source collection */
17
+ request: CollectionRequest;
18
+ /** Suite request metadata */
19
+ suiteRequest: SuiteRequest;
20
+ /** Collection scripts */
21
+ collectionScripts?: RequestScripts;
22
+ /** Folder scripts chain */
23
+ folderScriptsChain: RequestScripts[];
24
+ }
25
+ /**
26
+ * Interface for TestSuiteStore
27
+ */
28
+ export interface ITestSuiteStore {
29
+ /**
30
+ * Set the test suite
31
+ */
32
+ setSuite(suite: TestSuite): void;
33
+ /**
34
+ * Get the current suite
35
+ */
36
+ getSuite(): TestSuite | undefined;
37
+ /**
38
+ * Get a request by ID with full context (collection scripts + folder scripts)
39
+ */
40
+ getRequestWithContext(collectionId: string, requestId: string): SuiteRequestEntry | undefined;
41
+ /**
42
+ * Get all suite requests with their resolved data
43
+ */
44
+ getAllSuiteRequests(): SuiteRequestEntry[];
45
+ /**
46
+ * Get resolved requests for webview display
47
+ */
48
+ getResolvedRequests(): Array<{
49
+ id: string;
50
+ collectionId: string;
51
+ requestId: string;
52
+ name: string;
53
+ method: string;
54
+ url: string;
55
+ collectionName: string;
56
+ folderPath: string;
57
+ enabled: boolean;
58
+ }>;
59
+ /**
60
+ * Get suite requests by selection state
61
+ * @param selectedIds IDs of selected requests in execution order
62
+ */
63
+ getSelectedRequests(selectedIds: string[]): SuiteRequestEntry[];
64
+ /**
65
+ * Add a request to the suite
66
+ */
67
+ addRequest(request: SuiteRequest): void;
68
+ /**
69
+ * Remove a request from the suite
70
+ */
71
+ removeRequest(requestId: string): void;
72
+ /**
73
+ * Reorder requests
74
+ */
75
+ reorderRequests(requestIds: string[]): void;
76
+ }
77
+ /**
78
+ * Implementation of TestSuiteStore
79
+ */
80
+ export declare class TestSuiteStore implements ITestSuiteStore {
81
+ private readonly collectionService;
82
+ private suite;
83
+ constructor(collectionService: ICollectionService);
84
+ /**
85
+ * Set the suite
86
+ */
87
+ setSuite(suite: TestSuite): void;
88
+ /**
89
+ * Get the current suite
90
+ */
91
+ getSuite(): TestSuite | undefined;
92
+ /**
93
+ * Resolve a suite request to its full request data
94
+ */
95
+ private resolveRequest;
96
+ /**
97
+ * Find a request in a collection, including folder scripts
98
+ */
99
+ private findRequestInCollection;
100
+ /**
101
+ * Recursively search for a request
102
+ */
103
+ private searchItems;
104
+ /**
105
+ * Normalize request data
106
+ */
107
+ private normalizeRequest;
108
+ /**
109
+ * Normalize key-value array or object to standard format
110
+ * Handles both array format [{key, value}] and object format {key: value}
111
+ */
112
+ private normalizeKeyValues;
113
+ /**
114
+ * Get a request with full context
115
+ * Always resolves fresh from collection service to ensure latest data
116
+ */
117
+ getRequestWithContext(collectionId: string, requestId: string): SuiteRequestEntry | undefined;
118
+ /**
119
+ * Get all suite requests with resolved data
120
+ * Always resolves fresh from collection service to ensure latest data
121
+ */
122
+ getAllSuiteRequests(): SuiteRequestEntry[];
123
+ /**
124
+ * Get resolved requests for webview display
125
+ * Returns simplified format with display-relevant properties
126
+ */
127
+ getResolvedRequests(): Array<{
128
+ id: string;
129
+ collectionId: string;
130
+ requestId: string;
131
+ name: string;
132
+ method: string;
133
+ url: string;
134
+ collectionName: string;
135
+ folderPath: string;
136
+ enabled: boolean;
137
+ }>;
138
+ /**
139
+ * Get selected requests in order
140
+ * Always resolves fresh from collection service to ensure latest data
141
+ */
142
+ getSelectedRequests(selectedIds: string[]): SuiteRequestEntry[];
143
+ /**
144
+ * Add a request to the suite
145
+ */
146
+ addRequest(request: SuiteRequest): void;
147
+ /**
148
+ * Remove a request from the suite
149
+ */
150
+ removeRequest(requestId: string): void;
151
+ /**
152
+ * Reorder requests by request IDs (format: "collectionId:requestId")
153
+ */
154
+ reorderRequests(orderedKeys: string[]): void;
155
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Console Service Interface
3
+ *
4
+ * Platform-agnostic logging abstraction.
5
+ * VS Code extension implements this with an Output Channel.
6
+ * Standalone / CLI can implement with stdout or a file logger.
7
+ */
8
+ /**
9
+ * Log levels for console output
10
+ */
11
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
12
+ /**
13
+ * Log entry with metadata
14
+ */
15
+ export interface LogEntry {
16
+ timestamp: Date;
17
+ level: LogLevel;
18
+ message: string;
19
+ source?: string;
20
+ context?: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Console service interface for unified logging
24
+ */
25
+ export interface IConsoleService {
26
+ log(level: LogLevel, message: string, source?: string): void;
27
+ trace(message: string, source?: string): void;
28
+ debug(message: string, source?: string): void;
29
+ info(message: string, source?: string): void;
30
+ warn(message: string, source?: string): void;
31
+ error(message: string, source?: string): void;
32
+ logBatch(entries: Array<{
33
+ level: LogLevel;
34
+ message: string;
35
+ }>, source?: string): void;
36
+ logRawLines(lines: string[], source?: string): void;
37
+ show(preserveFocus?: boolean): void;
38
+ clear(): void;
39
+ dispose(): void;
40
+ }