@http-forge/core 0.1.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 +500 -0
- package/dist/container.d.ts +146 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/implementations/cookie-jar.d.ts +97 -0
- package/dist/implementations/cookie-jar.d.ts.map +1 -0
- package/dist/implementations/cookie-utils.d.ts +78 -0
- package/dist/implementations/cookie-utils.d.ts.map +1 -0
- package/dist/implementations/data-file-parser.d.ts +71 -0
- package/dist/implementations/data-file-parser.d.ts.map +1 -0
- package/dist/implementations/fetch-http-client.d.ts +19 -0
- package/dist/implementations/fetch-http-client.d.ts.map +1 -0
- package/dist/implementations/index.d.ts +22 -0
- package/dist/implementations/index.d.ts.map +1 -0
- package/dist/implementations/interceptor-chain.d.ts +262 -0
- package/dist/implementations/interceptor-chain.d.ts.map +1 -0
- package/dist/implementations/module-loader.d.ts +74 -0
- package/dist/implementations/module-loader.d.ts.map +1 -0
- package/dist/implementations/native-http-client.d.ts +72 -0
- package/dist/implementations/native-http-client.d.ts.map +1 -0
- package/dist/implementations/node-file-system.d.ts +52 -0
- package/dist/implementations/node-file-system.d.ts.map +1 -0
- package/dist/implementations/request-history.d.ts +73 -0
- package/dist/implementations/request-history.d.ts.map +1 -0
- package/dist/implementations/request-preprocessor.d.ts +78 -0
- package/dist/implementations/request-preprocessor.d.ts.map +1 -0
- package/dist/implementations/variable-interpolator.d.ts +55 -0
- package/dist/implementations/variable-interpolator.d.ts.map +1 -0
- package/dist/implementations/vm2-script-runner.d.ts +76 -0
- package/dist/implementations/vm2-script-runner.d.ts.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.mjs +46 -0
- package/dist/interfaces/cookie.d.ts +101 -0
- package/dist/interfaces/cookie.d.ts.map +1 -0
- package/dist/interfaces/history.d.ts +117 -0
- package/dist/interfaces/history.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +170 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/types.d.ts +308 -0
- package/dist/interfaces/types.d.ts.map +1 -0
- package/dist/parsers/http-forge-parser.d.ts +35 -0
- package/dist/parsers/http-forge-parser.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +7 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/services/collection-loader.d.ts +52 -0
- package/dist/services/collection-loader.d.ts.map +1 -0
- package/dist/services/environment-resolver.d.ts +91 -0
- package/dist/services/environment-resolver.d.ts.map +1 -0
- package/dist/services/folder-collection-loader.d.ts +91 -0
- package/dist/services/folder-collection-loader.d.ts.map +1 -0
- package/dist/services/forge-env.d.ts +166 -0
- package/dist/services/forge-env.d.ts.map +1 -0
- package/dist/services/index.d.ts +20 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/parser-registry.d.ts +49 -0
- package/dist/services/parser-registry.d.ts.map +1 -0
- package/dist/services/request-executor.d.ts +86 -0
- package/dist/services/request-executor.d.ts.map +1 -0
- package/dist/services/script-pipeline.d.ts +43 -0
- package/dist/services/script-pipeline.d.ts.map +1 -0
- package/dist/services/script-session.d.ts +66 -0
- package/dist/services/script-session.d.ts.map +1 -0
- package/dist/services/url-builder.d.ts +60 -0
- package/dist/services/url-builder.d.ts.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie Interface Definitions
|
|
3
|
+
*
|
|
4
|
+
* Extracted 100% from VS Code plugin: src/services/interfaces/cookie.interface.ts
|
|
5
|
+
* DO NOT modify the core logic - it has been tested and is reliable.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Cookie data structure
|
|
9
|
+
* Matches plugin's Cookie interface exactly
|
|
10
|
+
*/
|
|
11
|
+
export interface Cookie {
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
domain?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
expires?: string;
|
|
17
|
+
maxAge?: number;
|
|
18
|
+
httpOnly?: boolean;
|
|
19
|
+
secure?: boolean;
|
|
20
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parsed cookie from response (simplified version)
|
|
24
|
+
* Used by HttpResponse for immediate access
|
|
25
|
+
*/
|
|
26
|
+
export interface ParsedCookie {
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
domain?: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
expires?: string;
|
|
32
|
+
httpOnly?: boolean;
|
|
33
|
+
secure?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Cookie read operations
|
|
37
|
+
* Interface Segregation: Separate read-only operations
|
|
38
|
+
*/
|
|
39
|
+
export interface ICookieReader {
|
|
40
|
+
/**
|
|
41
|
+
* Get a cookie by name
|
|
42
|
+
*/
|
|
43
|
+
get(name: string, domain?: string): Cookie | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a cookie exists
|
|
46
|
+
*/
|
|
47
|
+
has(name: string, domain?: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get all cookies, optionally filtered by domain
|
|
50
|
+
*/
|
|
51
|
+
getAll(domain?: string): Cookie[];
|
|
52
|
+
/**
|
|
53
|
+
* Get cookies formatted for HTTP Cookie header
|
|
54
|
+
*/
|
|
55
|
+
getCookieHeader(domain?: string): string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Cookie parsing operations
|
|
59
|
+
*/
|
|
60
|
+
export interface ICookieParser {
|
|
61
|
+
/**
|
|
62
|
+
* Parse Set-Cookie headers from response
|
|
63
|
+
*/
|
|
64
|
+
parseCookieHeaders(headers: Record<string, string | string[]>, domain?: string): Cookie[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Cookie write operations
|
|
68
|
+
*/
|
|
69
|
+
export interface ICookieWriter {
|
|
70
|
+
/**
|
|
71
|
+
* Set a cookie
|
|
72
|
+
*/
|
|
73
|
+
set(cookie: Cookie): void;
|
|
74
|
+
/**
|
|
75
|
+
* Set multiple cookies from a response
|
|
76
|
+
*/
|
|
77
|
+
setFromResponse(cookies: Cookie[]): void;
|
|
78
|
+
/**
|
|
79
|
+
* Delete a cookie
|
|
80
|
+
*/
|
|
81
|
+
delete(name: string, domain?: string, path?: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Clear all cookies
|
|
84
|
+
*/
|
|
85
|
+
clear(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Clear cookies for a specific domain
|
|
88
|
+
*/
|
|
89
|
+
clearDomain(domain: string): void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Full cookie jar interface (memory-based, no persistence)
|
|
93
|
+
* Core package version - no VS Code dependency
|
|
94
|
+
*/
|
|
95
|
+
export interface ICookieJar extends ICookieReader, ICookieWriter, ICookieParser {
|
|
96
|
+
/**
|
|
97
|
+
* Get cookie count
|
|
98
|
+
*/
|
|
99
|
+
readonly count: number;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/interfaces/cookie.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACxC;AA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EG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa,EAAE,aAAa,EAAE,aAAa;IAC3E;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request History Types and Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Extracted from VS Code plugin: src/services/interfaces/request-history.interface.ts
|
|
5
|
+
* Adapted for core package - storage-agnostic design
|
|
6
|
+
*/
|
|
7
|
+
import { HttpRequest, HttpResponse } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* History entry - records a single request execution
|
|
10
|
+
*/
|
|
11
|
+
export interface HistoryEntry {
|
|
12
|
+
/** Unique entry ID */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Timestamp of execution */
|
|
15
|
+
timestamp: number;
|
|
16
|
+
/** Associated ticket/issue number */
|
|
17
|
+
ticket?: string;
|
|
18
|
+
/** Git branch name */
|
|
19
|
+
branch?: string;
|
|
20
|
+
/** Environment used */
|
|
21
|
+
environment: string;
|
|
22
|
+
/** HTTP method */
|
|
23
|
+
method: string;
|
|
24
|
+
/** Actual HTTP request sent */
|
|
25
|
+
sentRequest: {
|
|
26
|
+
url: string;
|
|
27
|
+
method: string;
|
|
28
|
+
headers: Record<string, string>;
|
|
29
|
+
body?: any;
|
|
30
|
+
params?: Record<string, string>;
|
|
31
|
+
query?: Record<string, string>;
|
|
32
|
+
};
|
|
33
|
+
/** Response summary */
|
|
34
|
+
response: {
|
|
35
|
+
status: number;
|
|
36
|
+
statusText: string;
|
|
37
|
+
time: number;
|
|
38
|
+
};
|
|
39
|
+
/** Optional note/comment */
|
|
40
|
+
note?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Full response data (stored separately for large responses)
|
|
44
|
+
*/
|
|
45
|
+
export interface FullResponse {
|
|
46
|
+
timestamp: number;
|
|
47
|
+
status: number;
|
|
48
|
+
statusText: string;
|
|
49
|
+
headers: Record<string, string>;
|
|
50
|
+
cookies: any[];
|
|
51
|
+
body: any;
|
|
52
|
+
time: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Request history container
|
|
56
|
+
*/
|
|
57
|
+
export interface RequestHistory {
|
|
58
|
+
environment: string;
|
|
59
|
+
requestPath: string;
|
|
60
|
+
requestId: string;
|
|
61
|
+
method: string;
|
|
62
|
+
entries: HistoryEntry[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* History read operations
|
|
66
|
+
*/
|
|
67
|
+
export interface IHistoryReader {
|
|
68
|
+
/**
|
|
69
|
+
* Get all entries for a request
|
|
70
|
+
*/
|
|
71
|
+
getEntries(requestId: string, environment?: string): HistoryEntry[];
|
|
72
|
+
/**
|
|
73
|
+
* Get a specific entry by ID
|
|
74
|
+
*/
|
|
75
|
+
getEntry(entryId: string): HistoryEntry | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Get full response for an entry
|
|
78
|
+
*/
|
|
79
|
+
getFullResponse(entryId: string): FullResponse | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Get entry count
|
|
82
|
+
*/
|
|
83
|
+
readonly count: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* History write operations
|
|
87
|
+
*/
|
|
88
|
+
export interface IHistoryWriter {
|
|
89
|
+
/**
|
|
90
|
+
* Add a new history entry
|
|
91
|
+
*/
|
|
92
|
+
addEntry(requestId: string, request: HttpRequest, response: HttpResponse, environment: string, metadata?: {
|
|
93
|
+
ticket?: string;
|
|
94
|
+
branch?: string;
|
|
95
|
+
note?: string;
|
|
96
|
+
}): HistoryEntry;
|
|
97
|
+
/**
|
|
98
|
+
* Delete a specific entry
|
|
99
|
+
*/
|
|
100
|
+
deleteEntry(entryId: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Clear all history for a request
|
|
103
|
+
*/
|
|
104
|
+
clearHistory(requestId: string): void;
|
|
105
|
+
/**
|
|
106
|
+
* Clear all history
|
|
107
|
+
*/
|
|
108
|
+
clearAll(): void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Full history service interface
|
|
112
|
+
*/
|
|
113
|
+
export interface IRequestHistory extends IHistoryReader, IHistoryWriter {
|
|
114
|
+
/** Maximum entries to keep per request (oldest removed when exceeded) */
|
|
115
|
+
maxEntriesPerRequest: number;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/interfaces/history.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IAEf,+BAA+B;IAC/B,WAAW,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IAEF,uBAAuB;IACvB,QAAQ,EAAE;QACN,MAAM,EAAE,M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,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,GACF,YAAY,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,QAAQ,IAAI,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc,EAAE,cAAc;IACnE,yEAAyE;IACzE,oBAAoB,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @http-forge/core - Core Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Following SOLID principles:
|
|
5
|
+
* - Single Responsibility: Each interface has one focused purpose
|
|
6
|
+
* - Interface Segregation: Small, focused interfaces
|
|
7
|
+
* - Dependency Inversion: High-level modules depend on these abstractions
|
|
8
|
+
*/
|
|
9
|
+
import { HttpRequest, HttpResponse, ScriptContext, ScriptResult, UnifiedCollection } from './types';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './cookie';
|
|
12
|
+
export * from './history';
|
|
13
|
+
export type { IRequestPreprocessor } from '../implementations/request-preprocessor';
|
|
14
|
+
/**
|
|
15
|
+
* Interface for loading collections from storage.
|
|
16
|
+
*
|
|
17
|
+
* Implementations:
|
|
18
|
+
* - CollectionLoader: Loads single-file collections (.forge.json)
|
|
19
|
+
* - FolderCollectionLoader: Loads folder-based collections
|
|
20
|
+
*/
|
|
21
|
+
export interface ICollectionLoader {
|
|
22
|
+
/**
|
|
23
|
+
* Load all collections
|
|
24
|
+
*/
|
|
25
|
+
loadAll(): Promise<UnifiedCollection[]> | UnifiedCollection[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Interface for parsing collection files into unified format.
|
|
29
|
+
*
|
|
30
|
+
* Implementations:
|
|
31
|
+
* - HttpForgeParser: Parses .forge.json files
|
|
32
|
+
* - PostmanParser: Parses .postman_collection.json (future)
|
|
33
|
+
* - InsomniaParser: Parses Insomnia exports (future)
|
|
34
|
+
*/
|
|
35
|
+
export interface ICollectionParser {
|
|
36
|
+
/** Parser format identifier */
|
|
37
|
+
readonly format: string;
|
|
38
|
+
/**
|
|
39
|
+
* Check if this parser can handle the given content
|
|
40
|
+
*/
|
|
41
|
+
canParse(content: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Parse file content into unified collection format
|
|
44
|
+
*/
|
|
45
|
+
parse(content: string, filePath: string): UnifiedCollection;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Interface for storing and retrieving environment variables.
|
|
49
|
+
* Simplified version - implementations can add more methods.
|
|
50
|
+
*/
|
|
51
|
+
export interface IEnvironmentStore {
|
|
52
|
+
/**
|
|
53
|
+
* Get a single variable value
|
|
54
|
+
*/
|
|
55
|
+
get(key: string): string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Set a variable value
|
|
58
|
+
*/
|
|
59
|
+
set(key: string, value: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get all variables as a record
|
|
62
|
+
*/
|
|
63
|
+
getAll(): Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the currently active environment name
|
|
66
|
+
*/
|
|
67
|
+
getActive(): string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Set the active environment
|
|
70
|
+
*/
|
|
71
|
+
setActive(name: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Get merged variables for an environment (includes globals)
|
|
74
|
+
*/
|
|
75
|
+
getVariables(environmentName?: string): Record<string, string>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Interface for interpolating variables in strings.
|
|
79
|
+
* Handles {{variable}} syntax replacement.
|
|
80
|
+
*/
|
|
81
|
+
export interface IVariableInterpolator {
|
|
82
|
+
/**
|
|
83
|
+
* Replace {{variable}} placeholders with values
|
|
84
|
+
*/
|
|
85
|
+
interpolate(input: string, variables: Record<string, string>): string;
|
|
86
|
+
/**
|
|
87
|
+
* Extract variable names from a string
|
|
88
|
+
*/
|
|
89
|
+
extractVariables(input: string): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Replace variables in all string values of an object (recursive)
|
|
92
|
+
*/
|
|
93
|
+
interpolateObject<T>(obj: T, variables: Record<string, string>): T;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Interface for executing HTTP requests.
|
|
97
|
+
*/
|
|
98
|
+
export interface IHttpClient {
|
|
99
|
+
/**
|
|
100
|
+
* Execute an HTTP request
|
|
101
|
+
*/
|
|
102
|
+
execute(request: HttpRequest): Promise<HttpResponse>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Interface for executing individual scripts.
|
|
106
|
+
*/
|
|
107
|
+
export interface IScriptRunner {
|
|
108
|
+
/**
|
|
109
|
+
* Execute a script with the given context
|
|
110
|
+
*/
|
|
111
|
+
run(script: string, context: ScriptContext): Promise<ScriptResult>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Interface for managing script execution pipeline.
|
|
115
|
+
* Handles combining and executing multiple scripts.
|
|
116
|
+
*/
|
|
117
|
+
export interface IScriptPipeline {
|
|
118
|
+
/**
|
|
119
|
+
* Execute pre-request scripts
|
|
120
|
+
*/
|
|
121
|
+
executePreRequest(scripts: string[], context: ScriptContext): Promise<ScriptResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Execute post-response scripts
|
|
124
|
+
*/
|
|
125
|
+
executePostResponse(scripts: string[], context: ScriptContext): Promise<ScriptResult>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Interface for file system operations.
|
|
129
|
+
* Allows mocking in tests and platform-agnostic code.
|
|
130
|
+
*/
|
|
131
|
+
export interface IFileSystem {
|
|
132
|
+
/**
|
|
133
|
+
* Read file contents as string
|
|
134
|
+
*/
|
|
135
|
+
readFile(filePath: string): Promise<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Write string content to file
|
|
138
|
+
*/
|
|
139
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Check if file/directory exists
|
|
142
|
+
*/
|
|
143
|
+
exists(filePath: string): Promise<boolean>;
|
|
144
|
+
/**
|
|
145
|
+
* Create directory (recursive)
|
|
146
|
+
*/
|
|
147
|
+
mkdir(dirPath: string): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Find files matching glob pattern
|
|
150
|
+
*/
|
|
151
|
+
glob(patterns: string[], cwd?: string): Promise<string[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Read directory contents
|
|
154
|
+
*/
|
|
155
|
+
readDir(dirPath: string): Promise<string[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Check if path is directory
|
|
158
|
+
*/
|
|
159
|
+
isDirectory(filePath: string): Promise<boolean>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Interface for logging.
|
|
163
|
+
*/
|
|
164
|
+
export interface ILogger {
|
|
165
|
+
debug(message: string, ...args: any[]): void;
|
|
166
|
+
info(message: string, ...args: any[]): void;
|
|
167
|
+
warn(message: string, ...args: any[]): void;
|
|
168
|
+
error(message: string, ...args: any[]): void;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACH,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAGjB,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,YAAY,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAMpF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,OAAO,I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