@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.
Files changed (86) hide show
  1. package/dist/browser/codegen/index.js +225 -0
  2. package/dist/browser/extractors/index.js +835 -0
  3. package/dist/browser/index.js +1215 -0
  4. package/dist/browser/types.js +0 -0
  5. package/dist/codegen/index.d.ts +9 -11
  6. package/dist/codegen/index.d.ts.map +1 -1
  7. package/dist/codegen/index.js +223 -14
  8. package/dist/codegen/operation-gen.d.ts +9 -8
  9. package/dist/codegen/operation-gen.d.ts.map +1 -1
  10. package/dist/codegen/registry-gen.d.ts +7 -6
  11. package/dist/codegen/registry-gen.d.ts.map +1 -1
  12. package/dist/codegen/schema-gen.d.ts +9 -8
  13. package/dist/codegen/schema-gen.d.ts.map +1 -1
  14. package/dist/codegen/types.d.ts +29 -32
  15. package/dist/codegen/types.d.ts.map +1 -1
  16. package/dist/detect.d.ts +19 -17
  17. package/dist/detect.d.ts.map +1 -1
  18. package/dist/extract.d.ts +10 -8
  19. package/dist/extract.d.ts.map +1 -1
  20. package/dist/extractors/base.d.ts +76 -75
  21. package/dist/extractors/base.d.ts.map +1 -1
  22. package/dist/extractors/elysia/extractor.d.ts +15 -12
  23. package/dist/extractors/elysia/extractor.d.ts.map +1 -1
  24. package/dist/extractors/express/extractor.d.ts +16 -12
  25. package/dist/extractors/express/extractor.d.ts.map +1 -1
  26. package/dist/extractors/fastify/extractor.d.ts +16 -12
  27. package/dist/extractors/fastify/extractor.d.ts.map +1 -1
  28. package/dist/extractors/hono/extractor.d.ts +15 -12
  29. package/dist/extractors/hono/extractor.d.ts.map +1 -1
  30. package/dist/extractors/index.d.ts +16 -17
  31. package/dist/extractors/index.d.ts.map +1 -1
  32. package/dist/extractors/index.js +834 -40
  33. package/dist/extractors/nestjs/extractor.d.ts +28 -23
  34. package/dist/extractors/nestjs/extractor.d.ts.map +1 -1
  35. package/dist/extractors/next-api/extractor.d.ts +16 -13
  36. package/dist/extractors/next-api/extractor.d.ts.map +1 -1
  37. package/dist/extractors/trpc/extractor.d.ts +16 -12
  38. package/dist/extractors/trpc/extractor.d.ts.map +1 -1
  39. package/dist/extractors/zod/extractor.d.ts +15 -13
  40. package/dist/extractors/zod/extractor.d.ts.map +1 -1
  41. package/dist/index.d.ts +30 -7
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +1215 -6
  44. package/dist/node/codegen/index.js +225 -0
  45. package/dist/node/extractors/index.js +835 -0
  46. package/dist/node/index.js +1215 -0
  47. package/dist/node/types.js +0 -0
  48. package/dist/registry.d.ts +69 -68
  49. package/dist/registry.d.ts.map +1 -1
  50. package/dist/types.d.ts +182 -185
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js +1 -0
  53. package/package.json +60 -21
  54. package/dist/_virtual/_rolldown/runtime.js +0 -18
  55. package/dist/codegen/index.js.map +0 -1
  56. package/dist/codegen/operation-gen.js +0 -91
  57. package/dist/codegen/operation-gen.js.map +0 -1
  58. package/dist/codegen/registry-gen.js +0 -47
  59. package/dist/codegen/registry-gen.js.map +0 -1
  60. package/dist/codegen/schema-gen.js +0 -93
  61. package/dist/codegen/schema-gen.js.map +0 -1
  62. package/dist/detect.js +0 -177
  63. package/dist/detect.js.map +0 -1
  64. package/dist/extract.js +0 -125
  65. package/dist/extract.js.map +0 -1
  66. package/dist/extractors/base.js +0 -152
  67. package/dist/extractors/base.js.map +0 -1
  68. package/dist/extractors/elysia/extractor.js +0 -58
  69. package/dist/extractors/elysia/extractor.js.map +0 -1
  70. package/dist/extractors/express/extractor.js +0 -61
  71. package/dist/extractors/express/extractor.js.map +0 -1
  72. package/dist/extractors/fastify/extractor.js +0 -61
  73. package/dist/extractors/fastify/extractor.js.map +0 -1
  74. package/dist/extractors/hono/extractor.js +0 -57
  75. package/dist/extractors/hono/extractor.js.map +0 -1
  76. package/dist/extractors/index.js.map +0 -1
  77. package/dist/extractors/nestjs/extractor.js +0 -118
  78. package/dist/extractors/nestjs/extractor.js.map +0 -1
  79. package/dist/extractors/next-api/extractor.js +0 -80
  80. package/dist/extractors/next-api/extractor.js.map +0 -1
  81. package/dist/extractors/trpc/extractor.js +0 -71
  82. package/dist/extractors/trpc/extractor.js.map +0 -1
  83. package/dist/extractors/zod/extractor.js +0 -69
  84. package/dist/extractors/zod/extractor.js.map +0 -1
  85. package/dist/registry.js +0 -87
  86. package/dist/registry.js.map +0 -1
