@http-forge/core 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -117
- package/dist/index.js +166 -166
- package/dist/index.mjs +166 -166
- package/dist/infrastructure/script/script-executor.d.ts +8 -0
- package/dist/infrastructure/test-suite/interfaces.d.ts +5 -1
- package/dist/infrastructure/test-suite/test-suite-service.d.ts +8 -0
- package/dist/infrastructure/test-suite/test-suite-store.d.ts +64 -7
- package/package.json +1 -1
|
@@ -37,6 +37,14 @@ export declare class ScriptExecutor implements IScriptExecutor {
|
|
|
37
37
|
* Used by RequestScriptSession for pre-request and test scripts
|
|
38
38
|
*/
|
|
39
39
|
private createCommonContext;
|
|
40
|
+
/**
|
|
41
|
+
* Serialize a value for storage. Non-string values are JSON-stringified (Postman-compatible).
|
|
42
|
+
*/
|
|
43
|
+
private serializeValue;
|
|
44
|
+
/**
|
|
45
|
+
* Deserialize a stored value. Attempts JSON.parse; returns raw string on failure.
|
|
46
|
+
*/
|
|
47
|
+
private deserializeValue;
|
|
40
48
|
/**
|
|
41
49
|
* Create a basic variable scope with get/set/has/unset/clear/toObject
|
|
42
50
|
*/
|
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Request reference within a Test Suite
|
|
8
|
-
* References a request from a Collection
|
|
8
|
+
* References a request from a Collection with an optional embedded snapshot.
|
|
9
|
+
* When a slug is present, request data lives in the suite's folder structure.
|
|
9
10
|
*/
|
|
10
11
|
export interface SuiteRequest {
|
|
12
|
+
/** Folder slug (directory name) within the suite — required for folder-based suites */
|
|
13
|
+
slug?: string;
|
|
11
14
|
/** Collection ID where the request lives */
|
|
12
15
|
collectionId: string;
|
|
13
16
|
/** Collection name for display purposes */
|
|
@@ -140,6 +143,7 @@ export interface ITestSuiteService {
|
|
|
140
143
|
getAllSuites(): Promise<TestSuite[]>;
|
|
141
144
|
updateSuite(suite: TestSuite): Promise<void>;
|
|
142
145
|
deleteSuite(id: string): Promise<boolean>;
|
|
146
|
+
duplicateSuite(sourceId: string, newName: string): Promise<TestSuite>;
|
|
143
147
|
createTempSuiteFromCollection(collectionId: string): Promise<TestSuite | undefined>;
|
|
144
148
|
saveTempSuite(suite: TestSuite, name: string): Promise<TestSuite>;
|
|
145
149
|
}
|
|
@@ -63,6 +63,14 @@ export declare class TestSuiteService implements ITestSuiteService {
|
|
|
63
63
|
* Update an existing suite
|
|
64
64
|
*/
|
|
65
65
|
updateSuite(suite: TestSuite): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Duplicate a suite including its request folders
|
|
68
|
+
*/
|
|
69
|
+
duplicateSuite(sourceId: string, newName: string): Promise<TestSuite>;
|
|
70
|
+
/**
|
|
71
|
+
* Recursively copy a directory
|
|
72
|
+
*/
|
|
73
|
+
private copyDirRecursive;
|
|
66
74
|
/**
|
|
67
75
|
* Delete a suite
|
|
68
76
|
*/
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Test Suite Store
|
|
3
3
|
*
|
|
4
4
|
* Manages suite requests that can come from different collections.
|
|
5
|
-
*
|
|
5
|
+
* Supports folder-based suite storage where each request has its own directory.
|
|
6
|
+
* Falls back to resolving from collection service for legacy suites.
|
|
6
7
|
*
|
|
7
|
-
* Single Responsibility: Maintain suite state and resolve requests
|
|
8
|
+
* Single Responsibility: Maintain suite state and resolve requests
|
|
8
9
|
* Dependency Inversion: Depends on ICollectionService abstraction
|
|
9
10
|
*/
|
|
10
11
|
import { CollectionRequest, ICollectionService, RequestScripts } from '../../types/collection';
|
|
@@ -30,6 +31,10 @@ export interface ITestSuiteStore {
|
|
|
30
31
|
* Set the test suite
|
|
31
32
|
*/
|
|
32
33
|
setSuite(suite: TestSuite): void;
|
|
34
|
+
/**
|
|
35
|
+
* Set the suite directory path (for folder-based suites)
|
|
36
|
+
*/
|
|
37
|
+
setSuiteDir(dir: string | undefined): void;
|
|
33
38
|
/**
|
|
34
39
|
* Get the current suite
|
|
35
40
|
*/
|
|
@@ -38,6 +43,10 @@ export interface ITestSuiteStore {
|
|
|
38
43
|
* Get a request by ID with full context (collection scripts + folder scripts)
|
|
39
44
|
*/
|
|
40
45
|
getRequestWithContext(collectionId: string, requestId: string): SuiteRequestEntry | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get a request by slug with full context
|
|
48
|
+
*/
|
|
49
|
+
getRequestBySlug(slug: string): SuiteRequestEntry | undefined;
|
|
41
50
|
/**
|
|
42
51
|
* Get all suite requests with their resolved data
|
|
43
52
|
*/
|
|
@@ -55,6 +64,8 @@ export interface ITestSuiteStore {
|
|
|
55
64
|
collectionName: string;
|
|
56
65
|
folderPath: string;
|
|
57
66
|
enabled: boolean;
|
|
67
|
+
hasEmbeddedRequest: boolean;
|
|
68
|
+
slug?: string;
|
|
58
69
|
}>;
|
|
59
70
|
/**
|
|
60
71
|
* Get suite requests by selection state
|
|
@@ -62,9 +73,9 @@ export interface ITestSuiteStore {
|
|
|
62
73
|
*/
|
|
63
74
|
getSelectedRequests(selectedIds: string[]): SuiteRequestEntry[];
|
|
64
75
|
/**
|
|
65
|
-
* Add a request to the suite
|
|
76
|
+
* Add a request to the suite (creates folder if suiteDir is set)
|
|
66
77
|
*/
|
|
67
|
-
addRequest(request: SuiteRequest): void;
|
|
78
|
+
addRequest(request: SuiteRequest, fullRequest?: CollectionRequest): void;
|
|
68
79
|
/**
|
|
69
80
|
* Remove a request from the suite
|
|
70
81
|
*/
|
|
@@ -73,6 +84,14 @@ export interface ITestSuiteStore {
|
|
|
73
84
|
* Reorder requests
|
|
74
85
|
*/
|
|
75
86
|
reorderRequests(requestIds: string[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Update a suite request's data in its folder
|
|
89
|
+
*/
|
|
90
|
+
updateSuiteRequest(slug: string, updatedRequest: CollectionRequest): void;
|
|
91
|
+
/**
|
|
92
|
+
* Re-sync a suite request from its source collection
|
|
93
|
+
*/
|
|
94
|
+
resyncFromCollection(slug: string): CollectionRequest | undefined;
|
|
76
95
|
}
|
|
77
96
|
/**
|
|
78
97
|
* Implementation of TestSuiteStore
|
|
@@ -80,17 +99,37 @@ export interface ITestSuiteStore {
|
|
|
80
99
|
export declare class TestSuiteStore implements ITestSuiteStore {
|
|
81
100
|
private readonly collectionService;
|
|
82
101
|
private suite;
|
|
102
|
+
private suiteDir;
|
|
83
103
|
constructor(collectionService: ICollectionService);
|
|
84
104
|
/**
|
|
85
105
|
* Set the suite
|
|
86
106
|
*/
|
|
87
107
|
setSuite(suite: TestSuite): void;
|
|
108
|
+
/**
|
|
109
|
+
* Set the suite directory (for folder-based storage)
|
|
110
|
+
*/
|
|
111
|
+
setSuiteDir(dir: string | undefined): void;
|
|
88
112
|
/**
|
|
89
113
|
* Get the current suite
|
|
90
114
|
*/
|
|
91
115
|
getSuite(): TestSuite | undefined;
|
|
92
116
|
/**
|
|
93
|
-
*
|
|
117
|
+
* Load a suite request from its folder.
|
|
118
|
+
* Reads request.json + scripts/pre-request.js + scripts/post-response.js
|
|
119
|
+
*/
|
|
120
|
+
private loadSuiteRequest;
|
|
121
|
+
/**
|
|
122
|
+
* Save a suite request to its folder.
|
|
123
|
+
* Writes request.json + scripts/pre-request.js + scripts/post-response.js
|
|
124
|
+
*/
|
|
125
|
+
private saveSuiteRequest;
|
|
126
|
+
/**
|
|
127
|
+
* Check if a suite request has embedded data in its folder
|
|
128
|
+
*/
|
|
129
|
+
private hasEmbeddedRequest;
|
|
130
|
+
/**
|
|
131
|
+
* Resolve a suite request to its full request data.
|
|
132
|
+
* Priority: suite folder → collection (fallback for legacy suites)
|
|
94
133
|
*/
|
|
95
134
|
private resolveRequest;
|
|
96
135
|
/**
|
|
@@ -115,6 +154,7 @@ export declare class TestSuiteStore implements ITestSuiteStore {
|
|
|
115
154
|
* Always resolves fresh from collection service to ensure latest data
|
|
116
155
|
*/
|
|
117
156
|
getRequestWithContext(collectionId: string, requestId: string): SuiteRequestEntry | undefined;
|
|
157
|
+
getRequestBySlug(slug: string): SuiteRequestEntry | undefined;
|
|
118
158
|
/**
|
|
119
159
|
* Get all suite requests with resolved data
|
|
120
160
|
* Always resolves fresh from collection service to ensure latest data
|
|
@@ -134,6 +174,8 @@ export declare class TestSuiteStore implements ITestSuiteStore {
|
|
|
134
174
|
collectionName: string;
|
|
135
175
|
folderPath: string;
|
|
136
176
|
enabled: boolean;
|
|
177
|
+
hasEmbeddedRequest: boolean;
|
|
178
|
+
slug?: string;
|
|
137
179
|
}>;
|
|
138
180
|
/**
|
|
139
181
|
* Get selected requests in order
|
|
@@ -141,9 +183,14 @@ export declare class TestSuiteStore implements ITestSuiteStore {
|
|
|
141
183
|
*/
|
|
142
184
|
getSelectedRequests(selectedIds: string[]): SuiteRequestEntry[];
|
|
143
185
|
/**
|
|
144
|
-
* Add a request to the suite
|
|
186
|
+
* Add a request to the suite.
|
|
187
|
+
* If fullRequest is provided and suiteDir is set, creates a folder with request.json + scripts.
|
|
145
188
|
*/
|
|
146
|
-
addRequest(request: SuiteRequest): void;
|
|
189
|
+
addRequest(request: SuiteRequest, fullRequest?: CollectionRequest): void;
|
|
190
|
+
/**
|
|
191
|
+
* Resolve a unique slug (handle duplicates with numeric suffix)
|
|
192
|
+
*/
|
|
193
|
+
private resolveUniqueSlug;
|
|
147
194
|
/**
|
|
148
195
|
* Remove a request from the suite
|
|
149
196
|
*/
|
|
@@ -152,4 +199,14 @@ export declare class TestSuiteStore implements ITestSuiteStore {
|
|
|
152
199
|
* Reorder requests by request IDs (format: "collectionId:requestId")
|
|
153
200
|
*/
|
|
154
201
|
reorderRequests(orderedKeys: string[]): void;
|
|
202
|
+
/**
|
|
203
|
+
* Update the request data in the suite folder.
|
|
204
|
+
* Called when user edits a request from the suite panel.
|
|
205
|
+
*/
|
|
206
|
+
updateSuiteRequest(slug: string, updatedRequest: CollectionRequest): void;
|
|
207
|
+
/**
|
|
208
|
+
* Replace the suite request with the latest version from the collection.
|
|
209
|
+
* Overwrites the request folder content.
|
|
210
|
+
*/
|
|
211
|
+
resyncFromCollection(slug: string): CollectionRequest | undefined;
|
|
155
212
|
}
|
package/package.json
CHANGED