@kubb/adapter-oas 5.18.4 → 5.18.6

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
@@ -36,7 +36,7 @@ var compatibility = {
36
36
  "node": ">=22.22"
37
37
  };
38
38
  // package.json
39
- var version = "5.18.4";
39
+ var version = "5.18.6";
40
40
  // src/constants.ts
41
41
  /**
42
42
  * Default parser options applied when no explicit options are provided.
@@ -76,17 +76,6 @@ const SUPPORTED_METHODS = /* @__PURE__ */ new Set([
76
76
  "query"
77
77
  ]);
78
78
  /**
79
- * Media types OpenAPI 3.2 reads as a stream of items (its "sequential media types"), each described by `itemSchema`.
80
- */
81
- const STREAM_MEDIA_TYPES = /* @__PURE__ */ new Set([
82
- "application/jsonl",
83
- "application/x-ndjson",
84
- "application/json-seq",
85
- "application/geo+json-seq",
86
- "text/event-stream",
87
- "multipart/mixed"
88
- ]);
89
- /**
90
79
  * Set of JSON Schema keywords that prevent a schema fragment from being inlined during `allOf` flattening.
91
80
  *
92
81
  * A fragment that contains any of these keys carries structural meaning of its own and must stay as a separate
@@ -183,21 +172,21 @@ const enumDescriptionKeys = ["x-enumDescriptions", "x-enum-descriptions"];
183
172
  function buildDiscriminatorChildMap(schemas) {
184
173
  const childMap = /* @__PURE__ */ new Map();