File without changes
@@ -1,84 +1,85 @@
1
- import { ExtractOptions, ExtractResult, ProjectInfo } from "./types.js";
2
-
3
- //#region src/registry.d.ts
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
- /** Unique identifier for this extractor */
9
- id: string;
10
- /** Human-readable name */
11
- name: string;
12
- /** Frameworks this extractor supports */
13
- frameworks: string[];
14
- /** Priority (higher = preferred when multiple match) */
15
- priority: number;
16
- /**
17
- * Detect if this extractor can handle the given project.
18
- * @param project Project information
19
- * @returns true if this extractor should be used
20
- */
21
- detect(project: ProjectInfo): Promise<boolean>;
22
- /**
23
- * Extract contract candidates from the project.
24
- * @param project Project information
25
- * @param options Extraction options
26
- * @returns Extraction result with IR
27
- */
28
- extract(project: ProjectInfo, options: ExtractOptions): Promise<ExtractResult>;
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
- private extractors;
35
- /**
36
- * Register an extractor plugin.
37
- */
38
- register(extractor: SourceExtractor): void;
39
- /**
40
- * Unregister an extractor plugin.
41
- */
42
- unregister(id: string): boolean;
43
- /**
44
- * Get an extractor by ID.
45
- */
46
- get(id: string): SourceExtractor | undefined;
47
- /**
48
- * Get all registered extractors.
49
- */
50
- getAll(): SourceExtractor[];
51
- /**
52
- * Find extractors that can handle the given project.
53
- * Returns extractors sorted by priority (highest first).
54
- */
55
- findMatching(project: ProjectInfo): Promise<SourceExtractor[]>;
56
- /**
57
- * Find extractors for a specific framework.
58
- */
59
- findByFramework(framework: string): SourceExtractor[];
60
- /**
61
- * Alias for findByFramework.
62
- */
63
- findForFramework(framework: string): SourceExtractor[];
64
- /**
65
- * Check if an extractor exists for the given framework.
66
- */
67
- hasExtractorFor(framework: string): boolean;
68
- /**
69
- * Get list of all supported framework IDs.
70
- */
71
- getSupportedFrameworks(): string[];
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
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","names":[],"sources":["../src/registry.ts"],"mappings":";;;;;;UAWiB,eAAA;EA0BJ;EAxBX,EAAA;EAwBU;EAtBV,IAAA;EAFA;EAIA,UAAA;EAAA;EAEA,QAAA;EAOA;;;;;EAAA,MAAA,CAAO,OAAA,EAAS,WAAA,GAAc,OAAA;EAS5B;;;;;;EADF,OAAA,CACE,OAAA,EAAS,WAAA,EACT,OAAA,EAAS,cAAA,GACR,OAAA,CAAQ,aAAA;AAAA;;;;cAMA,iBAAA;EAAA,QACH,UAAA;EAkCoB;;;EA7B5B,QAAA,CAAS,SAAA,EAAW,eAAA;EA+DiB;;;EAxDrC,UAAA,CAAW,EAAA;EAPX;;;EAcA,GAAA,CAAI,EAAA,WAAa,eAAA;EAPN;;;EAcX,MAAA,CAAA,GAAU,eAAA;EAAV;;;;EAQM,YAAA,CAAa,OAAA,EAAS,WAAA,GAAc,OAAA,CAAQ,eAAA;EAAR;;;EAmB1C,eAAA,CAAgB,SAAA,WAAoB,eAAA;EAAA;;;EAepC,gBAAA,CAAiB,SAAA,WAAoB,eAAA;EAOrC;;;EAAA,eAAA,CAAgB,SAAA;EAeM;AAexB;;EAfE,sBAAA,CAAA;AAA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AM,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
- /** File path (relative to project root) */
22
- file: string;
23
- /** Start line number (1-indexed) */
24
- startLine: number;
25
- /** End line number (1-indexed) */
26
- endLine: number;
27
- /** Optional column information */
28
- startColumn?: number;
29
- endColumn?: number;
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
- level: ConfidenceLevel;
44
- reasons: ConfidenceReason[];
45
- notes?: string[];
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
- /** Unique identifier for this schema */
53
- id: string;
54
- /** Schema name (e.g., class name, export name) */
55
- name: string;
56
- /** Type of schema source */
57
- schemaType: 'zod' | 'class-validator' | 'json-schema' | 'typebox' | 'typescript' | 'unknown';
58
- /** Raw schema definition (for Zod, the code; for class-validator, the class def) */
59
- rawDefinition?: string;
60
- /** Parsed fields if available */
61
- fields?: SchemaField[];
62
- /** Source location */
63
- source: SourceLocation;
64
- /** Confidence in this extraction */
65
- confidence: ConfidenceMeta;
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
- name: string;
72
- type: string;
73
- optional: boolean;
74
- description?: string;
75
- validation?: string[];
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
- /** Unique identifier for this endpoint */
83
- id: string;
84
- /** HTTP method */
85
- method: HttpMethod;
86
- /** Route path (e.g., '/users/:id') */
87
- path: string;
88
- /** Operation kind (command/query) */
89
- kind: OpKind;
90
- /** Handler function name */
91
- handlerName: string;
92
- /** Controller/router name if applicable */
93
- controllerName?: string;
94
- /** Input schema reference */
95
- input?: SchemaRef;
96
- /** Output schema reference */
97
- output?: SchemaRef;
98
- /** Path parameters */
99
- pathParams?: SchemaRef;
100
- /** Query parameters */
101
- queryParams?: SchemaRef;
102
- /** Associated errors */
103
- errors?: ErrorRef[];
104
- /** Framework-specific metadata */
105
- frameworkMeta?: Record<string, unknown>;
106
- /** Source location */
107
- source: SourceLocation;
108
- /** Confidence in this extraction */
109
- confidence: ConfidenceMeta;
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
- /** Reference to a SchemaCandidate.id */
116
- ref?: string;
117
- /** Inline schema definition if not a reference */
118
- inline?: SchemaCandidate;
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
- /** Unique identifier for this error */
125
- id: string;
126
- /** Error name/code */
127
- name: string;
128
- /** HTTP status code if applicable */
129
- httpStatus?: number;
130
- /** Error description */
131
- description?: string;
132
- /** Error payload schema if any */
133
- payload?: SchemaRef;
134
- /** Source location */
135
- source: SourceLocation;
136
- /** Confidence in this extraction */
137
- confidence: ConfidenceMeta;
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
- /** Reference to an ErrorCandidate.id */
144
- ref?: string;
145
- /** Condition when this error is thrown */
146
- when?: string;
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
- /** Unique identifier for this event */
153
- id: string;
154
- /** Event name/key */
155
- name: string;
156
- /** Event payload schema */
157
- payload?: SchemaRef;
158
- /** Source location */
159
- source: SourceLocation;
160
- /** Confidence in this extraction */
161
- confidence: ConfidenceMeta;
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
- /** Type of ambiguous item */
169
- type: 'endpoint' | 'schema' | 'error' | 'event';
170
- /** Reference to the item ID */
171
- itemId: string;
172
- /** Description of the ambiguity */
173
- description: string;
174
- /** Suggested resolution */
175
- suggestion?: string;
176
- /** Source location */
177
- source: SourceLocation;
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
- /** Framework identifier */
184
- id: string;
185
- /** Human-readable name */
186
- name: string;
187
- /** Version if detected */
188
- version?: string;
189
- /** Detection confidence */
190
- confidence: ConfidenceLevel;
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
- /** Project root path */
197
- rootPath: string;
198
- /** Detected frameworks */
199
- frameworks: FrameworkInfo[];
200
- /** TypeScript config path if found */
201
- tsConfigPath?: string;
202
- /** Package.json path if found */
203
- packageJsonPath?: string;
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
- /** Force a specific framework */
210
- framework?: string;
211
- /** Limit extraction to specific paths (glob patterns) */
212
- scope?: string[];
213
- /** Exclude paths (glob patterns) */
214
- exclude?: string[];
215
- /** Include node_modules */
216
- includeNodeModules?: boolean;
217
- /** Extraction mode */
218
- mode?: 'full' | 'endpoints-only' | 'schemas-only';
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
- /** IR schema version */
225
- version: '1.0';
226
- /** Extraction timestamp (ISO 8601) */
227
- extractedAt: string;
228
- /** Project information */
229
- project: ProjectInfo;
230
- /** Extracted endpoints */
231
- endpoints: EndpointCandidate[];
232
- /** Extracted schemas */
233
- schemas: SchemaCandidate[];
234
- /** Extracted errors */
235
- errors: ErrorCandidate[];
236
- /** Extracted events */
237
- events: EventCandidate[];
238
- /** Detected ambiguities requiring review */
239
- ambiguities: Ambiguity[];
240
- /** Extraction statistics */
241
- stats: {
242
- filesScanned: number;
243
- endpointsFound: number;
244
- schemasFound: number;
245
- errorsFound: number;
246
- eventsFound: number;
247
- ambiguitiesFound: number;
248
- highConfidence: number;
249
- mediumConfidence: number;
250
- lowConfidence: number;
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
- success: boolean;
258
- ir?: ImportIR;
259
- errors?: ExtractError[];
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
- code: string;
266
- message: string;
267
- source?: SourceLocation;
268
- recoverable: boolean;
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
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;AAWA;;;;;AAKA;;;;AAAA,KALY,eAAA;AAiBZ;;;AAAA,KAZY,gBAAA;;;;UAYK,cAAA;EASf;EAPA,IAAA;EAOS;EALT,SAAA;EAWoB;EATpB,OAAA;EASoB;EAPpB,WAAA;EACA,SAAA;AAAA;;;;KAMU,UAAA;;;;KAYA,MAAA;;;;UAKK,cAAA;EACf,KAAA,EAAO,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