@http-forge/core 0.2.1 → 0.2.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.
Files changed (165) hide show
  1. package/dist/application/dto/index.d.ts +8 -0
  2. package/dist/application/dto/request-dtos.d.ts +105 -0
  3. package/dist/application/dto/response-dtos.d.ts +185 -0
  4. package/dist/application/events/application-events.d.ts +53 -0
  5. package/dist/application/events/index.d.ts +6 -0
  6. package/dist/application/index.d.ts +25 -0
  7. package/dist/application/mappers/collection-mapper.d.ts +39 -0
  8. package/dist/application/mappers/execution-result-mapper.d.ts +16 -0
  9. package/dist/application/mappers/index.d.ts +9 -0
  10. package/dist/application/mappers/request-mapper.d.ts +29 -0
  11. package/dist/application/queries/get-request-schema.query.d.ts +32 -0
  12. package/dist/application/queries/index.d.ts +6 -0
  13. package/dist/application/use-cases/create-request.use-case.d.ts +23 -0
  14. package/dist/application/use-cases/delete-request.use-case.d.ts +15 -0
  15. package/dist/application/use-cases/execute-request.use-case.d.ts +46 -0
  16. package/dist/application/use-cases/export-collection.use-case.d.ts +22 -0
  17. package/dist/application/use-cases/get-collection.use-case.d.ts +13 -0
  18. package/dist/application/use-cases/index.d.ts +12 -0
  19. package/dist/application/use-cases/list-requests.use-case.d.ts +14 -0
  20. package/dist/application/use-cases/load-collection.use-case.d.ts +30 -0
  21. package/dist/application/use-cases/save-collection.use-case.d.ts +25 -0
  22. package/dist/application/use-cases/update-request.use-case.d.ts +17 -0
  23. package/dist/container.d.ts +30 -13
  24. package/dist/di/index.d.ts +8 -0
  25. package/dist/di/platform-adapters.d.ts +14 -1
  26. package/dist/di/service-container.d.ts +12 -12
  27. package/dist/di/service-identifiers.d.ts +1 -1
  28. package/dist/domain/errors/domain-errors.d.ts +52 -0
  29. package/dist/domain/errors/index.d.ts +4 -0
  30. package/dist/domain/index.d.ts +24 -0
  31. package/dist/domain/models/execution.d.ts +88 -0
  32. package/dist/domain/models/index.d.ts +4 -0
  33. package/dist/domain/services/domain-events.d.ts +60 -0
  34. package/dist/domain/services/execution-planner.domain-service.d.ts +40 -0
  35. package/dist/domain/services/index.d.ts +9 -0
  36. package/dist/domain/services/schema-inference.domain-service.d.ts +54 -0
  37. package/dist/domain/value-objects/entity-id.d.ts +26 -0
  38. package/dist/domain/value-objects/http-method.d.ts +30 -0
  39. package/dist/domain/value-objects/index.d.ts +9 -0
  40. package/dist/domain/value-objects/request-url.d.ts +28 -0
  41. package/dist/index.d.ts +86 -86
  42. package/dist/index.js +111 -111
  43. package/dist/index.mjs +117 -117
  44. package/dist/infrastructure/adapters/index.d.ts +5 -0
  45. package/dist/infrastructure/adapters/logger.adapter.d.ts +25 -0
  46. package/dist/infrastructure/adapters/node-file-system.adapter.d.ts +18 -0
  47. package/dist/{auth → infrastructure/auth}/interfaces.d.ts +1 -1
  48. package/dist/{auth → infrastructure/auth}/oauth2-token-manager.d.ts +3 -3
  49. package/dist/{collection → infrastructure/collection}/collection-loader.d.ts +3 -3
  50. package/dist/{collection → infrastructure/collection}/collection-service.d.ts +2 -2
  51. package/dist/{collection → infrastructure/collection}/collection-store.d.ts +2 -2
  52. package/dist/{collection → infrastructure/collection}/folder-collection-loader.d.ts +2 -2
  53. package/dist/{collection → infrastructure/collection}/folder-collection-store.d.ts +1 -1
  54. package/dist/{collection → infrastructure/collection}/folder-io.d.ts +1 -1
  55. package/dist/{collection → infrastructure/collection}/json-collection-loader.d.ts +1 -1
  56. package/dist/{collection → infrastructure/collection}/parser-registry.d.ts +1 -1
  57. package/dist/{config → infrastructure/config}/config-service.d.ts +1 -1
  58. package/dist/{cookie → infrastructure/cookie}/cookie-service.d.ts +1 -1
  59. package/dist/infrastructure/di/complete-bootstrap.d.ts +24 -0
  60. package/dist/infrastructure/di/index.d.ts +6 -0
  61. package/dist/infrastructure/di/infrastructure-di-config.d.ts +33 -0
  62. package/dist/infrastructure/di/simple-event-publisher.d.ts +17 -0
  63. package/dist/{environment → infrastructure/environment}/environment-config-service.d.ts +2 -2
  64. package/dist/{environment → infrastructure/environment}/environment-resolver.d.ts +1 -1
  65. package/dist/{environment → infrastructure/environment}/forge-env.d.ts +1 -1
  66. package/dist/{environment → infrastructure/environment}/variable-interpolator.d.ts +1 -1
  67. package/dist/{execution → infrastructure/execution}/collection-request-executor-interfaces.d.ts +1 -1
  68. package/dist/{execution → infrastructure/execution}/collection-request-executor.d.ts +2 -2
  69. package/dist/{execution → infrastructure/execution}/request-executor.d.ts +2 -2
  70. package/dist/{execution → infrastructure/execution}/request-preparer-interfaces.d.ts +2 -2
  71. package/dist/{execution → infrastructure/execution}/request-preparer.d.ts +3 -3
  72. package/dist/{graphql → infrastructure/graphql}/graphql-schema-service.d.ts +1 -1
  73. package/dist/{history → infrastructure/history}/history-interfaces.d.ts +1 -1
  74. package/dist/{history → infrastructure/history}/request-history.d.ts +1 -1
  75. package/dist/{http → infrastructure/http}/fetch-http-client.d.ts +2 -2
  76. package/dist/{http → infrastructure/http}/http-request-service.d.ts +2 -2
  77. package/dist/infrastructure/http/index.d.ts +4 -0
  78. package/dist/{http → infrastructure/http}/interceptor-chain.d.ts +1 -1
  79. package/dist/{http → infrastructure/http}/interfaces.d.ts +1 -1
  80. package/dist/{http → infrastructure/http}/merge-request-settings.d.ts +1 -1
  81. package/dist/{http → infrastructure/http}/native-http-client.d.ts +2 -2
  82. package/dist/infrastructure/http/node-http-executor.adapter.d.ts +25 -0
  83. package/dist/{http → infrastructure/http}/request-preprocessor.d.ts +1 -1
  84. package/dist/{import-export → infrastructure/import-export}/import-postman-environment.d.ts +3 -3
  85. package/dist/{import-export → infrastructure/import-export}/rest-client-export.d.ts +3 -3
  86. package/dist/infrastructure/index.d.ts +31 -0
  87. package/dist/{openapi → infrastructure/openapi}/example-generator.d.ts +1 -1
  88. package/dist/{openapi → infrastructure/openapi}/history-analyzer.d.ts +1 -1
  89. package/dist/{openapi → infrastructure/openapi}/interfaces.d.ts +2 -2
  90. package/dist/{openapi → infrastructure/openapi}/openapi-exporter.d.ts +2 -2
  91. package/dist/{openapi → infrastructure/openapi}/openapi-importer.d.ts +2 -2
  92. package/dist/{openapi → infrastructure/openapi}/schema-inference-service.d.ts +1 -1
  93. package/dist/{openapi → infrastructure/openapi}/schema-inferrer.d.ts +1 -1
  94. package/dist/infrastructure/parsers/collection-parser.adapter.d.ts +32 -0
  95. package/dist/{parsers → infrastructure/parsers}/http-forge-parser.d.ts +2 -2
  96. package/dist/infrastructure/parsers/index.d.ts +7 -0
  97. package/dist/infrastructure/persistence/file-system-history-loader.d.ts +31 -0
  98. package/dist/infrastructure/persistence/index.d.ts +6 -0
  99. package/dist/{platform → infrastructure/platform}/node-file-system.d.ts +1 -1
  100. package/dist/infrastructure/repositories/file-system/fs-collection-repository.d.ts +72 -0
  101. package/dist/infrastructure/repositories/file-system/fs-environment-file-loader.adapter.d.ts +41 -0
  102. package/dist/infrastructure/repositories/file-system/fs-environment-repository.d.ts +34 -0
  103. package/dist/infrastructure/repositories/file-system/fs-request-repository.d.ts +31 -0
  104. package/dist/infrastructure/repositories/file-system/index.d.ts +7 -0
  105. package/dist/infrastructure/repositories/in-memory/in-memory-collection-repository.d.ts +18 -0
  106. package/dist/infrastructure/repositories/in-memory/in-memory-environment-repository.d.ts +25 -0
  107. package/dist/infrastructure/repositories/in-memory/in-memory-request-repository.d.ts +25 -0
  108. package/dist/infrastructure/repositories/in-memory/index.d.ts +7 -0
  109. package/dist/infrastructure/script/index.d.ts +4 -0
  110. package/dist/{script → infrastructure/script}/interfaces.d.ts +1 -1
  111. package/dist/{script → infrastructure/script}/script-utils.d.ts +1 -1
  112. package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +19 -0
  113. package/dist/{test-suite → infrastructure/test-suite}/result-storage-service.d.ts +1 -1
  114. package/dist/{test-suite → infrastructure/test-suite}/result-storage.d.ts +1 -1
  115. package/dist/{test-suite → infrastructure/test-suite}/test-suite-service.d.ts +1 -1
  116. package/dist/{test-suite → infrastructure/test-suite}/test-suite-store.d.ts +1 -1
  117. package/dist/ports/executors/http-executor.interface.d.ts +34 -0
  118. package/dist/ports/executors/index.d.ts +5 -0
  119. package/dist/ports/executors/script-executor.interface.d.ts +43 -0
  120. package/dist/ports/external/file-system.interface.d.ts +44 -0
  121. package/dist/ports/external/http-client.interface.d.ts +25 -0
  122. package/dist/ports/external/index.d.ts +7 -0
  123. package/dist/ports/external/logger.interface.d.ts +17 -0
  124. package/dist/ports/index.d.ts +17 -0
  125. package/dist/ports/parsers/collection-parser.interface.d.ts +23 -0
  126. package/dist/ports/parsers/index.d.ts +4 -0
  127. package/dist/ports/repositories/collection-repository.interface.d.ts +32 -0
  128. package/dist/ports/repositories/environment-repository.interface.d.ts +31 -0
  129. package/dist/ports/repositories/index.d.ts +6 -0
  130. package/dist/ports/repositories/request-repository.interface.d.ts +32 -0
  131. package/dist/ports/storage/cache-store.interface.d.ts +26 -0
  132. package/dist/ports/storage/history-loader.interface.d.ts +37 -0
  133. package/dist/ports/storage/index.d.ts +5 -0
  134. package/dist/{collection/collection-service-interfaces.d.ts → types/collection.d.ts} +19 -4
  135. package/dist/types/environment-config.d.ts +143 -0
  136. package/dist/types/types.d.ts +20 -7
  137. package/package.json +1 -1
  138. package/dist/collection/interfaces.d.ts +0 -32
  139. package/dist/parsers/index.d.ts +0 -6
  140. /package/dist/{collection → infrastructure/collection}/collection-loader-factory.d.ts +0 -0
  141. /package/dist/{config → infrastructure/config}/config.interface.d.ts +0 -0
  142. /package/dist/{config → infrastructure/config}/default-config.d.ts +0 -0
  143. /package/dist/{config → infrastructure/config}/index.d.ts +0 -0
  144. /package/dist/{cookie → infrastructure/cookie}/cookie-jar.d.ts +0 -0
  145. /package/dist/{cookie → infrastructure/cookie}/cookie-utils.d.ts +0 -0
  146. /package/dist/{cookie → infrastructure/cookie}/in-memory-cookie-jar.d.ts +0 -0
  147. /package/dist/{cookie → infrastructure/cookie}/interfaces.d.ts +0 -0
  148. /package/dist/{cookie → infrastructure/cookie}/persistent-cookie-jar.d.ts +0 -0
  149. /package/dist/{environment → infrastructure/environment}/environment-file-loader.d.ts +0 -0
  150. /package/dist/{environment → infrastructure/environment}/interfaces.d.ts +0 -0
  151. /package/dist/{graphql → infrastructure/graphql}/graphql-completion-provider.d.ts +0 -0
  152. /package/dist/{history → infrastructure/history}/request-history-service-interfaces.d.ts +0 -0
  153. /package/dist/{history → infrastructure/history}/request-history-service.d.ts +0 -0
  154. /package/dist/{http → infrastructure/http}/url-builder.d.ts +0 -0
  155. /package/dist/{openapi → infrastructure/openapi}/index.d.ts +0 -0
  156. /package/dist/{openapi → infrastructure/openapi}/ref-resolver.d.ts +0 -0
  157. /package/dist/{openapi → infrastructure/openapi}/script-analyzer.d.ts +0 -0
  158. /package/dist/{platform → infrastructure/platform}/data-file-parser.d.ts +0 -0
  159. /package/dist/{script → infrastructure/script}/module-loader.d.ts +0 -0
  160. /package/dist/{script → infrastructure/script}/request-script-session.d.ts +0 -0
  161. /package/dist/{script → infrastructure/script}/script-executor.d.ts +0 -0
  162. /package/dist/{script → infrastructure/script}/script-factories.d.ts +0 -0
  163. /package/dist/{test-suite → infrastructure/test-suite}/index.d.ts +0 -0
  164. /package/dist/{test-suite → infrastructure/test-suite}/interfaces.d.ts +0 -0
  165. /package/dist/{test-suite → infrastructure/test-suite}/statistics-service.d.ts +0 -0
