@kubb/adapter-oas 5.0.0-beta.80 → 5.0.0-beta.82

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.cjs CHANGED
@@ -21,6 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
+ let _kubb_ast = require("@kubb/ast");
24
25
  let _kubb_core = require("@kubb/core");
25
26
  let node_path = require("node:path");
26
27
  node_path = __toESM(node_path, 1);
@@ -29,9 +30,6 @@ let _readme_openapi_parser = require("@readme/openapi-parser");
29
30
  let _scalar_openapi_upgrader = require("@scalar/openapi-upgrader");
30
31
  let yaml = require("yaml");
31
32
  let api_ref_bundler = require("api-ref-bundler");
32
- let _kubb_ast_macros = require("@kubb/ast/macros");
33
- let _kubb_ast_utils = require("@kubb/ast/utils");
34
- let _kubb_ast = require("@kubb/ast");
35
33
  //#region src/constants.ts
36
34
  /**
37
35
  * Default parser options applied when no explicit options are provided.
@@ -541,7 +539,7 @@ function dereferenceWithRef(document, schema) {
541
539
  * const parser = createSchemaParser(context, oasDialect) // explicit
542
540
  * ```
543
541
  */
544
- const oasDialect = _kubb_core.ast.defineDialect({
542
+ const oasDialect = _kubb_ast.ast.defineDialect({
545
543
  name: "oas",
546
544
  schema: {
547
545
  isNullable,
@@ -563,11 +561,11 @@ const oasDialect = _kubb_core.ast.defineDialect({
563
561
  function buildDiscriminatorChildMap(schemas) {
564
562
  const childMap = /* @__PURE__ */ new Map();
565
563
  for (const schema of schemas) {
566
- let unionNode = _kubb_core.ast.narrowSchema(schema, "union");
564
+ let unionNode = _kubb_ast.ast.narrowSchema(schema, "union");
567
565
  if (!unionNode) {
568
- const intersectionMembers = _kubb_core.ast.narrowSchema(schema, "intersection")?.members;
566
+ const intersectionMembers = _kubb_ast.ast.narrowSchema(schema, "intersection")?.members;
569
567
  if (intersectionMembers) for (const m of intersectionMembers) {
570
- const u = _kubb_core.ast.narrowSchema(m, "union");
568
+ const u = _kubb_ast.ast.narrowSchema(m, "union");
571
569
  if (u) {
572
570
  unionNode = u;
573
571
  break;
@@ -577,17 +575,17 @@ function buildDiscriminatorChildMap(schemas) {
577
575
  if (!unionNode?.discriminatorPropertyName || !unionNode.members) continue;
578
576
  const { discriminatorPropertyName, members } = unionNode;
579
577
  for (const member of members) {
580
- const intersectionNode = _kubb_core.ast.narrowSchema(member, "intersection");
578
+ const intersectionNode = _kubb_ast.ast.narrowSchema(member, "intersection");
581
579
  if (!intersectionNode?.members) continue;
582
580
  let refNode = null;
583
581
  let objNode = null;
584
582
  for (const m of intersectionNode.members) {
585
- refNode ??= _kubb_core.ast.narrowSchema(m, "ref");
586
- objNode ??= _kubb_core.ast.narrowSchema(m, "object");
583
+ refNode ??= _kubb_ast.ast.narrowSchema(m, "ref");
584
+ objNode ??= _kubb_ast.ast.narrowSchema(m, "object");
587
585
  }
588
586
  if (!refNode?.name || !objNode) continue;
589
587
  const prop = objNode.properties.find((p) => p.name === discriminatorPropertyName);
590
- const enumNode = prop ? _kubb_core.ast.narrowSchema(prop.schema, "enum") : null;
588
+ const enumNode = prop ? _kubb_ast.ast.narrowSchema(prop.schema, "enum") : null;
591
589
  if (!enumNode?.enumValues?.length) continue;
592
590
  const enumValues = enumNode.enumValues.filter((v) => v !== null);
593
591
  if (!enumValues.length) continue;
@@ -610,14 +608,14 @@ function buildDiscriminatorChildMap(schemas) {
610
608
  * without buffering all schemas.
611
609
  */
612
610
  function patchDiscriminatorNode(node, entry) {
613
- const objectNode = _kubb_core.ast.narrowSchema(node, "object");
611
+ const objectNode = _kubb_ast.ast.narrowSchema(node, "object");
614
612
  if (!objectNode) return node;
615
613
  const { propertyName, enumValues } = entry;
616
- const enumSchema = _kubb_core.ast.factory.createSchema({
614
+ const enumSchema = _kubb_ast.ast.factory.createSchema({
617
615
  type: "enum",
618
616
  enumValues
619
617
  });
620
- const newProp = _kubb_core.ast.factory.createProperty({
618
+ const newProp = _kubb_ast.ast.factory.createProperty({
621
619
  name: propertyName,
622
620
  required: true,
623
621
  schema: enumSchema
@@ -639,12 +637,12 @@ function patchDiscriminatorNode(node, entry) {
639
637
  * ```
640
638
  */
641
639
  function createDiscriminantNode({ propertyName, value }) {
642
- return _kubb_core.ast.factory.createSchema({
640
+ return _kubb_ast.ast.factory.createSchema({
643
641
  type: "object",
644
642
  primitive: "object",
645
- properties: [_kubb_core.ast.factory.createProperty({
643
+ properties: [_kubb_ast.ast.factory.createProperty({
646
644
  name: propertyName,
647
- schema: _kubb_core.ast.factory.createSchema({
645
+ schema: _kubb_ast.ast.factory.createSchema({
648
646
  type: "enum",
649
647
  primitive: "string",
650
648
  enumValues: [value]
@@ -1285,7 +1283,7 @@ function normalizeArrayEnum(schema) {
1285
1283
  * and the drf-spectacular `NullEnum` (`{ enum: [null] }`) branches, which render identically.
1286
1284
  */
1287
1285
  function createNullSchema(schema, name, nullable) {
1288
- return _kubb_core.ast.factory.createSchema({
1286
+ return _kubb_ast.ast.factory.createSchema({
1289
1287
  type: "null",
1290
1288
  primitive: "null",
1291
1289
  name,
@@ -1301,11 +1299,11 @@ function createNullSchema(schema, name, nullable) {
1301
1299
  * the parent and property name. Wraps `macroEnumName` at the property construction site.
1302
1300
  */
1303
1301
  function nameEnums(node, options) {
1304
- const macro = (0, _kubb_ast_macros.macroEnumName)(options);
1305
- const named = _kubb_core.ast.applyMacros(node, [macro], { depth: "shallow" });
1306
- const tupleNode = _kubb_core.ast.narrowSchema(named, "tuple");
1302
+ const macro = (0, _kubb_ast.macroEnumName)(options);
1303
+ const named = _kubb_ast.ast.applyMacros(node, [macro], { depth: "shallow" });
1304
+ const tupleNode = _kubb_ast.ast.narrowSchema(named, "tuple");
1307
1305
  if (tupleNode?.items) {
1308
- const namedItems = tupleNode.items.map((item) => _kubb_core.ast.applyMacros(item, [macro], { depth: "shallow" }));
1306
+ const namedItems = tupleNode.items.map((item) => _kubb_ast.ast.applyMacros(item, [macro], { depth: "shallow" }));
1309
1307
  if (namedItems.some((item, i) => item !== tupleNode.items[i])) return {
1310
1308
  ...tupleNode,
1311
1309
  items: namedItems
@@ -1381,14 +1379,14 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1381
1379
  }
1382
1380
  resolvedSchema = resolvedRefCache.get(refPath) ?? null;
1383
1381
  }
1384
- if (refPath && document.components && !refExists(refPath)) return _kubb_core.ast.factory.createSchema({
1382
+ if (refPath && document.components && !refExists(refPath)) return _kubb_ast.ast.factory.createSchema({
1385
1383
  ...buildSchemaNode(schema, name, nullable, defaultValue),
1386
1384
  type: "unknown"
1387
1385
  });
1388
- return _kubb_core.ast.factory.createSchema({
1386
+ return _kubb_ast.ast.factory.createSchema({
1389
1387
  ...buildSchemaNode(schema, name, nullable, defaultValue),
1390
1388
  type: "ref",
1391
- name: (0, _kubb_ast_utils.extractRefName)(schema.$ref),
1389
+ name: (0, _kubb_ast.extractRefName)(schema.$ref),
1392
1390
  ref: schema.$ref,
1393
1391
  schema: resolvedSchema
1394
1392
  });
@@ -1406,7 +1404,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1406
1404
  const { kind: _kind, ...memberNodeProps } = memberNode;
1407
1405
  const mergedNullable = nullable || memberNode.nullable || void 0;
1408
1406
  const mergedDefault = schema.default === null && mergedNullable ? void 0 : schema.default ?? memberNode.default;
1409
- return _kubb_core.ast.factory.createSchema({
1407
+ return _kubb_ast.ast.factory.createSchema({
1410
1408
  ...memberNodeProps,
1411
1409
  name,
1412
1410
  title: schema.title ?? memberNode.title,
@@ -1474,9 +1472,9 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1474
1472
  propertyName,
1475
1473
  value
1476
1474
  }));
1477
- return _kubb_core.ast.factory.createSchema({
1475
+ return _kubb_ast.ast.factory.createSchema({
1478
1476
  type: "intersection",
1479
- members: [...(0, _kubb_ast_utils.mergeAdjacentObjectsLazy)(allOfMembers.slice(0, syntheticStart)), ...(0, _kubb_ast_utils.mergeAdjacentObjectsLazy)(allOfMembers.slice(syntheticStart))],
1477
+ members: [...(0, _kubb_ast.mergeAdjacentObjectsLazy)(allOfMembers.slice(0, syntheticStart)), ...(0, _kubb_ast.mergeAdjacentObjectsLazy)(allOfMembers.slice(syntheticStart))],
1480
1478
  ...buildSchemaNode(schema, name, nullable, defaultValue)
1481
1479
  });
1482
1480
  }
@@ -1485,9 +1483,9 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1485
1483
  */
1486
1484
  function convertUnion({ schema, name, nullable, defaultValue, rawOptions }) {
1487
1485
  function pickDiscriminatorPropertyNode(node, propertyName) {
1488
- const discriminatorProperty = _kubb_core.ast.narrowSchema(node, "object")?.properties?.find((property) => property.name === propertyName);
1486
+ const discriminatorProperty = _kubb_ast.ast.narrowSchema(node, "object")?.properties?.find((property) => property.name === propertyName);
1489
1487
  if (!discriminatorProperty) return null;
1490
- return _kubb_core.ast.factory.createSchema({
1488
+ return _kubb_ast.ast.factory.createSchema({
1491
1489
  type: "object",
1492
1490
  primitive: "object",
1493
1491
  properties: [discriminatorProperty]
@@ -1499,7 +1497,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1499
1497
  }
1500
1498
  function implicitDiscriminantValue(member) {
1501
1499
  if (!discriminator || discriminator.mapping || !dialect.schema.isReference(member)) return null;
1502
- const value = (0, _kubb_ast_utils.extractRefName)(member.$ref);
1500
+ const value = (0, _kubb_ast.extractRefName)(member.$ref);
1503
1501
  if (!value) return null;
1504
1502
  const variant = resolveRefSilent(member.$ref);
1505
1503
  if (!variant) return null;
@@ -1543,11 +1541,11 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1543
1541
  name
1544
1542
  }, rawOptions);
1545
1543
  if (!discriminatorValue || !discriminator) return memberNode;
1546
- const narrowedDiscriminatorNode = sharedPropertiesNode ? pickDiscriminatorPropertyNode(_kubb_core.ast.applyMacros(sharedPropertiesNode, [(0, _kubb_ast_macros.macroDiscriminatorEnum)({
1544
+ const narrowedDiscriminatorNode = sharedPropertiesNode ? pickDiscriminatorPropertyNode(_kubb_ast.ast.applyMacros(sharedPropertiesNode, [(0, _kubb_ast.macroDiscriminatorEnum)({
1547
1545
  propertyName: discriminator.propertyName,
1548
1546
  values: [discriminatorValue]
1549
1547
  })], { depth: "shallow" }), discriminator.propertyName) : void 0;
1550
- return _kubb_core.ast.factory.createSchema({
1548
+ return _kubb_ast.ast.factory.createSchema({
1551
1549
  type: "intersection",
1552
1550
  members: [memberNode, narrowedDiscriminatorNode ?? createDiscriminantNode({
1553
1551
  propertyName: discriminator.propertyName,
@@ -1555,19 +1553,19 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1555
1553
  })]
1556
1554
  });
1557
1555
  });
1558
- const unionNode = _kubb_core.ast.factory.createSchema({
1556
+ const unionNode = _kubb_ast.ast.factory.createSchema({
1559
1557
  type: "union",
1560
1558
  ...unionBase,
1561
1559
  members
1562
1560
  });
1563
1561
  if (!sharedPropertiesNode) return unionNode;
1564
- return _kubb_core.ast.factory.createSchema({
1562
+ return _kubb_ast.ast.factory.createSchema({
1565
1563
  type: "intersection",
1566
1564
  ...buildSchemaNode(schema, name, nullable, defaultValue),
1567
1565
  members: [unionNode, sharedPropertiesNode]
1568
1566
  });
1569
1567
  }
1570
- const unionNode = _kubb_core.ast.factory.createSchema({
1568
+ const unionNode = _kubb_ast.ast.factory.createSchema({
1571
1569
  type: "union",
1572
1570
  ...unionBase,
1573
1571
  members: unionMembers.map((s) => parseSchema({
@@ -1575,7 +1573,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1575
1573
  name
1576
1574
  }, rawOptions))
1577
1575
  });
1578
- return _kubb_core.ast.applyMacros(unionNode, [_kubb_ast_macros.macroSimplifyUnion], { depth: "shallow" });
1576
+ return _kubb_ast.ast.applyMacros(unionNode, [_kubb_ast.macroSimplifyUnion], { depth: "shallow" });
1579
1577
  }
1580
1578
  /**
1581
1579
  * Converts an OAS 3.1 `const` schema into a null scalar or a single-value `EnumSchemaNode`.
@@ -1584,7 +1582,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1584
1582
  const constValue = schema.const;
1585
1583
  if (constValue === null) return createNullSchema(schema, name);
1586
1584
  const constPrimitive = getPrimitiveType(typeof constValue === "number" ? "number" : typeof constValue === "boolean" ? "boolean" : "string");
1587
- return _kubb_core.ast.factory.createSchema({
1585
+ return _kubb_ast.ast.factory.createSchema({
1588
1586
  type: "enum",
1589
1587
  primitive: constPrimitive,
1590
1588
  enumValues: [constValue],
@@ -1597,7 +1595,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1597
1595
  */
1598
1596
  function convertFormat({ schema, name, nullable, defaultValue, options }) {
1599
1597
  const base = buildSchemaNode(schema, name, nullable, defaultValue);
1600
- if (schema.format === "int64") return _kubb_core.ast.factory.createSchema({
1598
+ if (schema.format === "int64") return _kubb_ast.ast.factory.createSchema({
1601
1599
  type: options.integerType === "bigint" ? "bigint" : "integer",
1602
1600
  primitive: "integer",
1603
1601
  ...base,
@@ -1609,14 +1607,14 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1609
1607
  if (schema.format === "date-time" || schema.format === "date" || schema.format === "time") {
1610
1608
  const dateType = getDateType(options, schema.format);
1611
1609
  if (!dateType) return null;
1612
- if (dateType.type === "datetime") return _kubb_core.ast.factory.createSchema({
1610
+ if (dateType.type === "datetime") return _kubb_ast.ast.factory.createSchema({
1613
1611
  ...base,
1614
1612
  primitive: "string",
1615
1613
  type: "datetime",
1616
1614
  offset: dateType.offset,
1617
1615
  local: dateType.local
1618
1616
  });
1619
- return _kubb_core.ast.factory.createSchema({
1617
+ return _kubb_ast.ast.factory.createSchema({
1620
1618
  ...base,
1621
1619
  primitive: "string",
1622
1620
  type: dateType.type,
@@ -1626,36 +1624,36 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1626
1624
  const specialType = getSchemaType(schema.format);
1627
1625
  if (!specialType) return null;
1628
1626
  const specialPrimitive = specialType === "number" || specialType === "integer" || specialType === "bigint" ? specialType : "string";
1629
- if (specialType === "number" || specialType === "integer" || specialType === "bigint") return _kubb_core.ast.factory.createSchema({
1627
+ if (specialType === "number" || specialType === "integer" || specialType === "bigint") return _kubb_ast.ast.factory.createSchema({
1630
1628
  ...base,
1631
1629
  primitive: specialPrimitive,
1632
1630
  type: specialType
1633
1631
  });
1634
- if (specialType === "url") return _kubb_core.ast.factory.createSchema({
1632
+ if (specialType === "url") return _kubb_ast.ast.factory.createSchema({
1635
1633
  ...base,
1636
1634
  primitive: "string",
1637
1635
  type: "url",
1638
1636
  min: schema.minLength,
1639
1637
  max: schema.maxLength
1640
1638
  });
1641
- if (specialType === "ipv4") return _kubb_core.ast.factory.createSchema({
1639
+ if (specialType === "ipv4") return _kubb_ast.ast.factory.createSchema({
1642
1640
  ...base,
1643
1641
  primitive: "string",
1644
1642
  type: "ipv4"
1645
1643
  });
1646
- if (specialType === "ipv6") return _kubb_core.ast.factory.createSchema({
1644
+ if (specialType === "ipv6") return _kubb_ast.ast.factory.createSchema({
1647
1645
  ...base,
1648
1646
  primitive: "string",
1649
1647
  type: "ipv6"
1650
1648
  });
1651
- if (specialType === "uuid" || specialType === "email") return _kubb_core.ast.factory.createSchema({
1649
+ if (specialType === "uuid" || specialType === "email") return _kubb_ast.ast.factory.createSchema({
1652
1650
  ...base,
1653
1651
  primitive: "string",
1654
1652
  type: specialType,
1655
1653
  min: schema.minLength,
1656
1654
  max: schema.maxLength
1657
1655
  });
1658
- return _kubb_core.ast.factory.createSchema({
1656
+ return _kubb_ast.ast.factory.createSchema({
1659
1657
  ...base,
1660
1658
  primitive: specialPrimitive,
1661
1659
  type: specialType
@@ -1697,7 +1695,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1697
1695
  const rawEnumDescriptions = descriptionKey ? schema[descriptionKey] : void 0;
1698
1696
  const uniqueValues = [...new Set(filteredValues)];
1699
1697
  const seenNames = /* @__PURE__ */ new Set();
1700
- return _kubb_core.ast.factory.createSchema({
1698
+ return _kubb_ast.ast.factory.createSchema({
1701
1699
  ...enumBase,
1702
1700
  primitive: enumPrimitiveType,
1703
1701
  namedEnumValues: uniqueValues.map((value, index) => ({
@@ -1712,7 +1710,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1712
1710
  })
1713
1711
  });
1714
1712
  }
1715
- return _kubb_core.ast.factory.createSchema({
1713
+ return _kubb_ast.ast.factory.createSchema({
1716
1714
  ...enumBase,
1717
1715
  enumValues: [...new Set(filteredValues)]
1718
1716
  });
@@ -1727,13 +1725,13 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1727
1725
  const propNullable = dialect.schema.isNullable(resolvedPropSchema);
1728
1726
  const schemaNode = nameEnums(parseSchema({
1729
1727
  schema: resolvedPropSchema,
1730
- name: (0, _kubb_ast_utils.childName)(name, propName)
1728
+ name: (0, _kubb_ast.childName)(name, propName)
1731
1729
  }, rawOptions), {
1732
1730
  parentName: name,
1733
1731
  propName,
1734
1732
  enumSuffix: options.enumSuffix
1735
1733
  });
1736
- return _kubb_core.ast.factory.createProperty({
1734
+ return _kubb_ast.ast.factory.createProperty({
1737
1735
  name: propName,
1738
1736
  schema: {
1739
1737
  ...schemaNode,
@@ -1747,11 +1745,11 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1747
1745
  if (additionalProperties === true) return true;
1748
1746
  if (additionalProperties === false) return false;
1749
1747
  if (additionalProperties && Object.keys(additionalProperties).length > 0) return parseSchema({ schema: additionalProperties }, rawOptions);
1750
- if (additionalProperties) return _kubb_core.ast.factory.createSchema({ type: options.unknownType });
1748
+ if (additionalProperties) return _kubb_ast.ast.factory.createSchema({ type: options.unknownType });
1751
1749
  })();
1752
1750
  const rawPatternProperties = "patternProperties" in schema ? schema.patternProperties : void 0;
1753
- const patternProperties = rawPatternProperties ? Object.fromEntries(Object.entries(rawPatternProperties).map(([pattern, patternSchema]) => [pattern, patternSchema === true || typeof patternSchema === "object" && Object.keys(patternSchema).length === 0 ? _kubb_core.ast.factory.createSchema({ type: options.unknownType }) : parseSchema({ schema: patternSchema }, rawOptions)])) : void 0;
1754
- const objectNode = _kubb_core.ast.factory.createSchema({
1751
+ const patternProperties = rawPatternProperties ? Object.fromEntries(Object.entries(rawPatternProperties).map(([pattern, patternSchema]) => [pattern, patternSchema === true || typeof patternSchema === "object" && Object.keys(patternSchema).length === 0 ? _kubb_ast.ast.factory.createSchema({ type: options.unknownType }) : parseSchema({ schema: patternSchema }, rawOptions)])) : void 0;
1752
+ const objectNode = _kubb_ast.ast.factory.createSchema({
1755
1753
  type: "object",
1756
1754
  primitive: "object",
1757
1755
  properties,
@@ -1764,8 +1762,8 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1764
1762
  if (dialect.schema.isDiscriminator(schema) && schema.discriminator.mapping) {
1765
1763
  const discPropName = schema.discriminator.propertyName;
1766
1764
  const values = Object.keys(schema.discriminator.mapping);
1767
- const enumName = name ? (0, _kubb_ast_utils.enumPropName)(name, discPropName, options.enumSuffix) : void 0;
1768
- return _kubb_core.ast.applyMacros(objectNode, [(0, _kubb_ast_macros.macroDiscriminatorEnum)({
1765
+ const enumName = name ? (0, _kubb_ast.enumPropName)(name, discPropName, options.enumSuffix) : void 0;
1766
+ return _kubb_ast.ast.applyMacros(objectNode, [(0, _kubb_ast.macroDiscriminatorEnum)({
1769
1767
  propertyName: discPropName,
1770
1768
  values,
1771
1769
  enumName
@@ -1778,8 +1776,8 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1778
1776
  */
1779
1777
  function convertTuple({ schema, name, nullable, defaultValue, rawOptions }) {
1780
1778
  const tupleItems = (schema.prefixItems ?? []).map((item) => parseSchema({ schema: item }, rawOptions));
1781
- const rest = schema.items === false ? void 0 : !schema.items || schema.items === true ? _kubb_core.ast.factory.createSchema({ type: "any" }) : parseSchema({ schema: schema.items }, rawOptions);
1782
- return _kubb_core.ast.factory.createSchema({
1779
+ const rest = schema.items === false ? void 0 : !schema.items || schema.items === true ? _kubb_ast.ast.factory.createSchema({ type: "any" }) : parseSchema({ schema: schema.items }, rawOptions);
1780
+ return _kubb_ast.ast.factory.createSchema({
1783
1781
  type: "tuple",
1784
1782
  primitive: "array",
1785
1783
  items: tupleItems,
@@ -1794,12 +1792,12 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1794
1792
  */
1795
1793
  function convertArray({ schema, name, nullable, defaultValue, rawOptions, options }) {
1796
1794
  const rawItems = schema.items;
1797
- const itemName = rawItems?.enum?.length && name ? (0, _kubb_ast_utils.enumPropName)(null, name, options.enumSuffix) : name;
1795
+ const itemName = rawItems?.enum?.length && name ? (0, _kubb_ast.enumPropName)(null, name, options.enumSuffix) : name;
1798
1796
  const items = rawItems ? [parseSchema({
1799
1797
  schema: rawItems,
1800
1798
  name: itemName
1801
1799
  }, rawOptions)] : [];
1802
- return _kubb_core.ast.factory.createSchema({
1800
+ return _kubb_ast.ast.factory.createSchema({
1803
1801
  type: "array",
1804
1802
  primitive: "array",
1805
1803
  items,
@@ -1813,7 +1811,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1813
1811
  * Converts a `type: 'string'` schema into a `StringSchemaNode`.
1814
1812
  */
1815
1813
  function convertString({ schema, name, nullable, defaultValue }) {
1816
- return _kubb_core.ast.factory.createSchema({
1814
+ return _kubb_ast.ast.factory.createSchema({
1817
1815
  type: "string",
1818
1816
  primitive: "string",
1819
1817
  min: schema.minLength,
@@ -1826,7 +1824,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1826
1824
  * Converts a `type: 'number'` or `type: 'integer'` schema.
1827
1825
  */
1828
1826
  function convertNumeric({ schema, name, nullable, defaultValue }, type) {
1829
- return _kubb_core.ast.factory.createSchema({
1827
+ return _kubb_ast.ast.factory.createSchema({
1830
1828
  type,
1831
1829
  primitive: type,
1832
1830
  min: schema.minimum,
@@ -1841,7 +1839,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1841
1839
  * Converts a `type: 'boolean'` schema.
1842
1840
  */
1843
1841
  function convertBoolean({ schema, name, nullable, defaultValue }) {
1844
- return _kubb_core.ast.factory.createSchema({
1842
+ return _kubb_ast.ast.factory.createSchema({
1845
1843
  type: "boolean",
1846
1844
  primitive: "boolean",
1847
1845
  ...buildSchemaNode(schema, name, nullable, defaultValue)
@@ -1852,7 +1850,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1852
1850
  * into a `blob` node.
1853
1851
  */
1854
1852
  function convertBlob({ schema, name, nullable, defaultValue }) {
1855
- return _kubb_core.ast.factory.createSchema({
1853
+ return _kubb_ast.ast.factory.createSchema({
1856
1854
  type: "blob",
1857
1855
  primitive: "string",
1858
1856
  ...buildSchemaNode(schema, name, nullable, defaultValue)
@@ -1869,7 +1867,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1869
1867
  const nonNullTypes = types.filter((t) => t !== "null");
1870
1868
  if (nonNullTypes.length <= 1) return null;
1871
1869
  const arrayNullable = types.includes("null") || nullable || void 0;
1872
- return _kubb_core.ast.factory.createSchema({
1870
+ return _kubb_ast.ast.factory.createSchema({
1873
1871
  type: "union",
1874
1872
  members: nonNullTypes.map((t) => parseSchema({
1875
1873
  schema: {
@@ -1994,7 +1992,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
1994
1992
  if (node) return node;
1995
1993
  }
1996
1994
  const emptyType = options.emptySchemaType;
1997
- return _kubb_core.ast.factory.createSchema({
1995
+ return _kubb_ast.ast.factory.createSchema({
1998
1996
  type: emptyType,
1999
1997
  name,
2000
1998
  title: schema.title,
@@ -2012,10 +2010,10 @@ function createSchemaParser(ctx, dialect = oasDialect) {
2012
2010
  const schema = param["schema"] ? parseSchema({
2013
2011
  schema: param["schema"],
2014
2012
  name: schemaName
2015
- }, options) : _kubb_core.ast.factory.createSchema({ type: options.unknownType });
2013
+ }, options) : _kubb_ast.ast.factory.createSchema({ type: options.unknownType });
2016
2014
  const style = param["style"];
2017
2015
  const explode = param["explode"];
2018
- return _kubb_core.ast.factory.createParameter({
2016
+ return _kubb_ast.ast.factory.createParameter({
2019
2017
  name: paramName,
2020
2018
  in: param["in"],
2021
2019
  schema: {
@@ -2065,9 +2063,9 @@ function createSchemaParser(ctx, dialect = oasDialect) {
2065
2063
  const content = allContentTypes.flatMap((ct) => {
2066
2064
  const schema = getRequestSchema(document, operation, { contentType: ct });
2067
2065
  if (!schema) return [];
2068
- return [_kubb_core.ast.factory.createContent({
2066
+ return [_kubb_ast.ast.factory.createContent({
2069
2067
  contentType: ct,
2070
- schema: _kubb_core.ast.optionality(parseSchema({
2068
+ schema: _kubb_ast.ast.optionality(parseSchema({
2071
2069
  schema,
2072
2070
  name: requestBodyName
2073
2071
  }, options), requestBodyMeta.required),
@@ -2093,22 +2091,22 @@ function createSchemaParser(ctx, dialect = oasDialect) {
2093
2091
  schema: raw && Object.keys(raw).length > 0 ? parseSchema({
2094
2092
  schema: raw,
2095
2093
  name: responseName
2096
- }, options) : _kubb_core.ast.factory.createSchema({ type: options.emptySchemaType }),
2094
+ }, options) : _kubb_ast.ast.factory.createSchema({ type: options.emptySchemaType }),
2097
2095
  keysToOmit: collectPropertyKeysByFlag(raw, "writeOnly")
2098
2096
  };
2099
2097
  };
2100
- const content = (ctx.contentType ? [ctx.contentType] : getResponseBodyContentTypes(document, operation, statusCode)).map((contentType) => _kubb_core.ast.factory.createContent({
2098
+ const content = (ctx.contentType ? [ctx.contentType] : getResponseBodyContentTypes(document, operation, statusCode)).map((contentType) => _kubb_ast.ast.factory.createContent({
2101
2099
  contentType,
2102
2100
  ...parseEntrySchema(contentType)
2103
2101
  }));
2104
- if (content.length === 0) content.push(_kubb_core.ast.factory.createContent({
2102
+ if (content.length === 0) content.push(_kubb_ast.ast.factory.createContent({
2105
2103
  contentType: getRequestContentType({
2106
2104
  document,
2107
2105
  operation
2108
2106
  }) || "application/json",
2109
2107
  ...parseEntrySchema(ctx.contentType)
2110
2108
  }));
2111
- return _kubb_core.ast.factory.createResponse({
2109
+ return _kubb_ast.ast.factory.createResponse({
2112
2110
  statusCode,
2113
2111
  description,
2114
2112
  content
@@ -2122,7 +2120,7 @@ function createSchemaParser(ctx, dialect = oasDialect) {
2122
2120
  const fallback = pathItemDoc?.[key];
2123
2121
  return typeof fallback === "string" ? fallback : void 0;
2124
2122
  };
2125
- return _kubb_core.ast.factory.createOperation({
2123
+ return _kubb_ast.ast.factory.createOperation({
2126
2124
  operationId,
2127
2125
  protocol: "http",
2128
2126
  method: operation.method.toUpperCase(),
@@ -2153,7 +2151,7 @@ function collectInlineEnums(roots, topLevelNames) {
2153
2151
  const promoted = /* @__PURE__ */ new Map();
2154
2152
  for (const root of roots) {
2155
2153
  const isSchemaRoot = root.kind === "Schema";
2156
- for (const node of _kubb_core.ast.collect(root, { schema: (schemaNode) => schemaNode })) {
2154
+ for (const node of _kubb_ast.ast.collect(root, { schema: (schemaNode) => schemaNode })) {
2157
2155
  if (node.type !== "enum" || !node.name) continue;
2158
2156
  if (isSchemaRoot && node === root) continue;
2159
2157
  if (topLevelNames.has(node.name)) continue;
@@ -2172,9 +2170,9 @@ function collectInlineEnums(roots, topLevelNames) {
2172
2170
  */
2173
2171
  function refPromotedEnums(node, promoted) {
2174
2172
  if (promoted.size === 0) return node;
2175
- return _kubb_core.ast.transform(node, { schema(schemaNode) {
2173
+ return _kubb_ast.ast.transform(node, { schema(schemaNode) {
2176
2174
  if (schemaNode.type !== "enum" || !schemaNode.name || !promoted.has(schemaNode.name)) return void 0;
2177
- return _kubb_core.ast.factory.createSchema({
2175
+ return _kubb_ast.ast.factory.createSchema({
2178
2176
  type: "ref",
2179
2177
  name: schemaNode.name,
2180
2178
  ref: `${SCHEMA_REF_PREFIX}${schemaNode.name}`,
@@ -2304,10 +2302,10 @@ function preScan({ schemas, parseSchema, parseOperation, document, parserOptions
2304
2302
  name
2305
2303
  });
2306
2304
  if (node.type === "ref" && node.name && node.name !== name) refAliasMap.set(name, node);
2307
- if (_kubb_core.ast.narrowSchema(node, _kubb_core.ast.schemaTypes.enum) && node.name) enumNames.push(node.name);
2305
+ if (_kubb_ast.ast.narrowSchema(node, _kubb_ast.ast.schemaTypes.enum) && node.name) enumNames.push(node.name);
2308
2306
  if (discriminator === "propagate" && (schema.oneOf ?? schema.anyOf) && schema.discriminator?.propertyName) discriminatorParentNodes.push(node);
2309
2307
  }
2310
- const circularNames = [...(0, _kubb_ast_utils.findCircularSchemas)(allNodes)];
2308
+ const circularNames = [...(0, _kubb_ast.findCircularSchemas)(allNodes)];
2311
2309
  const discriminatorChildMap = discriminatorParentNodes.length > 0 ? buildDiscriminatorChildMap(discriminatorParentNodes) : null;
2312
2310
  let promotedEnums = null;
2313
2311
  if (enums === "root" && document && parseOperation) {
@@ -2379,7 +2377,7 @@ function createInputStream({ schemas, parseSchema, parseOperation, document, par
2379
2377
  }
2380
2378
  })();
2381
2379
  } };
2382
- return _kubb_core.ast.factory.createInput({
2380
+ return _kubb_ast.ast.factory.createInput({
2383
2381
  stream: true,
2384
2382
  schemas: schemasIterable,
2385
2383
  operations: operationsIterable,
@@ -2538,9 +2536,9 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
2538
2536
  return (0, _kubb_ast.collect)(node, { schema(schemaNode) {
2539
2537
  const schemaRef = (0, _kubb_ast.narrowSchema)(schemaNode, "ref");
2540
2538
  if (!schemaRef?.ref) return null;
2541
- const result = resolve(nameMapping.get(schemaRef.ref) ?? (0, _kubb_ast_utils.extractRefName)(schemaRef.ref));
2539
+ const result = resolve(nameMapping.get(schemaRef.ref) ?? (0, _kubb_ast.extractRefName)(schemaRef.ref));
2542
2540
  if (!result) return null;
2543
- return _kubb_core.ast.factory.createImport({
2541
+ return _kubb_ast.ast.factory.createImport({
2544
2542
  name: [result.name],
2545
2543
  path: result.path
2546
2544
  });
@@ -2549,7 +2547,7 @@ const adapterOas = (0, _kubb_core.createAdapter)((options) => {
2549
2547
  async parse(source) {
2550
2548
  const streamNode = await createStream(source);
2551
2549
  const [schemas, operations] = await Promise.all([Array.fromAsync(streamNode.schemas), Array.fromAsync(streamNode.operations)]);
2552
- return _kubb_core.ast.factory.createInput({
2550
+ return _kubb_ast.ast.factory.createInput({
2553
2551
  schemas,
2554
2552
  operations,
2555
2553
  meta: streamNode.meta