@http-forge/core 0.2.13 → 0.2.15
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 +6 -0
- package/dist/index.js +116 -116
- package/dist/index.mjs +114 -114
- package/dist/infrastructure/collection/collection-service.d.ts +3 -0
- package/dist/infrastructure/collection/collection-store.d.ts +5 -1
- package/dist/infrastructure/collection/folder-collection-store.d.ts +4 -0
- package/dist/infrastructure/collection/folder-io.d.ts +1 -0
- package/dist/infrastructure/collection/json-collection-loader.d.ts +5 -0
- package/dist/infrastructure/test-suite/interfaces.d.ts +2 -0
- package/dist/types/collection.d.ts +2 -0
- package/package.json +1 -1
- package/dist/application/dto/index.d.ts +0 -8
- package/dist/application/dto/request-dtos.d.ts +0 -105
- package/dist/application/dto/response-dtos.d.ts +0 -185
- package/dist/application/events/application-events.d.ts +0 -53
- package/dist/application/events/index.d.ts +0 -6
- package/dist/application/index.d.ts +0 -25
- package/dist/application/mappers/collection-mapper.d.ts +0 -39
- package/dist/application/mappers/execution-result-mapper.d.ts +0 -16
- package/dist/application/mappers/index.d.ts +0 -9
- package/dist/application/mappers/request-mapper.d.ts +0 -29
- package/dist/application/queries/get-request-schema.query.d.ts +0 -32
- package/dist/application/queries/index.d.ts +0 -6
- package/dist/application/use-cases/create-request.use-case.d.ts +0 -23
- package/dist/application/use-cases/delete-request.use-case.d.ts +0 -15
- package/dist/application/use-cases/execute-request.use-case.d.ts +0 -46
- package/dist/application/use-cases/export-collection.use-case.d.ts +0 -22
- package/dist/application/use-cases/get-collection.use-case.d.ts +0 -13
- package/dist/application/use-cases/index.d.ts +0 -12
- package/dist/application/use-cases/list-requests.use-case.d.ts +0 -14
- package/dist/application/use-cases/load-collection.use-case.d.ts +0 -30
- package/dist/application/use-cases/save-collection.use-case.d.ts +0 -25
- package/dist/application/use-cases/update-request.use-case.d.ts +0 -17
- package/dist/domain/errors/domain-errors.d.ts +0 -52
- package/dist/domain/errors/index.d.ts +0 -4
- package/dist/domain/index.d.ts +0 -24
- package/dist/domain/models/execution.d.ts +0 -88
- package/dist/domain/models/index.d.ts +0 -4
- package/dist/domain/services/domain-events.d.ts +0 -60
- package/dist/domain/services/execution-planner.domain-service.d.ts +0 -40
- package/dist/domain/services/index.d.ts +0 -9
- package/dist/domain/services/schema-inference.domain-service.d.ts +0 -54
- package/dist/domain/value-objects/entity-id.d.ts +0 -26
- package/dist/domain/value-objects/http-method.d.ts +0 -30
- package/dist/domain/value-objects/index.d.ts +0 -9
- package/dist/domain/value-objects/request-url.d.ts +0 -28
- package/dist/infrastructure/adapters/index.d.ts +0 -5
- package/dist/infrastructure/adapters/logger.adapter.d.ts +0 -25
- package/dist/infrastructure/adapters/node-file-system.adapter.d.ts +0 -18
- package/dist/infrastructure/di/complete-bootstrap.d.ts +0 -24
- package/dist/infrastructure/di/index.d.ts +0 -6
- package/dist/infrastructure/di/infrastructure-di-config.d.ts +0 -33
- package/dist/infrastructure/di/simple-event-publisher.d.ts +0 -17
- package/dist/infrastructure/environment/interfaces.d.ts +0 -139
- package/dist/infrastructure/http/index.d.ts +0 -4
- package/dist/infrastructure/http/node-http-executor.adapter.d.ts +0 -25
- package/dist/infrastructure/index.d.ts +0 -31
- package/dist/infrastructure/persistence/file-system-history-loader.d.ts +0 -31
- package/dist/infrastructure/persistence/index.d.ts +0 -6
- package/dist/infrastructure/repositories/file-system/fs-collection-repository.d.ts +0 -72
- package/dist/infrastructure/repositories/file-system/fs-environment-file-loader.adapter.d.ts +0 -41
- package/dist/infrastructure/repositories/file-system/fs-environment-repository.d.ts +0 -34
- package/dist/infrastructure/repositories/file-system/fs-request-repository.d.ts +0 -31
- package/dist/infrastructure/repositories/file-system/index.d.ts +0 -7
- package/dist/infrastructure/repositories/in-memory/in-memory-collection-repository.d.ts +0 -18
- package/dist/infrastructure/repositories/in-memory/in-memory-environment-repository.d.ts +0 -25
- package/dist/infrastructure/repositories/in-memory/in-memory-request-repository.d.ts +0 -25
- package/dist/infrastructure/repositories/in-memory/index.d.ts +0 -7
- package/dist/infrastructure/script/index.d.ts +0 -4
- package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +0 -19
- package/dist/infrastructure/test-suite/index.d.ts +0 -10
- package/dist/ports/executors/index.d.ts +0 -5
- package/dist/ports/external/file-system.interface.d.ts +0 -44
- package/dist/ports/external/http-client.interface.d.ts +0 -25
- package/dist/ports/external/index.d.ts +0 -7
- package/dist/ports/index.d.ts +0 -17
- package/dist/ports/parsers/index.d.ts +0 -4
- package/dist/ports/repositories/collection-repository.interface.d.ts +0 -32
- package/dist/ports/repositories/environment-repository.interface.d.ts +0 -31
- package/dist/ports/repositories/index.d.ts +0 -6
- package/dist/ports/repositories/request-repository.interface.d.ts +0 -32
- package/dist/ports/storage/cache-store.interface.d.ts +0 -26
- package/dist/ports/storage/history-loader.interface.d.ts +0 -37
- package/dist/ports/storage/index.d.ts +0 -5
|
@@ -59,6 +59,7 @@ export declare class CollectionService implements ICollectionService {
|
|
|
59
59
|
private collectRequestsRecursive;
|
|
60
60
|
createCollection(name: string): Promise<Collection>;
|
|
61
61
|
renameCollection(id: string, newName: string): Promise<boolean>;
|
|
62
|
+
duplicateCollection(sourceId: string, newName: string): Promise<Collection>;
|
|
62
63
|
createFolder(options: {
|
|
63
64
|
name: string;
|
|
64
65
|
collectionId: string;
|
|
@@ -66,11 +67,13 @@ export declare class CollectionService implements ICollectionService {
|
|
|
66
67
|
}): Promise<CollectionItem>;
|
|
67
68
|
deleteFolder(collectionId: string, folderId: string): Promise<boolean>;
|
|
68
69
|
renameFolder(collectionId: string, folderId: string, newName: string): Promise<boolean>;
|
|
70
|
+
duplicateFolder(collectionId: string, folderId: string, newName: string): Promise<CollectionItem>;
|
|
69
71
|
createRequest(options: CreateRequestOptions): Promise<CollectionRequestItem>;
|
|
70
72
|
renameRequest(collectionId: string, requestId: string, newName: string): Promise<boolean>;
|
|
71
73
|
moveItem(collectionId: string, itemId: string, newParentId?: string): Promise<boolean>;
|
|
72
74
|
reorderItems(collectionId: string, parentId: string | undefined, orderedItemIds: string[]): Promise<boolean>;
|
|
73
75
|
private findItemById;
|
|
76
|
+
private copyDirRecursive;
|
|
74
77
|
private deleteItemById;
|
|
75
78
|
importCollection(filePath: string): Promise<Collection>;
|
|
76
79
|
private importPostmanCollection;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* - JsonCollectionLoader: Loads from single JSON files
|
|
7
7
|
* - FolderCollectionStore: Loads from directory structure
|
|
8
8
|
*/
|
|
9
|
-
import type { CollectionRequest } from '../../types/types';
|
|
10
9
|
import type { Collection, CollectionItem, RequestScripts } from '../../types/collection';
|
|
10
|
+
import type { CollectionRequest } from '../../types/types';
|
|
11
11
|
/**
|
|
12
12
|
* Rich interface for loading, saving, and managing collections
|
|
13
13
|
*/
|
|
@@ -78,6 +78,10 @@ export interface ICollectionStore {
|
|
|
78
78
|
* Load scripts for a specific item
|
|
79
79
|
*/
|
|
80
80
|
loadScripts(collectionId: string, itemId: string): RequestScripts | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Get the disk path of an item (folder or request) within a collection
|
|
83
|
+
*/
|
|
84
|
+
getItemPath(collectionId: string, itemId: string): string | undefined;
|
|
81
85
|
}
|
|
82
86
|
/**
|
|
83
87
|
* Metadata stored in collection.json for folder format
|
|
@@ -129,6 +129,10 @@ export declare class FolderCollectionStore implements ICollectionStore {
|
|
|
129
129
|
* Get the path for a collection
|
|
130
130
|
*/
|
|
131
131
|
getCollectionPath(id: string): string;
|
|
132
|
+
/**
|
|
133
|
+
* Get the disk path of an item (folder or request) within a collection
|
|
134
|
+
*/
|
|
135
|
+
getItemPath(collectionId: string, itemId: string): string | undefined;
|
|
132
136
|
/**
|
|
133
137
|
* Create a new collection
|
|
134
138
|
*/
|
|
@@ -49,6 +49,7 @@ export interface ScriptsData {
|
|
|
49
49
|
export declare function readScriptsFromDir(scriptsPath: string): ScriptsData | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* Write scripts to a scripts/ directory.
|
|
52
|
+
* If a script is empty/undefined, the corresponding file is deleted.
|
|
52
53
|
*/
|
|
53
54
|
export declare function writeScriptsToDir(scriptsPath: string, scripts: ScriptsData): Promise<void>;
|
|
54
55
|
/**
|
|
@@ -45,6 +45,11 @@ export declare class JsonCollectionLoader implements ICollectionStore {
|
|
|
45
45
|
* Get the file path for a collection
|
|
46
46
|
*/
|
|
47
47
|
getCollectionPath(id: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Get the disk path of an item within a collection
|
|
50
|
+
* JSON format stores everything in one file, so items don't have individual paths
|
|
51
|
+
*/
|
|
52
|
+
getItemPath(_collectionId: string, _itemId: string): string | undefined;
|
|
48
53
|
/**
|
|
49
54
|
* Create a new collection
|
|
50
55
|
*/
|
|
@@ -23,6 +23,8 @@ export interface SuiteRequest {
|
|
|
23
23
|
folderPath: string;
|
|
24
24
|
/** Whether this request is enabled for execution */
|
|
25
25
|
enabled?: boolean;
|
|
26
|
+
/** Optional description of what this request does in the suite */
|
|
27
|
+
description?: string;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Test Suite run configuration
|
|
@@ -73,6 +73,7 @@ export interface ICollectionReader {
|
|
|
73
73
|
*/
|
|
74
74
|
export interface ICollectionWriter {
|
|
75
75
|
createCollection(name: string): Promise<Collection>;
|
|
76
|
+
duplicateCollection(sourceId: string, newName: string): Promise<Collection>;
|
|
76
77
|
saveCollection(collection: Collection): Promise<void>;
|
|
77
78
|
deleteCollection(id: string): Promise<boolean>;
|
|
78
79
|
renameCollection(id: string, newName: string): Promise<boolean>;
|
|
@@ -91,6 +92,7 @@ export interface IRequestManager {
|
|
|
91
92
|
*/
|
|
92
93
|
export interface IFolderManager {
|
|
93
94
|
createFolder(options: CreateFolderOptions): Promise<CollectionItem>;
|
|
95
|
+
duplicateFolder(collectionId: string, folderId: string, newName: string): Promise<CollectionItem>;
|
|
94
96
|
deleteFolder(collectionId: string, folderId: string): Promise<boolean>;
|
|
95
97
|
renameFolder(collectionId: string, folderId: string, newName: string): Promise<boolean>;
|
|
96
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Headless HTTP testing engine with Postman collection support, dynamic variables, and script-based automation.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application DTOs
|
|
3
|
-
*
|
|
4
|
-
* Data Transfer Objects decouple use-case inputs/outputs
|
|
5
|
-
* from domain internals and infrastructure types.
|
|
6
|
-
*/
|
|
7
|
-
export type { CreateRequestInput, UpdateRequestInput, DeleteRequestInput, ListRequestsInput, GetCollectionInput, ExecuteRequestInput, LoadCollectionInput, SaveCollectionInput, ExportCollectionInput, GetRequestSchemaInput, ExportFormat, } from './request-dtos';
|
|
8
|
-
export type { RequestSummaryDto, RequestDetailDto, CollectionSummaryDto, CollectionDetailDto, CollectionItemDto, ScriptResultDto, AssertionResultDto, ExecuteRequestOutput, RequestSchemaOutput, CreateRequestOutput, UpdateRequestOutput, DeleteRequestOutput, SaveCollectionOutput, ExportCollectionOutput, LoadCollectionOutput, ListRequestsOutput, GetCollectionOutput, } from './response-dtos';
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application DTOs — Request Input Types
|
|
3
|
-
*
|
|
4
|
-
* Standardized input objects for all use-cases.
|
|
5
|
-
* These decouple the public API from internal domain types.
|
|
6
|
-
*/
|
|
7
|
-
import { BodySchemaDefinition, KeyValueEntry, PathParamEntry, RequestBody, RequestScripts, RequestSettings, ResponseSchemaDefinition } from '../../types/types';
|
|
8
|
-
export interface CreateRequestInput {
|
|
9
|
-
collectionId: string;
|
|
10
|
-
name: string;
|
|
11
|
-
method: string;
|
|
12
|
-
url: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
/** Headers with enabled/disabled flag */
|
|
15
|
-
headers?: KeyValueEntry[];
|
|
16
|
-
/** Query parameters with enabled/disabled flag */
|
|
17
|
-
query?: KeyValueEntry[];
|
|
18
|
-
/** Path parameters */
|
|
19
|
-
params?: Record<string, string | PathParamEntry>;
|
|
20
|
-
/** Request body - supports raw, form-data, url-encoded, graphql, binary, or none */
|
|
21
|
-
body?: RequestBody;
|
|
22
|
-
/** Content-Type override */
|
|
23
|
-
bodyContentType?: string;
|
|
24
|
-
/** Request-level settings */
|
|
25
|
-
settings?: RequestSettings;
|
|
26
|
-
/** Request scripts (pre/post) */
|
|
27
|
-
scripts?: RequestScripts;
|
|
28
|
-
/** Authentication config (basic, bearer, apikey - no oauth2 at collection level) */
|
|
29
|
-
auth?: any;
|
|
30
|
-
/** Mark as disabled */
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
/** Mark as deprecated */
|
|
33
|
-
deprecated?: boolean;
|
|
34
|
-
/** Response schema */
|
|
35
|
-
responseSchema?: ResponseSchemaDefinition;
|
|
36
|
-
/** Body schema */
|
|
37
|
-
bodySchema?: BodySchemaDefinition;
|
|
38
|
-
}
|
|
39
|
-
export interface UpdateRequestInput {
|
|
40
|
-
collectionId: string;
|
|
41
|
-
requestId: string;
|
|
42
|
-
name?: string;
|
|
43
|
-
method?: string;
|
|
44
|
-
url?: string;
|
|
45
|
-
description?: string;
|
|
46
|
-
/** Headers with enabled/disabled flag */
|
|
47
|
-
headers?: KeyValueEntry[];
|
|
48
|
-
/** Query parameters with enabled/disabled flag */
|
|
49
|
-
query?: KeyValueEntry[];
|
|
50
|
-
/** Path parameters */
|
|
51
|
-
params?: Record<string, string | PathParamEntry>;
|
|
52
|
-
/** Request body - supports raw, form-data, url-encoded, graphql, binary, or none */
|
|
53
|
-
body?: RequestBody;
|
|
54
|
-
/** Content-Type override */
|
|
55
|
-
bodyContentType?: string;
|
|
56
|
-
/** Request-level settings */
|
|
57
|
-
settings?: RequestSettings;
|
|
58
|
-
/** Request scripts (pre/post) */
|
|
59
|
-
scripts?: RequestScripts;
|
|
60
|
-
/** Authentication config (basic, bearer, apikey - no oauth2 at collection level) */
|
|
61
|
-
auth?: any;
|
|
62
|
-
/** Mark as disabled */
|
|
63
|
-
disabled?: boolean;
|
|
64
|
-
/** Mark as deprecated */
|
|
65
|
-
deprecated?: boolean;
|
|
66
|
-
/** Response schema */
|
|
67
|
-
responseSchema?: ResponseSchemaDefinition;
|
|
68
|
-
/** Body schema */
|
|
69
|
-
bodySchema?: BodySchemaDefinition;
|
|
70
|
-
}
|
|
71
|
-
export interface DeleteRequestInput {
|
|
72
|
-
collectionId: string;
|
|
73
|
-
requestId: string;
|
|
74
|
-
}
|
|
75
|
-
export interface ListRequestsInput {
|
|
76
|
-
collectionId: string;
|
|
77
|
-
}
|
|
78
|
-
export interface GetCollectionInput {
|
|
79
|
-
collectionId: string;
|
|
80
|
-
}
|
|
81
|
-
export interface ExecuteRequestInput {
|
|
82
|
-
collectionId: string;
|
|
83
|
-
requestId: string;
|
|
84
|
-
overrides?: {
|
|
85
|
-
variables?: Record<string, any>;
|
|
86
|
-
environment?: Record<string, any>;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export interface LoadCollectionInput {
|
|
90
|
-
filePath: string;
|
|
91
|
-
}
|
|
92
|
-
export interface SaveCollectionInput {
|
|
93
|
-
filePath: string;
|
|
94
|
-
collectionId: string;
|
|
95
|
-
}
|
|
96
|
-
export type ExportFormat = 'postman' | 'openapi';
|
|
97
|
-
export interface ExportCollectionInput {
|
|
98
|
-
collectionId: string;
|
|
99
|
-
format: ExportFormat;
|
|
100
|
-
outputPath: string;
|
|
101
|
-
}
|
|
102
|
-
export interface GetRequestSchemaInput {
|
|
103
|
-
collectionId: string;
|
|
104
|
-
requestId: string;
|
|
105
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application DTOs — Response Output Types
|
|
3
|
-
*
|
|
4
|
-
* Standardized output objects for all use-cases.
|
|
5
|
-
* These shield consumers from internal domain model changes.
|
|
6
|
-
*/
|
|
7
|
-
import { BodySchemaDefinition, KeyValueEntry, RequestBody, RequestScripts, RequestSettings, ResponseSchemaDefinition } from '../../types/types';
|
|
8
|
-
export interface RequestSummaryDto {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
method: string;
|
|
12
|
-
url: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
deprecated?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface RequestDetailDto {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
method: string;
|
|
21
|
-
url: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
/** Headers with per-header enabled/disabled flag */
|
|
24
|
-
headers: KeyValueEntry[];
|
|
25
|
-
/** Query parameters with per-item enabled/disabled flag */
|
|
26
|
-
query: KeyValueEntry[];
|
|
27
|
-
body?: RequestBody;
|
|
28
|
-
bodyContentType?: string;
|
|
29
|
-
auth?: any;
|
|
30
|
-
settings?: RequestSettings;
|
|
31
|
-
scripts?: RequestScripts;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
deprecated?: boolean;
|
|
34
|
-
responseSchema?: ResponseSchemaDefinition;
|
|
35
|
-
bodySchema?: BodySchemaDefinition;
|
|
36
|
-
hasPreScript: boolean;
|
|
37
|
-
hasPostScript: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface CollectionSummaryDto {
|
|
40
|
-
id: string;
|
|
41
|
-
name: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
requestCount: number;
|
|
44
|
-
folderCount: number;
|
|
45
|
-
}
|
|
46
|
-
export interface CollectionItemDto {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
type: 'request' | 'folder';
|
|
50
|
-
method?: string;
|
|
51
|
-
url?: string;
|
|
52
|
-
childCount?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface CollectionDetailDto {
|
|
55
|
-
id: string;
|
|
56
|
-
name: string;
|
|
57
|
-
description?: string;
|
|
58
|
-
items: CollectionItemDto[];
|
|
59
|
-
requestCount: number;
|
|
60
|
-
folderCount: number;
|
|
61
|
-
meta?: Record<string, any>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Full Collection Detail with all nested request/folder metadata
|
|
65
|
-
* Used by LoadCollectionUseCase to return COMPLETE data (not filtered)
|
|
66
|
-
*/
|
|
67
|
-
export interface CollectionFullDetailDto {
|
|
68
|
-
id: string;
|
|
69
|
-
name: string;
|
|
70
|
-
description?: string;
|
|
71
|
-
/** Full nested structure with all request/folder metadata preserved */
|
|
72
|
-
items: (CollectionFullItemDto)[];
|
|
73
|
-
variables?: Record<string, string>;
|
|
74
|
-
auth?: any;
|
|
75
|
-
scripts?: RequestScripts;
|
|
76
|
-
meta?: Record<string, any>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Full collection item (request or folder) with ALL metadata
|
|
80
|
-
*/
|
|
81
|
-
export type CollectionFullItemDto = CollectionFullRequestDto | CollectionFullFolderDto;
|
|
82
|
-
/**
|
|
83
|
-
* Full request DTO with all fields preserved (headers, query, body, scripts, etc.)
|
|
84
|
-
*/
|
|
85
|
-
export interface CollectionFullRequestDto {
|
|
86
|
-
type: 'request';
|
|
87
|
-
id: string;
|
|
88
|
-
name: string;
|
|
89
|
-
method: string;
|
|
90
|
-
url: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
headers: KeyValueEntry[];
|
|
93
|
-
query: KeyValueEntry[];
|
|
94
|
-
body?: RequestBody;
|
|
95
|
-
bodyContentType?: string;
|
|
96
|
-
auth?: any;
|
|
97
|
-
settings?: RequestSettings;
|
|
98
|
-
scripts?: RequestScripts;
|
|
99
|
-
disabled?: boolean;
|
|
100
|
-
deprecated?: boolean;
|
|
101
|
-
responseSchema?: ResponseSchemaDefinition;
|
|
102
|
-
bodySchema?: BodySchemaDefinition;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Full folder DTO with nested items preserved
|
|
106
|
-
*/
|
|
107
|
-
export interface CollectionFullFolderDto {
|
|
108
|
-
type: 'folder';
|
|
109
|
-
id: string;
|
|
110
|
-
name: string;
|
|
111
|
-
description?: string;
|
|
112
|
-
auth?: any;
|
|
113
|
-
scripts?: RequestScripts;
|
|
114
|
-
items: (CollectionFullItemDto)[];
|
|
115
|
-
}
|
|
116
|
-
export interface ScriptResultDto {
|
|
117
|
-
success: boolean;
|
|
118
|
-
output?: any;
|
|
119
|
-
errors: string[];
|
|
120
|
-
}
|
|
121
|
-
export interface AssertionResultDto {
|
|
122
|
-
name: string;
|
|
123
|
-
passed: boolean;
|
|
124
|
-
expected?: any;
|
|
125
|
-
actual?: any;
|
|
126
|
-
message?: string;
|
|
127
|
-
}
|
|
128
|
-
export interface ExecuteRequestOutput {
|
|
129
|
-
requestId: string;
|
|
130
|
-
status: 'success' | 'failed' | 'partial';
|
|
131
|
-
duration: number;
|
|
132
|
-
response: {
|
|
133
|
-
status: number;
|
|
134
|
-
statusText: string;
|
|
135
|
-
headers: Record<string, string | string[]>;
|
|
136
|
-
bodySize?: number;
|
|
137
|
-
};
|
|
138
|
-
preScriptResult?: ScriptResultDto;
|
|
139
|
-
postScriptResult?: ScriptResultDto & {
|
|
140
|
-
assertions?: AssertionResultDto[];
|
|
141
|
-
};
|
|
142
|
-
variableChanges?: Record<string, any>;
|
|
143
|
-
error?: string;
|
|
144
|
-
}
|
|
145
|
-
export interface RequestSchemaOutput {
|
|
146
|
-
requestId: string;
|
|
147
|
-
schema: any;
|
|
148
|
-
sources: ('user' | 'history' | 'script')[];
|
|
149
|
-
confidence: 'high' | 'medium' | 'low';
|
|
150
|
-
}
|
|
151
|
-
export interface CreateRequestOutput {
|
|
152
|
-
request: RequestDetailDto;
|
|
153
|
-
}
|
|
154
|
-
export interface UpdateRequestOutput {
|
|
155
|
-
request: RequestDetailDto;
|
|
156
|
-
}
|
|
157
|
-
export interface DeleteRequestOutput {
|
|
158
|
-
requestId: string;
|
|
159
|
-
collectionId: string;
|
|
160
|
-
deletedAt: string;
|
|
161
|
-
}
|
|
162
|
-
export interface SaveCollectionOutput {
|
|
163
|
-
filePath: string;
|
|
164
|
-
collectionName: string;
|
|
165
|
-
savedAt: string;
|
|
166
|
-
}
|
|
167
|
-
export interface ExportCollectionOutput {
|
|
168
|
-
collectionId: string;
|
|
169
|
-
format: string;
|
|
170
|
-
outputPath: string;
|
|
171
|
-
exportedAt: string;
|
|
172
|
-
}
|
|
173
|
-
export interface LoadCollectionOutput {
|
|
174
|
-
/** Full collection with ALL nested metadata preserved */
|
|
175
|
-
collection: CollectionFullDetailDto;
|
|
176
|
-
loadedFrom: string;
|
|
177
|
-
}
|
|
178
|
-
export interface ListRequestsOutput {
|
|
179
|
-
collectionId: string;
|
|
180
|
-
requests: RequestSummaryDto[];
|
|
181
|
-
total: number;
|
|
182
|
-
}
|
|
183
|
-
export interface GetCollectionOutput {
|
|
184
|
-
collection: CollectionDetailDto;
|
|
185
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application Events
|
|
3
|
-
*
|
|
4
|
-
* Higher-level events published by use-cases to notify the outer system
|
|
5
|
-
* (e.g. VS Code extension, CLI) about completed operations.
|
|
6
|
-
*
|
|
7
|
-
* These are distinct from domain events:
|
|
8
|
-
* - Domain events: model business invariants (RequestExecutedEvent, VariableUpdatedEvent)
|
|
9
|
-
* - Application events: notify about user actions (RequestCreatedEvent, CollectionExportedEvent)
|
|
10
|
-
*/
|
|
11
|
-
import { DomainEvent } from '../../domain/services/domain-events';
|
|
12
|
-
export declare class RequestCreatedEvent extends DomainEvent {
|
|
13
|
-
readonly collectionId: string;
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly method: string;
|
|
16
|
-
readonly url: string;
|
|
17
|
-
constructor(requestId: string, collectionId: string, name: string, method: string, url: string);
|
|
18
|
-
}
|
|
19
|
-
export declare class RequestUpdatedEvent extends DomainEvent {
|
|
20
|
-
readonly collectionId: string;
|
|
21
|
-
readonly changes: string[];
|
|
22
|
-
constructor(requestId: string, collectionId: string, changes: string[]);
|
|
23
|
-
}
|
|
24
|
-
export declare class RequestDeletedEvent extends DomainEvent {
|
|
25
|
-
readonly collectionId: string;
|
|
26
|
-
constructor(requestId: string, collectionId: string);
|
|
27
|
-
}
|
|
28
|
-
export declare class CollectionLoadedEvent extends DomainEvent {
|
|
29
|
-
readonly name: string;
|
|
30
|
-
readonly source: string;
|
|
31
|
-
readonly requestCount: number;
|
|
32
|
-
constructor(collectionId: string, name: string, source: string, // file path or identifier
|
|
33
|
-
requestCount: number);
|
|
34
|
-
}
|
|
35
|
-
export declare class CollectionSavedEvent extends DomainEvent {
|
|
36
|
-
readonly name: string;
|
|
37
|
-
readonly filePath: string;
|
|
38
|
-
constructor(collectionId: string, name: string, filePath: string);
|
|
39
|
-
}
|
|
40
|
-
export declare class CollectionExportedEvent extends DomainEvent {
|
|
41
|
-
readonly format: string;
|
|
42
|
-
readonly outputPath: string;
|
|
43
|
-
constructor(collectionId: string, format: string, outputPath: string);
|
|
44
|
-
}
|
|
45
|
-
export declare const ApplicationEventTypes: {
|
|
46
|
-
readonly REQUEST_CREATED: "REQUEST_CREATED";
|
|
47
|
-
readonly REQUEST_UPDATED: "REQUEST_UPDATED";
|
|
48
|
-
readonly REQUEST_DELETED: "REQUEST_DELETED";
|
|
49
|
-
readonly COLLECTION_LOADED: "COLLECTION_LOADED";
|
|
50
|
-
readonly COLLECTION_SAVED: "COLLECTION_SAVED";
|
|
51
|
-
readonly COLLECTION_EXPORTED: "COLLECTION_EXPORTED";
|
|
52
|
-
};
|
|
53
|
-
export type ApplicationEventType = typeof ApplicationEventTypes[keyof typeof ApplicationEventTypes];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application Events
|
|
3
|
-
*
|
|
4
|
-
* Events published by use-cases to notify about completed user actions.
|
|
5
|
-
*/
|
|
6
|
-
export { RequestCreatedEvent, RequestUpdatedEvent, RequestDeletedEvent, CollectionLoadedEvent, CollectionSavedEvent, CollectionExportedEvent, ApplicationEventTypes, type ApplicationEventType, } from './application-events';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application Layer - Use Cases and Queries
|
|
3
|
-
*
|
|
4
|
-
* Contains:
|
|
5
|
-
* - Use Cases (commands that modify state)
|
|
6
|
-
* - Queries (read-only operations)
|
|
7
|
-
* - Data Transfer Objects (DTOs)
|
|
8
|
-
* - Application Events
|
|
9
|
-
* - Mappers (domain ↔ DTO conversion)
|
|
10
|
-
*
|
|
11
|
-
* Constraints:
|
|
12
|
-
* - Depends on Domain and Ports layers
|
|
13
|
-
* - Orchestrates between Domain and Infrastructure
|
|
14
|
-
* - Never directly depends on Infrastructure implementations
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* - Called by controllers/handlers
|
|
18
|
-
* - Uses repositories and executors from ports
|
|
19
|
-
* - Publishes domain events
|
|
20
|
-
*/
|
|
21
|
-
export * from './use-cases';
|
|
22
|
-
export * from './queries';
|
|
23
|
-
export * from './dto';
|
|
24
|
-
export * from './events';
|
|
25
|
-
export * from './mappers';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CollectionMapper
|
|
3
|
-
*
|
|
4
|
-
* Maps between UnifiedCollection (domain/infrastructure type) and
|
|
5
|
-
* application-layer DTOs (CollectionDetailDto, CollectionSummaryDto, CollectionFullDetailDto).
|
|
6
|
-
*
|
|
7
|
-
* Provides two mapping strategies:
|
|
8
|
-
* - toDetail() / toSummary() - Filtered summaries for list/UI views
|
|
9
|
-
* - toFullDetail() - Complete metadata for full collection operations (load, edit)
|
|
10
|
-
*/
|
|
11
|
-
import { UnifiedCollection } from '../../types/types';
|
|
12
|
-
import { CollectionDetailDto, CollectionFullDetailDto, CollectionSummaryDto } from '../dto/response-dtos';
|
|
13
|
-
export declare class CollectionMapper {
|
|
14
|
-
/**
|
|
15
|
-
* Map domain collection to a summary DTO
|
|
16
|
-
*/
|
|
17
|
-
static toSummary(collection: UnifiedCollection): CollectionSummaryDto;
|
|
18
|
-
/**
|
|
19
|
-
* Map domain collection to a full detail DTO
|
|
20
|
-
*/
|
|
21
|
-
static toDetail(collection: UnifiedCollection): CollectionDetailDto;
|
|
22
|
-
/**
|
|
23
|
-
* Map domain collection to a full detail DTO (preserves ALL metadata)
|
|
24
|
-
* Used by LoadCollectionUseCase to return complete collection with all fields
|
|
25
|
-
*/
|
|
26
|
-
static toFullDetail(collection: UnifiedCollection): CollectionFullDetailDto;
|
|
27
|
-
/**
|
|
28
|
-
* Map top-level items to full detail items (preserves ALL metadata per request/folder)
|
|
29
|
-
*/
|
|
30
|
-
private static toFullItems;
|
|
31
|
-
/**
|
|
32
|
-
* Map top-level items to flat CollectionItemDto list
|
|
33
|
-
*/
|
|
34
|
-
private static mapItems;
|
|
35
|
-
/**
|
|
36
|
-
* Recursively count requests and folders
|
|
37
|
-
*/
|
|
38
|
-
private static countItems;
|
|
39
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ExecutionResultMapper
|
|
3
|
-
*
|
|
4
|
-
* Maps between IExecutionResult (domain model) and
|
|
5
|
-
* ExecuteRequestOutput (application DTO).
|
|
6
|
-
*/
|
|
7
|
-
import { IExecutionResult } from '../../domain/models/execution';
|
|
8
|
-
import { ExecuteRequestOutput } from '../dto/response-dtos';
|
|
9
|
-
export declare class ExecutionResultMapper {
|
|
10
|
-
/**
|
|
11
|
-
* Map domain execution result to application-layer output DTO
|
|
12
|
-
*/
|
|
13
|
-
static toOutput(result: IExecutionResult): ExecuteRequestOutput;
|
|
14
|
-
private static mapScriptResult;
|
|
15
|
-
private static mapAssertion;
|
|
16
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Application Mappers
|
|
3
|
-
*
|
|
4
|
-
* Convert between domain types and application DTOs.
|
|
5
|
-
* Mappers formalize the boundary between layers.
|
|
6
|
-
*/
|
|
7
|
-
export { RequestMapper } from './request-mapper';
|
|
8
|
-
export { CollectionMapper } from './collection-mapper';
|
|
9
|
-
export { ExecutionResultMapper } from './execution-result-mapper';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RequestMapper
|
|
3
|
-
*
|
|
4
|
-
* Maps between UnifiedRequest (domain/infrastructure type) and
|
|
5
|
-
* application-layer DTOs (RequestDetailDto, RequestSummaryDto).
|
|
6
|
-
*
|
|
7
|
-
* Preserves all metadata including enabled/disabled flags and schemas.
|
|
8
|
-
*/
|
|
9
|
-
import { UnifiedRequest } from '../../types/types';
|
|
10
|
-
import { RequestDetailDto, RequestSummaryDto } from '../dto/response-dtos';
|
|
11
|
-
export declare class RequestMapper {
|
|
12
|
-
/**
|
|
13
|
-
* Map domain request to a lightweight summary DTO
|
|
14
|
-
*/
|
|
15
|
-
static toSummary(request: UnifiedRequest): RequestSummaryDto;
|
|
16
|
-
/**
|
|
17
|
-
* Map domain request to a full detail DTO
|
|
18
|
-
* PRESERVES all metadata including enabled/disabled headers and schemas
|
|
19
|
-
*/
|
|
20
|
-
static toDetail(request: UnifiedRequest): RequestDetailDto;
|
|
21
|
-
/**
|
|
22
|
-
* Map multiple requests to summaries
|
|
23
|
-
*/
|
|
24
|
-
static toSummaryList(requests: UnifiedRequest[]): RequestSummaryDto[];
|
|
25
|
-
/**
|
|
26
|
-
* Map multiple requests to details
|
|
27
|
-
*/
|
|
28
|
-
static toDetailList(requests: UnifiedRequest[]): RequestDetailDto[];
|
|
29
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get Request Schema Query
|
|
3
|
-
*
|
|
4
|
-
* Retrieves inferred response schema for a request
|
|
5
|
-
* Merges information from: user definition, history, script hints
|
|
6
|
-
*/
|
|
7
|
-
import { IRequestRepository } from '../../ports/repositories/request-repository.interface';
|
|
8
|
-
import { IHistoryLoader } from '../../ports/storage/history-loader.interface';
|
|
9
|
-
import { ResponseSchema } from '../../domain/services/schema-inference.domain-service';
|
|
10
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
11
|
-
/**
|
|
12
|
-
* Query: Get request response schema
|
|
13
|
-
*/
|
|
14
|
-
export declare class GetRequestSchemaQuery {
|
|
15
|
-
private requestRepository;
|
|
16
|
-
private historyLoader;
|
|
17
|
-
private logger;
|
|
18
|
-
private schemaInference;
|
|
19
|
-
constructor(requestRepository: IRequestRepository, historyLoader: IHistoryLoader, logger: ILogger);
|
|
20
|
-
/**
|
|
21
|
-
* Get combined response schema for a request
|
|
22
|
-
*/
|
|
23
|
-
execute(collectionId: string, requestId: string): Promise<ResponseSchema>;
|
|
24
|
-
/**
|
|
25
|
-
* Infer schema from historical responses
|
|
26
|
-
*/
|
|
27
|
-
private inferFromHistory;
|
|
28
|
-
/**
|
|
29
|
-
* Extract property hints from post-response script
|
|
30
|
-
*/
|
|
31
|
-
private extractScriptHints;
|
|
32
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create Request Use Case
|
|
3
|
-
*
|
|
4
|
-
* Creates a new HTTP request in a collection
|
|
5
|
-
* Supports full request metadata including enabled/disabled headers, schemas, etc.
|
|
6
|
-
*/
|
|
7
|
-
import { IDomainEventPublisher } from '../../domain/services/domain-events';
|
|
8
|
-
import { ILogger } from '../../ports/external/logger.interface';
|
|
9
|
-
import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
|
|
10
|
-
import { CreateRequestInput } from '../dto/request-dtos';
|
|
11
|
-
import { CreateRequestOutput } from '../dto/response-dtos';
|
|
12
|
-
export type { CreateRequestInput } from '../dto/request-dtos';
|
|
13
|
-
/**
|
|
14
|
-
* Use Case: Create a new request in collection
|
|
15
|
-
*/
|
|
16
|
-
export declare class CreateRequestUseCase {
|
|
17
|
-
private collectionRepository;
|
|
18
|
-
private eventPublisher;
|
|
19
|
-
private logger;
|
|
20
|
-
constructor(collectionRepository: ICollectionRepository, eventPublisher: IDomainEventPublisher, logger: ILogger);
|
|
21
|
-
execute(input: CreateRequestInput): Promise<CreateRequestOutput>;
|
|
22
|
-
private generateId;
|
|
23
|
-
}
|