@contractspec/lib.source-extractors 0.11.0 → 0.13.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/dist/browser/codegen/index.js +225 -0
- package/dist/browser/extractors/index.js +835 -0
- package/dist/browser/index.js +1215 -0
- package/dist/browser/types.js +0 -0
- package/dist/codegen/index.d.ts +9 -11
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +223 -14
- package/dist/codegen/operation-gen.d.ts +9 -8
- package/dist/codegen/operation-gen.d.ts.map +1 -1
- package/dist/codegen/registry-gen.d.ts +7 -6
- package/dist/codegen/registry-gen.d.ts.map +1 -1
- package/dist/codegen/schema-gen.d.ts +9 -8
- package/dist/codegen/schema-gen.d.ts.map +1 -1
- package/dist/codegen/types.d.ts +29 -32
- package/dist/codegen/types.d.ts.map +1 -1
- package/dist/detect.d.ts +19 -17
- package/dist/detect.d.ts.map +1 -1
- package/dist/extract.d.ts +10 -8
- package/dist/extract.d.ts.map +1 -1
- package/dist/extractors/base.d.ts +76 -75
- package/dist/extractors/base.d.ts.map +1 -1
- package/dist/extractors/elysia/extractor.d.ts +15 -12
- package/dist/extractors/elysia/extractor.d.ts.map +1 -1
- package/dist/extractors/express/extractor.d.ts +16 -12
- package/dist/extractors/express/extractor.d.ts.map +1 -1
- package/dist/extractors/fastify/extractor.d.ts +16 -12
- package/dist/extractors/fastify/extractor.d.ts.map +1 -1
- package/dist/extractors/hono/extractor.d.ts +15 -12
- package/dist/extractors/hono/extractor.d.ts.map +1 -1
- package/dist/extractors/index.d.ts +16 -17
- package/dist/extractors/index.d.ts.map +1 -1
- package/dist/extractors/index.js +834 -40
- package/dist/extractors/nestjs/extractor.d.ts +28 -23
- package/dist/extractors/nestjs/extractor.d.ts.map +1 -1
- package/dist/extractors/next-api/extractor.d.ts +16 -13
- package/dist/extractors/next-api/extractor.d.ts.map +1 -1
- package/dist/extractors/trpc/extractor.d.ts +16 -12
- package/dist/extractors/trpc/extractor.d.ts.map +1 -1
- package/dist/extractors/zod/extractor.d.ts +15 -13
- package/dist/extractors/zod/extractor.d.ts.map +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1215 -6
- package/dist/node/codegen/index.js +225 -0
- package/dist/node/extractors/index.js +835 -0
- package/dist/node/index.js +1215 -0
- package/dist/node/types.js +0 -0
- package/dist/registry.d.ts +69 -68
- package/dist/registry.d.ts.map +1 -1
- package/dist/types.d.ts +182 -185
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/package.json +60 -21
- package/dist/_virtual/_rolldown/runtime.js +0 -18
- package/dist/codegen/index.js.map +0 -1
- package/dist/codegen/operation-gen.js +0 -91
- package/dist/codegen/operation-gen.js.map +0 -1
- package/dist/codegen/registry-gen.js +0 -47
- package/dist/codegen/registry-gen.js.map +0 -1
- package/dist/codegen/schema-gen.js +0 -93
- package/dist/codegen/schema-gen.js.map +0 -1
- package/dist/detect.js +0 -177
- package/dist/detect.js.map +0 -1
- package/dist/extract.js +0 -125
- package/dist/extract.js.map +0 -1
- package/dist/extractors/base.js +0 -152
- package/dist/extractors/base.js.map +0 -1
- package/dist/extractors/elysia/extractor.js +0 -58
- package/dist/extractors/elysia/extractor.js.map +0 -1
- package/dist/extractors/express/extractor.js +0 -61
- package/dist/extractors/express/extractor.js.map +0 -1
- package/dist/extractors/fastify/extractor.js +0 -61
- package/dist/extractors/fastify/extractor.js.map +0 -1
- package/dist/extractors/hono/extractor.js +0 -57
- package/dist/extractors/hono/extractor.js.map +0 -1
- package/dist/extractors/index.js.map +0 -1
- package/dist/extractors/nestjs/extractor.js +0 -118
- package/dist/extractors/nestjs/extractor.js.map +0 -1
- package/dist/extractors/next-api/extractor.js +0 -80
- package/dist/extractors/next-api/extractor.js.map +0 -1
- package/dist/extractors/trpc/extractor.js +0 -71
- package/dist/extractors/trpc/extractor.js.map +0 -1
- package/dist/extractors/zod/extractor.js +0 -69
- package/dist/extractors/zod/extractor.js.map +0 -1
- package/dist/registry.js +0 -87
- package/dist/registry.js.map +0 -1
|
File without changes
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,84 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Source extractor registry.
|
|
3
|
+
*
|
|
4
|
+
* Manages extractor plugins and provides lookup by framework.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtractOptions, ExtractResult, ProjectInfo } from './types';
|
|
4
7
|
/**
|
|
5
8
|
* Interface that all source extractors must implement.
|
|
6
9
|
*/
|
|
7
|
-
interface SourceExtractor {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
10
|
+
export interface SourceExtractor {
|
|
11
|
+
/** Unique identifier for this extractor */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Human-readable name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Frameworks this extractor supports */
|
|
16
|
+
frameworks: string[];
|
|
17
|
+
/** Priority (higher = preferred when multiple match) */
|
|
18
|
+
priority: number;
|
|
19
|
+
/**
|
|
20
|
+
* Detect if this extractor can handle the given project.
|
|
21
|
+
* @param project Project information
|
|
22
|
+
* @returns true if this extractor should be used
|
|
23
|
+
*/
|
|
24
|
+
detect(project: ProjectInfo): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Extract contract candidates from the project.
|
|
27
|
+
* @param project Project information
|
|
28
|
+
* @param options Extraction options
|
|
29
|
+
* @returns Extraction result with IR
|
|
30
|
+
*/
|
|
31
|
+
extract(project: ProjectInfo, options: ExtractOptions): Promise<ExtractResult>;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* Registry for source extractor plugins.
|
|
32
35
|
*/
|
|
33
|
-
declare class ExtractorRegistry {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
36
|
+
export declare class ExtractorRegistry {
|
|
37
|
+
private extractors;
|
|
38
|
+
/**
|
|
39
|
+
* Register an extractor plugin.
|
|
40
|
+
*/
|
|
41
|
+
register(extractor: SourceExtractor): void;
|
|
42
|
+
/**
|
|
43
|
+
* Unregister an extractor plugin.
|
|
44
|
+
*/
|
|
45
|
+
unregister(id: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get an extractor by ID.
|
|
48
|
+
*/
|
|
49
|
+
get(id: string): SourceExtractor | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Get all registered extractors.
|
|
52
|
+
*/
|
|
53
|
+
getAll(): SourceExtractor[];
|
|
54
|
+
/**
|
|
55
|
+
* Find extractors that can handle the given project.
|
|
56
|
+
* Returns extractors sorted by priority (highest first).
|
|
57
|
+
*/
|
|
58
|
+
findMatching(project: ProjectInfo): Promise<SourceExtractor[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Find extractors for a specific framework.
|
|
61
|
+
*/
|
|
62
|
+
findByFramework(framework: string): SourceExtractor[];
|
|
63
|
+
/**
|
|
64
|
+
* Alias for findByFramework.
|
|
65
|
+
*/
|
|
66
|
+
findForFramework(framework: string): SourceExtractor[];
|
|
67
|
+
/**
|
|
68
|
+
* Check if an extractor exists for the given framework.
|
|
69
|
+
*/
|
|
70
|
+
hasExtractorFor(framework: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get list of all supported framework IDs.
|
|
73
|
+
*/
|
|
74
|
+
getSupportedFrameworks(): string[];
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
77
|
* Global extractor registry instance.
|
|
75
78
|
*/
|
|
76
|
-
declare const extractorRegistry: ExtractorRegistry;
|
|
79
|
+
export declare const extractorRegistry: ExtractorRegistry;
|
|
77
80
|
/**
|
|
78
81
|
* Register built-in extractors.
|
|
79
82
|
* Called automatically when the module is imported.
|
|
80
83
|
*/
|
|
81
|
-
declare function registerBuiltInExtractors(): void;
|
|
82
|
-
//#endregion
|
|
83
|
-
export { ExtractorRegistry, SourceExtractor, extractorRegistry, registerBuiltInExtractors };
|
|
84
|
+
export declare function registerBuiltInExtractors(): void;
|
|
84
85
|
//# sourceMappingURL=registry.d.ts.map
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;;OAKG;IACH,OAAO,CACL,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAsC;IAExD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAI1C;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI5C;;OAEG;IACH,MAAM,IAAI,eAAe,EAAE;IAI3B;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAgBpE;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAYrD;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAItD;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAY3C;;OAEG;IACH,sBAAsB,IAAI,MAAM,EAAE;CAUnC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Intermediate Representation (IR) types for source extraction.
|
|
4
3
|
*
|
|
@@ -9,264 +8,262 @@
|
|
|
9
8
|
* Confidence level for extracted candidates.
|
|
10
9
|
* Indicates how certain we are about the extraction.
|
|
11
10
|
*/
|
|
12
|
-
type ConfidenceLevel = 'high' | 'medium' | 'low' | 'ambiguous';
|
|
11
|
+
export type ConfidenceLevel = 'high' | 'medium' | 'low' | 'ambiguous';
|
|
13
12
|
/**
|
|
14
13
|
* Reason for the assigned confidence level.
|
|
15
14
|
*/
|
|
16
|
-
type ConfidenceReason = 'explicit-schema' | 'explicit-decorator' | 'inferred-types' | 'decorator-hints' | 'naming-convention' | 'missing-schema' | 'partial-extraction';
|
|
15
|
+
export type ConfidenceReason = 'explicit-schema' | 'explicit-decorator' | 'inferred-types' | 'decorator-hints' | 'naming-convention' | 'missing-schema' | 'partial-extraction';
|
|
17
16
|
/**
|
|
18
17
|
* Source location information.
|
|
19
18
|
*/
|
|
20
|
-
interface SourceLocation {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
export interface SourceLocation {
|
|
20
|
+
/** File path (relative to project root) */
|
|
21
|
+
file: string;
|
|
22
|
+
/** Start line number (1-indexed) */
|
|
23
|
+
startLine: number;
|
|
24
|
+
/** End line number (1-indexed) */
|
|
25
|
+
endLine: number;
|
|
26
|
+
/** Optional column information */
|
|
27
|
+
startColumn?: number;
|
|
28
|
+
endColumn?: number;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* HTTP method types.
|
|
33
32
|
*/
|
|
34
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
33
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
35
34
|
/**
|
|
36
35
|
* Operation kind derived from HTTP method or explicit annotation.
|
|
37
36
|
*/
|
|
38
|
-
type OpKind = 'command' | 'query';
|
|
37
|
+
export type OpKind = 'command' | 'query';
|
|
39
38
|
/**
|
|
40
39
|
* Confidence metadata attached to extracted items.
|
|
41
40
|
*/
|
|
42
|
-
interface ConfidenceMeta {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export interface ConfidenceMeta {
|
|
42
|
+
level: ConfidenceLevel;
|
|
43
|
+
reasons: ConfidenceReason[];
|
|
44
|
+
notes?: string[];
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* Schema candidate extracted from source code.
|
|
49
48
|
* Can represent Zod schemas, class-validator DTOs, JSON Schema, etc.
|
|
50
49
|
*/
|
|
51
|
-
interface SchemaCandidate {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
export interface SchemaCandidate {
|
|
51
|
+
/** Unique identifier for this schema */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Schema name (e.g., class name, export name) */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Type of schema source */
|
|
56
|
+
schemaType: 'zod' | 'class-validator' | 'json-schema' | 'typebox' | 'typescript' | 'unknown';
|
|
57
|
+
/** Raw schema definition (for Zod, the code; for class-validator, the class def) */
|
|
58
|
+
rawDefinition?: string;
|
|
59
|
+
/** Parsed fields if available */
|
|
60
|
+
fields?: SchemaField[];
|
|
61
|
+
/** Source location */
|
|
62
|
+
source: SourceLocation;
|
|
63
|
+
/** Confidence in this extraction */
|
|
64
|
+
confidence: ConfidenceMeta;
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
67
|
* Individual field in a schema.
|
|
69
68
|
*/
|
|
70
|
-
interface SchemaField {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
export interface SchemaField {
|
|
70
|
+
name: string;
|
|
71
|
+
type: string;
|
|
72
|
+
optional: boolean;
|
|
73
|
+
description?: string;
|
|
74
|
+
validation?: string[];
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Endpoint candidate extracted from source code.
|
|
79
78
|
* Represents an API route/handler.
|
|
80
79
|
*/
|
|
81
|
-
interface EndpointCandidate {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
80
|
+
export interface EndpointCandidate {
|
|
81
|
+
/** Unique identifier for this endpoint */
|
|
82
|
+
id: string;
|
|
83
|
+
/** HTTP method */
|
|
84
|
+
method: HttpMethod;
|
|
85
|
+
/** Route path (e.g., '/users/:id') */
|
|
86
|
+
path: string;
|
|
87
|
+
/** Operation kind (command/query) */
|
|
88
|
+
kind: OpKind;
|
|
89
|
+
/** Handler function name */
|
|
90
|
+
handlerName: string;
|
|
91
|
+
/** Controller/router name if applicable */
|
|
92
|
+
controllerName?: string;
|
|
93
|
+
/** Input schema reference */
|
|
94
|
+
input?: SchemaRef;
|
|
95
|
+
/** Output schema reference */
|
|
96
|
+
output?: SchemaRef;
|
|
97
|
+
/** Path parameters */
|
|
98
|
+
pathParams?: SchemaRef;
|
|
99
|
+
/** Query parameters */
|
|
100
|
+
queryParams?: SchemaRef;
|
|
101
|
+
/** Associated errors */
|
|
102
|
+
errors?: ErrorRef[];
|
|
103
|
+
/** Framework-specific metadata */
|
|
104
|
+
frameworkMeta?: Record<string, unknown>;
|
|
105
|
+
/** Source location */
|
|
106
|
+
source: SourceLocation;
|
|
107
|
+
/** Confidence in this extraction */
|
|
108
|
+
confidence: ConfidenceMeta;
|
|
110
109
|
}
|
|
111
110
|
/**
|
|
112
111
|
* Reference to a schema (either inline or by ID).
|
|
113
112
|
*/
|
|
114
|
-
interface SchemaRef {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
export interface SchemaRef {
|
|
114
|
+
/** Reference to a SchemaCandidate.id */
|
|
115
|
+
ref?: string;
|
|
116
|
+
/** Inline schema definition if not a reference */
|
|
117
|
+
inline?: SchemaCandidate;
|
|
119
118
|
}
|
|
120
119
|
/**
|
|
121
120
|
* Error candidate extracted from source code.
|
|
122
121
|
*/
|
|
123
|
-
interface ErrorCandidate {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
export interface ErrorCandidate {
|
|
123
|
+
/** Unique identifier for this error */
|
|
124
|
+
id: string;
|
|
125
|
+
/** Error name/code */
|
|
126
|
+
name: string;
|
|
127
|
+
/** HTTP status code if applicable */
|
|
128
|
+
httpStatus?: number;
|
|
129
|
+
/** Error description */
|
|
130
|
+
description?: string;
|
|
131
|
+
/** Error payload schema if any */
|
|
132
|
+
payload?: SchemaRef;
|
|
133
|
+
/** Source location */
|
|
134
|
+
source: SourceLocation;
|
|
135
|
+
/** Confidence in this extraction */
|
|
136
|
+
confidence: ConfidenceMeta;
|
|
138
137
|
}
|
|
139
138
|
/**
|
|
140
139
|
* Reference to an error.
|
|
141
140
|
*/
|
|
142
|
-
interface ErrorRef {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
export interface ErrorRef {
|
|
142
|
+
/** Reference to an ErrorCandidate.id */
|
|
143
|
+
ref?: string;
|
|
144
|
+
/** Condition when this error is thrown */
|
|
145
|
+
when?: string;
|
|
147
146
|
}
|
|
148
147
|
/**
|
|
149
148
|
* Event candidate extracted from source code.
|
|
150
149
|
*/
|
|
151
|
-
interface EventCandidate {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
export interface EventCandidate {
|
|
151
|
+
/** Unique identifier for this event */
|
|
152
|
+
id: string;
|
|
153
|
+
/** Event name/key */
|
|
154
|
+
name: string;
|
|
155
|
+
/** Event payload schema */
|
|
156
|
+
payload?: SchemaRef;
|
|
157
|
+
/** Source location */
|
|
158
|
+
source: SourceLocation;
|
|
159
|
+
/** Confidence in this extraction */
|
|
160
|
+
confidence: ConfidenceMeta;
|
|
162
161
|
}
|
|
163
162
|
/**
|
|
164
163
|
* Ambiguity detected during extraction.
|
|
165
164
|
* Used to flag items that need human review.
|
|
166
165
|
*/
|
|
167
|
-
interface Ambiguity {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
166
|
+
export interface Ambiguity {
|
|
167
|
+
/** Type of ambiguous item */
|
|
168
|
+
type: 'endpoint' | 'schema' | 'error' | 'event';
|
|
169
|
+
/** Reference to the item ID */
|
|
170
|
+
itemId: string;
|
|
171
|
+
/** Description of the ambiguity */
|
|
172
|
+
description: string;
|
|
173
|
+
/** Suggested resolution */
|
|
174
|
+
suggestion?: string;
|
|
175
|
+
/** Source location */
|
|
176
|
+
source: SourceLocation;
|
|
178
177
|
}
|
|
179
178
|
/**
|
|
180
179
|
* Framework detection result.
|
|
181
180
|
*/
|
|
182
|
-
interface FrameworkInfo {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
181
|
+
export interface FrameworkInfo {
|
|
182
|
+
/** Framework identifier */
|
|
183
|
+
id: string;
|
|
184
|
+
/** Human-readable name */
|
|
185
|
+
name: string;
|
|
186
|
+
/** Version if detected */
|
|
187
|
+
version?: string;
|
|
188
|
+
/** Detection confidence */
|
|
189
|
+
confidence: ConfidenceLevel;
|
|
191
190
|
}
|
|
192
191
|
/**
|
|
193
192
|
* Project information used for extraction.
|
|
194
193
|
*/
|
|
195
|
-
interface ProjectInfo {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
export interface ProjectInfo {
|
|
195
|
+
/** Project root path */
|
|
196
|
+
rootPath: string;
|
|
197
|
+
/** Detected frameworks */
|
|
198
|
+
frameworks: FrameworkInfo[];
|
|
199
|
+
/** TypeScript config path if found */
|
|
200
|
+
tsConfigPath?: string;
|
|
201
|
+
/** Package.json path if found */
|
|
202
|
+
packageJsonPath?: string;
|
|
204
203
|
}
|
|
205
204
|
/**
|
|
206
205
|
* Options for extraction.
|
|
207
206
|
*/
|
|
208
|
-
interface ExtractOptions {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
207
|
+
export interface ExtractOptions {
|
|
208
|
+
/** Force a specific framework */
|
|
209
|
+
framework?: string;
|
|
210
|
+
/** Limit extraction to specific paths (glob patterns) */
|
|
211
|
+
scope?: string[];
|
|
212
|
+
/** Exclude paths (glob patterns) */
|
|
213
|
+
exclude?: string[];
|
|
214
|
+
/** Include node_modules */
|
|
215
|
+
includeNodeModules?: boolean;
|
|
216
|
+
/** Extraction mode */
|
|
217
|
+
mode?: 'full' | 'endpoints-only' | 'schemas-only';
|
|
219
218
|
}
|
|
220
219
|
/**
|
|
221
220
|
* The complete Intermediate Representation of extracted contracts.
|
|
222
221
|
*/
|
|
223
|
-
interface ImportIR {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
222
|
+
export interface ImportIR {
|
|
223
|
+
/** IR schema version */
|
|
224
|
+
version: '1.0';
|
|
225
|
+
/** Extraction timestamp (ISO 8601) */
|
|
226
|
+
extractedAt: string;
|
|
227
|
+
/** Project information */
|
|
228
|
+
project: ProjectInfo;
|
|
229
|
+
/** Extracted endpoints */
|
|
230
|
+
endpoints: EndpointCandidate[];
|
|
231
|
+
/** Extracted schemas */
|
|
232
|
+
schemas: SchemaCandidate[];
|
|
233
|
+
/** Extracted errors */
|
|
234
|
+
errors: ErrorCandidate[];
|
|
235
|
+
/** Extracted events */
|
|
236
|
+
events: EventCandidate[];
|
|
237
|
+
/** Detected ambiguities requiring review */
|
|
238
|
+
ambiguities: Ambiguity[];
|
|
239
|
+
/** Extraction statistics */
|
|
240
|
+
stats: {
|
|
241
|
+
filesScanned: number;
|
|
242
|
+
endpointsFound: number;
|
|
243
|
+
schemasFound: number;
|
|
244
|
+
errorsFound: number;
|
|
245
|
+
eventsFound: number;
|
|
246
|
+
ambiguitiesFound: number;
|
|
247
|
+
highConfidence: number;
|
|
248
|
+
mediumConfidence: number;
|
|
249
|
+
lowConfidence: number;
|
|
250
|
+
};
|
|
252
251
|
}
|
|
253
252
|
/**
|
|
254
253
|
* Result of an extraction operation.
|
|
255
254
|
*/
|
|
256
|
-
interface ExtractResult {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
export interface ExtractResult {
|
|
256
|
+
success: boolean;
|
|
257
|
+
ir?: ImportIR;
|
|
258
|
+
errors?: ExtractError[];
|
|
260
259
|
}
|
|
261
260
|
/**
|
|
262
261
|
* Error during extraction.
|
|
263
262
|
*/
|
|
264
|
-
interface ExtractError {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
export interface ExtractError {
|
|
264
|
+
code: string;
|
|
265
|
+
message: string;
|
|
266
|
+
source?: SourceLocation;
|
|
267
|
+
recoverable: boolean;
|
|
269
268
|
}
|
|
270
|
-
//#endregion
|
|
271
|
-
export { Ambiguity, ConfidenceLevel, ConfidenceMeta, ConfidenceReason, EndpointCandidate, ErrorCandidate, ErrorRef, EventCandidate, ExtractError, ExtractOptions, ExtractResult, FrameworkInfo, HttpMethod, ImportIR, OpKind, ProjectInfo, SchemaCandidate, SchemaField, SchemaRef, SourceLocation };
|
|
272
269
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,WAAW,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,CAAC;AAEd;;GAEG;AACH,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