@kubb/oas 4.28.1 → 4.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as __name } from "./chunk-BdfDOGov.js";
1
+ import { i as __name } from "./chunk-Dxrv8gPv.js";
2
2
  import BaseOas from "oas";
3
3
  import * as _readme_openapi_parser0 from "@readme/openapi-parser";
4
4
  import * as OasTypes from "oas/types";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as __require, i as __name, n as __esmMin, o as __toCommonJS, r as __exportAll, s as __toESM, t as __commonJSMin } from "./chunk-BdfDOGov.js";
1
+ import { a as __require, i as __name, n as __esmMin, o as __toCommonJS, r as __exportAll, s as __toESM, t as __commonJSMin } from "./chunk-Dxrv8gPv.js";
2
2
  import jsonpointer from "jsonpointer";
3
3
  import BaseOas from "oas";
4
4
  import { matchesMimeType } from "oas/utils";
@@ -380,9 +380,9 @@ function __asyncValues(o) {
380
380
  };
381
381
  }
382
382
  function settle(resolve, reject, d, v) {
383
- Promise.resolve(v).then(function(v$1) {
383
+ Promise.resolve(v).then(function(v) {
384
384
  resolve({
385
- value: v$1,
385
+ value: v,
386
386
  done: d
387
387
  });
388
388
  }, reject);
@@ -475,24 +475,24 @@ function __disposeResources(env) {
475
475
  }
476
476
  return next();
477
477
  }
478
- function __rewriteRelativeImportExtension(path$1, preserveJsx) {
479
- if (typeof path$1 === "string" && /^\.\.?\//.test(path$1)) return path$1.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
478
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
479
+ if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
480
480
  return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
481
481
  });
482
- return path$1;
482
+ return path;
483
483
  }
484
484
  var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
485
485
  var init_tslib_es6 = __esmMin((() => {
486
486
  extendStatics = function(d, b) {
487
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d$1, b$1) {
488
- d$1.__proto__ = b$1;
489
- } || function(d$1, b$1) {
490
- for (var p in b$1) if (Object.prototype.hasOwnProperty.call(b$1, p)) d$1[p] = b$1[p];
487
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
488
+ d.__proto__ = b;
489
+ } || function(d, b) {
490
+ for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
491
491
  };
492
492
  return extendStatics(d, b);
493
493
  };
494
494
  __assign = function() {
495
- __assign = Object.assign || function __assign$1(t) {
495
+ __assign = Object.assign || function __assign(t) {
496
496
  for (var s, i = 1, n = arguments.length; i < n; i++) {
497
497
  s = arguments[i];
498
498
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
@@ -524,9 +524,9 @@ var init_tslib_es6 = __esmMin((() => {
524
524
  o["default"] = v;
525
525
  };
526
526
  ownKeys = function(o) {
527
- ownKeys = Object.getOwnPropertyNames || function(o$1) {
527
+ ownKeys = Object.getOwnPropertyNames || function(o) {
528
528
  var ar = [];
529
- for (var k in o$1) if (Object.prototype.hasOwnProperty.call(o$1, k)) ar[ar.length] = k;
529
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
530
530
  return ar;
531
531
  };
532
532
  return ownKeys(o);
@@ -1176,7 +1176,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1176
1176
  var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1177
1177
  const common = require_common();
1178
1178
  const type_1 = require_type();
1179
- var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
1179
+ var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
1180
1180
  function resolveYamlFloat(data) {
1181
1181
  if (null === data) return false;
1182
1182
  if (!YAML_FLOAT_PATTERN.test(data)) return false;
@@ -1262,7 +1262,7 @@ var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1262
1262
  //#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/timestamp.js
1263
1263
  var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1264
1264
  const type_1 = require_type();
1265
- var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");
1265
+ var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");
1266
1266
  function resolveYamlTimestamp(data) {
1267
1267
  if (null === data) return false;
1268
1268
  if (null === YAML_TIMESTAMP_REGEXP.exec(data)) return false;
@@ -1590,6 +1590,7 @@ var require_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1590
1590
  regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
1591
1591
  }
1592
1592
  try {
1593
+ new RegExp(regexp, modifiers);
1593
1594
  return true;
1594
1595
  } catch (error) {
1595
1596
  return false;
@@ -2910,8 +2911,8 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports) => {
2910
2911
  var indent = state.indent * Math.max(1, level);
2911
2912
  var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
2912
2913
  var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
2913
- function testAmbiguity(string$1) {
2914
- return testImplicitResolving(state, string$1);
2914
+ function testAmbiguity(string) {
2915
+ return testImplicitResolving(state, string);
2915
2916
  }
2916
2917
  switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
2917
2918
  case STYLE_PLAIN: return string;
@@ -3384,29 +3385,29 @@ var require_buildJsonPath = /* @__PURE__ */ __commonJSMin(((exports) => {
3384
3385
  const types_1 = require_types();
3385
3386
  const utils_1 = require_utils();
3386
3387
  function buildJsonPath(node) {
3387
- const path$1 = [];
3388
+ const path = [];
3388
3389
  let prevNode = node;
3389
3390
  while (node) {
3390
3391
  switch (node.kind) {
3391
3392
  case types_1.Kind.SCALAR:
3392
- path$1.unshift(node.value);
3393
+ path.unshift(node.value);
3393
3394
  break;
3394
3395
  case types_1.Kind.MAPPING:
3395
- if (prevNode !== node.key) if (path$1.length > 0 && utils_1.isObject(node.value) && node.value.value === path$1[0]) path$1[0] = node.key.value;
3396
- else path$1.unshift(node.key.value);
3396
+ if (prevNode !== node.key) if (path.length > 0 && utils_1.isObject(node.value) && node.value.value === path[0]) path[0] = node.key.value;
3397
+ else path.unshift(node.key.value);
3397
3398
  break;
3398
3399
  case types_1.Kind.SEQ:
3399
3400
  if (prevNode) {
3400
3401
  const index = node.items.indexOf(prevNode);
3401
- if (prevNode.kind === types_1.Kind.SCALAR) path$1[0] = index;
3402
- else if (index !== -1) path$1.unshift(index);
3402
+ if (prevNode.kind === types_1.Kind.SCALAR) path[0] = index;
3403
+ else if (index !== -1) path.unshift(index);
3403
3404
  }
3404
3405
  break;
3405
3406
  }
3406
3407
  prevNode = node;
3407
3408
  node = node.parent;
3408
3409
  }
3409
- return path$1;
3410
+ return path;
3410
3411
  }
3411
3412
  exports.buildJsonPath = buildJsonPath;
3412
3413
  }));
@@ -3451,9 +3452,9 @@ var require_getJsonPathForPosition = /* @__PURE__ */ __commonJSMin(((exports) =>
3451
3452
  const startOffset = line === 0 ? 0 : lineMap[line - 1] + 1;
3452
3453
  const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
3453
3454
  if (!utils_1.isObject(node)) return;
3454
- const path$1 = buildJsonPath_1.buildJsonPath(node);
3455
- if (path$1.length === 0) return;
3456
- return path$1;
3455
+ const path = buildJsonPath_1.buildJsonPath(node);
3456
+ if (path.length === 0) return;
3457
+ return path;
3457
3458
  };
3458
3459
  function* walk(node) {
3459
3460
  switch (node.kind) {
@@ -3532,8 +3533,8 @@ var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports) =>
3532
3533
  const lineForPosition_1 = require_lineForPosition();
3533
3534
  const types_1 = require_types();
3534
3535
  const utils_1 = require_utils();
3535
- exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path$1, closest = false) => {
3536
- const node = findNodeAtPath(ast, path$1, {
3536
+ exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path, closest = false) => {
3537
+ const node = findNodeAtPath(ast, path, {
3537
3538
  closest,
3538
3539
  mergeKeys: metadata !== void 0 && metadata.mergeKeys === true
3539
3540
  });
@@ -3572,8 +3573,8 @@ var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports) =>
3572
3573
  }
3573
3574
  return node.endPosition;
3574
3575
  }
3575
- function findNodeAtPath(node, path$1, { closest, mergeKeys }) {
3576
- pathLoop: for (const segment of path$1) {
3576
+ function findNodeAtPath(node, path, { closest, mergeKeys }) {
3577
+ pathLoop: for (const segment of path) {
3577
3578
  if (!utils_1.isObject(node)) return closest ? node : void 0;
3578
3579
  switch (node.kind) {
3579
3580
  case types_1.Kind.MAP:
@@ -4655,16 +4656,16 @@ var Oas = class extends BaseOas {
4655
4656
  * 3. Property with single enum value
4656
4657
  * 4. Title as fallback
4657
4658
  */
4658
- const getDiscriminatorValue = (schema$1) => {
4659
- if (!schema$1) return null;
4659
+ const getDiscriminatorValue = (schema) => {
4660
+ if (!schema) return null;
4660
4661
  if (propertyName.startsWith("x-")) {
4661
- const extensionValue = schema$1[propertyName];
4662
+ const extensionValue = schema[propertyName];
4662
4663
  if (extensionValue && typeof extensionValue === "string") return extensionValue;
4663
4664
  }
4664
- const propertySchema = schema$1.properties?.[propertyName];
4665
+ const propertySchema = schema.properties?.[propertyName];
4665
4666
  if (propertySchema && "const" in propertySchema && propertySchema.const !== void 0) return String(propertySchema.const);
4666
4667
  if (propertySchema && propertySchema.enum?.length === 1) return String(propertySchema.enum[0]);
4667
- return schema$1.title || null;
4668
+ return schema.title || null;
4668
4669
  };
4669
4670
  /**
4670
4671
  * Process oneOf/anyOf items to build mapping.
@@ -4769,9 +4770,9 @@ var Oas = class extends BaseOas {
4769
4770
  }
4770
4771
  getResponseSchema(operation, statusCode) {
4771
4772
  if (operation.schema.responses) Object.keys(operation.schema.responses).forEach((key) => {
4772
- const schema$1 = operation.schema.responses[key];
4773
- const $ref = isReference(schema$1) ? schema$1.$ref : void 0;
4774
- if (schema$1 && $ref) operation.schema.responses[key] = this.get($ref);
4773
+ const schema = operation.schema.responses[key];
4774
+ const $ref = isReference(schema) ? schema.$ref : void 0;
4775
+ if (schema && $ref) operation.schema.responses[key] = this.get($ref);
4775
4776
  });
4776
4777
  const getResponseBody = this.#getResponseBodyFactory(operation.getResponseByStatusCode(statusCode));
4777
4778
  const { contentType } = this.#options;