185
174
  for (const schema of schemas) {
186
- const unionNode = _kubb_kit.ast.narrowSchema(schema, "union") ?? _kubb_kit.ast.narrowSchema(schema, "intersection")?.members?.map((member) => _kubb_kit.ast.narrowSchema(member, "union")).find((union) => union);
175
+ const unionNode = _kubb_kit.ast.schema.narrow(schema, "union") ?? _kubb_kit.ast.schema.narrow(schema, "intersection")?.members?.map((member) => _kubb_kit.ast.schema.narrow(member, "union")).find((union) => union);
187
176
  if (!unionNode?.discriminatorPropertyName || !unionNode.members) continue;
188
177
  const { discriminatorPropertyName, members } = unionNode;
189
178
  for (const member of members) {
190
- const intersectionNode = _kubb_kit.ast.narrowSchema(member, "intersection");
179
+ const intersectionNode = _kubb_kit.ast.schema.narrow(member, "intersection");
191
180
  if (!intersectionNode?.members) continue;
192
181
  let refNode = null;
193
182
  let objNode = null;
194
183
  for (const m of intersectionNode.members) {
195
- refNode ??= _kubb_kit.ast.narrowSchema(m, "ref");
196
- objNode ??= _kubb_kit.ast.narrowSchema(m, "object");
184
+ refNode ??= _kubb_kit.ast.schema.narrow(m, "ref");
185
+ objNode ??= _kubb_kit.ast.schema.narrow(m, "object");
197
186
  }
198
187
  if (!refNode?.name || !objNode) continue;
199
188
  const prop = objNode.properties.find((p) => p.name === discriminatorPropertyName);
200
- const enumNode = prop ? _kubb_kit.ast.narrowSchema(prop.schema, "enum") : null;
189
+ const enumNode = prop ? _kubb_kit.ast.schema.narrow(prop.schema, "enum") : null;
201
190
  if (!enumNode?.enumValues?.length) continue;
202
191
  const enumValues = enumNode.enumValues.filter((v) => v !== null);
203
192
  if (!enumValues.length) continue;
@@ -232,7 +221,7 @@ function patchDiscriminatorNode(node, entry) {
232
221
  required: true,
233
222
  schema: enumSchema
234
223
  });
235
- const objectNode = _kubb_kit.ast.narrowSchema(node, "object");
224
+ const objectNode = _kubb_kit.ast.schema.narrow(node, "object");
236
225
  if (objectNode) {
237
226
  const existingIdx = objectNode.properties.findIndex((p) => p.name === propertyName);
238
227
  const newProperties = existingIdx >= 0 ? objectNode.properties.map((p, i) => i === existingIdx ? newProp : p) : [...objectNode.properties, newProp];
@@ -241,14 +230,14 @@ function patchDiscriminatorNode(node, entry) {
241
230
  properties: newProperties
242
231
  };
243
232
  }
244
- const intersectionNode = _kubb_kit.ast.narrowSchema(node, "intersection");
233
+ const intersectionNode = _kubb_kit.ast.schema.narrow(node, "intersection");
245
234
  if (!intersectionNode?.members) return node;
246
235
  const discriminantNode = _kubb_kit.ast.factory.createSchema({
247
236
  type: "object",
248
237
  primitive: "object",
249
238
  properties: [newProp]
250
239
  });
251
- const patchedIdx = intersectionNode.members.findIndex((member) => _kubb_kit.ast.narrowSchema(member, "object")?.properties.some((p) => p.name === propertyName));
240
+ const patchedIdx = intersectionNode.members.findIndex((member) => _kubb_kit.ast.schema.narrow(member, "object")?.properties.some((p) => p.name === propertyName));
252
241
  const newMembers = patchedIdx >= 0 ? intersectionNode.members.map((member, i) => i === patchedIdx ? patchDiscriminatorNode(member, entry) : member) : [...intersectionNode.members, discriminantNode];
253
242
  return {
254
243
  ...intersectionNode,
@@ -1471,22 +1460,16 @@ function toInputTags(tags) {
1471
1460
  }
1472
1461
  // src/model/mediaType.ts
1473
1462
  /**
1474
- * The media type without its parameters, so `text/event-stream; charset=utf-8` matches the bare name.
1475
- */
1476
- function baseMediaType(contentType) {
1477
- return contentType.split(";")[0].trim().toLowerCase();
1478
- }
1479
- /**
1480
- * Returns `true` for a media type read as a stream of items: one that OpenAPI 3.2 lists, or any that declares `itemSchema`.
1463
+ * Returns `true` for a media type read as a stream of items: one `ast.mediaType.isStream` accepts, or any that declares `itemSchema`.
1481
1464
  */
1482
1465
  function isStream(contentType, mediaType) {
1483
- return STREAM_MEDIA_TYPES.has(baseMediaType(contentType)) || mediaType?.itemSchema !== void 0;
1466
+ return _kubb_kit.ast.mediaType.isStream(contentType) || mediaType?.itemSchema !== void 0;
1484
1467
  }
1485
1468
  /**
1486
1469
  * Whether the media type is `text/event-stream`, with or without parameters.
1487
1470
  */
1488
1471
  function isEventStream(contentType) {
1489
- return baseMediaType(contentType) === "text/event-stream";
1472
+ return _kubb_kit.ast.mediaType.getBase(contentType) === "text/event-stream";
1490
1473
  }
1491
1474
  /**
1492
1475
  * Replaces a `data` string that holds JSON with its `contentSchema`, so the event reads as parsed.
@@ -1563,8 +1546,29 @@ function toEventSchema(schema, refs) {
1563
1546
  [key]: members.map((member) => isReference(member) ? withParsedRef(member, refs) : withParsedData(merge ? mergeSchemas(shared, member) : member, refs))
1564
1547
  };
1565
1548
  }
1549
+ const SSE_FIELDS = /* @__PURE__ */ new Set([
1550
+ "event",
1551
+ "id",
1552
+ "retry",
1553
+ "data"
1554
+ ]);
1566
1555
  /**
1567
- * Whether the schema, following `$ref`s, or a composition member of it declares an `event` or `data` property.
1556
+ * Property names of the schema and its `allOf` members, following `$ref`s, as one combined object declares them.
1557
+ */
1558
+ function collectFields(schema, refs, seen) {
1559
+ if (isReference(schema)) {
1560
+ if (seen.has(schema.$ref)) return [];
1561
+ seen.add(schema.$ref);
1562
+ const resolved = refs.resolve(schema.$ref, { report: false });
1563
+ return resolved ? collectFields(resolved, refs, seen) : [];
1564
+ }
1565
+ const members = schema.allOf ?? [];
1566
+ return [...Object.keys(schema.properties ?? {}), ...members.flatMap((member) => collectFields(member, refs, seen))];
1567
+ }
1568
+ /**
1569
+ * Whether the schema, following `$ref`s, or a `oneOf`/`anyOf` member of it is a whole Server-Sent Event: its combined
1570
+ * `allOf` fields declare `data`, or `event` with no field an event cannot carry. An `event` next to fields such as
1571
+ * `planet` is the payload's own property, sent as JSON in the `data:` line.
1568
1572
  */
1569
1573
  function declaresEventFields(schema, refs, seen) {
1570
1574
  if (isReference(schema)) {
@@ -1573,15 +1577,13 @@ function declaresEventFields(schema, refs, seen) {
1573
1577
  const resolved = refs.resolve(schema.$ref, { report: false });
1574
1578
  return !!resolved && declaresEventFields(resolved, refs, seen);
1575
1579
  }
1576
- if (schema.properties && (Object.hasOwn(schema.properties, "event") || Object.hasOwn(schema.properties, "data"))) return true;
1577
- return [
1578
- ...schema.oneOf ?? [],
1579
- ...schema.anyOf ?? [],
1580
- ...schema.allOf ?? []
1581
- ].some((member) => declaresEventFields(member, refs, seen));
1580
+ const fields = collectFields(schema, refs, new Set(seen));
1581
+ if (fields.includes("data")) return true;
1582
+ if (fields.includes("event")) return fields.every((field) => SSE_FIELDS.has(field));
1583
+ return [...schema.oneOf ?? [], ...schema.anyOf ?? []].some((member) => declaresEventFields(member, refs, seen));
1582
1584
  }
1583
1585
  /**
1584
- * Returns `'event'` when the item declares `event` or `data`, directly or in a composition member, else `'data'`.
1586
+ * Returns `'event'` when the item is a whole event, directly or in a composition member (see `declaresEventFields`), else `'data'`.
1585
1587
  */
1586
1588
  function getItemShape(schema, refs) {
1587
1589
  return declaresEventFields(schema, refs, /* @__PURE__ */ new Set()) ? "event" : "data";
@@ -1757,10 +1759,10 @@ function memberValues(node, propertyName, seen = /* @__PURE__ */ new Set()) {
1757
1759
  seen.add(node);
1758
1760
  const target = node.type === "ref" && node.schema ? node.schema : node;
1759
1761
  if (target.type === "union") return [...new Set(target.members?.flatMap((member) => memberValues(member, propertyName, seen)))];
1760
- return intersect(_kubb_kit.ast.resolveSchemaProperties({
1762
+ return intersect(_kubb_kit.ast.schema.findProperties({
1761
1763
  node,
1762
1764
  propertyName
1763
- }).map((property) => [..._kubb_kit.ast.getSchemaLiteralValues(property.schema)]));
1765
+ }).map((property) => [..._kubb_kit.ast.schema.getLiterals(property.schema)]));
1764
1766
  }
1765
1767
  function intersect(slices) {
1766
1768
  const pinned = slices.filter((values) => values.length > 0);
@@ -2028,6 +2030,25 @@ function parseParameter({ param, pointer, parentName, options, parseSchema, refs
2028
2030
  ...param.allowEmptyValue && { allowEmptyValue: true }
2029
2031
  });
2030
2032
  }
2033
+ function spreadQuerystring(param) {
2034
+ if (param.in !== "querystring") return [param];
2035
+ const schema = _kubb_kit.ast.ref.getSchema(param.schema);
2036
+ const formEncoded = !param.contentType || _kubb_kit.ast.mediaType.getBase(param.contentType) === "application/x-www-form-urlencoded";
2037
+ if (schema.type !== "object" || !formEncoded) return [param];
2038
+ return schema.properties.map((property) => {
2039
+ const { style, explode, allowReserved } = param.encoding?.[property.name] ?? {};
2040
+ return _kubb_kit.ast.factory.createParameter({
2041
+ ...param.pointer ? { pointer: param.pointer } : {},
2042
+ name: property.name,
2043
+ in: "query",
2044
+ schema: property.schema,
2045
+ required: param.required && property.required,
2046
+ ...style !== void 0 && { style },
2047
+ ...explode !== void 0 && { explode },
2048
+ ...allowReserved !== void 0 && { allowReserved }
2049
+ });
2050
+ });
2051
+ }
2031
2052
  /**
2032
2053
  * Converts an OAS `Operation` into an `OperationNode`.
2033
2054
  */
@@ -2045,7 +2066,7 @@ function parseOperation({ operation, ...ctx }) {
2045
2066
  refs,
2046
2067
  ...entry,
2047
2068
  parentName: operationName
2048
- }));
2069
+ })).flatMap(spreadQuerystring);
2049
2070
  const body = getRequestBody({
2050
2071
  operation,
2051
2072
  refs
@@ -2065,7 +2086,7 @@ function parseOperation({ operation, ...ctx }) {
2065
2086
  contentType: ct,
2066
2087
  refs
2067
2088
  });
2068
- const node = _kubb_kit.ast.optionality(parseSchema({
2089
+ const node = _kubb_kit.ast.schema.applyOptionality(parseSchema({
2069
2090
  schema,
2070
2091
  name: requestBodyName
2071
2092
  }), bodyRequired);
@@ -2358,7 +2379,7 @@ function isObjectLike(member, refs) {
2358
2379
  */
2359
2380
  function narrowUnionMembers({ unionMembers, discriminator, sharedPropertiesNode, parentType, parse, name, refs }) {
2360
2381
  function pickDiscriminatorPropertyNode(node, propertyName) {
2361
- const discriminatorProperty = _kubb_kit.ast.narrowSchema(node, "object")?.properties?.find((property) => property.name === propertyName);
2382
+ const discriminatorProperty = _kubb_kit.ast.schema.narrow(node, "object")?.properties?.find((property) => property.name === propertyName);
2362
2383
  if (!discriminatorProperty) return null;
2363
2384
  return _kubb_kit.ast.factory.createSchema({
2364
2385
  type: "object",
@@ -2368,7 +2389,7 @@ function narrowUnionMembers({ unionMembers, discriminator, sharedPropertiesNode,
2368
2389
  }
2369
2390
  function implicitDiscriminantValue(member) {
2370
2391
  if (!discriminator || discriminator.mapping || !isReference(member)) return null;
2371
- const value = (0, _kubb_kit.extractRefName)(member.$ref);
2392
+ const value = _kubb_kit.ast.ref.getName(member.$ref);
2372
2393
  if (!value) return null;
2373
2394
  const variant = refs.resolve(member.$ref, { report: false });
2374
2395
  if (!variant) return null;
@@ -2416,7 +2437,7 @@ function narrowUnionMembers({ unionMembers, discriminator, sharedPropertiesNode,
2416
2437
  name
2417
2438
  });
2418
2439
  if (!discriminatorValues.length || !discriminator || !isObjectLike(s, refs)) return memberNode;
2419
- const narrowedDiscriminatorNode = sharedPropertiesNode ? pickDiscriminatorPropertyNode(_kubb_kit.ast.applyMacros(sharedPropertiesNode, [(0, _kubb_kit.macroDiscriminatorEnum)({
2440
+ const narrowedDiscriminatorNode = sharedPropertiesNode ? pickDiscriminatorPropertyNode(_kubb_kit.ast.macro.apply(sharedPropertiesNode, [(0, _kubb_kit.macroDiscriminatorEnum)({
2420
2441
  propertyName: discriminator.propertyName,
2421
2442
  values: discriminatorValues
2422
2443
  })], { depth: "shallow" }), discriminator.propertyName) : void 0;
@@ -2608,7 +2629,7 @@ function resolveUnionSchema(schema, siblingProperties) {
2608
2629
  *
2609
2630
  * The resolved schema is stored in `node.schema`. Usage-site sibling fields
2610
2631
  * (description, readOnly, nullable, etc.) are stored directly on the ref node.
2611
- * Use `syncSchemaRef(node)` in printers to get a merged view of both.
2632
+ * Use `ast.ref.mergeSchema(node)` in printers to get a merged view of both.
2612
2633
  * Circular refs are detected in `refs.resolveNode` and leave `schema` as `null`.
2613
2634
  */
2614
2635
  function convertRef({ schema, name, nullable, defaultValue, document, parse, refs, renames }) {
@@ -2620,7 +2641,7 @@ function convertRef({ schema, name, nullable, defaultValue, document, parse, ref
2620
2641
  nullable,
2621
2642
  defaultValue
2622
2643
  };
2623
- if (refPath && document.components && !refs.resolve(refPath, { report: false })) return createNode(ctx, { type: _kubb_kit.ast.schemaTypes.unknown });
2644
+ if (refPath && document.components && !refs.resolve(refPath, { report: false })) return createNode(ctx, { type: _kubb_kit.ast.schema.types.unknown });
2624
2645
  if (refPath && !refPath.startsWith("#/components/schemas/") && resolvedSchema) return _kubb_kit.ast.factory.createSchema({
2625
2646
  ...resolvedSchema,
2626
2647
  title: schema.title ?? resolvedSchema.title,
@@ -2634,8 +2655,8 @@ function convertRef({ schema, name, nullable, defaultValue, document, parse, ref
2634
2655
  });
2635
2656
  const targetName = renames?.get(schema.$ref);
2636
2657
  return createNode(ctx, {
2637
- type: _kubb_kit.ast.schemaTypes.ref,
2638
- name: (0, _kubb_kit.extractRefName)(schema.$ref),
2658
+ type: _kubb_kit.ast.schema.types.ref,
2659
+ name: _kubb_kit.ast.ref.getName(schema.$ref),
2639
2660
  ref: schema.$ref,
2640
2661
  ...targetName ? { targetName } : {},
2641
2662
  schema: resolvedSchema
@@ -2646,7 +2667,7 @@ function convertNot({ schema, name, nullable, defaultValue, parse }) {
2646
2667
  const { not, ...rest } = schema;
2647
2668
  const [subschema] = resolveUnionMembers([not], rest.properties ?? {});
2648
2669
  const notNode = _kubb_kit.ast.factory.createSchema({
2649
- type: _kubb_kit.ast.schemaTypes.not,
2670
+ type: _kubb_kit.ast.schema.types.not,
2650
2671
  members: [parse({ schema: subschema })]
2651
2672
  });
2652
2673
  return createNode({
@@ -2655,7 +2676,7 @@ function convertNot({ schema, name, nullable, defaultValue, parse }) {
2655
2676
  nullable,
2656
2677
  defaultValue
2657
2678
  }, {
2658
- type: _kubb_kit.ast.schemaTypes.intersection,
2679
+ type: _kubb_kit.ast.schema.types.intersection,
2659
2680
  members: [parse({
2660
2681
  schema: rest,
2661
2682
  name
@@ -2783,7 +2804,7 @@ function convertAllOf({ schema: original, name, nullable, defaultValue, parse, r
2783
2804
  nullable,
2784
2805
  defaultValue
2785
2806
  }, {
2786
- type: _kubb_kit.ast.schemaTypes.intersection,
2807
+ type: _kubb_kit.ast.schema.types.intersection,
2787
2808
  members: [...(0, _kubb_kit.mergeAdjacentObjectsLazy)(allOfMembers.slice(0, syntheticStart)), ...(0, _kubb_kit.mergeAdjacentObjectsLazy)(allOfMembers.slice(syntheticStart))]
2788
2809
  });
2789
2810
  }
@@ -2827,24 +2848,24 @@ function convertUnion(context) {
2827
2848
  refs
2828
2849
  });
2829
2850
  const unionNode = createNode(ctx, {
2830
- type: _kubb_kit.ast.schemaTypes.union,
2851
+ type: _kubb_kit.ast.schema.types.union,
2831
2852
  strategy,
2832
2853
  members,
2833
- discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_kit.ast.inferDiscriminatorPropertyName(members)
2854
+ discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_kit.ast.schema.inferDiscriminator(members)
2834
2855
  });
2835
2856
  const requiredProperties = missingRequired.map((name) => _kubb_kit.ast.factory.createProperty({
2836
2857
  name,
2837
2858
  required: true,
2838
- schema: _kubb_kit.ast.factory.createSchema({ type: _kubb_kit.ast.schemaTypes.unknown })
2859
+ schema: _kubb_kit.ast.factory.createSchema({ type: _kubb_kit.ast.schema.types.unknown })
2839
2860
  }));
2840
2861
  const siblings = sharedPropertiesNode ? [sharedPropertiesNode] : [];
2841
2862
  if (requiredProperties.length) siblings.push(_kubb_kit.ast.factory.createSchema({
2842
- type: _kubb_kit.ast.schemaTypes.object,
2863
+ type: _kubb_kit.ast.schema.types.object,
2843
2864
  properties: requiredProperties
2844
2865
  }));
2845
2866
  if (!siblings.length) return unionNode;
2846
2867
  return createNode(ctx, {
2847
- type: _kubb_kit.ast.schemaTypes.intersection,
2868
+ type: _kubb_kit.ast.schema.types.intersection,
2848
2869
  members: [unionNode, ...siblings]
2849
2870
  });
2850
2871
  }
@@ -2853,12 +2874,12 @@ function convertUnion(context) {
2853
2874
  name
2854
2875
  }));
2855
2876
  const unionNode = createNode(ctx, {
2856
- type: _kubb_kit.ast.schemaTypes.union,
2877
+ type: _kubb_kit.ast.schema.types.union,
2857
2878
  strategy,
2858
2879
  members,
2859
- discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_kit.ast.inferDiscriminatorPropertyName(members)
2880
+ discriminatorPropertyName: explicitDiscriminatorPropertyName ?? _kubb_kit.ast.schema.inferDiscriminator(members)
2860
2881
  });
2861
- return _kubb_kit.ast.applyMacros(unionNode, [_kubb_kit.macroDedupeUnion], { depth: "shallow" });
2882
+ return _kubb_kit.ast.macro.apply(unionNode, [_kubb_kit.macroDedupeUnion], { depth: "shallow" });
2862
2883
  }
2863
2884
  /**
2864
2885
  * Converts an OAS 3.1 multi-type array (e.g. `type: ['string', 'number']`) into a `UnionSchemaNode`.
@@ -2875,7 +2896,7 @@ function convertMultiType({ schema, name, nullable, defaultValue, parse }) {
2875
2896
  nullable: types.includes("null") || nullable || void 0,
2876
2897
  defaultValue
2877
2898
  }, {
2878
- type: _kubb_kit.ast.schemaTypes.union,
2899
+ type: _kubb_kit.ast.schema.types.union,
2879
2900
  members: nonNullTypes.map((t) => {
2880
2901
  return parse({
2881
2902
  schema: {
@@ -3154,10 +3175,10 @@ function resolveMapSchema(mapSchema, { options, parse }) {
3154
3175
  */
3155
3176
  function nameEnums(node, options) {
3156
3177
  const macro = (0, _kubb_kit.macroEnumName)(options);
3157
- const named = _kubb_kit.ast.applyMacros(node, [macro], { depth: "shallow" });
3158
- const tupleNode = _kubb_kit.ast.narrowSchema(named, "tuple");
3178
+ const named = _kubb_kit.ast.macro.apply(node, [macro], { depth: "shallow" });
3179
+ const tupleNode = _kubb_kit.ast.schema.narrow(named, "tuple");
3159
3180
  if (tupleNode?.items) {
3160
- const namedItems = tupleNode.items.map((item) => _kubb_kit.ast.applyMacros(item, [macro], { depth: "shallow" }));
3181
+ const namedItems = tupleNode.items.map((item) => _kubb_kit.ast.macro.apply(item, [macro], { depth: "shallow" }));
3161
3182
  if (namedItems.some((item, i) => item !== tupleNode.items[i])) return {
3162
3183
  ...tupleNode,
3163
3184
  items: namedItems
@@ -3240,7 +3261,7 @@ function convertObject({ schema, name, nullable, defaultValue, options, parse, r
3240
3261
  })
3241
3262
  });
3242
3263
  const enumName = name ? (0, _kubb_kit.enumPropName)(name, discPropName, options.enumSuffix) : void 0;
3243
- return _kubb_kit.ast.applyMacros(objectNode, [(0, _kubb_kit.macroDiscriminatorEnum)({
3264
+ return _kubb_kit.ast.macro.apply(objectNode, [(0, _kubb_kit.macroDiscriminatorEnum)({
3244
3265
  propertyName: discPropName,
3245
3266
  values,
3246
3267
  enumName
@@ -3484,9 +3505,9 @@ function createSchemaParser(ctx) {
3484
3505
  }
3485
3506
  const presenceKeys = /* @__PURE__ */ new WeakMap();
3486
3507
  function requireKeys(keys) {
3487
- const unknown = _kubb_kit.ast.factory.createSchema({ type: _kubb_kit.ast.schemaTypes.unknown });
3508
+ const unknown = _kubb_kit.ast.factory.createSchema({ type: _kubb_kit.ast.schema.types.unknown });
3488
3509
  const node = _kubb_kit.ast.factory.createSchema({
3489
- type: _kubb_kit.ast.schemaTypes.object,
3510
+ type: _kubb_kit.ast.schema.types.object,
3490
3511
  primitive: "object",
3491
3512
  properties: keys.map((name) => _kubb_kit.ast.factory.createProperty({
3492
3513
  name,
@@ -3566,8 +3587,8 @@ function createSchemaParser(ctx) {
3566
3587
  function collectInlineEnums(roots, topLevelNames) {
3567
3588
  const promoted = /* @__PURE__ */ new Map();
3568
3589
  for (const root of roots) {
3569
- const isSchemaRoot = root.kind === _kubb_kit.ast.nodeKinds.schema;
3570
- for (const node of _kubb_kit.ast.collect(root, { schema: (schemaNode) => schemaNode })) {
3590
+ const isSchemaRoot = root.kind === _kubb_kit.ast.node.kinds.schema;
3591
+ for (const node of _kubb_kit.ast.node.collect(root, { schema: (schemaNode) => schemaNode })) {
3571
3592
  if (node.type !== "enum" || !node.name) continue;
3572
3593
  if (isSchemaRoot && node === root) continue;
3573
3594
  if (topLevelNames.has(node.name)) continue;
@@ -3586,7 +3607,7 @@ function collectInlineEnums(roots, topLevelNames) {
3586
3607
  */
3587
3608
  function refPromotedEnums(node, promoted) {
3588
3609
  if (promoted.size === 0) return node;
3589
- return _kubb_kit.ast.transform(node, { schema(schemaNode) {
3610
+ return _kubb_kit.ast.node.transform(node, { schema(schemaNode) {
3590
3611
  if (schemaNode.type !== "enum" || !schemaNode.name || !promoted.has(schemaNode.name)) return void 0;
3591
3612
  return _kubb_kit.ast.factory.createSchema({
3592
3613
  type: "ref",
@@ -3848,7 +3869,7 @@ const adapterOas = (0, _kubb_core.defineExtension)({
3848
3869
  const promotedEnums = enums === "root" ? collectInlineEnums([...parsedByName.values(), ...operationNodes], new Set(Object.keys(schemas))) : null;
3849
3870
  const aliasTargetOf = (name) => {
3850
3871
  const node = refAliasMap.get(name);
3851
- return node?.ref ? _kubb_kit.ast.refName(node.ref) : node?.name;
3872
+ return node?.ref ? _kubb_kit.ast.ref.getName(node.ref) : node?.name;
3852
3873
  };
3853
3874
  function isAliasCycle(name) {
3854
3875
  const seen = /* @__PURE__ */ new Set([name]);