@abapify/ts-xsd 0.3.6 → 0.4.1

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/index.mjs ADDED
@@ -0,0 +1,1116 @@
1
+ import { _ as getAllChildElements, a as loadAndLinkSchema, b as getLocalName, c as getSubstitutes, d as SchemaTraverser, f as resolveSchemaTypes, g as parseXsd, h as buildXsd, i as linkSchema, l as resolveSchema, m as resolveImports, n as createSchemaLoader, o as loadSchema, p as linkSchemas, r as defaultLoader, s as parseSchemaContent, t as runCodegen, u as SchemaResolver, v as getAttributeValue, x as getTextContent, y as getChildElements } from "./runner-CRhT3smd.mjs";
2
+ import { n as generateSchemaLiteral, t as generateSchemaFile } from "./generate-DnX2dJZe.mjs";
3
+ import { n as deriveRootTypeName, r as generateInterfaces, t as defineConfig } from "./types-CtrpGRyM.mjs";
4
+ import { DOMImplementation, DOMParser, XMLSerializer } from "@xmldom/xmldom";
5
+
6
+ //#region src/walker/index.ts
7
+ /**
8
+ * Walk all complexTypes in a schema and its $imports/$includes (depth-first).
9
+ *
10
+ * @param schema - Root schema to start from
11
+ * @param options - Walk options (e.g., includesOnly to skip $imports)
12
+ * @yields ComplexType with the schema it was found in
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * function findComplexType(name: string, schema: SchemaLike) {
17
+ * for (const { ct, schema: s } of walkComplexTypes(schema)) {
18
+ * if (ct.name === name) return { type: ct, schema: s };
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ function* walkComplexTypes(schema, options = {}) {
24
+ const complexTypes = schema.complexType;
25
+ if (complexTypes) if (Array.isArray(complexTypes)) for (const ct of complexTypes) yield {
26
+ ct,
27
+ schema
28
+ };
29
+ else for (const [name, ct] of Object.entries(complexTypes)) yield {
30
+ ct: {
31
+ ...ct,
32
+ name
33
+ },
34
+ schema
35
+ };
36
+ if (schema.redefine) {
37
+ for (const redef of schema.redefine) if (redef.complexType) for (const ct of redef.complexType) yield {
38
+ ct,
39
+ schema
40
+ };
41
+ }
42
+ if (schema.override) {
43
+ for (const ovr of schema.override) if (ovr.complexType) for (const ct of ovr.complexType) yield {
44
+ ct,
45
+ schema
46
+ };
47
+ }
48
+ if (schema.$includes) for (const included of schema.$includes) yield* walkComplexTypes(included, options);
49
+ if (!options.includesOnly && schema.$imports) for (const imported of schema.$imports) yield* walkComplexTypes(imported, options);
50
+ }
51
+ /**
52
+ * Walk all simpleTypes in a schema and its $imports/$includes.
53
+ */
54
+ function* walkSimpleTypes(schema, options = {}) {
55
+ const simpleTypes = schema.simpleType;
56
+ if (simpleTypes) if (Array.isArray(simpleTypes)) for (const st of simpleTypes) yield {
57
+ st,
58
+ schema
59
+ };
60
+ else for (const [name, st] of Object.entries(simpleTypes)) yield {
61
+ st: {
62
+ ...st,
63
+ name
64
+ },
65
+ schema
66
+ };
67
+ if (schema.redefine) {
68
+ for (const redef of schema.redefine) if (redef.simpleType) for (const st of redef.simpleType) yield {
69
+ st,
70
+ schema
71
+ };
72
+ }
73
+ if (schema.override) {
74
+ for (const ovr of schema.override) if (ovr.simpleType) for (const st of ovr.simpleType) yield {
75
+ st,
76
+ schema
77
+ };
78
+ }
79
+ if (schema.$includes) for (const included of schema.$includes) yield* walkSimpleTypes(included, options);
80
+ if (!options.includesOnly && schema.$imports) for (const imported of schema.$imports) yield* walkSimpleTypes(imported, options);
81
+ }
82
+ /**
83
+ * Walk all top-level elements in a schema and its $imports/$includes.
84
+ */
85
+ function* walkTopLevelElements(schema, options = {}) {
86
+ if (schema.element) for (const element of schema.element) yield {
87
+ element,
88
+ schema
89
+ };
90
+ if (schema.$includes) for (const included of schema.$includes) yield* walkTopLevelElements(included, options);
91
+ if (!options.includesOnly && schema.$imports) for (const imported of schema.$imports) yield* walkTopLevelElements(imported, options);
92
+ }
93
+ /**
94
+ * Find a complexType by name, searching schema and $imports.
95
+ * Returns both the type AND the schema it was found in (important for inheritance).
96
+ */
97
+ function findComplexType(name, schema) {
98
+ for (const entry of walkComplexTypes(schema)) if (entry.ct.name === name) return entry;
99
+ }
100
+ /**
101
+ * Find a simpleType by name, searching schema and $imports.
102
+ */
103
+ function findSimpleType(name, schema) {
104
+ for (const entry of walkSimpleTypes(schema)) if (entry.st.name === name) return entry;
105
+ }
106
+ /**
107
+ * Find a top-level element by name, searching schema and $imports.
108
+ */
109
+ function findElement(name, schema) {
110
+ for (const entry of walkTopLevelElements(schema)) if (entry.element.name === name) return entry;
111
+ }
112
+ /**
113
+ * Walk all elements in a complexType, handling:
114
+ * - sequence, choice, all groups
115
+ * - Nested groups (recursive)
116
+ * - complexContent/extension inheritance
117
+ * - Group references
118
+ *
119
+ * @param ct - ComplexType to walk
120
+ * @param schema - Schema context (for resolving base types and group refs)
121
+ * @yields Elements with metadata (optional, array, source)
122
+ */
123
+ function* walkElements(ct, schema) {
124
+ if (ct.complexContent?.extension) {
125
+ const ext = ct.complexContent.extension;
126
+ if (ext.base) {
127
+ const baseEntry = findComplexType(stripNsPrefix(ext.base), schema);
128
+ if (baseEntry) yield* walkElements(baseEntry.ct, baseEntry.schema);
129
+ }
130
+ yield* walkGroup(ext.sequence, "sequence", schema);
131
+ yield* walkGroup(ext.choice, "choice", schema);
132
+ yield* walkGroup(ext.all, "all", schema);
133
+ if (ext.group?.ref) yield* walkGroupRef(ext.group.ref, schema);
134
+ return;
135
+ }
136
+ if (ct.complexContent?.restriction) {
137
+ const rest = ct.complexContent.restriction;
138
+ yield* walkGroup(rest.sequence, "sequence", schema);
139
+ yield* walkGroup(rest.choice, "choice", schema);
140
+ yield* walkGroup(rest.all, "all", schema);
141
+ if (rest.group?.ref) yield* walkGroupRef(rest.group.ref, schema);
142
+ return;
143
+ }
144
+ yield* walkGroup(ct.sequence, "sequence", schema);
145
+ yield* walkGroup(ct.choice, "choice", schema);
146
+ yield* walkGroup(ct.all, "all", schema);
147
+ if (ct.group?.ref) yield* walkGroupRef(ct.group.ref, schema);
148
+ }
149
+ /**
150
+ * Walk elements in a group (sequence/choice/all), handling nested groups.
151
+ */
152
+ function* walkGroup(group, source, schema, parentOptional = false, parentArray = false) {
153
+ if (!group) return;
154
+ const groupOptional = parentOptional || group.minOccurs === 0 || group.minOccurs === "0";
155
+ const groupArray = parentArray || isArray(group);
156
+ const choiceOptional = source === "choice";
157
+ if (group.element) for (const element of group.element) {
158
+ const optional = choiceOptional || groupOptional || element.minOccurs === 0 || element.minOccurs === "0";
159
+ const array = groupArray || isArray(element);
160
+ if (element.ref) {
161
+ const refName = stripNsPrefix(element.ref);
162
+ const refEntry = findElement(refName, schema);
163
+ if (refEntry && isAbstractElement(refEntry.element)) {
164
+ const substitutes = findSubstitutes(refName, schema);
165
+ if (substitutes.length > 0) {
166
+ for (const sub of substitutes) yield {
167
+ element: sub,
168
+ optional,
169
+ array,
170
+ source,
171
+ schema
172
+ };
173
+ continue;
174
+ }
175
+ }
176
+ }
177
+ yield {
178
+ element,
179
+ optional,
180
+ array,
181
+ source,
182
+ schema
183
+ };
184
+ }
185
+ if (group.sequence) {
186
+ const sequences = Array.isArray(group.sequence) ? group.sequence : [group.sequence];
187
+ for (const nested of sequences) yield* walkGroup(nested, "sequence", schema, groupOptional, groupArray);
188
+ }
189
+ if (group.choice) {
190
+ const choices = Array.isArray(group.choice) ? group.choice : [group.choice];
191
+ for (const nested of choices) yield* walkGroup(nested, "choice", schema, true, groupArray || isArray(nested));
192
+ }
193
+ if (group.group) {
194
+ const refs = Array.isArray(group.group) ? group.group : [group.group];
195
+ for (const ref of refs) if (ref.ref) yield* walkGroupRef(ref.ref, schema, groupOptional || choiceOptional, groupArray || isArray(ref));
196
+ }
197
+ }
198
+ /**
199
+ * Walk elements from a group reference (xs:group ref="...").
200
+ */
201
+ function* walkGroupRef(ref, schema, parentOptional = false, parentArray = false) {
202
+ const group = findGroup(stripNsPrefix(ref), schema);
203
+ if (group) {
204
+ if (group.sequence) yield* walkGroup(group.sequence, "sequence", schema, parentOptional, parentArray);
205
+ if (group.choice) yield* walkGroup(group.choice, "choice", schema, true, parentArray);
206
+ if (group.all) yield* walkGroup(group.all, "all", schema, parentOptional, parentArray);
207
+ }
208
+ }
209
+ /**
210
+ * Walk all attributes in a complexType, handling:
211
+ * - Direct attributes
212
+ * - complexContent/extension attributes
213
+ * - simpleContent/extension attributes
214
+ * - Inherited attributes from base type
215
+ * - AttributeGroup references
216
+ */
217
+ function* walkAttributes(ct, schema) {
218
+ if (ct.complexContent?.extension) {
219
+ const ext = ct.complexContent.extension;
220
+ if (ext.base) {
221
+ const baseEntry = findComplexType(stripNsPrefix(ext.base), schema);
222
+ if (baseEntry) yield* walkAttributes(baseEntry.ct, baseEntry.schema);
223
+ }
224
+ if (ext.attribute) for (const attr of ext.attribute) {
225
+ const resolved = resolveAttribute(attr, schema);
226
+ if (resolved) yield {
227
+ attribute: resolved,
228
+ required: resolved.use === "required",
229
+ schema
230
+ };
231
+ }
232
+ yield* walkAttributeGroupRefs(ext.attributeGroup, schema);
233
+ return;
234
+ }
235
+ if (ct.simpleContent?.extension) {
236
+ const ext = ct.simpleContent.extension;
237
+ if (ext.attribute) for (const attr of ext.attribute) {
238
+ const resolved = resolveAttribute(attr, schema);
239
+ if (resolved) yield {
240
+ attribute: resolved,
241
+ required: resolved.use === "required",
242
+ schema
243
+ };
244
+ }
245
+ yield* walkAttributeGroupRefs(ext.attributeGroup, schema);
246
+ return;
247
+ }
248
+ if (ct.attribute) for (const attr of ct.attribute) {
249
+ const resolved = resolveAttribute(attr, schema);
250
+ if (resolved) yield {
251
+ attribute: resolved,
252
+ required: resolved.use === "required",
253
+ schema
254
+ };
255
+ }
256
+ yield* walkAttributeGroupRefs(ct.attributeGroup, schema);
257
+ }
258
+ /**
259
+ * Walk attributes from attributeGroup references.
260
+ */
261
+ function* walkAttributeGroupRefs(refs, schema) {
262
+ if (!refs) return;
263
+ for (const ref of refs) {
264
+ const refObj = ref;
265
+ if (refObj.ref) {
266
+ const group = findAttributeGroup(stripNsPrefix(refObj.ref), schema);
267
+ if (group?.attribute) for (const attribute of group.attribute) yield {
268
+ attribute,
269
+ required: attribute.use === "required",
270
+ schema
271
+ };
272
+ }
273
+ }
274
+ }
275
+ /**
276
+ * Find a named group (xs:group) by name.
277
+ */
278
+ function findGroup(name, schema) {
279
+ if (schema.group) {
280
+ for (const g of schema.group) if (g.name === name) return g;
281
+ }
282
+ if (schema.$includes) for (const included of schema.$includes) {
283
+ const found = findGroup(name, included);
284
+ if (found) return found;
285
+ }
286
+ if (schema.$imports) for (const imported of schema.$imports) {
287
+ const found = findGroup(name, imported);
288
+ if (found) return found;
289
+ }
290
+ }
291
+ /**
292
+ * Find a top-level attribute by name.
293
+ * Searches current schema and $imports.
294
+ */
295
+ function findAttribute(name, schema) {
296
+ const schemaWithAttrs = schema;
297
+ if (schemaWithAttrs.attribute) {
298
+ for (const attr of schemaWithAttrs.attribute) if (attr.name === name) return attr;
299
+ }
300
+ if (schema.$includes) for (const included of schema.$includes) {
301
+ const found = findAttribute(name, included);
302
+ if (found) return found;
303
+ }
304
+ if (schema.$imports) for (const imported of schema.$imports) {
305
+ const found = findAttribute(name, imported);
306
+ if (found) return found;
307
+ }
308
+ }
309
+ /**
310
+ * Resolve an attribute - handles both direct attributes and refs.
311
+ * Returns the resolved attribute with its name.
312
+ */
313
+ function resolveAttribute(attribute, schema) {
314
+ if (attribute.ref) {
315
+ const refName = stripNsPrefix(attribute.ref);
316
+ const resolved = findAttribute(refName, schema);
317
+ if (resolved) return {
318
+ ...resolved,
319
+ use: attribute.use ?? resolved.use
320
+ };
321
+ return {
322
+ name: refName,
323
+ type: "xs:string",
324
+ use: attribute.use
325
+ };
326
+ }
327
+ return attribute;
328
+ }
329
+ /**
330
+ * Find an attributeGroup by name.
331
+ */
332
+ function findAttributeGroup(name, schema) {
333
+ if (schema.attributeGroup) {
334
+ for (const g of schema.attributeGroup) if (g.name === name) return g;
335
+ }
336
+ if (schema.$includes) for (const included of schema.$includes) {
337
+ const found = findAttributeGroup(name, included);
338
+ if (found) return found;
339
+ }
340
+ if (schema.$imports) for (const imported of schema.$imports) {
341
+ const found = findAttributeGroup(name, imported);
342
+ if (found) return found;
343
+ }
344
+ }
345
+ /**
346
+ * Strip namespace prefix from a QName (e.g., "tns:PersonType" -> "PersonType")
347
+ */
348
+ function stripNsPrefix(name) {
349
+ const colonIndex = name.indexOf(":");
350
+ return colonIndex >= 0 ? name.slice(colonIndex + 1) : name;
351
+ }
352
+ /**
353
+ * Check if element/group has maxOccurs > 1 (is array)
354
+ */
355
+ function isArray(item) {
356
+ if (item.maxOccurs === "unbounded") return true;
357
+ if (typeof item.maxOccurs === "number") return item.maxOccurs > 1;
358
+ if (typeof item.maxOccurs === "string") {
359
+ if (item.maxOccurs === "unbounded") return true;
360
+ const num = parseInt(item.maxOccurs, 10);
361
+ return !isNaN(num) && num > 1;
362
+ }
363
+ return false;
364
+ }
365
+ /**
366
+ * Check if an element is abstract
367
+ */
368
+ function isAbstractElement(element) {
369
+ return element.abstract === true || element.abstract === "true";
370
+ }
371
+ /**
372
+ * Find all elements that substitute for a given abstract element.
373
+ * This handles XSD substitution groups where concrete elements can
374
+ * substitute for an abstract element.
375
+ */
376
+ function findSubstitutes(abstractElementName, schema) {
377
+ const substitutes = [];
378
+ for (const { element } of walkTopLevelElements(schema)) {
379
+ const subGroup = element.substitutionGroup;
380
+ if (subGroup) {
381
+ if (stripNsPrefix(subGroup) === abstractElementName) substitutes.push(element);
382
+ }
383
+ }
384
+ return substitutes;
385
+ }
386
+
387
+ //#endregion
388
+ //#region src/xml/parse.ts
389
+ /**
390
+ * XML Parser for W3C Schema
391
+ *
392
+ * Parse XML string to typed JavaScript object using W3C-compliant Schema definition.
393
+ * Uses the walker module for schema traversal.
394
+ */
395
+ /**
396
+ * Find all elements that substitute for a given abstract element
397
+ * Searches current schema and all $imports
398
+ */
399
+ function findSubstitutingElements(abstractElementName, schema) {
400
+ const results = [];
401
+ const checkSchema = (s) => {
402
+ const elements = s.element;
403
+ if (!elements) return;
404
+ for (const el of elements) if (el.substitutionGroup) {
405
+ if (stripNsPrefix(el.substitutionGroup) === abstractElementName) results.push({
406
+ element: el,
407
+ schema: s
408
+ });
409
+ }
410
+ };
411
+ checkSchema(schema);
412
+ const imports = schema.$imports;
413
+ if (imports) for (const imported of imports) {
414
+ checkSchema(imported);
415
+ const nestedResults = findSubstitutingElements(abstractElementName, imported);
416
+ results.push(...nestedResults);
417
+ }
418
+ return results;
419
+ }
420
+ /**
421
+ * Check if an element is abstract
422
+ * Searches current schema and all $imports
423
+ */
424
+ function isAbstractElement$1(elementName, schema) {
425
+ const elements = schema.element;
426
+ if (elements) {
427
+ for (const el of elements) if (el.name === elementName && el.abstract === true) return true;
428
+ }
429
+ const imports = schema.$imports;
430
+ if (imports) {
431
+ for (const imported of imports) if (isAbstractElement$1(elementName, imported)) return true;
432
+ }
433
+ return false;
434
+ }
435
+ /**
436
+ * Parse XML string to typed object using schema definition
437
+ */
438
+ function parse(schema, xml) {
439
+ const root = new DOMParser().parseFromString(xml, "text/xml")?.documentElement;
440
+ if (!root) throw new Error("Invalid XML: missing root element");
441
+ const rootLocalName = getLocalName(root);
442
+ const elementEntry = findElementByName(schema, rootLocalName);
443
+ if (!elementEntry) throw new Error(`Schema missing element declaration for: ${rootLocalName}`);
444
+ const inlineComplexType = elementEntry.element.complexType;
445
+ if (inlineComplexType) {
446
+ const content = parseElement(root, inlineComplexType, elementEntry.schema, schema);
447
+ return { [rootLocalName]: content };
448
+ }
449
+ const typeName = stripNsPrefix(elementEntry.element.type || elementEntry.element.name || "");
450
+ const typeEntry = findComplexType(typeName, schema);
451
+ if (!typeEntry) throw new Error(`Schema missing complexType for: ${typeName}`);
452
+ const content = parseElement(root, typeEntry.ct, typeEntry.schema, schema);
453
+ return { [rootLocalName]: content };
454
+ }
455
+ /**
456
+ * Find element declaration by name (case-insensitive fallback)
457
+ */
458
+ function findElementByName(schema, name) {
459
+ const exact = findElement(name, schema);
460
+ if (exact) return exact;
461
+ const elements = schema.element;
462
+ if (elements) {
463
+ const lowerName = name.toLowerCase();
464
+ const found = elements.find((el) => el.name?.toLowerCase() === lowerName);
465
+ if (found) return {
466
+ element: found,
467
+ schema
468
+ };
469
+ }
470
+ }
471
+ /**
472
+ * Parse a single element using its complexType definition
473
+ * Uses walker to iterate elements and attributes (handles inheritance automatically)
474
+ * @param node - The XML element to parse
475
+ * @param typeDef - The complexType definition for this element
476
+ * @param schema - The schema where typeDef is defined (for type resolution)
477
+ * @param rootSchema - The root schema (for substitution group lookups)
478
+ */
479
+ function parseElement(node, typeDef, schema, rootSchema) {
480
+ const result = {};
481
+ if (typeDef.simpleContent?.extension) return parseSimpleContent(node, typeDef, schema, rootSchema);
482
+ for (const { attribute } of walkAttributes(typeDef, schema)) {
483
+ if (!attribute.name) continue;
484
+ const value = getAttributeValue(node, attribute.name);
485
+ if (value !== null) result[attribute.name] = convertValue(value, attribute.type || "string");
486
+ else if (attribute.default !== void 0) result[attribute.name] = convertValue(String(attribute.default), attribute.type || "string");
487
+ }
488
+ for (const { element, array } of walkElements(typeDef, schema)) {
489
+ const resolved = resolveElementInfo$1(element, schema);
490
+ if (!resolved) continue;
491
+ if (isAbstractElement$1(resolved.name, rootSchema)) {
492
+ const substitutes = findSubstitutingElements(resolved.name, rootSchema);
493
+ const allChildren = getAllChildElements(node);
494
+ for (const child of allChildren) {
495
+ const childName = getLocalName(child);
496
+ const substitute = substitutes.find((s) => s.element.name === childName);
497
+ if (substitute && substitute.element.name) {
498
+ const subTypeName = substitute.element.type ? stripNsPrefix(substitute.element.type) : void 0;
499
+ result[substitute.element.name] = parseChildValue(child, subTypeName, substitute.schema, rootSchema);
500
+ }
501
+ }
502
+ } else {
503
+ const children = getChildElements(node, resolved.name);
504
+ if (array || children.length > 1) {
505
+ const values = children.map((child) => parseChildValue(child, resolved.typeName, schema, rootSchema));
506
+ if (values.length > 0) result[resolved.name] = values;
507
+ } else if (children.length === 1) result[resolved.name] = parseChildValue(children[0], resolved.typeName, schema, rootSchema);
508
+ }
509
+ }
510
+ return result;
511
+ }
512
+ /**
513
+ * Parse simpleContent (text content with attributes)
514
+ */
515
+ function parseSimpleContent(node, typeDef, _schema, _rootSchema) {
516
+ const result = {};
517
+ const simpleContent = typeDef.simpleContent;
518
+ if (!simpleContent?.extension) return result;
519
+ const ext = simpleContent.extension;
520
+ result.$value = convertValue(getTextContent(node), ext.base ? stripNsPrefix(ext.base) : "string");
521
+ if (ext.attribute) for (const attrDef of ext.attribute) {
522
+ if (!attrDef.name) continue;
523
+ const value = getAttributeValue(node, attrDef.name);
524
+ if (value !== null) result[attrDef.name] = convertValue(value, attrDef.type || "string");
525
+ else if (attrDef.default !== void 0) result[attrDef.name] = convertValue(String(attrDef.default), attrDef.type || "string");
526
+ }
527
+ return result;
528
+ }
529
+ /**
530
+ * Resolve element info (name and type), handling ref
531
+ */
532
+ function resolveElementInfo$1(element, schema) {
533
+ if (element.name) return {
534
+ name: element.name,
535
+ typeName: element.type ? stripNsPrefix(element.type) : void 0
536
+ };
537
+ if (element.ref) {
538
+ const refName = stripNsPrefix(element.ref);
539
+ const refElement = findElement(refName, schema);
540
+ if (refElement) return {
541
+ name: refElement.element.name ?? refName,
542
+ typeName: refElement.element.type ? stripNsPrefix(refElement.element.type) : void 0
543
+ };
544
+ return {
545
+ name: refName,
546
+ typeName: void 0
547
+ };
548
+ }
549
+ }
550
+ /**
551
+ * Parse a child element's value (either complex type or simple value)
552
+ */
553
+ function parseChildValue(child, typeName, schema, rootSchema) {
554
+ const nestedType = typeName ? findComplexType(typeName, schema) : void 0;
555
+ if (nestedType) return parseElement(child, nestedType.ct, nestedType.schema, rootSchema);
556
+ return convertValue(getTextContent(child) || "", typeName || "string");
557
+ }
558
+ /**
559
+ * Convert string value to typed value based on XSD type
560
+ */
561
+ function convertValue(value, type) {
562
+ switch (stripNsPrefix(type)) {
563
+ case "int":
564
+ case "integer":
565
+ case "decimal":
566
+ case "float":
567
+ case "double":
568
+ case "short":
569
+ case "long":
570
+ case "byte":
571
+ case "unsignedInt":
572
+ case "unsignedShort":
573
+ case "unsignedLong":
574
+ case "unsignedByte":
575
+ case "positiveInteger":
576
+ case "negativeInteger":
577
+ case "nonPositiveInteger":
578
+ case "nonNegativeInteger": return Number(value);
579
+ case "boolean": return value === "true" || value === "1";
580
+ case "date":
581
+ case "dateTime": return value;
582
+ default: return value;
583
+ }
584
+ }
585
+
586
+ //#endregion
587
+ //#region src/xml/build-utils.ts
588
+ /**
589
+ * Get namespace prefix from schema $xmlns declarations
590
+ */
591
+ function getSchemaPrefix(schema) {
592
+ if (!schema.$xmlns || !schema.targetNamespace) return void 0;
593
+ for (const [prefix, uri] of Object.entries(schema.$xmlns)) if (uri === schema.targetNamespace && prefix) return prefix;
594
+ }
595
+ /**
596
+ * Create XML document with namespace
597
+ */
598
+ function createXmlDocument(schema) {
599
+ const impl = new DOMImplementation();
600
+ const ns = schema.targetNamespace || null;
601
+ return impl.createDocument(ns, "", null);
602
+ }
603
+ /**
604
+ * Collect namespace declarations from a schema and its $imports/$includes recursively.
605
+ *
606
+ * Gathers all $xmlns prefix→URI mappings from the schema tree.
607
+ * Unused declarations are cleaned up later by stripUnusedNamespaces()
608
+ * after the XML tree is built — that approach is generic and doesn't
609
+ * require any domain-specific knowledge.
610
+ */
611
+ function collectAllNamespaces(schema, collected = /* @__PURE__ */ new Map(), visited = /* @__PURE__ */ new Set()) {
612
+ if (visited.has(schema)) return collected;
613
+ visited.add(schema);
614
+ if (schema.$xmlns) {
615
+ for (const [pfx, uri] of Object.entries(schema.$xmlns)) if (!collected.has(pfx)) collected.set(pfx, uri);
616
+ }
617
+ const imports = schema.$imports;
618
+ if (imports) for (const imported of imports) collectAllNamespaces(imported, collected, visited);
619
+ const includes = schema.$includes;
620
+ if (includes) for (const included of includes) collectAllNamespaces(included, collected, visited);
621
+ return collected;
622
+ }
623
+ /**
624
+ * Create root element with namespace declarations
625
+ *
626
+ * When elementFormDefault="unqualified", the root element should NOT have
627
+ * a namespace prefix. This is important for formats like abapGit where
628
+ * the root element (abapGit) is unqualified but child elements may have prefixes.
629
+ */
630
+ function createRootElement(doc, elementName, schema, prefix) {
631
+ const ns = schema.targetNamespace || null;
632
+ const usePrefix = schema.elementFormDefault === "unqualified" ? void 0 : prefix;
633
+ const rootTag = usePrefix ? `${usePrefix}:${elementName}` : elementName;
634
+ const root = doc.createElement(rootTag);
635
+ if (ns && prefix) root.setAttribute(`xmlns:${prefix}`, ns);
636
+ else if (ns && !prefix) root.setAttribute("xmlns", ns);
637
+ const allNamespaces = collectAllNamespaces(schema);
638
+ for (const [pfx, uri] of allNamespaces) if (pfx && pfx !== prefix) root.setAttribute(`xmlns:${pfx}`, uri);
639
+ else if (!pfx) root.setAttribute("xmlns", uri);
640
+ return root;
641
+ }
642
+ /**
643
+ * Remove xmlns declarations from the root element for prefixes that are
644
+ * not actually used anywhere in the document tree.
645
+ *
646
+ * This prevents emitting unused namespace declarations (e.g. xmlns:abapsource,
647
+ * xmlns:abapoo) that come from the schema's $imports chain but aren't
648
+ * referenced by any element or attribute in the built XML.
649
+ *
650
+ * The prefix that maps to the schema's own targetNamespace is always
651
+ * preserved — even when elementFormDefault="unqualified" causes the root
652
+ * element to be emitted without a prefix, the xmlns declaration is still
653
+ * required for the document to be in the correct namespace.
654
+ */
655
+ /**
656
+ * Add namespace prefix from a qualified name to the set (if present).
657
+ */
658
+ function addPrefixFromName(name, usedPrefixes) {
659
+ const colon = name.indexOf(":");
660
+ if (colon > 0) usedPrefixes.add(name.substring(0, colon));
661
+ }
662
+ /**
663
+ * Collect namespace prefixes referenced by attributes on a single element
664
+ * (xmlns declarations are skipped — they declare rather than use prefixes).
665
+ */
666
+ function collectPrefixesFromAttributes(node, usedPrefixes) {
667
+ if (!node.attributes) return;
668
+ for (const attr of Array.from(node.attributes)) if (!attr.name.startsWith("xmlns:") && attr.name !== "xmlns") addPrefixFromName(attr.name, usedPrefixes);
669
+ }
670
+ /**
671
+ * Collect prefixes used by elements and attributes in the tree (recursive walk).
672
+ */
673
+ function collectUsedPrefixes(node, usedPrefixes) {
674
+ addPrefixFromName(node.tagName, usedPrefixes);
675
+ collectPrefixesFromAttributes(node, usedPrefixes);
676
+ if (node.childNodes) {
677
+ for (const child of Array.from(node.childNodes)) if (child.nodeType === 1) collectUsedPrefixes(child, usedPrefixes);
678
+ }
679
+ }
680
+ /**
681
+ * Collect xmlns:prefix attribute names on the root element whose prefix
682
+ * is not in the used-prefixes set.
683
+ */
684
+ function findUnusedXmlnsAttrs(root, usedPrefixes) {
685
+ const toRemove = [];
686
+ if (!root.attributes) return toRemove;
687
+ for (const attr of Array.from(root.attributes)) if (attr.name.startsWith("xmlns:")) {
688
+ const pfx = attr.name.substring(6);
689
+ if (!usedPrefixes.has(pfx)) toRemove.push(attr.name);
690
+ }
691
+ return toRemove;
692
+ }
693
+ function stripUnusedNamespaces(root, schema) {
694
+ const usedPrefixes = /* @__PURE__ */ new Set();
695
+ if (schema?.targetNamespace && schema.$xmlns) {
696
+ for (const [pfx, uri] of Object.entries(schema.$xmlns)) if (pfx && uri === schema.targetNamespace) usedPrefixes.add(pfx);
697
+ }
698
+ collectUsedPrefixes(root, usedPrefixes);
699
+ for (const name of findUnusedXmlnsAttrs(root, usedPrefixes)) root.removeAttribute(name);
700
+ }
701
+ /**
702
+ * Format value for XML output
703
+ */
704
+ function formatValue(value, type) {
705
+ if (value instanceof Date) return stripNsPrefix(type) === "date" ? value.toISOString().split("T")[0] : value.toISOString();
706
+ if (typeof value === "boolean") return value ? "true" : "false";
707
+ return String(value);
708
+ }
709
+ /**
710
+ * Simple XML formatter (basic indentation)
711
+ *
712
+ * Keeps text content inline: <tag>text</tag>
713
+ * Only adds newlines for nested elements
714
+ */
715
+ function formatXml(xml) {
716
+ let formatted = "";
717
+ let indent = 0;
718
+ const parts = [];
719
+ let pos = 0;
720
+ while (pos < xml.length) if (xml.charCodeAt(pos) === 60) {
721
+ const end = xml.indexOf(">", pos + 1);
722
+ if (end === -1) {
723
+ parts.push(xml.slice(pos));
724
+ break;
725
+ }
726
+ parts.push(xml.slice(pos, end + 1));
727
+ pos = end + 1;
728
+ } else {
729
+ const next = xml.indexOf("<", pos);
730
+ if (next === -1) {
731
+ parts.push(xml.slice(pos));
732
+ break;
733
+ }
734
+ if (next > pos) parts.push(xml.slice(pos, next));
735
+ pos = next;
736
+ }
737
+ let lastWasText = false;
738
+ for (let i = 0; i < parts.length; i++) {
739
+ const part = parts[i];
740
+ const nextPart = parts[i + 1];
741
+ if (part.startsWith("<?")) {
742
+ formatted += part + "\n";
743
+ lastWasText = false;
744
+ } else if (part.startsWith("</")) {
745
+ indent = Math.max(0, indent - 1);
746
+ if (lastWasText) formatted += part + "\n";
747
+ else formatted += " ".repeat(indent) + part + "\n";
748
+ lastWasText = false;
749
+ } else if (part.startsWith("<") && part.endsWith("/>")) {
750
+ formatted += " ".repeat(indent) + part + "\n";
751
+ lastWasText = false;
752
+ } else if (part.startsWith("<")) {
753
+ formatted += " ".repeat(indent) + part;
754
+ if (!part.includes("</")) indent++;
755
+ if (nextPart && !nextPart.startsWith("<")) {} else formatted += "\n";
756
+ lastWasText = false;
757
+ } else {
758
+ const trimmed = part.trim();
759
+ if (trimmed) {
760
+ formatted += trimmed;
761
+ lastWasText = true;
762
+ }
763
+ }
764
+ }
765
+ return formatted.trim();
766
+ }
767
+
768
+ //#endregion
769
+ //#region src/xml/build.ts
770
+ /**
771
+ * XML Builder for W3C Schema (Walker-based implementation)
772
+ *
773
+ * Build XML string from typed JavaScript object using W3C-compliant Schema definition.
774
+ * Uses the walker module for schema traversal.
775
+ */
776
+ /**
777
+ * Collect all namespace prefixes from a schema and its $imports chain
778
+ */
779
+ function collectAllXmlns(schema, visited = /* @__PURE__ */ new Set()) {
780
+ if (visited.has(schema)) return {};
781
+ visited.add(schema);
782
+ const result = {};
783
+ const xmlns = schema.$xmlns;
784
+ if (xmlns) Object.assign(result, xmlns);
785
+ const imports = schema.$imports;
786
+ if (imports) for (const imported of imports) Object.assign(result, collectAllXmlns(imported, visited));
787
+ return result;
788
+ }
789
+ /**
790
+ * Get the namespace prefix for a schema's targetNamespace from the root schema's $xmlns
791
+ * and all imported schemas' $xmlns (for inherited attributes)
792
+ */
793
+ function getPrefixForSchema(schema, rootSchema) {
794
+ const targetNs = schema.targetNamespace;
795
+ if (!targetNs) return void 0;
796
+ const allXmlns = collectAllXmlns(rootSchema);
797
+ for (const [prefix, ns] of Object.entries(allXmlns)) if (ns === targetNs) return prefix;
798
+ }
799
+ /**
800
+ * Build XML string from typed object using schema definition
801
+ */
802
+ function build(schema, data, options = {}) {
803
+ const { xmlDecl = true, encoding = "utf-8", pretty = false } = options;
804
+ const prefix = options.prefix ?? getSchemaPrefix(schema);
805
+ const doc = createXmlDocument(schema);
806
+ let elementDecl;
807
+ let elementSchema = schema;
808
+ let elementData = data;
809
+ if (options.rootElement) {
810
+ const found = findElement(options.rootElement, schema);
811
+ if (!found) throw new Error(`Element '${options.rootElement}' not found in schema`);
812
+ elementDecl = found.element;
813
+ elementSchema = found.schema;
814
+ if (elementData[options.rootElement] !== void 0) elementData = elementData[options.rootElement];
815
+ } else {
816
+ const dataKeys = Object.keys(elementData);
817
+ if (dataKeys.length === 1) {
818
+ const potentialElementName = dataKeys[0];
819
+ const found = findElement(potentialElementName, schema);
820
+ if (found) {
821
+ elementDecl = found.element;
822
+ elementSchema = found.schema;
823
+ elementData = elementData[potentialElementName];
824
+ }
825
+ }
826
+ if (!elementDecl) {
827
+ elementDecl = findMatchingElement(elementData, schema);
828
+ if (!elementDecl) throw new Error("Schema has no element declarations");
829
+ }
830
+ }
831
+ let rootType;
832
+ let rootSchema = elementSchema;
833
+ if (elementDecl.complexType) rootType = elementDecl.complexType;
834
+ else if (elementDecl.type) {
835
+ const typeName = stripNsPrefix(elementDecl.type);
836
+ const rootTypeEntry = findComplexType(typeName, elementSchema);
837
+ if (!rootTypeEntry) throw new Error(`Schema missing complexType for: ${typeName}`);
838
+ rootType = rootTypeEntry.ct;
839
+ rootSchema = rootTypeEntry.schema;
840
+ } else throw new Error(`Element ${elementDecl.name} has no type or inline complexType`);
841
+ const elementName = elementDecl.name ?? elementDecl.ref;
842
+ if (!elementName) throw new Error("Element declaration has no name or ref");
843
+ const root = createRootElement(doc, elementName, schema, prefix);
844
+ buildElement(doc, root, elementData, rootType, rootSchema, schema, prefix);
845
+ stripUnusedNamespaces(root, schema);
846
+ if (!root.hasChildNodes()) root.appendChild(doc.createTextNode(""));
847
+ doc.appendChild(root);
848
+ let xml = new XMLSerializer().serializeToString(doc);
849
+ if (xmlDecl) xml = `<?xml version="1.0" encoding="${encoding}"?>\n${xml}`;
850
+ if (pretty) xml = formatXml(xml);
851
+ return xml;
852
+ }
853
+ /**
854
+ * Find the element declaration that best matches the data structure.
855
+ * Searches in the main schema first, then in $imports.
856
+ */
857
+ function findMatchingElement(data, schema) {
858
+ const dataKeys = new Set(Object.keys(data));
859
+ let bestMatch;
860
+ let bestScore = -1;
861
+ const scoreElement = (element, searchSchema) => {
862
+ let ct;
863
+ let ctSchema = searchSchema;
864
+ if (element.complexType) ct = element.complexType;
865
+ else if (element.type) {
866
+ const typeEntry = findComplexType(stripNsPrefix(element.type), searchSchema);
867
+ if (typeEntry) {
868
+ ct = typeEntry.ct;
869
+ ctSchema = typeEntry.schema;
870
+ }
871
+ }
872
+ if (!ct) return 0;
873
+ const typeFields = /* @__PURE__ */ new Set();
874
+ for (const { element: el } of walkElements(ct, ctSchema)) if (el.name) typeFields.add(el.name);
875
+ for (const { attribute } of walkAttributes(ct, ctSchema)) if (attribute.name) typeFields.add(attribute.name);
876
+ let score = 0;
877
+ dataKeys.forEach((key) => {
878
+ if (typeFields.has(key)) score++;
879
+ });
880
+ return score;
881
+ };
882
+ const elements = schema.element;
883
+ if (elements && elements.length > 0) for (const element of elements) {
884
+ const score = scoreElement(element, schema);
885
+ if (score > bestScore) {
886
+ bestScore = score;
887
+ bestMatch = element;
888
+ }
889
+ }
890
+ const imports = schema.$imports;
891
+ if (imports) for (const importedSchema of imports) {
892
+ const importedElements = importedSchema.element;
893
+ if (!importedElements) continue;
894
+ for (const element of importedElements) {
895
+ const score = scoreElement(element, importedSchema);
896
+ if (score > bestScore) {
897
+ bestScore = score;
898
+ bestMatch = element;
899
+ }
900
+ }
901
+ }
902
+ if (!bestMatch && elements && elements.length > 0) return elements[0];
903
+ return bestMatch;
904
+ }
905
+ /**
906
+ * Build element content using its complexType definition
907
+ * Uses walker to iterate elements and attributes (handles inheritance automatically)
908
+ * @param rootSchema - The original schema passed to build(), used for substitution group lookup
909
+ */
910
+ function buildElement(doc, node, data, typeDef, schema, rootSchema, prefix) {
911
+ for (const { attribute, schema: attrSchema } of walkAttributes(typeDef, schema)) {
912
+ if (!attribute.name) continue;
913
+ const value = data[attribute.name];
914
+ if (value !== void 0 && value !== null) {
915
+ const attributeFormDefault = attrSchema.attributeFormDefault;
916
+ const attrForm = attribute.form;
917
+ let attrName = attribute.name;
918
+ if (attrForm === "qualified" || attrForm !== "unqualified" && attributeFormDefault === "qualified") {
919
+ const attrPrefix = getPrefixForSchema(attrSchema, rootSchema);
920
+ if (attrPrefix) attrName = `${attrPrefix}:${attribute.name}`;
921
+ }
922
+ node.setAttribute(attrName, formatValue(value, attribute.type || "string"));
923
+ }
924
+ }
925
+ for (const { element, schema: elementDefSchema } of walkElements(typeDef, schema)) {
926
+ if (element.ref) {
927
+ const refName = stripNsPrefix(element.ref);
928
+ const refElement = findElement(refName, elementDefSchema);
929
+ if (refElement && refElement.element.abstract) {
930
+ const substitutes = findSubstitutes$1(refName, rootSchema);
931
+ for (const substitute of substitutes) {
932
+ const subName = substitute.element.name;
933
+ if (!subName) continue;
934
+ const value = data[subName];
935
+ if (value !== void 0) buildField(doc, node, value, subName, substitute.element.type ? stripNsPrefix(substitute.element.type) : void 0, substitute.schema, rootSchema, prefix);
936
+ }
937
+ continue;
938
+ }
939
+ }
940
+ const resolved = resolveElementInfo(element, elementDefSchema);
941
+ if (!resolved) continue;
942
+ const value = data[resolved.dataKey];
943
+ if (value !== void 0) buildFieldWithTagName(doc, node, value, resolved.tagName, resolved.typeName, resolved.inlineComplexType, resolved.elementSchema, rootSchema, prefix, resolved.form);
944
+ }
945
+ }
946
+ /**
947
+ * Resolve element info (name and type), handling ref
948
+ *
949
+ * Returns:
950
+ * - tagName: The XML tag name to use (may include prefix like "asx:abap")
951
+ * - dataKey: The key to look up in data object (local name without prefix)
952
+ * - typeName: The type name for building nested content (if type attribute)
953
+ * - inlineComplexType: The inline complexType definition (if present)
954
+ * - elementSchema: The schema where the element was found
955
+ * - form: Per-element form override ("qualified" or "unqualified")
956
+ */
957
+ function resolveElementInfo(element, schema) {
958
+ if (element.name) return {
959
+ tagName: element.name,
960
+ dataKey: element.name,
961
+ typeName: element.type ? stripNsPrefix(element.type) : void 0,
962
+ inlineComplexType: element.complexType,
963
+ elementSchema: schema,
964
+ form: element.form
965
+ };
966
+ if (element.ref) {
967
+ const refName = stripNsPrefix(element.ref);
968
+ const refElement = findElement(refName, schema);
969
+ if (refElement) return {
970
+ tagName: element.ref,
971
+ dataKey: refElement.element.name ?? refName,
972
+ typeName: refElement.element.type ? stripNsPrefix(refElement.element.type) : void 0,
973
+ inlineComplexType: refElement.element.complexType,
974
+ elementSchema: refElement.schema,
975
+ form: void 0
976
+ };
977
+ return {
978
+ tagName: element.ref,
979
+ dataKey: refName,
980
+ typeName: void 0,
981
+ inlineComplexType: void 0,
982
+ elementSchema: schema,
983
+ form: void 0
984
+ };
985
+ }
986
+ }
987
+ /**
988
+ * Build a field (child element)
989
+ *
990
+ * Respects elementFormDefault:
991
+ * - "qualified": local elements get namespace prefix
992
+ * - "unqualified" (default): local elements do NOT get namespace prefix
993
+ */
994
+ function buildField(doc, parent, value, elementName, typeName, schema, rootSchema, prefix) {
995
+ if (value === void 0 || value === null) return;
996
+ const nestedType = typeName ? findComplexType(typeName, schema) : void 0;
997
+ const usePrefix = rootSchema.elementFormDefault === "qualified" ? prefix : void 0;
998
+ const tagName = usePrefix ? `${usePrefix}:${elementName}` : elementName;
999
+ if (Array.isArray(value)) for (const item of value) {
1000
+ const child = doc.createElement(tagName);
1001
+ if (nestedType) buildElement(doc, child, item, nestedType.ct, nestedType.schema, rootSchema, prefix);
1002
+ else {
1003
+ const text = formatValue(item, typeName || "string");
1004
+ if (text) child.appendChild(doc.createTextNode(text));
1005
+ }
1006
+ parent.appendChild(child);
1007
+ }
1008
+ else {
1009
+ const child = doc.createElement(tagName);
1010
+ if (nestedType) buildElement(doc, child, value, nestedType.ct, nestedType.schema, rootSchema, prefix);
1011
+ else {
1012
+ const text = formatValue(value, typeName || "string");
1013
+ if (text) child.appendChild(doc.createTextNode(text));
1014
+ }
1015
+ parent.appendChild(child);
1016
+ }
1017
+ }
1018
+ /**
1019
+ * Build a field with an explicit tag name (used for element refs with prefix)
1020
+ *
1021
+ * Handles three cases:
1022
+ * 1. Element refs with prefix (e.g., ref="asx:abap") - use tagName directly
1023
+ * 2. Elements with form="unqualified" - never use prefix
1024
+ * 3. Direct elements - apply elementFormDefault logic
1025
+ */
1026
+ function buildFieldWithTagName(doc, parent, value, tagName, typeName, inlineComplexType, elementSchema, rootSchema, prefix, elementForm) {
1027
+ if (value === void 0 || value === null) return;
1028
+ let nestedType;
1029
+ if (inlineComplexType) nestedType = {
1030
+ ct: inlineComplexType,
1031
+ schema: elementSchema
1032
+ };
1033
+ else if (typeName) nestedType = findComplexType(typeName, elementSchema);
1034
+ let actualTagName = tagName;
1035
+ if (!tagName.includes(":")) {
1036
+ let usePrefix;
1037
+ if (elementForm === "unqualified") usePrefix = void 0;
1038
+ else if (elementForm === "qualified") usePrefix = getPrefixForSchema(elementSchema, rootSchema) ?? prefix;
1039
+ else usePrefix = (elementSchema.elementFormDefault ?? rootSchema.elementFormDefault) === "qualified" ? getPrefixForSchema(elementSchema, rootSchema) ?? prefix : void 0;
1040
+ actualTagName = usePrefix ? `${usePrefix}:${tagName}` : tagName;
1041
+ }
1042
+ if (Array.isArray(value)) for (const item of value) {
1043
+ const child = doc.createElement(actualTagName);
1044
+ if (nestedType) buildElement(doc, child, item, nestedType.ct, nestedType.schema, rootSchema, prefix);
1045
+ else {
1046
+ const text = formatValue(item, typeName || "string");
1047
+ if (text) child.appendChild(doc.createTextNode(text));
1048
+ }
1049
+ parent.appendChild(child);
1050
+ }
1051
+ else {
1052
+ const child = doc.createElement(actualTagName);
1053
+ if (nestedType) buildElement(doc, child, value, nestedType.ct, nestedType.schema, rootSchema, prefix);
1054
+ else {
1055
+ const text = formatValue(value, typeName || "string");
1056
+ if (text) child.appendChild(doc.createTextNode(text));
1057
+ }
1058
+ parent.appendChild(child);
1059
+ }
1060
+ }
1061
+ /**
1062
+ * Find all elements that substitute for a given abstract element name.
1063
+ * Searches in the main schema and all $imports.
1064
+ */
1065
+ function findSubstitutes$1(abstractElementName, schema) {
1066
+ const substitutes = [];
1067
+ const searchSchema = (s) => {
1068
+ const elements = s.element;
1069
+ if (!elements) return;
1070
+ for (const el of elements) if (el.substitutionGroup) {
1071
+ if (stripNsPrefix(el.substitutionGroup) === abstractElementName) substitutes.push({
1072
+ element: el,
1073
+ schema: s
1074
+ });
1075
+ }
1076
+ };
1077
+ searchSchema(schema);
1078
+ const imports = schema.$imports;
1079
+ if (imports) for (const imported of imports) searchSchema(imported);
1080
+ return substitutes;
1081
+ }
1082
+
1083
+ //#endregion
1084
+ //#region src/xml/typed.ts
1085
+ /**
1086
+ * Create a typed schema wrapper
1087
+ *
1088
+ * @param schema - Raw schema literal (with `as const`)
1089
+ * @returns Typed schema with parse/build methods
1090
+ *
1091
+ * @example
1092
+ * ```typescript
1093
+ * // Infer type from schema
1094
+ * const personSchema = typedSchema(rawPersonSchema);
1095
+ * const person = personSchema.parse(xml);
1096
+ *
1097
+ * // Or with explicit type
1098
+ * const personSchema = typedSchema<PersonType>(rawPersonSchema);
1099
+ * ```
1100
+ */
1101
+ function typedSchema(schema) {
1102
+ return {
1103
+ _type: null,
1104
+ schema,
1105
+ parse(xml) {
1106
+ return parse(schema, xml);
1107
+ },
1108
+ build(data, options) {
1109
+ return build(schema, data, options);
1110
+ }
1111
+ };
1112
+ }
1113
+
1114
+ //#endregion
1115
+ export { SchemaResolver, SchemaTraverser, build as buildXml, buildXsd, createSchemaLoader, defaultLoader, defineConfig, deriveRootTypeName, findComplexType, findElement, findSimpleType, findSubstitutes, generateInterfaces, generateSchemaFile, generateSchemaLiteral, getSubstitutes, isAbstractElement, linkSchema, linkSchemas, loadAndLinkSchema, loadSchema, parseXsd as parse, parseXsd, parseSchemaContent, parse as parseXml, resolveImports, resolveSchema, resolveSchemaTypes, runCodegen, stripNsPrefix, typedSchema, walkAttributes, walkComplexTypes, walkElements, walkSimpleTypes, walkTopLevelElements };
1116
+ //# sourceMappingURL=index.mjs.map