@kubb/oas 4.28.1 → 4.29.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/{chunk-BdfDOGov.js → chunk-Dxrv8gPv.js} +3 -3
- package/dist/index.cjs +43 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -39
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/Oas.ts +1 -1
- package/dist/index.d.cts +0 -135
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -13,7 +13,7 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
13
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
14
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
15
15
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
16
|
-
var __exportAll = (all,
|
|
16
|
+
var __exportAll = (all, no_symbols) => {
|
|
17
17
|
let target = {};
|
|
18
18
|
for (var name in all) {
|
|
19
19
|
__defProp(target, name, {
|
|
@@ -21,7 +21,7 @@ var __exportAll = (all, symbols) => {
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
24
|
+
if (!no_symbols) {
|
|
25
25
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
26
26
|
}
|
|
27
27
|
return target;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -11,7 +12,7 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
11
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
13
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
13
14
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
14
|
-
var __exportAll = (all,
|
|
15
|
+
var __exportAll = (all, no_symbols) => {
|
|
15
16
|
let target = {};
|
|
16
17
|
for (var name in all) {
|
|
17
18
|
__defProp(target, name, {
|
|
@@ -19,7 +20,7 @@ var __exportAll = (all, symbols) => {
|
|
|
19
20
|
enumerable: true
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
if (
|
|
23
|
+
if (!no_symbols) {
|
|
23
24
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
24
25
|
}
|
|
25
26
|
return target;
|
|
@@ -431,9 +432,9 @@ function __asyncValues(o) {
|
|
|
431
432
|
};
|
|
432
433
|
}
|
|
433
434
|
function settle(resolve, reject, d, v) {
|
|
434
|
-
Promise.resolve(v).then(function(v
|
|
435
|
+
Promise.resolve(v).then(function(v) {
|
|
435
436
|
resolve({
|
|
436
|
-
value: v
|
|
437
|
+
value: v,
|
|
437
438
|
done: d
|
|
438
439
|
});
|
|
439
440
|
}, reject);
|
|
@@ -526,24 +527,24 @@ function __disposeResources(env) {
|
|
|
526
527
|
}
|
|
527
528
|
return next();
|
|
528
529
|
}
|
|
529
|
-
function __rewriteRelativeImportExtension(path
|
|
530
|
-
if (typeof path
|
|
530
|
+
function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
531
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
531
532
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
532
533
|
});
|
|
533
|
-
return path
|
|
534
|
+
return path;
|
|
534
535
|
}
|
|
535
536
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
536
537
|
var init_tslib_es6 = __esmMin((() => {
|
|
537
538
|
extendStatics = function(d, b) {
|
|
538
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d
|
|
539
|
-
d
|
|
540
|
-
} || function(d
|
|
541
|
-
for (var p in b
|
|
539
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
|
|
540
|
+
d.__proto__ = b;
|
|
541
|
+
} || function(d, b) {
|
|
542
|
+
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
542
543
|
};
|
|
543
544
|
return extendStatics(d, b);
|
|
544
545
|
};
|
|
545
546
|
__assign = function() {
|
|
546
|
-
__assign = Object.assign || function __assign
|
|
547
|
+
__assign = Object.assign || function __assign(t) {
|
|
547
548
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
548
549
|
s = arguments[i];
|
|
549
550
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
@@ -575,9 +576,9 @@ var init_tslib_es6 = __esmMin((() => {
|
|
|
575
576
|
o["default"] = v;
|
|
576
577
|
};
|
|
577
578
|
ownKeys = function(o) {
|
|
578
|
-
ownKeys = Object.getOwnPropertyNames || function(o
|
|
579
|
+
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
579
580
|
var ar = [];
|
|
580
|
-
for (var k in o
|
|
581
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
581
582
|
return ar;
|
|
582
583
|
};
|
|
583
584
|
return ownKeys(o);
|
|
@@ -1227,7 +1228,7 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1227
1228
|
var require_float = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1228
1229
|
const common = require_common();
|
|
1229
1230
|
const type_1 = require_type();
|
|
1230
|
-
var YAML_FLOAT_PATTERN =
|
|
1231
|
+
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))$");
|
|
1231
1232
|
function resolveYamlFloat(data) {
|
|
1232
1233
|
if (null === data) return false;
|
|
1233
1234
|
if (!YAML_FLOAT_PATTERN.test(data)) return false;
|
|
@@ -1313,7 +1314,7 @@ var require_core = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1313
1314
|
//#region ../../node_modules/.pnpm/@stoplight+yaml-ast-parser@0.0.50/node_modules/@stoplight/yaml-ast-parser/dist/src/type/timestamp.js
|
|
1314
1315
|
var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1315
1316
|
const type_1 = require_type();
|
|
1316
|
-
var YAML_TIMESTAMP_REGEXP =
|
|
1317
|
+
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]))?))?)?$");
|
|
1317
1318
|
function resolveYamlTimestamp(data) {
|
|
1318
1319
|
if (null === data) return false;
|
|
1319
1320
|
if (null === YAML_TIMESTAMP_REGEXP.exec(data)) return false;
|
|
@@ -1641,6 +1642,7 @@ var require_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1641
1642
|
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
1642
1643
|
}
|
|
1643
1644
|
try {
|
|
1645
|
+
new RegExp(regexp, modifiers);
|
|
1644
1646
|
return true;
|
|
1645
1647
|
} catch (error) {
|
|
1646
1648
|
return false;
|
|
@@ -2961,8 +2963,8 @@ var require_dumper = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2961
2963
|
var indent = state.indent * Math.max(1, level);
|
|
2962
2964
|
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2963
2965
|
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2964
|
-
function testAmbiguity(string
|
|
2965
|
-
return testImplicitResolving(state, string
|
|
2966
|
+
function testAmbiguity(string) {
|
|
2967
|
+
return testImplicitResolving(state, string);
|
|
2966
2968
|
}
|
|
2967
2969
|
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
2968
2970
|
case STYLE_PLAIN: return string;
|
|
@@ -3435,29 +3437,29 @@ var require_buildJsonPath = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3435
3437
|
const types_1 = require_types();
|
|
3436
3438
|
const utils_1 = require_utils();
|
|
3437
3439
|
function buildJsonPath(node) {
|
|
3438
|
-
const path
|
|
3440
|
+
const path = [];
|
|
3439
3441
|
let prevNode = node;
|
|
3440
3442
|
while (node) {
|
|
3441
3443
|
switch (node.kind) {
|
|
3442
3444
|
case types_1.Kind.SCALAR:
|
|
3443
|
-
path
|
|
3445
|
+
path.unshift(node.value);
|
|
3444
3446
|
break;
|
|
3445
3447
|
case types_1.Kind.MAPPING:
|
|
3446
|
-
if (prevNode !== node.key) if (path
|
|
3447
|
-
else path
|
|
3448
|
+
if (prevNode !== node.key) if (path.length > 0 && utils_1.isObject(node.value) && node.value.value === path[0]) path[0] = node.key.value;
|
|
3449
|
+
else path.unshift(node.key.value);
|
|
3448
3450
|
break;
|
|
3449
3451
|
case types_1.Kind.SEQ:
|
|
3450
3452
|
if (prevNode) {
|
|
3451
3453
|
const index = node.items.indexOf(prevNode);
|
|
3452
|
-
if (prevNode.kind === types_1.Kind.SCALAR) path
|
|
3453
|
-
else if (index !== -1) path
|
|
3454
|
+
if (prevNode.kind === types_1.Kind.SCALAR) path[0] = index;
|
|
3455
|
+
else if (index !== -1) path.unshift(index);
|
|
3454
3456
|
}
|
|
3455
3457
|
break;
|
|
3456
3458
|
}
|
|
3457
3459
|
prevNode = node;
|
|
3458
3460
|
node = node.parent;
|
|
3459
3461
|
}
|
|
3460
|
-
return path
|
|
3462
|
+
return path;
|
|
3461
3463
|
}
|
|
3462
3464
|
exports.buildJsonPath = buildJsonPath;
|
|
3463
3465
|
}));
|
|
@@ -3502,9 +3504,9 @@ var require_getJsonPathForPosition = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
3502
3504
|
const startOffset = line === 0 ? 0 : lineMap[line - 1] + 1;
|
|
3503
3505
|
const node = findClosestScalar(ast, Math.min(lineMap[line] - 1, startOffset + character), line, lineMap);
|
|
3504
3506
|
if (!utils_1.isObject(node)) return;
|
|
3505
|
-
const path
|
|
3506
|
-
if (path
|
|
3507
|
-
return path
|
|
3507
|
+
const path = buildJsonPath_1.buildJsonPath(node);
|
|
3508
|
+
if (path.length === 0) return;
|
|
3509
|
+
return path;
|
|
3508
3510
|
};
|
|
3509
3511
|
function* walk(node) {
|
|
3510
3512
|
switch (node.kind) {
|
|
@@ -3583,8 +3585,8 @@ var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
3583
3585
|
const lineForPosition_1 = require_lineForPosition();
|
|
3584
3586
|
const types_1 = require_types();
|
|
3585
3587
|
const utils_1 = require_utils();
|
|
3586
|
-
exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path
|
|
3587
|
-
const node = findNodeAtPath(ast, path
|
|
3588
|
+
exports.getLocationForJsonPath = ({ ast, lineMap, metadata }, path, closest = false) => {
|
|
3589
|
+
const node = findNodeAtPath(ast, path, {
|
|
3588
3590
|
closest,
|
|
3589
3591
|
mergeKeys: metadata !== void 0 && metadata.mergeKeys === true
|
|
3590
3592
|
});
|
|
@@ -3623,8 +3625,8 @@ var require_getLocationForJsonPath = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
3623
3625
|
}
|
|
3624
3626
|
return node.endPosition;
|
|
3625
3627
|
}
|
|
3626
|
-
function findNodeAtPath(node, path
|
|
3627
|
-
pathLoop: for (const segment of path
|
|
3628
|
+
function findNodeAtPath(node, path, { closest, mergeKeys }) {
|
|
3629
|
+
pathLoop: for (const segment of path) {
|
|
3628
3630
|
if (!utils_1.isObject(node)) return closest ? node : void 0;
|
|
3629
3631
|
switch (node.kind) {
|
|
3630
3632
|
case types_1.Kind.MAP:
|
|
@@ -4706,16 +4708,16 @@ var Oas = class extends oas.default {
|
|
|
4706
4708
|
* 3. Property with single enum value
|
|
4707
4709
|
* 4. Title as fallback
|
|
4708
4710
|
*/
|
|
4709
|
-
const getDiscriminatorValue = (schema
|
|
4710
|
-
if (!schema
|
|
4711
|
+
const getDiscriminatorValue = (schema) => {
|
|
4712
|
+
if (!schema) return null;
|
|
4711
4713
|
if (propertyName.startsWith("x-")) {
|
|
4712
|
-
const extensionValue = schema
|
|
4714
|
+
const extensionValue = schema[propertyName];
|
|
4713
4715
|
if (extensionValue && typeof extensionValue === "string") return extensionValue;
|
|
4714
4716
|
}
|
|
4715
|
-
const propertySchema = schema
|
|
4717
|
+
const propertySchema = schema.properties?.[propertyName];
|
|
4716
4718
|
if (propertySchema && "const" in propertySchema && propertySchema.const !== void 0) return String(propertySchema.const);
|
|
4717
4719
|
if (propertySchema && propertySchema.enum?.length === 1) return String(propertySchema.enum[0]);
|
|
4718
|
-
return schema
|
|
4720
|
+
return schema.title || null;
|
|
4719
4721
|
};
|
|
4720
4722
|
/**
|
|
4721
4723
|
* Process oneOf/anyOf items to build mapping.
|
|
@@ -4820,9 +4822,9 @@ var Oas = class extends oas.default {
|
|
|
4820
4822
|
}
|
|
4821
4823
|
getResponseSchema(operation, statusCode) {
|
|
4822
4824
|
if (operation.schema.responses) Object.keys(operation.schema.responses).forEach((key) => {
|
|
4823
|
-
const schema
|
|
4824
|
-
const $ref = isReference(schema
|
|
4825
|
-
if (schema
|
|
4825
|
+
const schema = operation.schema.responses[key];
|
|
4826
|
+
const $ref = isReference(schema) ? schema.$ref : void 0;
|
|
4827
|
+
if (schema && $ref) operation.schema.responses[key] = this.get($ref);
|
|
4826
4828
|
});
|
|
4827
4829
|
const getResponseBody = this.#getResponseBodyFactory(operation.getResponseByStatusCode(statusCode));
|
|
4828
4830
|
const { contentType } = this.#options;
|