@http-forge/core 0.1.0 → 0.2.0
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 +194 -41
- package/dist/auth/interfaces.d.ts +63 -0
- package/dist/auth/oauth2-token-manager.d.ts +103 -0
- package/dist/collection/collection-loader-factory.d.ts +20 -0
- package/dist/{services → collection}/collection-loader.d.ts +3 -3
- package/dist/collection/collection-service-interfaces.d.ts +119 -0
- package/dist/collection/collection-service.d.ts +75 -0
- package/dist/collection/collection-store.d.ts +109 -0
- package/dist/collection/folder-collection-loader.d.ts +256 -0
- package/dist/collection/folder-collection-store.d.ts +168 -0
- package/dist/collection/interfaces.d.ts +32 -0
- package/dist/collection/json-collection-loader.d.ts +95 -0
- package/dist/{services → collection}/parser-registry.d.ts +1 -2
- package/dist/config/config-service.d.ts +79 -0
- package/dist/config/config.interface.d.ts +140 -0
- package/dist/config/default-config.d.ts +29 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/container.d.ts +22 -14
- package/dist/{implementations → cookie}/cookie-jar.d.ts +2 -3
- package/dist/cookie/cookie-service.d.ts +98 -0
- package/dist/{implementations → cookie}/cookie-utils.d.ts +1 -2
- package/dist/cookie/in-memory-cookie-jar.d.ts +44 -0
- package/dist/{interfaces/cookie.d.ts → cookie/interfaces.d.ts} +22 -3
- package/dist/cookie/persistent-cookie-jar.d.ts +35 -0
- package/dist/environment/environment-config-service.d.ts +95 -0
- package/dist/{services → environment}/environment-resolver.d.ts +6 -5
- package/dist/{services → environment}/forge-env.d.ts +1 -2
- package/dist/environment/interfaces.d.ts +139 -0
- package/dist/environment/variable-interpolator.d.ts +100 -0
- package/dist/execution/collection-request-executor-interfaces.d.ts +36 -0
- package/dist/execution/collection-request-executor.d.ts +78 -0
- package/dist/{services → execution}/request-executor.d.ts +23 -11
- package/dist/execution/request-preparer-interfaces.d.ts +36 -0
- package/dist/execution/request-preparer.d.ts +35 -0
- package/dist/graphql/graphql-completion-provider.d.ts +39 -0
- package/dist/graphql/graphql-schema-service.d.ts +89 -0
- package/dist/{interfaces/history.d.ts → history/history-interfaces.d.ts} +29 -6
- package/dist/history/request-history-service-interfaces.d.ts +43 -0
- package/dist/history/request-history-service.d.ts +133 -0
- package/dist/{implementations → history}/request-history.d.ts +2 -3
- package/dist/{implementations → http}/fetch-http-client.d.ts +4 -5
- package/dist/http/http-request-service.d.ts +36 -0
- package/dist/{implementations → http}/interceptor-chain.d.ts +1 -2
- package/dist/http/interfaces.d.ts +25 -0
- package/dist/http/merge-request-settings.d.ts +12 -0
- package/dist/{implementations → http}/native-http-client.d.ts +6 -15
- package/dist/{implementations → http}/request-preprocessor.d.ts +1 -2
- package/dist/{services → http}/url-builder.d.ts +7 -10
- package/dist/import-export/import-postman-environment.d.ts +21 -0
- package/dist/import-export/rest-client-export.d.ts +35 -0
- package/dist/index.d.ts +88 -6
- package/dist/index.js +262 -35
- package/dist/index.mjs +262 -35
- package/dist/openapi/example-generator.d.ts +26 -0
- package/dist/openapi/history-analyzer.d.ts +29 -0
- package/dist/openapi/index.d.ts +16 -0
- package/dist/openapi/interfaces.d.ts +42 -0
- package/dist/openapi/openapi-exporter.d.ts +73 -0
- package/dist/openapi/openapi-importer.d.ts +72 -0
- package/dist/openapi/ref-resolver.d.ts +28 -0
- package/dist/openapi/schema-inference-service.d.ts +40 -0
- package/dist/openapi/schema-inferrer.d.ts +26 -0
- package/dist/openapi/script-analyzer.d.ts +41 -0
- package/dist/parsers/http-forge-parser.d.ts +2 -3
- package/dist/parsers/index.d.ts +0 -1
- package/dist/{implementations → platform}/data-file-parser.d.ts +0 -1
- package/dist/{implementations → platform}/node-file-system.d.ts +1 -2
- package/dist/script/interfaces.d.ts +149 -0
- package/dist/script/module-loader.d.ts +115 -0
- package/dist/script/request-script-session.d.ts +70 -0
- package/dist/script/script-executor.d.ts +60 -0
- package/dist/script/script-factories.d.ts +83 -0
- package/dist/script/script-utils.d.ts +41 -0
- package/dist/test-suite/index.d.ts +10 -0
- package/dist/test-suite/interfaces.d.ts +164 -0
- package/dist/test-suite/result-storage-service.d.ts +70 -0
- package/dist/test-suite/result-storage.d.ts +296 -0
- package/dist/test-suite/statistics-service.d.ts +51 -0
- package/dist/test-suite/test-suite-service.d.ts +97 -0
- package/dist/test-suite/test-suite-store.d.ts +155 -0
- package/dist/types/console-service.d.ts +40 -0
- package/dist/types/platform.d.ts +206 -0
- package/dist/{interfaces → types}/types.d.ts +282 -12
- package/dist/utils/dynamic-variables.d.ts +38 -0
- package/dist/utils/expression-evaluator.d.ts +34 -0
- package/dist/utils/filter-engine.d.ts +47 -0
- package/dist/utils/helpers.d.ts +47 -0
- package/package.json +11 -3
- package/dist/container.d.ts.map +0 -1
- package/dist/implementations/cookie-jar.d.ts.map +0 -1
- package/dist/implementations/cookie-utils.d.ts.map +0 -1
- package/dist/implementations/data-file-parser.d.ts.map +0 -1
- package/dist/implementations/fetch-http-client.d.ts.map +0 -1
- package/dist/implementations/index.d.ts +0 -22
- package/dist/implementations/index.d.ts.map +0 -1
- package/dist/implementations/interceptor-chain.d.ts.map +0 -1
- package/dist/implementations/module-loader.d.ts +0 -74
- package/dist/implementations/module-loader.d.ts.map +0 -1
- package/dist/implementations/native-http-client.d.ts.map +0 -1
- package/dist/implementations/node-file-system.d.ts.map +0 -1
- package/dist/implementations/request-history.d.ts.map +0 -1
- package/dist/implementations/request-preprocessor.d.ts.map +0 -1
- package/dist/implementations/variable-interpolator.d.ts +0 -55
- package/dist/implementations/variable-interpolator.d.ts.map +0 -1
- package/dist/implementations/vm2-script-runner.d.ts +0 -76
- package/dist/implementations/vm2-script-runner.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/cookie.d.ts.map +0 -1
- package/dist/interfaces/history.d.ts.map +0 -1
- package/dist/interfaces/index.d.ts +0 -170
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/types.d.ts.map +0 -1
- package/dist/parsers/http-forge-parser.d.ts.map +0 -1
- package/dist/parsers/index.d.ts.map +0 -1
- package/dist/services/collection-loader.d.ts.map +0 -1
- package/dist/services/environment-resolver.d.ts.map +0 -1
- package/dist/services/folder-collection-loader.d.ts +0 -91
- package/dist/services/folder-collection-loader.d.ts.map +0 -1
- package/dist/services/forge-env.d.ts.map +0 -1
- package/dist/services/index.d.ts +0 -20
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/parser-registry.d.ts.map +0 -1
- package/dist/services/request-executor.d.ts.map +0 -1
- package/dist/services/script-pipeline.d.ts +0 -43
- package/dist/services/script-pipeline.d.ts.map +0 -1
- package/dist/services/script-session.d.ts +0 -66
- package/dist/services/script-session.d.ts.map +0 -1
- package/dist/services/url-builder.d.ts.map +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Completion Provider
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: Parse GraphQL document context and produce completion items
|
|
5
|
+
* from a given schema. Pure logic — no VS Code or editor dependencies.
|
|
6
|
+
*
|
|
7
|
+
* This is a lightweight context parser using regex + brace counting — no graphql-js dependency.
|
|
8
|
+
*
|
|
9
|
+
* Completion Scenarios:
|
|
10
|
+
* - Root level: query, mutation, subscription, fragment keywords
|
|
11
|
+
* - Selection set: fields of the current parent type + __typename
|
|
12
|
+
* - Arguments: field argument names
|
|
13
|
+
* - Argument values: enum values for enum-typed arguments
|
|
14
|
+
* - Fragment spread: on TypeName, defined fragment names
|
|
15
|
+
* - Directives: @skip, @include, custom directives
|
|
16
|
+
* - Variable types: input types + scalars
|
|
17
|
+
*/
|
|
18
|
+
import { GraphQLSchema } from './graphql-schema-service';
|
|
19
|
+
export type ContextType = 'root' | 'operation_name' | 'selection_set' | 'argument' | 'argument_value' | 'directive' | 'fragment_type' | 'variable_def';
|
|
20
|
+
export interface QueryContext {
|
|
21
|
+
contextType: ContextType;
|
|
22
|
+
fieldPath: string[];
|
|
23
|
+
parentType?: string;
|
|
24
|
+
inFragment?: boolean;
|
|
25
|
+
prefix: string;
|
|
26
|
+
currentField?: string;
|
|
27
|
+
currentArg?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CompletionItem {
|
|
30
|
+
label: string;
|
|
31
|
+
kind: 'field' | 'keyword' | 'argument' | 'enum' | 'type' | 'directive' | 'fragment' | 'snippet';
|
|
32
|
+
detail?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
insertText?: string;
|
|
35
|
+
deprecated?: boolean;
|
|
36
|
+
sortOrder?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function parseQueryContext(document: string, offset: number, schema?: GraphQLSchema): QueryContext;
|
|
39
|
+
export declare function getCompletions(schema: GraphQLSchema, context: QueryContext): CompletionItem[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Schema Service
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: Fetch, parse, and cache GraphQL schemas via introspection.
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Execute standard introspection query against any GraphQL endpoint
|
|
8
|
+
* - Parse introspection result into typed schema representation
|
|
9
|
+
* - Cache schemas per-endpoint with timestamp
|
|
10
|
+
* - Extract operation names from GraphQL documents
|
|
11
|
+
* - Resolve variable types for operations
|
|
12
|
+
*
|
|
13
|
+
* Zero Dependencies: Uses only the project's IHttpClient abstraction.
|
|
14
|
+
*/
|
|
15
|
+
import { IHttpClient } from '../types/platform';
|
|
16
|
+
export interface GraphQLField {
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
args: GraphQLArg[];
|
|
20
|
+
description?: string;
|
|
21
|
+
isDeprecated: boolean;
|
|
22
|
+
deprecationReason?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GraphQLArg {
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface GraphQLEnumValue {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
isDeprecated: boolean;
|
|
34
|
+
deprecationReason?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface GraphQLType {
|
|
37
|
+
name: string;
|
|
38
|
+
kind: 'OBJECT' | 'INPUT_OBJECT' | 'ENUM' | 'SCALAR' | 'INTERFACE' | 'UNION' | 'LIST' | 'NON_NULL';
|
|
39
|
+
fields: GraphQLField[];
|
|
40
|
+
inputFields: GraphQLArg[];
|
|
41
|
+
enumValues: GraphQLEnumValue[];
|
|
42
|
+
interfaces: string[];
|
|
43
|
+
possibleTypes: string[];
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface GraphQLDirective {
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
locations: string[];
|
|
50
|
+
args: GraphQLArg[];
|
|
51
|
+
}
|
|
52
|
+
export interface GraphQLSchema {
|
|
53
|
+
queryType: string;
|
|
54
|
+
mutationType?: string;
|
|
55
|
+
subscriptionType?: string;
|
|
56
|
+
types: Map<string, GraphQLType>;
|
|
57
|
+
directives: GraphQLDirective[];
|
|
58
|
+
fetchedAt: number;
|
|
59
|
+
endpointUrl: string;
|
|
60
|
+
}
|
|
61
|
+
export interface GraphQLOperation {
|
|
62
|
+
name: string;
|
|
63
|
+
type: 'query' | 'mutation' | 'subscription';
|
|
64
|
+
line: number;
|
|
65
|
+
}
|
|
66
|
+
export interface IGraphQLSchemaService {
|
|
67
|
+
fetchSchema(endpointUrl: string, headers?: Record<string, string>): Promise<GraphQLSchema>;
|
|
68
|
+
getCachedSchema(endpointUrl: string): GraphQLSchema | undefined;
|
|
69
|
+
extractOperations(document: string): GraphQLOperation[];
|
|
70
|
+
clearCache(endpointUrl?: string): void;
|
|
71
|
+
schemaToSerializable(schema: GraphQLSchema): any;
|
|
72
|
+
}
|
|
73
|
+
export declare class GraphQLSchemaService implements IGraphQLSchemaService {
|
|
74
|
+
private readonly httpClient;
|
|
75
|
+
private schemaCache;
|
|
76
|
+
constructor(httpClient: IHttpClient);
|
|
77
|
+
/**
|
|
78
|
+
* Execute introspection query and return parsed schema
|
|
79
|
+
*/
|
|
80
|
+
fetchSchema(endpointUrl: string, headers?: Record<string, string>): Promise<GraphQLSchema>;
|
|
81
|
+
getCachedSchema(endpointUrl: string): GraphQLSchema | undefined;
|
|
82
|
+
extractOperations(document: string): GraphQLOperation[];
|
|
83
|
+
clearCache(endpointUrl?: string): void;
|
|
84
|
+
schemaToSerializable(schema: GraphQLSchema): any;
|
|
85
|
+
private parseSchema;
|
|
86
|
+
private parseField;
|
|
87
|
+
private parseArg;
|
|
88
|
+
private renderTypeRef;
|
|
89
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Extracted from VS Code plugin: src/services/interfaces/request-history.interface.ts
|
|
5
5
|
* Adapted for core package - storage-agnostic design
|
|
6
6
|
*/
|
|
7
|
-
import { HttpRequest, HttpResponse } from '
|
|
7
|
+
import { HttpRequest, HttpResponse, RequestBody } from '../types/types';
|
|
8
8
|
/**
|
|
9
9
|
* History entry - records a single request execution
|
|
10
10
|
*/
|
|
@@ -14,7 +14,7 @@ export interface HistoryEntry {
|
|
|
14
14
|
/** Timestamp of execution */
|
|
15
15
|
timestamp: number;
|
|
16
16
|
/** Associated ticket/issue number */
|
|
17
|
-
ticket?: string;
|
|
17
|
+
ticket?: string | null;
|
|
18
18
|
/** Git branch name */
|
|
19
19
|
branch?: string;
|
|
20
20
|
/** Environment used */
|
|
@@ -26,10 +26,34 @@ export interface HistoryEntry {
|
|
|
26
26
|
url: string;
|
|
27
27
|
method: string;
|
|
28
28
|
headers: Record<string, string>;
|
|
29
|
-
body?: any;
|
|
29
|
+
body?: RequestBody | any | null;
|
|
30
30
|
params?: Record<string, string>;
|
|
31
31
|
query?: Record<string, string>;
|
|
32
32
|
};
|
|
33
|
+
/** Original request configuration (before variable resolution) */
|
|
34
|
+
originalConfig?: {
|
|
35
|
+
path: string;
|
|
36
|
+
params: Record<string, string>;
|
|
37
|
+
query: Record<string, string>;
|
|
38
|
+
headers: Record<string, string>;
|
|
39
|
+
body: RequestBody | null;
|
|
40
|
+
};
|
|
41
|
+
/** Request settings */
|
|
42
|
+
settings?: {
|
|
43
|
+
timeout?: number;
|
|
44
|
+
followRedirects?: boolean;
|
|
45
|
+
followOriginalMethod?: boolean;
|
|
46
|
+
followAuthHeader?: boolean;
|
|
47
|
+
maxRedirects?: number;
|
|
48
|
+
strictSSL?: boolean;
|
|
49
|
+
decompress?: boolean;
|
|
50
|
+
includeCookies?: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** Scripts associated with request */
|
|
53
|
+
scripts?: {
|
|
54
|
+
preRequest?: string;
|
|
55
|
+
postResponse?: string;
|
|
56
|
+
};
|
|
33
57
|
/** Response summary */
|
|
34
58
|
response: {
|
|
35
59
|
status: number;
|
|
@@ -46,7 +70,7 @@ export interface FullResponse {
|
|
|
46
70
|
timestamp: number;
|
|
47
71
|
status: number;
|
|
48
72
|
statusText: string;
|
|
49
|
-
headers: Record<string, string>;
|
|
73
|
+
headers: Record<string, string | string[]>;
|
|
50
74
|
cookies: any[];
|
|
51
75
|
body: any;
|
|
52
76
|
time: number;
|
|
@@ -59,7 +83,7 @@ export interface RequestHistory {
|
|
|
59
83
|
requestPath: string;
|
|
60
84
|
requestId: string;
|
|
61
85
|
method: string;
|
|
62
|
-
|
|
86
|
+
requests: HistoryEntry[];
|
|
63
87
|
}
|
|
64
88
|
/**
|
|
65
89
|
* History read operations
|
|
@@ -114,4 +138,3 @@ export interface IRequestHistory extends IHistoryReader, IHistoryWriter {
|
|
|
114
138
|
/** Maximum entries to keep per request (oldest removed when exceeded) */
|
|
115
139
|
maxEntriesPerRequest: number;
|
|
116
140
|
}
|
|
117
|
-
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request History Service Interface
|
|
3
|
+
*
|
|
4
|
+
* Interface Segregation: Separated into focused sub-interfaces
|
|
5
|
+
* Dependency Inversion: Consumers depend on this abstraction
|
|
6
|
+
*/
|
|
7
|
+
import { FullResponse, HistoryEntry, RequestHistory } from './history-interfaces';
|
|
8
|
+
export type { FullResponse, HistoryEntry, RequestHistory };
|
|
9
|
+
/**
|
|
10
|
+
* History read operations
|
|
11
|
+
*/
|
|
12
|
+
export interface IHistoryReader {
|
|
13
|
+
loadHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
|
|
14
|
+
loadSharedHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
|
|
15
|
+
getEntriesForEnvironment(environment: string, storagePath: string, endpointId: string): HistoryEntry[];
|
|
16
|
+
getEntriesGroupedByTicket(environment: string, storagePath: string, endpointId: string): Map<string, HistoryEntry[]>;
|
|
17
|
+
getSharedEntriesGroupedByTicket(environment: string, storagePath: string, endpointId: string): Map<string, HistoryEntry[]>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* History write operations
|
|
21
|
+
*/
|
|
22
|
+
export interface IHistoryWriter {
|
|
23
|
+
addEntry(environment: string, storagePath: string, endpointId: string, method: string, entry: Omit<HistoryEntry, 'id' | 'timestamp' | 'method'>): HistoryEntry;
|
|
24
|
+
deleteEntry(environment: string, storagePath: string, endpointId: string, entryId: string): boolean;
|
|
25
|
+
deleteSharedEntry(environment: string, storagePath: string, endpointId: string, entryId: string): boolean;
|
|
26
|
+
clearHistory(environment: string, storagePath: string, endpointId: string): void;
|
|
27
|
+
shareEntry(environment: string, storagePath: string, endpointId: string, entryId: string, tag: string): boolean;
|
|
28
|
+
moveSharedEntry(environment: string, storagePath: string, endpointId: string, entryId: string, tag: string): boolean;
|
|
29
|
+
renameSharedGroup(environment: string, storagePath: string, endpointId: string, oldTag: string, newTag: string): boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Full response storage operations
|
|
33
|
+
*/
|
|
34
|
+
export interface IResponseStorage {
|
|
35
|
+
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
|
|
36
|
+
loadFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
37
|
+
loadSharedFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Full request history service interface
|
|
41
|
+
*/
|
|
42
|
+
export interface IRequestHistoryService extends IHistoryReader, IHistoryWriter, IResponseStorage {
|
|
43
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request History Service - File-based Implementation
|
|
3
|
+
*
|
|
4
|
+
* Full-featured request history service with:
|
|
5
|
+
* - File-based persistence (JSON files on disk)
|
|
6
|
+
* - Shared history support (team-visible history)
|
|
7
|
+
* - Ticket/branch grouping
|
|
8
|
+
* - Separate full response file management
|
|
9
|
+
*
|
|
10
|
+
* Ported from VS Code extension's RequestHistoryService.
|
|
11
|
+
* No VS Code dependencies — uses only Node.js fs/path.
|
|
12
|
+
*/
|
|
13
|
+
import { FullResponse, HistoryEntry, RequestHistory } from './history-interfaces';
|
|
14
|
+
import { IRequestHistoryService } from './request-history-service-interfaces';
|
|
15
|
+
/**
|
|
16
|
+
* File-based request history service.
|
|
17
|
+
*
|
|
18
|
+
* Path-helper methods are `protected` so consumers can subclass and
|
|
19
|
+
* override the directory layout if needed.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RequestHistoryService implements IRequestHistoryService {
|
|
22
|
+
protected historyPath: string;
|
|
23
|
+
protected sharedHistoryPath: string;
|
|
24
|
+
constructor(historyPath: string, sharedHistoryPath: string);
|
|
25
|
+
/**
|
|
26
|
+
* Get history folder path for environment
|
|
27
|
+
*/
|
|
28
|
+
protected getEnvironmentHistoryPath(environment: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get history folder path for a collection within an environment
|
|
31
|
+
*/
|
|
32
|
+
protected getCollectionHistoryPath(environment: string, collectionPath: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Get request directory path
|
|
35
|
+
*/
|
|
36
|
+
protected getRequestPath(environment: string, requestPath: string, requestId: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get shared history folder path for environment
|
|
39
|
+
*/
|
|
40
|
+
protected getSharedEnvironmentHistoryPath(environment: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get shared history folder path for a collection within an environment
|
|
43
|
+
*/
|
|
44
|
+
protected getSharedCollectionHistoryPath(environment: string, collectionPath: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get shared request directory path
|
|
47
|
+
*/
|
|
48
|
+
protected getSharedRequestPath(environment: string, requestPath: string, requestId: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get history file path for a request
|
|
51
|
+
*/
|
|
52
|
+
protected getHistoryFilePath(environment: string, requestPath: string, requestId: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Get shared history file path for a request
|
|
55
|
+
*/
|
|
56
|
+
protected getSharedHistoryFilePath(environment: string, requestPath: string, requestId: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Get full response file path
|
|
59
|
+
*/
|
|
60
|
+
protected getResponseFilePath(environment: string, requestPath: string, requestId: string, entryId: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Get shared full response file path
|
|
63
|
+
*/
|
|
64
|
+
protected getSharedResponseFilePath(environment: string, requestPath: string, requestId: string, entryId: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Load history for a request
|
|
67
|
+
*/
|
|
68
|
+
loadHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
|
|
69
|
+
/**
|
|
70
|
+
* Load shared history for a request
|
|
71
|
+
*/
|
|
72
|
+
loadSharedHistory(environment: string, requestPath: string, requestId: string): RequestHistory | null;
|
|
73
|
+
/**
|
|
74
|
+
* Get history entries for a specific environment / request
|
|
75
|
+
*/
|
|
76
|
+
getEntriesForEnvironment(environment: string, requestPath: string, requestId: string): HistoryEntry[];
|
|
77
|
+
/**
|
|
78
|
+
* Get history entries grouped by ticket/branch
|
|
79
|
+
*/
|
|
80
|
+
getEntriesGroupedByTicket(environment: string, requestPath: string, requestId: string): Map<string, HistoryEntry[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Get shared history entries grouped by ticket/branch
|
|
83
|
+
*/
|
|
84
|
+
getSharedEntriesGroupedByTicket(environment: string, requestPath: string, requestId: string): Map<string, HistoryEntry[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Save history for a request (internal)
|
|
87
|
+
*/
|
|
88
|
+
protected saveHistory(history: RequestHistory): void;
|
|
89
|
+
/**
|
|
90
|
+
* Save shared history for a request (internal)
|
|
91
|
+
*/
|
|
92
|
+
protected saveSharedHistory(history: RequestHistory): void;
|
|
93
|
+
/**
|
|
94
|
+
* Add a new entry to the history
|
|
95
|
+
*/
|
|
96
|
+
addEntry(environment: string, requestPath: string, requestId: string, method: string, entry: Omit<HistoryEntry, 'id' | 'timestamp' | 'method'>): HistoryEntry;
|
|
97
|
+
/**
|
|
98
|
+
* Delete a specific entry
|
|
99
|
+
*/
|
|
100
|
+
deleteEntry(environment: string, requestPath: string, requestId: string, entryId: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Delete a specific entry from shared history
|
|
103
|
+
*/
|
|
104
|
+
deleteSharedEntry(environment: string, requestPath: string, requestId: string, entryId: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Move entry to shared history and remove from local history
|
|
107
|
+
*/
|
|
108
|
+
shareEntry(environment: string, requestPath: string, requestId: string, entryId: string, tag: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Move a shared history entry to another group tag
|
|
111
|
+
*/
|
|
112
|
+
moveSharedEntry(environment: string, requestPath: string, requestId: string, entryId: string, tag: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Rename a shared history group tag
|
|
115
|
+
*/
|
|
116
|
+
renameSharedGroup(environment: string, requestPath: string, requestId: string, oldTag: string, newTag: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Clear all history for a request
|
|
119
|
+
*/
|
|
120
|
+
clearHistory(environment: string, requestPath: string, requestId: string): void;
|
|
121
|
+
/**
|
|
122
|
+
* Save full response to a separate file
|
|
123
|
+
*/
|
|
124
|
+
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
|
|
125
|
+
/**
|
|
126
|
+
* Load full response from file
|
|
127
|
+
*/
|
|
128
|
+
loadFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
129
|
+
/**
|
|
130
|
+
* Load full response from shared history file
|
|
131
|
+
*/
|
|
132
|
+
loadSharedFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
133
|
+
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Based on VS Code plugin's RequestHistoryService logic,
|
|
8
8
|
* but adapted for storage-agnostic design.
|
|
9
9
|
*/
|
|
10
|
-
import { FullResponse, HistoryEntry, IRequestHistory } from '
|
|
11
|
-
import { HttpRequest, HttpResponse } from '../
|
|
10
|
+
import { FullResponse, HistoryEntry, IRequestHistory } from './history-interfaces';
|
|
11
|
+
import { HttpRequest, HttpResponse } from '../types/types';
|
|
12
12
|
/**
|
|
13
13
|
* In-memory request history storage
|
|
14
14
|
*
|
|
@@ -70,4 +70,3 @@ export declare class RequestHistoryStore implements IRequestHistory {
|
|
|
70
70
|
*/
|
|
71
71
|
clearAll(): void;
|
|
72
72
|
}
|
|
73
|
-
//# sourceMappingURL=request-history.d.ts.map
|
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
* Single Responsibility: Execute HTTP requests using fetch API
|
|
5
5
|
* Dependency Inversion: Implements IHttpClient interface
|
|
6
6
|
*/
|
|
7
|
-
import { IHttpClient } from '../
|
|
8
|
-
import { HttpRequest, HttpResponse } from '../
|
|
7
|
+
import { IHttpClient } from '../types/platform';
|
|
8
|
+
import { HttpRequest, HttpResponse } from '../types/types';
|
|
9
9
|
/**
|
|
10
10
|
* HTTP client implementation using Node.js native fetch.
|
|
11
11
|
* Requires Node.js 18+.
|
|
12
12
|
*/
|
|
13
13
|
export declare class FetchHttpClient implements IHttpClient {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Send an HTTP request
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
send(request: HttpRequest): Promise<HttpResponse>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=fetch-http-client.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Request Service
|
|
3
|
+
*
|
|
4
|
+
* High-level facade that orchestrates HTTP request execution through:
|
|
5
|
+
* - Request interceptors (pre-processing)
|
|
6
|
+
* - HTTP client (actual network call)
|
|
7
|
+
* - Response interceptors (post-processing)
|
|
8
|
+
* - Error interceptors (error recovery)
|
|
9
|
+
* - URL building (path param + query param substitution)
|
|
10
|
+
*
|
|
11
|
+
* Extracted from extension's http-request-service.ts.
|
|
12
|
+
*
|
|
13
|
+
* SOLID:
|
|
14
|
+
* - Single Responsibility: Orchestrates HTTP requests via interceptors
|
|
15
|
+
* - Open/Closed: Extended through interceptor chain
|
|
16
|
+
* - Dependency Inversion: Depends on IHttpClient, IUrlBuilder, IInterceptorChain, IRequestPreprocessor
|
|
17
|
+
*/
|
|
18
|
+
import { IInterceptorChain } from './interceptor-chain';
|
|
19
|
+
import { HttpRequestOptions, HttpResponse } from '../types/types';
|
|
20
|
+
import type { IHttpClient } from '../types/platform';
|
|
21
|
+
import { IHttpRequestService } from './interfaces';
|
|
22
|
+
import { IUrlBuilder } from './url-builder';
|
|
23
|
+
export declare class HttpRequestService implements IHttpRequestService {
|
|
24
|
+
private readonly urlBuilder;
|
|
25
|
+
private readonly interceptors;
|
|
26
|
+
private readonly httpClient;
|
|
27
|
+
constructor(urlBuilder: IUrlBuilder, interceptors: IInterceptorChain, httpClient: IHttpClient);
|
|
28
|
+
/**
|
|
29
|
+
* Execute an HTTP request with interceptor support.
|
|
30
|
+
*/
|
|
31
|
+
execute(options: HttpRequestOptions): Promise<HttpResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Build full URL from URL pattern, params, and query.
|
|
34
|
+
*/
|
|
35
|
+
buildUrl(urlPattern: string, params?: Record<string, string>, query?: Record<string, string>): string;
|
|
36
|
+
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - Post-response processing (modify response after receiving)
|
|
13
13
|
* - Error handling
|
|
14
14
|
*/
|
|
15
|
-
import { HttpRequest, HttpResponse } from '../
|
|
15
|
+
import { HttpRequest, HttpResponse } from '../types/types';
|
|
16
16
|
/**
|
|
17
17
|
* Context passed to interceptors
|
|
18
18
|
* Same as plugin's InterceptorContext
|
|
@@ -259,4 +259,3 @@ export declare class RetryErrorInterceptor implements IErrorInterceptor {
|
|
|
259
259
|
constructor(maxRetries?: number, retryableErrors?: string[]);
|
|
260
260
|
handle(error: Error, _request: HttpRequest, _context: InterceptorContext): void;
|
|
261
261
|
}
|
|
262
|
-
//# sourceMappingURL=interceptor-chain.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Request Service Interface
|
|
3
|
+
*
|
|
4
|
+
* Combines HTTP execution (IHttpClient) with URL building (IUrlBuilder).
|
|
5
|
+
* Adds interceptor support for pre/post processing of requests and responses.
|
|
6
|
+
*
|
|
7
|
+
* This is the high-level service interface that consumers use.
|
|
8
|
+
* It delegates to IHttpClient for actual network calls and IUrlBuilder for URL construction.
|
|
9
|
+
*/
|
|
10
|
+
import { HttpRequestOptions, HttpResponse } from '../types/types';
|
|
11
|
+
/**
|
|
12
|
+
* Full HTTP request service interface.
|
|
13
|
+
* Combines execution + URL building in a single facade.
|
|
14
|
+
*/
|
|
15
|
+
export interface IHttpRequestService {
|
|
16
|
+
/**
|
|
17
|
+
* Execute an HTTP request with interceptor support.
|
|
18
|
+
*/
|
|
19
|
+
execute(options: HttpRequestOptions): Promise<HttpResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Build a full URL from path with parameter and query substitution.
|
|
22
|
+
* Path is expected to have {{variables}} pre-resolved by caller.
|
|
23
|
+
*/
|
|
24
|
+
buildUrl(path: string, params?: Record<string, string>, query?: Record<string, string>): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge Request Settings
|
|
3
|
+
*
|
|
4
|
+
* Merges user-provided request settings with defaults.
|
|
5
|
+
* Extracted from extension's utils/merge-request-settings.ts.
|
|
6
|
+
*/
|
|
7
|
+
import { RequestSettings } from '../types/types';
|
|
8
|
+
/**
|
|
9
|
+
* Merge user-provided RequestSettings with defaults.
|
|
10
|
+
* Idempotent and safe to call from multiple layers.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mergeRequestSettings(userSettings?: Partial<RequestSettings>): Required<RequestSettings>;
|
|
@@ -14,34 +14,26 @@
|
|
|
14
14
|
* - Request cancellation via AbortSignal
|
|
15
15
|
* - Cookie parsing from Set-Cookie headers
|
|
16
16
|
*/
|
|
17
|
-
import { IHttpClient } from '../
|
|
18
|
-
import {
|
|
19
|
-
import { HttpRequest, HttpResponse, RequestSettings } from '../interfaces/types';
|
|
17
|
+
import { IHttpClient } from '../types/platform';
|
|
18
|
+
import { HttpRequest, HttpResponse, RequestSettings } from '../types/types';
|
|
20
19
|
/**
|
|
21
20
|
* Default request settings
|
|
22
21
|
* Same as plugin's DEFAULT_REQUEST_SETTINGS from shared/constants.ts
|
|
23
22
|
*/
|
|
24
23
|
export declare const DEFAULT_REQUEST_SETTINGS: Required<RequestSettings>;
|
|
25
|
-
/**
|
|
26
|
-
* Extended HTTP response with raw cookie data for internal use
|
|
27
|
-
* Compatible with HttpResponse through the cookies field
|
|
28
|
-
*/
|
|
29
|
-
export interface HttpResponseWithCookies extends HttpResponse {
|
|
30
|
-
/** Parsed cookie objects with full details */
|
|
31
|
-
rawCookies: ParsedCookie[];
|
|
32
|
-
}
|
|
33
24
|
/**
|
|
34
25
|
* Native HTTP client using Node.js http/https modules
|
|
35
26
|
*
|
|
36
27
|
* Implementation extracted 100% from plugin's HttpRequestService.executeInternal
|
|
37
28
|
*/
|
|
38
|
-
export declare class
|
|
29
|
+
export declare class NodeHttpClient implements IHttpClient {
|
|
39
30
|
private settings;
|
|
31
|
+
private version;
|
|
40
32
|
constructor(defaultSettings?: Partial<RequestSettings>);
|
|
41
33
|
/**
|
|
42
|
-
*
|
|
34
|
+
* Send an HTTP request
|
|
43
35
|
*/
|
|
44
|
-
|
|
36
|
+
send(request: HttpRequest): Promise<HttpResponse>;
|
|
45
37
|
/**
|
|
46
38
|
* Merge user settings with defaults
|
|
47
39
|
* Same implementation as plugin's HttpRequestService.mergeSettings
|
|
@@ -69,4 +61,3 @@ export declare class NativeHttpClient implements IHttpClient {
|
|
|
69
61
|
*/
|
|
70
62
|
private parseCookies;
|
|
71
63
|
}
|
|
72
|
-
//# sourceMappingURL=native-http-client.d.ts.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Single Responsibility: Handles request preparation (header sanitization, body encoding)
|
|
7
7
|
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
8
8
|
*/
|
|
9
|
-
import { RequestBody } from '../
|
|
9
|
+
import { RequestBody } from '../types/types';
|
|
10
10
|
/**
|
|
11
11
|
* Request Preprocessor Interface
|
|
12
12
|
* Same as plugin's IRequestPreprocessor
|
|
@@ -75,4 +75,3 @@ export declare class RequestPreprocessor implements IRequestPreprocessor {
|
|
|
75
75
|
*/
|
|
76
76
|
setContentTypeHeader(headers: Record<string, string>, body: RequestBody | null | undefined, bodyContentType?: string): void;
|
|
77
77
|
}
|
|
78
|
-
//# sourceMappingURL=request-preprocessor.d.ts.map
|
|
@@ -8,19 +8,18 @@
|
|
|
8
8
|
* - Path parameter replacement: :param, :param(regex), :param?
|
|
9
9
|
* - Query string building and merging
|
|
10
10
|
*/
|
|
11
|
-
import { IVariableInterpolator } from '../interfaces';
|
|
12
11
|
/**
|
|
13
12
|
* URL Builder interface
|
|
14
13
|
*/
|
|
15
14
|
export interface IUrlBuilder {
|
|
16
15
|
/**
|
|
17
|
-
* Build a complete URL with
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
16
|
+
* Build a complete URL with path parameter and query string substitution.
|
|
17
|
+
* Matches extension's IUrlBuilder — expects {{variables}} pre-resolved.
|
|
18
|
+
* @param path - URL path (with {{variables}} pre-resolved by caller)
|
|
20
19
|
* @param params - Path parameters for :param replacement
|
|
21
20
|
* @param query - Query parameters to append
|
|
22
21
|
*/
|
|
23
|
-
buildUrl(
|
|
22
|
+
buildUrl(path: string, params?: Record<string, string>, query?: Record<string, string>): string;
|
|
24
23
|
/**
|
|
25
24
|
* Replace only path parameters (:param) in a URL
|
|
26
25
|
*/
|
|
@@ -34,12 +33,11 @@ export interface IUrlBuilder {
|
|
|
34
33
|
* URL Builder implementation
|
|
35
34
|
*/
|
|
36
35
|
export declare class UrlBuilder implements IUrlBuilder {
|
|
37
|
-
private readonly interpolator;
|
|
38
|
-
constructor(interpolator: IVariableInterpolator);
|
|
39
36
|
/**
|
|
40
|
-
* Build a complete URL with all substitutions
|
|
37
|
+
* Build a complete URL with all substitutions.
|
|
38
|
+
* Expects {{variables}} in urlPattern to be pre-resolved by caller.
|
|
41
39
|
*/
|
|
42
|
-
buildUrl(urlPattern: string,
|
|
40
|
+
buildUrl(urlPattern: string, params?: Record<string, string>, query?: Record<string, string>): string;
|
|
43
41
|
/**
|
|
44
42
|
* Replace path parameters in URL
|
|
45
43
|
* Supports:
|
|
@@ -57,4 +55,3 @@ export declare class UrlBuilder implements IUrlBuilder {
|
|
|
57
55
|
*/
|
|
58
56
|
private appendQueryParams;
|
|
59
57
|
}
|
|
60
|
-
//# sourceMappingURL=url-builder.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postman Environment Import
|
|
3
|
+
*
|
|
4
|
+
* Parses Postman environment JSON files into a standard format.
|
|
5
|
+
* Extracted from extension's utils/import-postman-environment.ts.
|
|
6
|
+
*
|
|
7
|
+
* Pure function — no platform dependencies.
|
|
8
|
+
*/
|
|
9
|
+
import { IFileSystem } from '../types/platform';
|
|
10
|
+
import { ImportedEnvironment } from '../environment/interfaces';
|
|
11
|
+
export type { ImportedEnvironment } from '../environment/interfaces';
|
|
12
|
+
/**
|
|
13
|
+
* Parse Postman environment JSON content.
|
|
14
|
+
* Supports both standard and nested Postman export formats.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parsePostmanEnvironment(content: string | Buffer): ImportedEnvironment | null;
|
|
17
|
+
/**
|
|
18
|
+
* Parse Postman environment from file using the IFileSystem abstraction.
|
|
19
|
+
* Platform-independent — works with any IFileSystem implementation.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parsePostmanEnvironmentFile(filePath: string, fs: IFileSystem): Promise<ImportedEnvironment | null>;
|