@@ -0,0 +1,8 @@
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';
@@ -0,0 +1,105 @@
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
+ }
@@ -0,0 +1,185 @@
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
+ }
@@ -0,0 +1,53 @@
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];
@@ -0,0 +1,6 @@
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';
@@ -0,0 +1,25 @@
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';
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,9 @@
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';
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,32 @@
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
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Application Queries
3
+ *
4
+ * Read-only operations
5
+ */
6
+ export * from './get-request-schema.query';
@@ -0,0 +1,23 @@
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
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Delete Request Use Case
3
+ */
4
+ import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
5
+ import { ILogger } from '../../ports/external/logger.interface';
6
+ import { IDomainEventPublisher } from '../../domain/services/domain-events';
7
+ import { DeleteRequestInput } from '../dto/request-dtos';
8
+ import { DeleteRequestOutput } from '../dto/response-dtos';
9
+ export declare class DeleteRequestUseCase {
10
+ private collectionRepository;
11
+ private eventPublisher;
12
+ private logger;
13
+ constructor(collectionRepository: ICollectionRepository, eventPublisher: IDomainEventPublisher, logger: ILogger);
14
+ execute(input: DeleteRequestInput): Promise<DeleteRequestOutput>;
15
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Execute Request Use Case - Main business workflow
3
+ *
4
+ * Orchestrates:
5
+ * 1. Load request from repository
6
+ * 2. Prepare execution environment
7
+ * 3. Call domain services for planning
8
+ * 4. Execute HTTP request via infrastructure
9
+ * 5. Handle scripts and variable updates
10
+ * 6. Publish events
11
+ */
12
+ import { IRequestRepository } from '../../ports/repositories/request-repository.interface';
13
+ import { IEnvironmentRepository } from '../../ports/repositories/environment-repository.interface';
14
+ import { IHttpExecutor } from '../../ports/executors/http-executor.interface';
15
+ import { IScriptExecutor } from '../../ports/executors/script-executor.interface';
16
+ import { IDomainEventPublisher } from '../../domain/services/domain-events';
17
+ import { ILogger } from '../../ports/external/logger.interface';
18
+ import { ExecuteRequestInput } from '../dto/request-dtos';
19
+ import { ExecuteRequestOutput } from '../dto/response-dtos';
20
+ /**
21
+ * Options for request execution (backward compat alias)
22
+ */
23
+ export type ExecuteRequestOptions = ExecuteRequestInput;
24
+ /**
25
+ * Use Case: Execute a request
26
+ *
27
+ * This is the main business workflow
28
+ */
29
+ export declare class ExecuteRequestUseCase {
30
+ private requestRepository;
31
+ private environmentRepository;
32
+ private httpExecutor;
33
+ private scriptExecutor;
34
+ private eventPublisher;
35
+ private logger;
36
+ private planner;
37
+ constructor(requestRepository: IRequestRepository, environmentRepository: IEnvironmentRepository, httpExecutor: IHttpExecutor, scriptExecutor: IScriptExecutor, eventPublisher: IDomainEventPublisher, logger: ILogger);
38
+ /**
39
+ * Execute a request from a collection
40
+ */
41
+ execute(options: ExecuteRequestInput): Promise<ExecuteRequestOutput>;
42
+ /**
43
+ * Determine overall execution status
44
+ */
45
+ private determineStatus;
46
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Export Collection Use Case
3
+ */
4
+ import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
5
+ import { IFileSystem } from '../../ports/external/file-system.interface';
6
+ import { ILogger } from '../../ports/external/logger.interface';
7
+ import { IDomainEventPublisher } from '../../domain/services/domain-events';
8
+ import { ExportCollectionInput } from '../dto/request-dtos';
9
+ import { ExportCollectionOutput } from '../dto/response-dtos';
10
+ export type { ExportCollectionInput } from '../dto/request-dtos';
11
+ export declare class ExportCollectionUseCase {
12
+ private collectionRepository;
13
+ private fileSystem;
14
+ private eventPublisher;
15
+ private logger;
16
+ constructor(collectionRepository: ICollectionRepository, fileSystem: IFileSystem, eventPublisher: IDomainEventPublisher, logger: ILogger);
17
+ execute(input: ExportCollectionInput): Promise<ExportCollectionOutput>;
18
+ private toPostman;
19
+ private toOpenAPI;
20
+ private convertItems;
21
+ private extractPaths;
22
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Get Collection Use Case
3
+ */
4
+ import { ICollectionRepository } from '../../ports/repositories/collection-repository.interface';
5
+ import { ILogger } from '../../ports/external/logger.interface';
6
+ import { GetCollectionInput } from '../dto/request-dtos';
7
+ import { GetCollectionOutput } from '../dto/response-dtos';
8
+ export declare class GetCollectionUseCase {
9
+ private collectionRepository;
10
+ private logger;
11
+ constructor(collectionRepository: ICollectionRepository, logger: ILogger);
12
+ execute(input: GetCollectionInput): Promise<GetCollectionOutput>;
13
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Application Use Cases
3
+ */
4
+ export * from './execute-request.use-case';
5
+ export * from './load-collection.use-case';
6
+ export * from './save-collection.use-case';
7
+ export * from './create-request.use-case';
8
+ export * from './update-request.use-case';
9
+ export * from './delete-request.use-case';
10
+ export * from './list-requests.use-case';
11
+ export * from './get-collection.use-case';
12
+ export * from './export-collection.use-case';