@abapify/ts-xsd 0.4.0 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,741 @@
1
+ //#region src/xsd/types.d.ts
2
+ /**
3
+ * XSD Types - TypeScript representation of W3C XML Schema Definition
4
+ *
5
+ * Based on: https://www.w3.org/TR/xmlschema11-1/XMLSchema.xsd
6
+ *
7
+ * These types represent the structure of XSD documents.
8
+ * They are designed to be the result of parsing XMLSchema.xsd itself.
9
+ */
10
+ /**
11
+ * XML namespace declarations (xmlns:prefix -> URI mappings)
12
+ *
13
+ * This is not part of XSD itself, but part of XML Namespaces spec.
14
+ * XSD documents rely on xmlns declarations to resolve QName prefixes.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * xmlns: {
19
+ * xs: "http://www.w3.org/2001/XMLSchema",
20
+ * tns: "http://example.com/myschema",
21
+ * "": "http://example.com/default" // default namespace (no prefix)
22
+ * }
23
+ * ```
24
+ */
25
+ type XmlnsDeclarations = {
26
+ readonly [prefix: string]: string;
27
+ };
28
+ /**
29
+ * xs:openAttrs - base type extended by almost all schema types
30
+ * Allows attributes from other namespaces
31
+ */
32
+ interface OpenAttrs {
33
+ /**
34
+ * XML namespace declarations scoped to this element (xmlns:prefix -> namespace URI).
35
+ * Inherited by child elements unless overridden.
36
+ *
37
+ * Note: Prefixed with $ to indicate this is NOT a W3C XSD property -
38
+ * it's extracted from XML namespace attributes.
39
+ */
40
+ readonly $xmlns?: XmlnsDeclarations;
41
+ /** Any additional attributes from other namespaces */
42
+ [key: string]: unknown;
43
+ }
44
+ /**
45
+ * Schema-level extensions (non-W3C properties).
46
+ * Properties prefixed with $ are clearly non-W3C.
47
+ */
48
+ interface SchemaAttrs extends OpenAttrs {
49
+ /**
50
+ * Namespace prefix declarations (xmlns:prefix -> namespace URI).
51
+ * Extracted from XML namespace attributes, not part of XSD spec.
52
+ */
53
+ readonly $xmlns?: {
54
+ readonly [prefix: string]: string;
55
+ };
56
+ /**
57
+ * Original filename/path of this schema.
58
+ * Used to reconstruct $imports relationships from schemaLocation references.
59
+ */
60
+ readonly $filename?: string;
61
+ /**
62
+ * Resolved imported schemas for cross-schema type resolution (xs:import).
63
+ * Actual schema objects that can be searched for type definitions.
64
+ * Use this to link schemas that import each other (different namespace).
65
+ */
66
+ readonly $imports?: readonly Schema[];
67
+ /**
68
+ * Resolved included schemas for same-namespace type resolution (xs:include).
69
+ * Content from xs:include is in the same namespace as the including schema.
70
+ * Walker traverses both $imports and $includes for type lookups.
71
+ */
72
+ readonly $includes?: readonly Schema[];
73
+ }
74
+ /**
75
+ * xs:annotated - base type for elements that can have annotation
76
+ */
77
+ interface Annotated extends OpenAttrs {
78
+ readonly id?: string;
79
+ readonly annotation?: Annotation;
80
+ }
81
+ interface Annotation extends OpenAttrs {
82
+ readonly id?: string;
83
+ readonly appinfo?: Appinfo[];
84
+ readonly documentation?: Documentation[];
85
+ }
86
+ interface Appinfo extends OpenAttrs {
87
+ readonly source?: string;
88
+ readonly _text?: string;
89
+ }
90
+ interface Documentation extends OpenAttrs {
91
+ readonly source?: string;
92
+ readonly 'xml:lang'?: string;
93
+ readonly _text?: string;
94
+ }
95
+ /**
96
+ * xs:schema - the root element of an XSD document
97
+ */
98
+ interface Schema extends SchemaAttrs {
99
+ readonly id?: string;
100
+ readonly targetNamespace?: string;
101
+ readonly version?: string;
102
+ readonly finalDefault?: string;
103
+ readonly blockDefault?: string;
104
+ readonly attributeFormDefault?: FormChoice;
105
+ readonly elementFormDefault?: FormChoice;
106
+ readonly defaultAttributes?: string;
107
+ readonly xpathDefaultNamespace?: string;
108
+ readonly 'xml:lang'?: string;
109
+ readonly include?: Include[];
110
+ readonly import?: Import[];
111
+ readonly redefine?: Redefine[];
112
+ readonly override?: Override[];
113
+ readonly annotation?: Annotation[];
114
+ readonly simpleType?: TopLevelSimpleType[];
115
+ readonly complexType?: TopLevelComplexType[];
116
+ readonly group?: NamedGroup[];
117
+ readonly attributeGroup?: NamedAttributeGroup[];
118
+ readonly element?: TopLevelElement[];
119
+ readonly attribute?: TopLevelAttribute[];
120
+ readonly notation?: Notation[];
121
+ readonly defaultOpenContent?: DefaultOpenContent;
122
+ }
123
+ type FormChoice = 'qualified' | 'unqualified';
124
+ interface Include extends Annotated {
125
+ readonly schemaLocation: string;
126
+ }
127
+ interface Import extends Annotated {
128
+ readonly namespace?: string;
129
+ readonly schemaLocation?: string;
130
+ }
131
+ interface Redefine extends OpenAttrs {
132
+ readonly id?: string;
133
+ readonly schemaLocation: string;
134
+ readonly annotation?: Annotation[];
135
+ readonly simpleType?: TopLevelSimpleType[];
136
+ readonly complexType?: TopLevelComplexType[];
137
+ readonly group?: NamedGroup[];
138
+ readonly attributeGroup?: NamedAttributeGroup[];
139
+ }
140
+ interface Override extends OpenAttrs {
141
+ readonly id?: string;
142
+ readonly schemaLocation: string;
143
+ readonly annotation?: Annotation[];
144
+ readonly simpleType?: TopLevelSimpleType[];
145
+ readonly complexType?: TopLevelComplexType[];
146
+ readonly group?: NamedGroup[];
147
+ readonly attributeGroup?: NamedAttributeGroup[];
148
+ readonly element?: TopLevelElement[];
149
+ readonly attribute?: TopLevelAttribute[];
150
+ readonly notation?: Notation[];
151
+ }
152
+ /**
153
+ * xs:element (top-level)
154
+ */
155
+ interface TopLevelElement extends Annotated {
156
+ readonly name: string;
157
+ readonly type?: string;
158
+ readonly substitutionGroup?: string;
159
+ readonly default?: string;
160
+ readonly fixed?: string;
161
+ readonly nillable?: boolean;
162
+ readonly abstract?: boolean;
163
+ readonly final?: string;
164
+ readonly block?: string;
165
+ readonly simpleType?: LocalSimpleType;
166
+ readonly complexType?: LocalComplexType;
167
+ readonly unique?: Unique[];
168
+ readonly key?: Key[];
169
+ readonly keyref?: Keyref[];
170
+ readonly alternative?: Alternative[];
171
+ }
172
+ /**
173
+ * xs:element (local, within complexType)
174
+ */
175
+ interface LocalElement extends Annotated {
176
+ readonly name?: string;
177
+ readonly ref?: string;
178
+ readonly type?: string;
179
+ readonly minOccurs?: number | string;
180
+ readonly maxOccurs?: number | string | 'unbounded';
181
+ readonly default?: string;
182
+ readonly fixed?: string;
183
+ readonly nillable?: boolean;
184
+ readonly block?: string;
185
+ readonly form?: FormChoice;
186
+ readonly targetNamespace?: string;
187
+ readonly simpleType?: LocalSimpleType;
188
+ readonly complexType?: LocalComplexType;
189
+ readonly unique?: Unique[];
190
+ readonly key?: Key[];
191
+ readonly keyref?: Keyref[];
192
+ readonly alternative?: Alternative[];
193
+ }
194
+ /**
195
+ * xs:attribute (top-level)
196
+ */
197
+ interface TopLevelAttribute extends Annotated {
198
+ readonly name: string;
199
+ readonly type?: string;
200
+ readonly default?: string;
201
+ readonly fixed?: string;
202
+ readonly inheritable?: boolean;
203
+ readonly simpleType?: LocalSimpleType;
204
+ }
205
+ /**
206
+ * xs:attribute (local, within complexType)
207
+ */
208
+ interface LocalAttribute extends Annotated {
209
+ readonly name?: string;
210
+ readonly ref?: string;
211
+ readonly type?: string;
212
+ readonly use?: 'prohibited' | 'optional' | 'required';
213
+ readonly default?: string;
214
+ readonly fixed?: string;
215
+ readonly form?: FormChoice;
216
+ readonly targetNamespace?: string;
217
+ readonly inheritable?: boolean;
218
+ readonly simpleType?: LocalSimpleType;
219
+ }
220
+ /**
221
+ * xs:complexType (top-level, named)
222
+ */
223
+ interface TopLevelComplexType extends Annotated {
224
+ readonly name: string;
225
+ readonly mixed?: boolean;
226
+ readonly abstract?: boolean;
227
+ readonly final?: string;
228
+ readonly block?: string;
229
+ readonly defaultAttributesApply?: boolean;
230
+ readonly simpleContent?: SimpleContent;
231
+ readonly complexContent?: ComplexContent;
232
+ readonly openContent?: OpenContent;
233
+ readonly group?: GroupRef;
234
+ readonly all?: All;
235
+ readonly choice?: ExplicitGroup;
236
+ readonly sequence?: ExplicitGroup;
237
+ readonly attribute?: LocalAttribute[];
238
+ readonly attributeGroup?: AttributeGroupRef[];
239
+ readonly anyAttribute?: AnyAttribute;
240
+ readonly assert?: Assertion[];
241
+ }
242
+ /**
243
+ * xs:complexType (local, inline)
244
+ */
245
+ interface LocalComplexType extends Annotated {
246
+ readonly mixed?: boolean;
247
+ readonly simpleContent?: SimpleContent;
248
+ readonly complexContent?: ComplexContent;
249
+ readonly openContent?: OpenContent;
250
+ readonly group?: GroupRef;
251
+ readonly all?: All;
252
+ readonly choice?: ExplicitGroup;
253
+ readonly sequence?: ExplicitGroup;
254
+ readonly attribute?: LocalAttribute[];
255
+ readonly attributeGroup?: AttributeGroupRef[];
256
+ readonly anyAttribute?: AnyAttribute;
257
+ readonly assert?: Assertion[];
258
+ }
259
+ /**
260
+ * xs:simpleType (top-level, named)
261
+ */
262
+ interface TopLevelSimpleType extends Annotated {
263
+ readonly name: string;
264
+ readonly final?: string;
265
+ readonly restriction?: SimpleTypeRestriction;
266
+ readonly list?: List;
267
+ readonly union?: Union;
268
+ }
269
+ /**
270
+ * xs:simpleType (local, inline)
271
+ */
272
+ interface LocalSimpleType extends Annotated {
273
+ readonly restriction?: SimpleTypeRestriction;
274
+ readonly list?: List;
275
+ readonly union?: Union;
276
+ }
277
+ interface SimpleTypeRestriction extends Annotated {
278
+ readonly base?: string;
279
+ readonly simpleType?: LocalSimpleType;
280
+ readonly minExclusive?: Facet[];
281
+ readonly minInclusive?: Facet[];
282
+ readonly maxExclusive?: Facet[];
283
+ readonly maxInclusive?: Facet[];
284
+ readonly totalDigits?: Facet[];
285
+ readonly fractionDigits?: Facet[];
286
+ readonly length?: Facet[];
287
+ readonly minLength?: Facet[];
288
+ readonly maxLength?: Facet[];
289
+ readonly enumeration?: Facet[];
290
+ readonly whiteSpace?: Facet[];
291
+ readonly pattern?: Pattern[];
292
+ readonly assertion?: Assertion[];
293
+ readonly explicitTimezone?: Facet[];
294
+ }
295
+ interface List extends Annotated {
296
+ readonly itemType?: string;
297
+ readonly simpleType?: LocalSimpleType;
298
+ }
299
+ interface Union extends Annotated {
300
+ readonly memberTypes?: string;
301
+ readonly simpleType?: LocalSimpleType[];
302
+ }
303
+ interface Facet extends Annotated {
304
+ readonly value: string;
305
+ readonly fixed?: boolean;
306
+ }
307
+ interface Pattern extends Annotated {
308
+ readonly value: string;
309
+ }
310
+ interface ComplexContent extends Annotated {
311
+ readonly mixed?: boolean;
312
+ readonly restriction?: ComplexContentRestriction;
313
+ readonly extension?: ComplexContentExtension;
314
+ }
315
+ interface SimpleContent extends Annotated {
316
+ readonly restriction?: SimpleContentRestriction;
317
+ readonly extension?: SimpleContentExtension;
318
+ }
319
+ interface ComplexContentRestriction extends Annotated {
320
+ readonly base: string;
321
+ readonly openContent?: OpenContent;
322
+ readonly group?: GroupRef;
323
+ readonly all?: All;
324
+ readonly choice?: ExplicitGroup;
325
+ readonly sequence?: ExplicitGroup;
326
+ readonly attribute?: LocalAttribute[];
327
+ readonly attributeGroup?: AttributeGroupRef[];
328
+ readonly anyAttribute?: AnyAttribute;
329
+ readonly assert?: Assertion[];
330
+ }
331
+ interface ComplexContentExtension extends Annotated {
332
+ readonly base: string;
333
+ readonly openContent?: OpenContent;
334
+ readonly group?: GroupRef;
335
+ readonly all?: All;
336
+ readonly choice?: ExplicitGroup;
337
+ readonly sequence?: ExplicitGroup;
338
+ readonly attribute?: LocalAttribute[];
339
+ readonly attributeGroup?: AttributeGroupRef[];
340
+ readonly anyAttribute?: AnyAttribute;
341
+ readonly assert?: Assertion[];
342
+ }
343
+ interface SimpleContentRestriction extends Annotated {
344
+ readonly base: string;
345
+ readonly simpleType?: LocalSimpleType;
346
+ readonly minExclusive?: Facet[];
347
+ readonly minInclusive?: Facet[];
348
+ readonly maxExclusive?: Facet[];
349
+ readonly maxInclusive?: Facet[];
350
+ readonly totalDigits?: Facet[];
351
+ readonly fractionDigits?: Facet[];
352
+ readonly length?: Facet[];
353
+ readonly minLength?: Facet[];
354
+ readonly maxLength?: Facet[];
355
+ readonly enumeration?: Facet[];
356
+ readonly whiteSpace?: Facet[];
357
+ readonly pattern?: Pattern[];
358
+ readonly assertion?: Assertion[];
359
+ readonly explicitTimezone?: Facet[];
360
+ readonly attribute?: LocalAttribute[];
361
+ readonly attributeGroup?: AttributeGroupRef[];
362
+ readonly anyAttribute?: AnyAttribute;
363
+ readonly assert?: Assertion[];
364
+ }
365
+ interface SimpleContentExtension extends Annotated {
366
+ readonly base: string;
367
+ readonly attribute?: LocalAttribute[];
368
+ readonly attributeGroup?: AttributeGroupRef[];
369
+ readonly anyAttribute?: AnyAttribute;
370
+ readonly assert?: Assertion[];
371
+ }
372
+ /**
373
+ * xs:sequence / xs:choice (explicit group)
374
+ */
375
+ interface ExplicitGroup extends Annotated {
376
+ readonly minOccurs?: number | string;
377
+ readonly maxOccurs?: number | string | 'unbounded';
378
+ readonly element?: LocalElement[];
379
+ readonly group?: GroupRef[];
380
+ readonly choice?: ExplicitGroup[];
381
+ readonly sequence?: ExplicitGroup[];
382
+ readonly any?: Any[];
383
+ }
384
+ /**
385
+ * xs:all
386
+ */
387
+ interface All extends Annotated {
388
+ readonly minOccurs?: number | string;
389
+ readonly maxOccurs?: number | string;
390
+ readonly element?: LocalElement[];
391
+ readonly any?: Any[];
392
+ readonly group?: GroupRef[];
393
+ }
394
+ /**
395
+ * xs:group (named, top-level)
396
+ */
397
+ interface NamedGroup extends Annotated {
398
+ readonly name: string;
399
+ readonly all?: All;
400
+ readonly choice?: ExplicitGroup;
401
+ readonly sequence?: ExplicitGroup;
402
+ }
403
+ /**
404
+ * xs:group (reference)
405
+ */
406
+ interface GroupRef extends Annotated {
407
+ readonly ref: string;
408
+ readonly minOccurs?: number | string;
409
+ readonly maxOccurs?: number | string | 'unbounded';
410
+ }
411
+ /**
412
+ * xs:attributeGroup (named, top-level)
413
+ */
414
+ interface NamedAttributeGroup extends Annotated {
415
+ readonly name: string;
416
+ readonly attribute?: LocalAttribute[];
417
+ readonly attributeGroup?: AttributeGroupRef[];
418
+ readonly anyAttribute?: AnyAttribute;
419
+ }
420
+ /**
421
+ * xs:attributeGroup (reference)
422
+ */
423
+ interface AttributeGroupRef extends Annotated {
424
+ readonly ref: string;
425
+ }
426
+ interface Any extends Annotated {
427
+ readonly minOccurs?: number | string;
428
+ readonly maxOccurs?: number | string | 'unbounded';
429
+ readonly namespace?: string;
430
+ readonly processContents?: 'skip' | 'lax' | 'strict';
431
+ readonly notNamespace?: string;
432
+ readonly notQName?: string;
433
+ }
434
+ interface AnyAttribute extends Annotated {
435
+ readonly namespace?: string;
436
+ readonly processContents?: 'skip' | 'lax' | 'strict';
437
+ readonly notNamespace?: string;
438
+ readonly notQName?: string;
439
+ }
440
+ interface Unique extends Annotated {
441
+ readonly name: string;
442
+ readonly ref?: string;
443
+ readonly selector?: Selector;
444
+ readonly field?: Field[];
445
+ }
446
+ interface Key extends Annotated {
447
+ readonly name: string;
448
+ readonly ref?: string;
449
+ readonly selector?: Selector;
450
+ readonly field?: Field[];
451
+ }
452
+ interface Keyref extends Annotated {
453
+ readonly name: string;
454
+ readonly ref?: string;
455
+ readonly refer: string;
456
+ readonly selector?: Selector;
457
+ readonly field?: Field[];
458
+ }
459
+ interface Selector extends Annotated {
460
+ readonly xpath: string;
461
+ readonly xpathDefaultNamespace?: string;
462
+ }
463
+ interface Field extends Annotated {
464
+ readonly xpath: string;
465
+ readonly xpathDefaultNamespace?: string;
466
+ }
467
+ interface OpenContent extends Annotated {
468
+ readonly mode?: 'none' | 'interleave' | 'suffix';
469
+ readonly any?: Any;
470
+ }
471
+ interface DefaultOpenContent extends Annotated {
472
+ readonly appliesToEmpty?: boolean;
473
+ readonly mode?: 'interleave' | 'suffix';
474
+ readonly any: Any;
475
+ }
476
+ interface Assertion extends Annotated {
477
+ readonly test?: string;
478
+ readonly xpathDefaultNamespace?: string;
479
+ }
480
+ interface Alternative extends Annotated {
481
+ readonly test?: string;
482
+ readonly type?: string;
483
+ readonly xpathDefaultNamespace?: string;
484
+ readonly simpleType?: LocalSimpleType;
485
+ readonly complexType?: LocalComplexType;
486
+ }
487
+ interface Notation extends Annotated {
488
+ readonly name: string;
489
+ readonly public: string;
490
+ readonly system?: string;
491
+ }
492
+ /** Element - either top-level or local */
493
+ type Element = TopLevelElement | LocalElement;
494
+ /** ComplexType - either top-level (named) or local (inline) */
495
+ type ComplexType = TopLevelComplexType | LocalComplexType;
496
+ /** SimpleType - either top-level (named) or local (inline) */
497
+ type SimpleType = TopLevelSimpleType | LocalSimpleType;
498
+ /** Attribute - either top-level or local */
499
+ type Attribute = TopLevelAttribute | LocalAttribute;
500
+ /** Group content (sequence, choice, all) */
501
+ type Group = ExplicitGroup | All;
502
+ //#endregion
503
+ //#region src/codegen/types.d.ts
504
+ /**
505
+ * A file to be written by the codegen system
506
+ */
507
+ interface GeneratedFile {
508
+ /** Relative path from outputDir (e.g., 'intf.ts', 'index.ts') */
509
+ path: string;
510
+ /** File content */
511
+ content: string;
512
+ }
513
+ /**
514
+ * Information about a single schema being processed
515
+ */
516
+ interface SchemaInfo {
517
+ /** Schema name (e.g., 'intf', 'classes') */
518
+ name: string;
519
+ /** Parsed XSD content */
520
+ xsdContent: string;
521
+ /** Parsed schema object */
522
+ schema: Schema;
523
+ /** Source group name (e.g., 'sap', 'custom', 'abapgit') */
524
+ sourceName: string;
525
+ /** XSD file path */
526
+ xsdPath: string;
527
+ }
528
+ /**
529
+ * Information about a source group
530
+ */
531
+ interface SourceInfo {
532
+ /** Source name (e.g., 'sap', 'custom') */
533
+ name: string;
534
+ /** Directory containing XSD files */
535
+ xsdDir: string;
536
+ /** Output directory for generated files */
537
+ outputDir: string;
538
+ /** List of schema names to process */
539
+ schemas: string[];
540
+ }
541
+ /**
542
+ * Context passed to setup() - before any schemas are processed
543
+ */
544
+ interface SetupContext {
545
+ /** All configured sources */
546
+ sources: Record<string, SourceInfo>;
547
+ /** Root directory (where config file is located) */
548
+ rootDir: string;
549
+ }
550
+ /**
551
+ * Context passed to transform() - for each schema
552
+ */
553
+ interface TransformContext {
554
+ /** Current schema being processed */
555
+ schema: SchemaInfo;
556
+ /** Source this schema belongs to */
557
+ source: SourceInfo;
558
+ /** All schemas in this source (for import resolution) */
559
+ allSchemas: Map<string, SchemaInfo>;
560
+ /** All sources (for cross-source import resolution) */
561
+ allSources: Record<string, SourceInfo>;
562
+ /** Root directory */
563
+ rootDir: string;
564
+ /** Resolve import path for a schema location */
565
+ resolveImport: (schemaLocation: string) => string | null;
566
+ }
567
+ /**
568
+ * Context passed to finalize() - after all schemas are processed
569
+ */
570
+ interface FinalizeContext {
571
+ /** All processed schemas grouped by source */
572
+ processedSchemas: Map<string, SchemaInfo[]>;
573
+ /** All sources */
574
+ sources: Record<string, SourceInfo>;
575
+ /** Root directory */
576
+ rootDir: string;
577
+ }
578
+ /**
579
+ * Generator plugin interface
580
+ *
581
+ * Generators are composable - multiple generators can be used together.
582
+ * Each generator can:
583
+ * - setup(): Initialize state before processing
584
+ * - transform(): Generate files for each schema
585
+ * - finalize(): Generate aggregate files after all schemas
586
+ */
587
+ interface GeneratorPlugin {
588
+ /** Unique name for this generator */
589
+ readonly name: string;
590
+ /**
591
+ * Called once before processing any schemas.
592
+ * Use for initialization, validation, etc.
593
+ */
594
+ setup?(ctx: SetupContext): void | Promise<void>;
595
+ /**
596
+ * Called for each schema file.
597
+ * Return generated files for this schema.
598
+ */
599
+ transform?(ctx: TransformContext): GeneratedFile[] | Promise<GeneratedFile[]>;
600
+ /**
601
+ * Called once after all schemas are processed.
602
+ * Use for generating index files, aggregate types, etc.
603
+ */
604
+ finalize?(ctx: FinalizeContext): GeneratedFile[] | Promise<GeneratedFile[]>;
605
+ }
606
+ /**
607
+ * Source configuration
608
+ */
609
+ interface SourceConfig {
610
+ /** Directory containing XSD files (relative to config file) */
611
+ xsdDir: string;
612
+ /** Output directory for generated files (relative to config file) */
613
+ outputDir: string;
614
+ /** List of schema names to process (without .xsd extension) */
615
+ schemas: string[];
616
+ /**
617
+ * Automatically discover and include all dependent schemas referenced via
618
+ * xs:import, xs:include, xs:redefine schemaLocation attributes.
619
+ * When enabled, you only need to list entry-point schemas - all dependencies
620
+ * will be discovered and generated automatically.
621
+ */
622
+ autoLink?: boolean;
623
+ }
624
+ /**
625
+ * Hook context for beforeAll/afterAll
626
+ */
627
+ interface HookContext {
628
+ /** All configured sources */
629
+ sources: Record<string, SourceInfo>;
630
+ /** Root directory (where config file is located) */
631
+ rootDir: string;
632
+ }
633
+ /**
634
+ * Hook context for afterAll with results
635
+ */
636
+ interface AfterAllContext extends HookContext {
637
+ /** All processed schemas grouped by source */
638
+ processedSchemas: Map<string, SchemaInfo[]>;
639
+ /** All generated files */
640
+ generatedFiles: GeneratedFile[];
641
+ }
642
+ /**
643
+ * Codegen configuration
644
+ */
645
+ interface CodegenConfig {
646
+ /** Schema sources to process */
647
+ sources: Record<string, SourceConfig>;
648
+ /** Generator plugins to run */
649
+ generators: GeneratorPlugin[];
650
+ /** Import extension for generated files: '.ts' for Node.js native, '' for bundlers (default: '' for bundler compatibility) */
651
+ importExtension?: '.ts' | '';
652
+ /** Clean output directories before generation (default: false) */
653
+ clean?: boolean;
654
+ /** Features to enable for all generators */
655
+ features?: {
656
+ /** Include $xmlns in output */
657
+ $xmlns?: boolean;
658
+ /** Include $imports in output */
659
+ $imports?: boolean;
660
+ /** Include $filename in output */
661
+ $filename?: boolean;
662
+ };
663
+ /** Properties to exclude from output */
664
+ exclude?: string[];
665
+ /**
666
+ * Hook called before any processing starts.
667
+ * Use for setup, validation, cleaning output dirs, etc.
668
+ */
669
+ beforeAll?(ctx: HookContext): void | Promise<void>;
670
+ /**
671
+ * Hook called after all processing is complete.
672
+ * Use for generating aggregate files, post-processing, etc.
673
+ * Return additional files to write.
674
+ */
675
+ afterAll?(ctx: AfterAllContext): GeneratedFile[] | void | Promise<GeneratedFile[] | void>;
676
+ }
677
+ /**
678
+ * Define a codegen configuration with type checking
679
+ */
680
+ declare function defineConfig(config: CodegenConfig): CodegenConfig;
681
+ //#endregion
682
+ //#region src/xsd/resolve.d.ts
683
+ /** Options for schema resolution */
684
+ interface ResolveOptions {
685
+ /** Resolve xs:import - merge types from imported schemas (default: true) */
686
+ resolveImports?: boolean;
687
+ /** Resolve xs:include - merge content from included schemas (default: true) */
688
+ resolveIncludes?: boolean;
689
+ /** Expand complexContent/extension - flatten inheritance (default: true) */
690
+ expandExtensions?: boolean;
691
+ /** Expand substitutionGroup - replace abstract refs with concrete elements (default: true) */
692
+ expandSubstitutions?: boolean;
693
+ /** Filter to root elements only - exclude abstract and referenced elements (default: false) */
694
+ filterToRootElements?: boolean;
695
+ /** Keep original $imports array for reference (default: false) */
696
+ keepImportsRef?: boolean;
697
+ }
698
+ /**
699
+ * Resolve a schema by merging all imports/includes and expanding all references.
700
+ * Returns a new self-contained schema with no external dependencies.
701
+ */
702
+ declare function resolveSchema(schema: Schema, options?: ResolveOptions): Schema;
703
+ /**
704
+ * Get all substitutes for an abstract element.
705
+ */
706
+ declare function getSubstitutes(abstractElementName: string, schema: Schema): TopLevelElement[];
707
+ //#endregion
708
+ //#region src/codegen/runner.d.ts
709
+ interface RunnerOptions {
710
+ /** Root directory (where config file is located) */
711
+ rootDir: string;
712
+ /** Dry run - don't write files, just return what would be written */
713
+ dryRun?: boolean;
714
+ /** Verbose logging */
715
+ verbose?: boolean;
716
+ }
717
+ interface RunnerResult {
718
+ /** Files that were written (or would be written in dry run) */
719
+ files: Array<{
720
+ path: string;
721
+ source: string;
722
+ }>;
723
+ /** Schemas that were processed */
724
+ schemas: Array<{
725
+ name: string;
726
+ source: string;
727
+ }>;
728
+ /** Errors that occurred */
729
+ errors: Array<{
730
+ schema?: string;
731
+ source?: string;
732
+ error: Error;
733
+ }>;
734
+ }
735
+ /**
736
+ * Run the codegen pipeline
737
+ */
738
+ declare function runCodegen(config: CodegenConfig, options: RunnerOptions): Promise<RunnerResult>;
739
+ //#endregion
740
+ export { Notation as $, ComplexContentExtension as A, Group as B, Any as C, Attribute as D, Assertion as E, Element as F, Keyref as G, Import as H, ExplicitGroup as I, LocalComplexType as J, List as K, Facet as L, ComplexType as M, DefaultOpenContent as N, AttributeGroupRef as O, Documentation as P, NamedGroup as Q, Field as R, Annotation as S, Appinfo as T, Include as U, GroupRef as V, Key as W, LocalSimpleType as X, LocalElement as Y, NamedAttributeGroup as Z, TransformContext as _, Union as _t, getSubstitutes as a, Schema as at, Alternative as b, CodegenConfig as c, SimpleContent as ct, GeneratorPlugin as d, SimpleType as dt, OpenAttrs as et, HookContext as f, SimpleTypeRestriction as ft, SourceInfo as g, TopLevelSimpleType as gt, SourceConfig as h, TopLevelElement as ht, ResolveOptions as i, Redefine as it, ComplexContentRestriction as j, ComplexContent as k, FinalizeContext as l, SimpleContentExtension as lt, SetupContext as m, TopLevelComplexType as mt, RunnerResult as n, Override as nt, resolveSchema as o, SchemaAttrs as ot, SchemaInfo as p, TopLevelAttribute as pt, LocalAttribute as q, runCodegen as r, Pattern as rt, AfterAllContext as s, Selector as st, RunnerOptions as t, OpenContent as tt, GeneratedFile as u, SimpleContentRestriction as ut, defineConfig as v, Unique as vt, AnyAttribute as w, Annotated as x, All as y, XmlnsDeclarations as yt, FormChoice as z };
741
+ //# sourceMappingURL=runner-D1RCU_go.d.mts.map