@http-forge/core 0.6.39 → 0.6.40
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/dist/index.js +206 -206
- package/dist/index.mjs +197 -197
- package/dist/infrastructure/analysis/ai-env-suggester.d.ts +1 -1
- package/dist/infrastructure/collection/collection-service.d.ts +5 -0
- package/dist/infrastructure/collection/collection-store.d.ts +22 -0
- package/dist/infrastructure/collection/folder-collection-store.d.ts +35 -22
- package/dist/infrastructure/config/config-service.d.ts +3 -0
- package/dist/runtime/mcp-handlers/helpers.d.ts +7 -0
- package/dist/types/collection.d.ts +5 -0
- package/package.json +1 -1
|
@@ -19,4 +19,4 @@ import type { EnvSuggestion } from './env-suggester';
|
|
|
19
19
|
* @param aiProvider Any IAiProvider (Copilot, OpenAI, Anthropic, …).
|
|
20
20
|
* @returns Suggestions sorted by occurrence count descending.
|
|
21
21
|
*/
|
|
22
|
-
export declare function scanCollectionForEnvVarsWithAi(collection: Collection, aiProvider: IAiProvider): Promise<EnvSuggestion[]>;
|
|
22
|
+
export declare function scanCollectionForEnvVarsWithAi(collection: Collection, aiProvider: IAiProvider, collectionService?: Pick<import('../../types/collection').ICollectionService, 'getRequestDetail'>): Promise<EnvSuggestion[]>;
|
|
@@ -43,6 +43,11 @@ export declare class CollectionService implements ICollectionService {
|
|
|
43
43
|
constructor(configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined);
|
|
44
44
|
private ensureCollectionsDir;
|
|
45
45
|
private loadCollections;
|
|
46
|
+
/**
|
|
47
|
+
* Load heavy request detail on demand (body, scripts, schemas, doc).
|
|
48
|
+
* No-op for stores without lazy support (e.g. JSON format) — falls back to `findRequest`.
|
|
49
|
+
*/
|
|
50
|
+
getRequestDetail(collectionId: string, requestId: string): CollectionRequestItem | undefined;
|
|
46
51
|
private setupFileWatcher;
|
|
47
52
|
getAllCollections(): Collection[];
|
|
48
53
|
getCollection(id: string): Collection | undefined;
|
|
@@ -82,7 +82,29 @@ export interface ICollectionStore {
|
|
|
82
82
|
* Get the disk path of an item (folder or request) within a collection
|
|
83
83
|
*/
|
|
84
84
|
getItemPath(collectionId: string, itemId: string): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Load heavy request detail (body, scripts, schemas, doc) on demand.
|
|
87
|
+
* Used to keep `loadAll()` light for tree view and defer I/O until a request is opened/executed.
|
|
88
|
+
*/
|
|
89
|
+
loadRequestDetail?(collectionId: string, requestId: string): CollectionItem | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Load all collections in light mode (cheap metadata only, no body/scripts/schemas/doc).
|
|
92
|
+
* Optimized for tree view and startup.
|
|
93
|
+
*/
|
|
94
|
+
loadAllLight?(): Collection[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* In-memory marker for requests loaded via `loadAllLight()`.
|
|
98
|
+
* Never persisted to disk — set only on the in-memory item and cleared by
|
|
99
|
+
* `loadRequestDetail()` once heavy fields are enriched (or enrichment is attempted).
|
|
100
|
+
*/
|
|
101
|
+
export interface LightLoadedRequest {
|
|
102
|
+
_light?: boolean;
|
|
85
103
|
}
|
|
104
|
+
/** True when the item still needs on-demand heavy-field enrichment. */
|
|
105
|
+
export declare function isLightLoaded(item: CollectionItem): boolean;
|
|
106
|
+
/** Mark an item as fully loaded (enriched, or enrichment attempted). */
|
|
107
|
+
export declare function markDetailLoaded(item: CollectionItem): void;
|
|
86
108
|
/**
|
|
87
109
|
* Metadata stored in collection.json for folder format
|
|
88
110
|
*/
|
|
@@ -36,6 +36,11 @@ export declare class FolderCollectionStore implements ICollectionStore {
|
|
|
36
36
|
private cache;
|
|
37
37
|
private slugToIdMap;
|
|
38
38
|
private idToSlugMap;
|
|
39
|
+
/**
|
|
40
|
+
* When true, `loadRequestFromDir` delegates to the light loader
|
|
41
|
+
* (metadata only). Set only inside `loadAllLight()`; never left on.
|
|
42
|
+
*/
|
|
43
|
+
private lightLoad;
|
|
39
44
|
constructor(collectionsDir: string);
|
|
40
45
|
/**
|
|
41
46
|
* Get collection/item slug from ID
|
|
@@ -90,31 +95,26 @@ export declare class FolderCollectionStore implements ICollectionStore {
|
|
|
90
95
|
* Load a folder from directory
|
|
91
96
|
*/
|
|
92
97
|
private loadFolderFromDir;
|
|
98
|
+
/**
|
|
99
|
+
* Load a request from directory — light mode (cheap metadata only, no heavy I/O).
|
|
100
|
+
* Used by `loadAllLight()` for tree view / startup optimization.
|
|
101
|
+
*/
|
|
102
|
+
private loadRequestFromDirLight;
|
|
103
|
+
/**
|
|
104
|
+
* Load heavy request detail on demand (body, scripts, schemas, doc).
|
|
105
|
+
* Populates the cached collection item in-place when found.
|
|
106
|
+
* Idempotent: items that are already fully loaded are returned without disk I/O.
|
|
107
|
+
*/
|
|
108
|
+
loadRequestDetail(collectionId: string, requestId: string): CollectionItem | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Load all collections in light mode (no heavy I/O) — optimized for startup/tree view.
|
|
111
|
+
*/
|
|
112
|
+
loadAllLight(): Collection[];
|
|
93
113
|
/**
|
|
94
114
|
* Load a request from directory
|
|
95
115
|
*
|
|
96
|
-
*
|
|
97
|
-
* startup
|
|
98
|
-
* and docs can consume hundreds of MB of heap.
|
|
99
|
-
*
|
|
100
|
-
* The fix is to load only cheap metadata here (url, method, headers, auth, settings,
|
|
101
|
-
* name, description, deprecated) and introduce an on-demand
|
|
102
|
-
* `loadRequestDetail(requestPath)` that reads the heavy fields only when a request is
|
|
103
|
-
* actually opened or executed.
|
|
104
|
-
*
|
|
105
|
-
* Heavy fields to defer:
|
|
106
|
-
* - body (readBodyFromDir) — up to 100 KB+
|
|
107
|
-
* - scripts (loadScriptsFromDir) — pre/post JS source, up to 20 KB
|
|
108
|
-
* - responseSchema (readSchemaFile) — OpenAPI JSON, up to 1 MB+
|
|
109
|
-
* - bodySchema (readSchemaFile) — OpenAPI JSON, up to 1 MB+
|
|
110
|
-
* - doc (fs.readFileSync doc.md) — markdown, up to 50 KB
|
|
111
|
-
*
|
|
112
|
-
* Callers that need the heavy fields:
|
|
113
|
-
* - CollectionRequestExecutor (body, scripts)
|
|
114
|
-
* - RequestExecutionHandler (body, scripts)
|
|
115
|
-
* - SchemaHandler (responseSchema, bodySchema)
|
|
116
|
-
* - PanelDataProvider.getInitialData() (sends full request to webview)
|
|
117
|
-
* - MCP direct-execution: runRequest / runCollection (body, scripts)
|
|
116
|
+
* Heavy fields are loaded eagerly here for backward compatibility (direct execution, tests).
|
|
117
|
+
* For startup optimization, use `loadAllLight()` + `loadRequestDetail()` on demand.
|
|
118
118
|
*/
|
|
119
119
|
private loadRequestFromDir;
|
|
120
120
|
/**
|
|
@@ -193,6 +193,19 @@ export declare class FolderCollectionStore implements ICollectionStore {
|
|
|
193
193
|
* Load scripts for a specific item
|
|
194
194
|
*/
|
|
195
195
|
loadScripts(collectionId: string, itemId: string): RequestScripts | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Hydrate light-loaded requests in place before a disk write.
|
|
198
|
+
* Saving a light item would otherwise persist metadata without its heavy
|
|
199
|
+
* files (e.g. overwrite body.json with empty content). The cache holds the
|
|
200
|
+
* same object references the service works with, so in-place enrichment
|
|
201
|
+
* fixes both the write and any live readers.
|
|
202
|
+
*/
|
|
203
|
+
private hydrateLightItems;
|
|
204
|
+
/**
|
|
205
|
+
* Resolve the request to persist: a detached light copy carries no heavy
|
|
206
|
+
* fields, so prefer the enriched cached item when available.
|
|
207
|
+
*/
|
|
208
|
+
private resolveWritableRequest;
|
|
196
209
|
/**
|
|
197
210
|
* Update collection metadata only
|
|
198
211
|
*/
|
|
@@ -23,7 +23,10 @@ export declare class ConfigService implements IConfigService {
|
|
|
23
23
|
private configPath;
|
|
24
24
|
private configDir;
|
|
25
25
|
private fileWatchers;
|
|
26
|
+
private _standaloneProbeCache?;
|
|
27
|
+
private _cachedWorkspaceNormalization?;
|
|
26
28
|
constructor(workspacePath: string, fileWatcherFactory?: IFileWatcherFactory | undefined, notifications?: INotificationService | undefined);
|
|
29
|
+
private isStandaloneLayoutCached;
|
|
27
30
|
private normalizeWorkspacePath;
|
|
28
31
|
private resolveConfigPath;
|
|
29
32
|
/**
|
|
@@ -16,6 +16,13 @@ export declare function resolveCollectionByLabel(label: unknown, collections: Co
|
|
|
16
16
|
* name/substring.
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveRequestByLabel(label: unknown, col: Collection): CollectionRequestItem;
|
|
19
|
+
/**
|
|
20
|
+
* Hydrate a tree-resolved request with heavy fields (body/scripts/schemas/doc).
|
|
21
|
+
* Collections load light (metadata only); single-request readers must call this
|
|
22
|
+
* before touching heavy fields. Falls back to the passed item on stores
|
|
23
|
+
* without lazy support. List/match paths keep using light refs untouched.
|
|
24
|
+
*/
|
|
25
|
+
export declare function hydrateRequest(services: McpDispatchServices, collectionId: string, req: CollectionRequestItem): CollectionRequestItem;
|
|
19
26
|
/**
|
|
20
27
|
* Find a folder item in a collection tree by its ID.
|
|
21
28
|
*
|
|
@@ -66,6 +66,11 @@ export interface ICollectionReader {
|
|
|
66
66
|
getCollectionById(id: string): Collection | undefined;
|
|
67
67
|
getCollectionByName(name: string): Collection | undefined;
|
|
68
68
|
findRequest(collectionId: string, requestId: string): CollectionRequestItem | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Load heavy request detail (body, scripts, schemas, doc) on demand.
|
|
71
|
+
* Falls back to `findRequest` on stores without lazy support.
|
|
72
|
+
*/
|
|
73
|
+
getRequestDetail(collectionId: string, requestId: string): CollectionRequestItem | undefined;
|
|
69
74
|
getCollectionVariables(collectionId: string): Record<string, string>;
|
|
70
75
|
}
|
|
71
76
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.40",
|
|
4
4
|
"description": "Headless Postman-compatible API testing engine for Node.js, CI/CD, OpenAPI workflows, and HTTP Forge automation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|