@http-forge/core 0.4.1 → 0.4.3
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 +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +189 -186
- package/dist/index.mjs +188 -185
- package/dist/infrastructure/test-suite/interfaces.d.ts +1 -0
- package/dist/infrastructure/test-suite/test-suite-service.d.ts +10 -0
- package/dist/runtime/direct-execution.d.ts +11 -0
- package/dist/runtime/ref-resolver.d.ts +80 -0
- package/dist/runtime/runtime-contracts.d.ts +58 -6
- package/package.json +1 -1
|
@@ -147,6 +147,7 @@ export interface ITestSuiteService {
|
|
|
147
147
|
deleteSuite(id: string): Promise<boolean>;
|
|
148
148
|
duplicateSuite(sourceId: string, newName: string): Promise<TestSuite>;
|
|
149
149
|
createTempSuiteFromCollection(collectionId: string): Promise<TestSuite | undefined>;
|
|
150
|
+
createTempSuiteFromFolder(collectionId: string, folderPath: string, recursive?: boolean): Promise<TestSuite | undefined>;
|
|
150
151
|
saveTempSuite(suite: TestSuite, name: string): Promise<TestSuite>;
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
@@ -79,6 +79,16 @@ export declare class TestSuiteService implements ITestSuiteService {
|
|
|
79
79
|
* Create a temporary suite from a collection
|
|
80
80
|
*/
|
|
81
81
|
createTempSuiteFromCollection(collectionId: string): Promise<TestSuite | undefined>;
|
|
82
|
+
/**
|
|
83
|
+
* Create a temporary suite from a single folder within a collection.
|
|
84
|
+
*
|
|
85
|
+
* @param collectionId - the owning collection
|
|
86
|
+
* @param folderPath - slash-separated folder names (e.g. "Auth/Login")
|
|
87
|
+
* @param recursive - include requests in nested subfolders (default: true)
|
|
88
|
+
*/
|
|
89
|
+
createTempSuiteFromFolder(collectionId: string, folderPath: string, recursive?: boolean): Promise<TestSuite | undefined>;
|
|
90
|
+
/** Convert a folder path into an id-safe slug. */
|
|
91
|
+
private slugifyFolderPath;
|
|
82
92
|
/**
|
|
83
93
|
* Save a temporary suite as a permanent one
|
|
84
94
|
*/
|
|
@@ -20,6 +20,17 @@ export declare function runRequest(options: RunRequestOptions): Promise<unknown>
|
|
|
20
20
|
* Returns typed result; never calls process.exit.
|
|
21
21
|
*/
|
|
22
22
|
export declare function runCollection(options: RunCollectionOptions): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Execute the requests under a specific folder of a collection without MCP
|
|
25
|
+
* server overhead. Thin wrapper over {@link runCollection} that scopes the run
|
|
26
|
+
* to `options.folderPath` (recursively by default). Returns the same result
|
|
27
|
+
* shape as a collection run.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runFolder(options: RunCollectionOptions & ({
|
|
30
|
+
folderPath: string;
|
|
31
|
+
} | {
|
|
32
|
+
folderRef: string;
|
|
33
|
+
})): Promise<unknown>;
|
|
23
34
|
/**
|
|
24
35
|
* Execute a test suite without MCP server overhead.
|
|
25
36
|
* Returns typed result; never calls process.exit.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves user-supplied collection / folder / request references that may be
|
|
5
|
+
* an id, a slug, or a display name. Resolution proceeds by tier in order
|
|
6
|
+
* (id -> slug -> name) and stops at the first tier that yields a match.
|
|
7
|
+
*
|
|
8
|
+
* - id : exact match against the immutable, canonical `id`.
|
|
9
|
+
* - slug : `generateSlug(name)` computed with sibling-ordered de-duplication
|
|
10
|
+
* (mirrors the on-disk directory/file naming).
|
|
11
|
+
* - name : case-insensitive match against the display `name`.
|
|
12
|
+
*
|
|
13
|
+
* A name (and, defensively, a slug) can match more than one sibling; when that
|
|
14
|
+
* happens an {@link AmbiguousRefError} is thrown carrying the candidate list so
|
|
15
|
+
* callers can present a clear disambiguation message instead of silently
|
|
16
|
+
* picking one.
|
|
17
|
+
*
|
|
18
|
+
* Used by the direct-execution run APIs to let the CLI address things with a
|
|
19
|
+
* single flag per concept.
|
|
20
|
+
*/
|
|
21
|
+
import type { Collection, CollectionRequestItem } from '../types/collection';
|
|
22
|
+
/** Tier that produced a successful match. */
|
|
23
|
+
export type RefTier = 'id' | 'slug' | 'name';
|
|
24
|
+
/** Kind of reference being resolved (used for messaging). */
|
|
25
|
+
export type RefKind = 'collection' | 'folder' | 'request';
|
|
26
|
+
/** A candidate item surfaced when a reference is ambiguous. */
|
|
27
|
+
export interface RefCandidate {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
/** Human-readable location (e.g. folder path) for disambiguation. */
|
|
31
|
+
path: string;
|
|
32
|
+
}
|
|
33
|
+
/** Information about how a reference was resolved (for transparency/logging). */
|
|
34
|
+
export interface ResolutionInfo {
|
|
35
|
+
kind: RefKind;
|
|
36
|
+
value: string;
|
|
37
|
+
tier: RefTier;
|
|
38
|
+
id: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Thrown when a reference value matches multiple items within the same scope.
|
|
43
|
+
*/
|
|
44
|
+
export declare class AmbiguousRefError extends Error {
|
|
45
|
+
readonly kind: RefKind;
|
|
46
|
+
readonly value: string;
|
|
47
|
+
readonly candidates: RefCandidate[];
|
|
48
|
+
constructor(kind: RefKind, value: string, candidates: RefCandidate[]);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a collection reference (id, slug, or name) among all collections.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveCollectionRef(collections: Collection[], value: string): {
|
|
54
|
+
collection: Collection;
|
|
55
|
+
tier: RefTier;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a slash-separated folder reference into the folder-name path expected
|
|
59
|
+
* by the collection runner. Each segment is resolved id -> slug -> name against
|
|
60
|
+
* the folders at that level of the tree.
|
|
61
|
+
*
|
|
62
|
+
* @returns the resolved folder path (folder names joined by '/') and the tier
|
|
63
|
+
* that matched each segment.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveFolderRef(collection: Collection, slashPath: string): {
|
|
66
|
+
folderPath: string;
|
|
67
|
+
tiers: RefTier[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Resolve a request reference (id, slug, or name) to a request id.
|
|
71
|
+
*
|
|
72
|
+
* When `folderPath` (folder names joined by '/') is provided, the search is
|
|
73
|
+
* scoped to that folder's subtree (recursively); otherwise the whole collection
|
|
74
|
+
* is searched. Ambiguous matches throw {@link AmbiguousRefError}.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveRequestRef(collection: Collection, value: string, folderPath?: string): {
|
|
77
|
+
request: CollectionRequestItem;
|
|
78
|
+
tier: RefTier;
|
|
79
|
+
folderPath: string;
|
|
80
|
+
};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* 2. Direct execution: runRequest/runCollection/runSuite without MCP
|
|
10
10
|
* 3. CLI: subcommands that use modes 1 and 2
|
|
11
11
|
*/
|
|
12
|
+
import type { ResolutionInfo } from './ref-resolver';
|
|
12
13
|
/**
|
|
13
14
|
* Configuration for creating an embeddable MCP runtime instance.
|
|
14
15
|
*/
|
|
@@ -47,10 +48,27 @@ export declare function createMcpRuntime(options: McpRuntimeOptions): Promise<Mc
|
|
|
47
48
|
export interface RunRequestOptions {
|
|
48
49
|
/** Workspace root folder path */
|
|
49
50
|
workspaceFolder: string;
|
|
50
|
-
/** Collection ID containing the request */
|
|
51
|
-
collectionId
|
|
52
|
-
/** Request ID to execute */
|
|
53
|
-
requestId
|
|
51
|
+
/** Collection ID containing the request (exact id). */
|
|
52
|
+
collectionId?: string;
|
|
53
|
+
/** Request ID to execute (exact id). */
|
|
54
|
+
requestId?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Collection reference resolved by tier id -> slug -> name. Used when an
|
|
57
|
+
* exact `collectionId` is not provided.
|
|
58
|
+
*/
|
|
59
|
+
collectionRef?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Request reference resolved by tier id -> slug -> name. Used when an exact
|
|
62
|
+
* `requestId` is not provided. Scoped to `folderRef` when that is provided.
|
|
63
|
+
*/
|
|
64
|
+
requestRef?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional folder reference (slash-separated id/slug/name segments) that
|
|
67
|
+
* scopes request resolution to that folder's subtree.
|
|
68
|
+
*/
|
|
69
|
+
folderRef?: string;
|
|
70
|
+
/** Called for each reference resolved, for transparency/logging. */
|
|
71
|
+
onResolve?: (info: ResolutionInfo) => void;
|
|
54
72
|
/** Environment name (defaults to currently selected) */
|
|
55
73
|
environment?: string;
|
|
56
74
|
/** Extra variables to inject into execution */
|
|
@@ -70,8 +88,20 @@ export interface RunRequestOptions {
|
|
|
70
88
|
export interface RunCollectionOptions {
|
|
71
89
|
/** Workspace root folder path */
|
|
72
90
|
workspaceFolder: string;
|
|
73
|
-
/** Collection ID to execute */
|
|
74
|
-
collectionId
|
|
91
|
+
/** Collection ID to execute (exact id). */
|
|
92
|
+
collectionId?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Collection reference resolved by tier id -> slug -> name. Used when an
|
|
95
|
+
* exact `collectionId` is not provided.
|
|
96
|
+
*/
|
|
97
|
+
collectionRef?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Folder reference (slash-separated id/slug/name segments) resolved to a
|
|
100
|
+
* folder path. Used when an exact `folderPath` is not provided.
|
|
101
|
+
*/
|
|
102
|
+
folderRef?: string;
|
|
103
|
+
/** Called for each reference resolved, for transparency/logging. */
|
|
104
|
+
onResolve?: (info: ResolutionInfo) => void;
|
|
75
105
|
/** Environment name (defaults to currently selected) */
|
|
76
106
|
environment?: string;
|
|
77
107
|
/** Extra variables injected into every request */
|
|
@@ -84,6 +114,16 @@ export interface RunCollectionOptions {
|
|
|
84
114
|
delay?: number;
|
|
85
115
|
/** Extra response fields to include: perRequest, failedOnly, consoleOutput */
|
|
86
116
|
include?: string[];
|
|
117
|
+
/**
|
|
118
|
+
* Restrict execution to requests under this folder path (slash-separated
|
|
119
|
+
* folder names, e.g. "Auth/Login"). When omitted, the whole collection runs.
|
|
120
|
+
*/
|
|
121
|
+
folderPath?: string;
|
|
122
|
+
/**
|
|
123
|
+
* When a `folderPath` is provided, include requests in nested subfolders
|
|
124
|
+
* (default: true). When false, only requests directly in that folder run.
|
|
125
|
+
*/
|
|
126
|
+
recursive?: boolean;
|
|
87
127
|
}
|
|
88
128
|
/**
|
|
89
129
|
* Options for directly executing a test suite without MCP.
|
|
@@ -118,6 +158,18 @@ export declare function runRequest(options: RunRequestOptions): Promise<unknown>
|
|
|
118
158
|
* Returns typed result object; never calls process.exit.
|
|
119
159
|
*/
|
|
120
160
|
export declare function runCollection(options: RunCollectionOptions): Promise<unknown>;
|
|
161
|
+
/**
|
|
162
|
+
* Execute the requests under a specific folder of a collection without MCP
|
|
163
|
+
* server. Thin wrapper over {@link runCollection} scoped to a folder
|
|
164
|
+
* (recursively by default). The folder may be given as `folderPath` (folder
|
|
165
|
+
* names joined by '/') or `folderRef` (slash-separated id/slug/name segments).
|
|
166
|
+
* Returns the same result shape as a collection run.
|
|
167
|
+
*/
|
|
168
|
+
export declare function runFolder(options: RunCollectionOptions & ({
|
|
169
|
+
folderPath: string;
|
|
170
|
+
} | {
|
|
171
|
+
folderRef: string;
|
|
172
|
+
})): Promise<unknown>;
|
|
121
173
|
/**
|
|
122
174
|
* Execute a test suite directly without MCP server.
|
|
123
175
|
* Returns typed result object; never calls process.exit.
|
package/package.json
CHANGED