@orval/core 7.4.1 → 7.6.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 +29 -8
- package/dist/index.js +449 -299
- package/dist/index.js.map +1 -1
- package/package.json +4 -8
package/dist/index.js
CHANGED
|
@@ -1745,7 +1745,7 @@ var require_lodash = __commonJS({
|
|
|
1745
1745
|
function baseAt(object, paths) {
|
|
1746
1746
|
var index3 = -1, length = paths.length, result2 = Array2(length), skip = object == null;
|
|
1747
1747
|
while (++index3 < length) {
|
|
1748
|
-
result2[index3] = skip ? undefined2 :
|
|
1748
|
+
result2[index3] = skip ? undefined2 : get(object, paths[index3]);
|
|
1749
1749
|
}
|
|
1750
1750
|
return result2;
|
|
1751
1751
|
}
|
|
@@ -2190,7 +2190,7 @@ var require_lodash = __commonJS({
|
|
|
2190
2190
|
return matchesStrictComparable(toKey(path2), srcValue);
|
|
2191
2191
|
}
|
|
2192
2192
|
return function(object) {
|
|
2193
|
-
var objValue =
|
|
2193
|
+
var objValue = get(object, path2);
|
|
2194
2194
|
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
2195
2195
|
};
|
|
2196
2196
|
}
|
|
@@ -4945,7 +4945,7 @@ var require_lodash = __commonJS({
|
|
|
4945
4945
|
function functionsIn(object) {
|
|
4946
4946
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
4947
4947
|
}
|
|
4948
|
-
function
|
|
4948
|
+
function get(object, path2, defaultValue) {
|
|
4949
4949
|
var result2 = object == null ? undefined2 : baseGet(object, path2);
|
|
4950
4950
|
return result2 === undefined2 ? defaultValue : result2;
|
|
4951
4951
|
}
|
|
@@ -5000,7 +5000,7 @@ var require_lodash = __commonJS({
|
|
|
5000
5000
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
5001
5001
|
baseMerge(object, source, srcIndex, customizer);
|
|
5002
5002
|
});
|
|
5003
|
-
var
|
|
5003
|
+
var omit = flatRest(function(object, paths) {
|
|
5004
5004
|
var result2 = {};
|
|
5005
5005
|
if (object == null) {
|
|
5006
5006
|
return result2;
|
|
@@ -5691,7 +5691,7 @@ var require_lodash = __commonJS({
|
|
|
5691
5691
|
lodash.mixin = mixin;
|
|
5692
5692
|
lodash.negate = negate;
|
|
5693
5693
|
lodash.nthArg = nthArg;
|
|
5694
|
-
lodash.omit =
|
|
5694
|
+
lodash.omit = omit;
|
|
5695
5695
|
lodash.omitBy = omitBy;
|
|
5696
5696
|
lodash.once = once;
|
|
5697
5697
|
lodash.orderBy = orderBy;
|
|
@@ -5803,7 +5803,7 @@ var require_lodash = __commonJS({
|
|
|
5803
5803
|
lodash.forInRight = forInRight;
|
|
5804
5804
|
lodash.forOwn = forOwn;
|
|
5805
5805
|
lodash.forOwnRight = forOwnRight;
|
|
5806
|
-
lodash.get =
|
|
5806
|
+
lodash.get = get;
|
|
5807
5807
|
lodash.gt = gt;
|
|
5808
5808
|
lodash.gte = gte;
|
|
5809
5809
|
lodash.has = has;
|
|
@@ -8193,7 +8193,7 @@ function je(e3) {
|
|
|
8193
8193
|
return e3.includes(".") ? `["${e3.replace(/"/g, '\\"')}"]` : e3;
|
|
8194
8194
|
}
|
|
8195
8195
|
function Ee(e3, t3) {
|
|
8196
|
-
if ("string" == typeof e3 && "string" == typeof t3) return (0,
|
|
8196
|
+
if ("string" == typeof e3 && "string" == typeof t3) return (0, import_lodash.trimStart)(e3, t3);
|
|
8197
8197
|
if (!(e3 && Array.isArray(e3) && e3.length && t3 && Array.isArray(t3) && t3.length)) return e3;
|
|
8198
8198
|
let r3 = 0;
|
|
8199
8199
|
for (const n3 in e3) if (e3.hasOwnProperty(n3)) {
|
|
@@ -8202,11 +8202,11 @@ function Ee(e3, t3) {
|
|
|
8202
8202
|
}
|
|
8203
8203
|
return e3.slice(r3);
|
|
8204
8204
|
}
|
|
8205
|
-
var
|
|
8205
|
+
var import_lodash, import_safe_stable_stringify, A, $, S, E, x2, _, N, P, I, R, U, K, J, C, D, M, V, Z, q, G, H, Q, X, Y, ee, te, re, oe, ie, ce, le, de, me, ve, be, we, Ae, $e, Se;
|
|
8206
8206
|
var init_index_es2 = __esm({
|
|
8207
8207
|
"../../node_modules/@stoplight/json/index.es.js"() {
|
|
8208
8208
|
"use strict";
|
|
8209
|
-
|
|
8209
|
+
import_lodash = __toESM(require_lodash());
|
|
8210
8210
|
init_index_es();
|
|
8211
8211
|
init_main();
|
|
8212
8212
|
init_src();
|
|
@@ -8277,12 +8277,12 @@ var init_index_es2 = __esm({
|
|
|
8277
8277
|
q = "#/__errors__";
|
|
8278
8278
|
G = ({ document: t3, path: r3, bundleRoot: n3 = "#/__bundled__", errorsRoot: o3 = "#/__errors__", cloneDocument: i3 = true, keyProvider: a3 }, s2) => {
|
|
8279
8279
|
if (r3 === n3 || r3 === o3) throw new Error("Roots do not make any sense");
|
|
8280
|
-
const c2 = i3 ? (0,
|
|
8280
|
+
const c2 = i3 ? (0, import_lodash.cloneDeep)(t3) : t3;
|
|
8281
8281
|
return H(c2, K(n3), K(o3), r3, a3)(r3, { [r3]: true }, s2);
|
|
8282
8282
|
};
|
|
8283
8283
|
H = (e3, a3, s2, c2, u2) => {
|
|
8284
8284
|
const l2 = /* @__PURE__ */ new Set(), f2 = (p2, h2, y, g2 = {}, d2 = {}, m2 = {}) => {
|
|
8285
|
-
const v2 = K(p2), b3 = (0,
|
|
8285
|
+
const v2 = K(p2), b3 = (0, import_lodash.get)(e3, v2);
|
|
8286
8286
|
D(y || b3, { onEnter: ({ value: s3 }) => {
|
|
8287
8287
|
if ($(s3) && S(s3.$ref)) {
|
|
8288
8288
|
const y2 = s3.$ref;
|
|
@@ -8293,7 +8293,7 @@ var init_index_es2 = __esm({
|
|
|
8293
8293
|
let r3;
|
|
8294
8294
|
v3 = K(y2), u2 && (r3 = u2({ document: e3, path: v3 })), r3 || (r3 = (({ document: e4, path: r4 }) => {
|
|
8295
8295
|
if (0 === r4.length) return "root";
|
|
8296
|
-
if (Array.isArray((0,
|
|
8296
|
+
if (Array.isArray((0, import_lodash.get)(e4, r4.slice(0, -1)))) return `${r4[r4.length - 2]}_${r4[r4.length - 1]}`;
|
|
8297
8297
|
return String(r4[r4.length - 1]);
|
|
8298
8298
|
})({ document: e3, path: v3 })), w3 = r3;
|
|
8299
8299
|
let n3 = 1;
|
|
@@ -8303,18 +8303,18 @@ var init_index_es2 = __esm({
|
|
|
8303
8303
|
m2[y2] = e4 instanceof Error ? e4.message : String(e4);
|
|
8304
8304
|
}
|
|
8305
8305
|
if (!v3 || !b4 || !O2) return;
|
|
8306
|
-
if ("object" == typeof e3 && null !== e3 && !(j2 = (0,
|
|
8306
|
+
if ("object" == typeof e3 && null !== e3 && !(j2 = (0, import_lodash.get)(e3, v3))) try {
|
|
8307
8307
|
j2 = B(Object(e3), y2);
|
|
8308
8308
|
} catch (e4) {
|
|
8309
8309
|
}
|
|
8310
|
-
void 0 !== j2 && (g2[y2] = O2, s3.$ref = O2, (0,
|
|
8311
|
-
const a4 = n3.map((e5) => `[${JSON.stringify(e5)}]`).join(""), s4 = JSON.parse(JSON.stringify((0,
|
|
8312
|
-
(0,
|
|
8310
|
+
void 0 !== j2 && (g2[y2] = O2, s3.$ref = O2, (0, import_lodash.has)(d2, b4) || (Array.isArray(j2) ? (0, import_lodash.set)(d2, b4, new Array(j2.length).fill(null)) : "object" == typeof j2 && (0, import_lodash.setWith)(d2, b4, {}, Object), (0, import_lodash.set)(d2, b4, j2), "#" === y2 ? function(e4, t3, n3, o3) {
|
|
8311
|
+
const a4 = n3.map((e5) => `[${JSON.stringify(e5)}]`).join(""), s4 = JSON.parse(JSON.stringify((0, import_lodash.omit)(Object(e4), a4))), c3 = {};
|
|
8312
|
+
(0, import_lodash.set)(t3, o3, s4), (0, import_lodash.set)(s4, n3, c3), F(s4, "#", P(o3)), c3.$ref = "#";
|
|
8313
8313
|
}(e3, d2, K(c2), b4) : h2[y2] || (h2[y2] = true, f2(p2, h2, j2, g2, d2, m2), h2[y2] = false)));
|
|
8314
8314
|
}
|
|
8315
8315
|
} });
|
|
8316
|
-
const w2 = (0,
|
|
8317
|
-
return w2 && Object.keys(w2).length && (0,
|
|
8316
|
+
const w2 = (0, import_lodash.get)(d2, a3);
|
|
8317
|
+
return w2 && Object.keys(w2).length && (0, import_lodash.set)(b3, a3, w2), (Object.keys(m2).length || (0, import_lodash.has)(e3, s2)) && (0, import_lodash.set)(b3, s2, (0, import_lodash.has)(e3, s2) ? (0, import_lodash.get)(e3, s2) : m2), b3;
|
|
8318
8318
|
};
|
|
8319
8319
|
return f2;
|
|
8320
8320
|
};
|
|
@@ -24054,7 +24054,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24054
24054
|
function has(thing, prop) {
|
|
24055
24055
|
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
24056
24056
|
}
|
|
24057
|
-
function
|
|
24057
|
+
function get(thing, prop) {
|
|
24058
24058
|
return getArchtype(thing) === 2 ? thing.get(prop) : thing[prop];
|
|
24059
24059
|
}
|
|
24060
24060
|
function set(thing, propOrOldValue, value) {
|
|
@@ -24309,7 +24309,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24309
24309
|
return proxy;
|
|
24310
24310
|
}
|
|
24311
24311
|
var objectTraps = {
|
|
24312
|
-
get: function
|
|
24312
|
+
get: function get2(state, prop) {
|
|
24313
24313
|
if (prop === DRAFT_STATE) return state;
|
|
24314
24314
|
var source = latest(state);
|
|
24315
24315
|
if (!has(source, prop)) {
|
|
@@ -24606,7 +24606,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24606
24606
|
copy = copyHelper(value, archType);
|
|
24607
24607
|
}
|
|
24608
24608
|
each(copy, function(key, childValue) {
|
|
24609
|
-
if (state &&
|
|
24609
|
+
if (state && get(state.base_, key) === childValue) return;
|
|
24610
24610
|
set(copy, key, currentImpl(childValue));
|
|
24611
24611
|
});
|
|
24612
24612
|
return archType === 3 ? new Set(copy) : copy;
|
|
@@ -24683,7 +24683,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24683
24683
|
descriptors[prop] = desc = {
|
|
24684
24684
|
configurable: true,
|
|
24685
24685
|
enumerable,
|
|
24686
|
-
get: function
|
|
24686
|
+
get: function get2() {
|
|
24687
24687
|
var state = this[DRAFT_STATE];
|
|
24688
24688
|
assertUnrevoked(state);
|
|
24689
24689
|
return objectTraps.get(state, prop);
|
|
@@ -24864,8 +24864,8 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24864
24864
|
function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
|
|
24865
24865
|
var base_ = state.base_, copy_ = state.copy_;
|
|
24866
24866
|
each(state.assigned_, function(key, assignedValue) {
|
|
24867
|
-
var origValue =
|
|
24868
|
-
var value =
|
|
24867
|
+
var origValue = get(base_, key);
|
|
24868
|
+
var value = get(copy_, key);
|
|
24869
24869
|
var op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;
|
|
24870
24870
|
if (origValue === value && op === REPLACE) return;
|
|
24871
24871
|
var path2 = basePath.concat(key);
|
|
@@ -24952,7 +24952,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
24952
24952
|
}
|
|
24953
24953
|
if ((parentType === 0 || parentType === 1) && (p2 === "__proto__" || p2 === "constructor")) die(24);
|
|
24954
24954
|
if (typeof base2 === "function" && p2 === "prototype") die(24);
|
|
24955
|
-
base2 =
|
|
24955
|
+
base2 = get(base2, p2);
|
|
24956
24956
|
if (typeof base2 !== "object") die(15, path2.join("/"));
|
|
24957
24957
|
}
|
|
24958
24958
|
var type = getArchtype(base2);
|
|
@@ -25063,7 +25063,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
25063
25063
|
}
|
|
25064
25064
|
var p2 = DraftMap2.prototype;
|
|
25065
25065
|
Object.defineProperty(p2, "size", {
|
|
25066
|
-
get: function
|
|
25066
|
+
get: function get2() {
|
|
25067
25067
|
return latest(this[DRAFT_STATE]).size;
|
|
25068
25068
|
}
|
|
25069
25069
|
// enumerable: false,
|
|
@@ -25202,7 +25202,7 @@ var require_immer_cjs_development = __commonJS({
|
|
|
25202
25202
|
}
|
|
25203
25203
|
var p2 = DraftSet2.prototype;
|
|
25204
25204
|
Object.defineProperty(p2, "size", {
|
|
25205
|
-
get: function
|
|
25205
|
+
get: function get2() {
|
|
25206
25206
|
return latest(this[DRAFT_STATE]).size;
|
|
25207
25207
|
}
|
|
25208
25208
|
// enumerable: true,
|
|
@@ -25358,6 +25358,15 @@ var require_dist4 = __commonJS({
|
|
|
25358
25358
|
}
|
|
25359
25359
|
});
|
|
25360
25360
|
|
|
25361
|
+
// ../../node_modules/lodash/isArray.js
|
|
25362
|
+
var require_isArray = __commonJS({
|
|
25363
|
+
"../../node_modules/lodash/isArray.js"(exports2, module2) {
|
|
25364
|
+
"use strict";
|
|
25365
|
+
var isArray = Array.isArray;
|
|
25366
|
+
module2.exports = isArray;
|
|
25367
|
+
}
|
|
25368
|
+
});
|
|
25369
|
+
|
|
25361
25370
|
// ../../node_modules/lodash/_freeGlobal.js
|
|
25362
25371
|
var require_freeGlobal = __commonJS({
|
|
25363
25372
|
"../../node_modules/lodash/_freeGlobal.js"(exports2, module2) {
|
|
@@ -25451,6 +25460,53 @@ var require_baseGetTag = __commonJS({
|
|
|
25451
25460
|
}
|
|
25452
25461
|
});
|
|
25453
25462
|
|
|
25463
|
+
// ../../node_modules/lodash/isObjectLike.js
|
|
25464
|
+
var require_isObjectLike = __commonJS({
|
|
25465
|
+
"../../node_modules/lodash/isObjectLike.js"(exports2, module2) {
|
|
25466
|
+
"use strict";
|
|
25467
|
+
function isObjectLike(value) {
|
|
25468
|
+
return value != null && typeof value == "object";
|
|
25469
|
+
}
|
|
25470
|
+
module2.exports = isObjectLike;
|
|
25471
|
+
}
|
|
25472
|
+
});
|
|
25473
|
+
|
|
25474
|
+
// ../../node_modules/lodash/isSymbol.js
|
|
25475
|
+
var require_isSymbol = __commonJS({
|
|
25476
|
+
"../../node_modules/lodash/isSymbol.js"(exports2, module2) {
|
|
25477
|
+
"use strict";
|
|
25478
|
+
var baseGetTag = require_baseGetTag();
|
|
25479
|
+
var isObjectLike = require_isObjectLike();
|
|
25480
|
+
var symbolTag = "[object Symbol]";
|
|
25481
|
+
function isSymbol(value) {
|
|
25482
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
25483
|
+
}
|
|
25484
|
+
module2.exports = isSymbol;
|
|
25485
|
+
}
|
|
25486
|
+
});
|
|
25487
|
+
|
|
25488
|
+
// ../../node_modules/lodash/_isKey.js
|
|
25489
|
+
var require_isKey = __commonJS({
|
|
25490
|
+
"../../node_modules/lodash/_isKey.js"(exports2, module2) {
|
|
25491
|
+
"use strict";
|
|
25492
|
+
var isArray = require_isArray();
|
|
25493
|
+
var isSymbol = require_isSymbol();
|
|
25494
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
25495
|
+
var reIsPlainProp = /^\w*$/;
|
|
25496
|
+
function isKey(value, object) {
|
|
25497
|
+
if (isArray(value)) {
|
|
25498
|
+
return false;
|
|
25499
|
+
}
|
|
25500
|
+
var type = typeof value;
|
|
25501
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
|
|
25502
|
+
return true;
|
|
25503
|
+
}
|
|
25504
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
25505
|
+
}
|
|
25506
|
+
module2.exports = isKey;
|
|
25507
|
+
}
|
|
25508
|
+
});
|
|
25509
|
+
|
|
25454
25510
|
// ../../node_modules/lodash/isObject.js
|
|
25455
25511
|
var require_isObject = __commonJS({
|
|
25456
25512
|
"../../node_modules/lodash/isObject.js"(exports2, module2) {
|
|
@@ -25586,129 +25642,6 @@ var require_getNative = __commonJS({
|
|
|
25586
25642
|
}
|
|
25587
25643
|
});
|
|
25588
25644
|
|
|
25589
|
-
// ../../node_modules/lodash/_defineProperty.js
|
|
25590
|
-
var require_defineProperty = __commonJS({
|
|
25591
|
-
"../../node_modules/lodash/_defineProperty.js"(exports2, module2) {
|
|
25592
|
-
"use strict";
|
|
25593
|
-
var getNative = require_getNative();
|
|
25594
|
-
var defineProperty = function() {
|
|
25595
|
-
try {
|
|
25596
|
-
var func = getNative(Object, "defineProperty");
|
|
25597
|
-
func({}, "", {});
|
|
25598
|
-
return func;
|
|
25599
|
-
} catch (e3) {
|
|
25600
|
-
}
|
|
25601
|
-
}();
|
|
25602
|
-
module2.exports = defineProperty;
|
|
25603
|
-
}
|
|
25604
|
-
});
|
|
25605
|
-
|
|
25606
|
-
// ../../node_modules/lodash/_baseAssignValue.js
|
|
25607
|
-
var require_baseAssignValue = __commonJS({
|
|
25608
|
-
"../../node_modules/lodash/_baseAssignValue.js"(exports2, module2) {
|
|
25609
|
-
"use strict";
|
|
25610
|
-
var defineProperty = require_defineProperty();
|
|
25611
|
-
function baseAssignValue(object, key, value) {
|
|
25612
|
-
if (key == "__proto__" && defineProperty) {
|
|
25613
|
-
defineProperty(object, key, {
|
|
25614
|
-
"configurable": true,
|
|
25615
|
-
"enumerable": true,
|
|
25616
|
-
"value": value,
|
|
25617
|
-
"writable": true
|
|
25618
|
-
});
|
|
25619
|
-
} else {
|
|
25620
|
-
object[key] = value;
|
|
25621
|
-
}
|
|
25622
|
-
}
|
|
25623
|
-
module2.exports = baseAssignValue;
|
|
25624
|
-
}
|
|
25625
|
-
});
|
|
25626
|
-
|
|
25627
|
-
// ../../node_modules/lodash/eq.js
|
|
25628
|
-
var require_eq = __commonJS({
|
|
25629
|
-
"../../node_modules/lodash/eq.js"(exports2, module2) {
|
|
25630
|
-
"use strict";
|
|
25631
|
-
function eq(value, other) {
|
|
25632
|
-
return value === other || value !== value && other !== other;
|
|
25633
|
-
}
|
|
25634
|
-
module2.exports = eq;
|
|
25635
|
-
}
|
|
25636
|
-
});
|
|
25637
|
-
|
|
25638
|
-
// ../../node_modules/lodash/_assignValue.js
|
|
25639
|
-
var require_assignValue = __commonJS({
|
|
25640
|
-
"../../node_modules/lodash/_assignValue.js"(exports2, module2) {
|
|
25641
|
-
"use strict";
|
|
25642
|
-
var baseAssignValue = require_baseAssignValue();
|
|
25643
|
-
var eq = require_eq();
|
|
25644
|
-
var objectProto = Object.prototype;
|
|
25645
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
25646
|
-
function assignValue(object, key, value) {
|
|
25647
|
-
var objValue = object[key];
|
|
25648
|
-
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
25649
|
-
baseAssignValue(object, key, value);
|
|
25650
|
-
}
|
|
25651
|
-
}
|
|
25652
|
-
module2.exports = assignValue;
|
|
25653
|
-
}
|
|
25654
|
-
});
|
|
25655
|
-
|
|
25656
|
-
// ../../node_modules/lodash/isArray.js
|
|
25657
|
-
var require_isArray = __commonJS({
|
|
25658
|
-
"../../node_modules/lodash/isArray.js"(exports2, module2) {
|
|
25659
|
-
"use strict";
|
|
25660
|
-
var isArray = Array.isArray;
|
|
25661
|
-
module2.exports = isArray;
|
|
25662
|
-
}
|
|
25663
|
-
});
|
|
25664
|
-
|
|
25665
|
-
// ../../node_modules/lodash/isObjectLike.js
|
|
25666
|
-
var require_isObjectLike = __commonJS({
|
|
25667
|
-
"../../node_modules/lodash/isObjectLike.js"(exports2, module2) {
|
|
25668
|
-
"use strict";
|
|
25669
|
-
function isObjectLike(value) {
|
|
25670
|
-
return value != null && typeof value == "object";
|
|
25671
|
-
}
|
|
25672
|
-
module2.exports = isObjectLike;
|
|
25673
|
-
}
|
|
25674
|
-
});
|
|
25675
|
-
|
|
25676
|
-
// ../../node_modules/lodash/isSymbol.js
|
|
25677
|
-
var require_isSymbol = __commonJS({
|
|
25678
|
-
"../../node_modules/lodash/isSymbol.js"(exports2, module2) {
|
|
25679
|
-
"use strict";
|
|
25680
|
-
var baseGetTag = require_baseGetTag();
|
|
25681
|
-
var isObjectLike = require_isObjectLike();
|
|
25682
|
-
var symbolTag = "[object Symbol]";
|
|
25683
|
-
function isSymbol(value) {
|
|
25684
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
25685
|
-
}
|
|
25686
|
-
module2.exports = isSymbol;
|
|
25687
|
-
}
|
|
25688
|
-
});
|
|
25689
|
-
|
|
25690
|
-
// ../../node_modules/lodash/_isKey.js
|
|
25691
|
-
var require_isKey = __commonJS({
|
|
25692
|
-
"../../node_modules/lodash/_isKey.js"(exports2, module2) {
|
|
25693
|
-
"use strict";
|
|
25694
|
-
var isArray = require_isArray();
|
|
25695
|
-
var isSymbol = require_isSymbol();
|
|
25696
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
25697
|
-
var reIsPlainProp = /^\w*$/;
|
|
25698
|
-
function isKey(value, object) {
|
|
25699
|
-
if (isArray(value)) {
|
|
25700
|
-
return false;
|
|
25701
|
-
}
|
|
25702
|
-
var type = typeof value;
|
|
25703
|
-
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
|
|
25704
|
-
return true;
|
|
25705
|
-
}
|
|
25706
|
-
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
25707
|
-
}
|
|
25708
|
-
module2.exports = isKey;
|
|
25709
|
-
}
|
|
25710
|
-
});
|
|
25711
|
-
|
|
25712
25645
|
// ../../node_modules/lodash/_nativeCreate.js
|
|
25713
25646
|
var require_nativeCreate = __commonJS({
|
|
25714
25647
|
"../../node_modules/lodash/_nativeCreate.js"(exports2, module2) {
|
|
@@ -25834,6 +25767,17 @@ var require_listCacheClear = __commonJS({
|
|
|
25834
25767
|
}
|
|
25835
25768
|
});
|
|
25836
25769
|
|
|
25770
|
+
// ../../node_modules/lodash/eq.js
|
|
25771
|
+
var require_eq = __commonJS({
|
|
25772
|
+
"../../node_modules/lodash/eq.js"(exports2, module2) {
|
|
25773
|
+
"use strict";
|
|
25774
|
+
function eq(value, other) {
|
|
25775
|
+
return value === other || value !== value && other !== other;
|
|
25776
|
+
}
|
|
25777
|
+
module2.exports = eq;
|
|
25778
|
+
}
|
|
25779
|
+
});
|
|
25780
|
+
|
|
25837
25781
|
// ../../node_modules/lodash/_assocIndexOf.js
|
|
25838
25782
|
var require_assocIndexOf = __commonJS({
|
|
25839
25783
|
"../../node_modules/lodash/_assocIndexOf.js"(exports2, module2) {
|
|
@@ -26222,21 +26166,6 @@ var require_castPath = __commonJS({
|
|
|
26222
26166
|
}
|
|
26223
26167
|
});
|
|
26224
26168
|
|
|
26225
|
-
// ../../node_modules/lodash/_isIndex.js
|
|
26226
|
-
var require_isIndex = __commonJS({
|
|
26227
|
-
"../../node_modules/lodash/_isIndex.js"(exports2, module2) {
|
|
26228
|
-
"use strict";
|
|
26229
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
26230
|
-
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
26231
|
-
function isIndex(value, length) {
|
|
26232
|
-
var type = typeof value;
|
|
26233
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
26234
|
-
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
26235
|
-
}
|
|
26236
|
-
module2.exports = isIndex;
|
|
26237
|
-
}
|
|
26238
|
-
});
|
|
26239
|
-
|
|
26240
26169
|
// ../../node_modules/lodash/_toKey.js
|
|
26241
26170
|
var require_toKey = __commonJS({
|
|
26242
26171
|
"../../node_modules/lodash/_toKey.js"(exports2, module2) {
|
|
@@ -26254,6 +26183,108 @@ var require_toKey = __commonJS({
|
|
|
26254
26183
|
}
|
|
26255
26184
|
});
|
|
26256
26185
|
|
|
26186
|
+
// ../../node_modules/lodash/_baseGet.js
|
|
26187
|
+
var require_baseGet = __commonJS({
|
|
26188
|
+
"../../node_modules/lodash/_baseGet.js"(exports2, module2) {
|
|
26189
|
+
"use strict";
|
|
26190
|
+
var castPath = require_castPath();
|
|
26191
|
+
var toKey = require_toKey();
|
|
26192
|
+
function baseGet(object, path2) {
|
|
26193
|
+
path2 = castPath(path2, object);
|
|
26194
|
+
var index3 = 0, length = path2.length;
|
|
26195
|
+
while (object != null && index3 < length) {
|
|
26196
|
+
object = object[toKey(path2[index3++])];
|
|
26197
|
+
}
|
|
26198
|
+
return index3 && index3 == length ? object : void 0;
|
|
26199
|
+
}
|
|
26200
|
+
module2.exports = baseGet;
|
|
26201
|
+
}
|
|
26202
|
+
});
|
|
26203
|
+
|
|
26204
|
+
// ../../node_modules/lodash/get.js
|
|
26205
|
+
var require_get = __commonJS({
|
|
26206
|
+
"../../node_modules/lodash/get.js"(exports2, module2) {
|
|
26207
|
+
"use strict";
|
|
26208
|
+
var baseGet = require_baseGet();
|
|
26209
|
+
function get(object, path2, defaultValue) {
|
|
26210
|
+
var result = object == null ? void 0 : baseGet(object, path2);
|
|
26211
|
+
return result === void 0 ? defaultValue : result;
|
|
26212
|
+
}
|
|
26213
|
+
module2.exports = get;
|
|
26214
|
+
}
|
|
26215
|
+
});
|
|
26216
|
+
|
|
26217
|
+
// ../../node_modules/lodash/_defineProperty.js
|
|
26218
|
+
var require_defineProperty = __commonJS({
|
|
26219
|
+
"../../node_modules/lodash/_defineProperty.js"(exports2, module2) {
|
|
26220
|
+
"use strict";
|
|
26221
|
+
var getNative = require_getNative();
|
|
26222
|
+
var defineProperty = function() {
|
|
26223
|
+
try {
|
|
26224
|
+
var func = getNative(Object, "defineProperty");
|
|
26225
|
+
func({}, "", {});
|
|
26226
|
+
return func;
|
|
26227
|
+
} catch (e3) {
|
|
26228
|
+
}
|
|
26229
|
+
}();
|
|
26230
|
+
module2.exports = defineProperty;
|
|
26231
|
+
}
|
|
26232
|
+
});
|
|
26233
|
+
|
|
26234
|
+
// ../../node_modules/lodash/_baseAssignValue.js
|
|
26235
|
+
var require_baseAssignValue = __commonJS({
|
|
26236
|
+
"../../node_modules/lodash/_baseAssignValue.js"(exports2, module2) {
|
|
26237
|
+
"use strict";
|
|
26238
|
+
var defineProperty = require_defineProperty();
|
|
26239
|
+
function baseAssignValue(object, key, value) {
|
|
26240
|
+
if (key == "__proto__" && defineProperty) {
|
|
26241
|
+
defineProperty(object, key, {
|
|
26242
|
+
"configurable": true,
|
|
26243
|
+
"enumerable": true,
|
|
26244
|
+
"value": value,
|
|
26245
|
+
"writable": true
|
|
26246
|
+
});
|
|
26247
|
+
} else {
|
|
26248
|
+
object[key] = value;
|
|
26249
|
+
}
|
|
26250
|
+
}
|
|
26251
|
+
module2.exports = baseAssignValue;
|
|
26252
|
+
}
|
|
26253
|
+
});
|
|
26254
|
+
|
|
26255
|
+
// ../../node_modules/lodash/_assignValue.js
|
|
26256
|
+
var require_assignValue = __commonJS({
|
|
26257
|
+
"../../node_modules/lodash/_assignValue.js"(exports2, module2) {
|
|
26258
|
+
"use strict";
|
|
26259
|
+
var baseAssignValue = require_baseAssignValue();
|
|
26260
|
+
var eq = require_eq();
|
|
26261
|
+
var objectProto = Object.prototype;
|
|
26262
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
26263
|
+
function assignValue(object, key, value) {
|
|
26264
|
+
var objValue = object[key];
|
|
26265
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
26266
|
+
baseAssignValue(object, key, value);
|
|
26267
|
+
}
|
|
26268
|
+
}
|
|
26269
|
+
module2.exports = assignValue;
|
|
26270
|
+
}
|
|
26271
|
+
});
|
|
26272
|
+
|
|
26273
|
+
// ../../node_modules/lodash/_isIndex.js
|
|
26274
|
+
var require_isIndex = __commonJS({
|
|
26275
|
+
"../../node_modules/lodash/_isIndex.js"(exports2, module2) {
|
|
26276
|
+
"use strict";
|
|
26277
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
26278
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
26279
|
+
function isIndex(value, length) {
|
|
26280
|
+
var type = typeof value;
|
|
26281
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
26282
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
26283
|
+
}
|
|
26284
|
+
module2.exports = isIndex;
|
|
26285
|
+
}
|
|
26286
|
+
});
|
|
26287
|
+
|
|
26257
26288
|
// ../../node_modules/lodash/_baseSet.js
|
|
26258
26289
|
var require_baseSet = __commonJS({
|
|
26259
26290
|
"../../node_modules/lodash/_baseSet.js"(exports2, module2) {
|
|
@@ -28800,7 +28831,7 @@ var require_crawler = __commonJS({
|
|
|
28800
28831
|
exports2.ResolveCrawler = void 0;
|
|
28801
28832
|
var json_1 = (init_index_es2(), __toCommonJS(index_es_exports2));
|
|
28802
28833
|
var dependency_graph_1 = require_dep_graph();
|
|
28803
|
-
var
|
|
28834
|
+
var get = require_get();
|
|
28804
28835
|
var Utils = require_utils3();
|
|
28805
28836
|
var ResolveCrawler = class {
|
|
28806
28837
|
constructor(runner, jsonPointer, _resolved) {
|
|
@@ -28918,7 +28949,7 @@ var require_crawler = __commonJS({
|
|
|
28918
28949
|
this.pointerGraph.addDependency(parentPointer, targetPointer);
|
|
28919
28950
|
if (this.jsonPointer && (pointerStack.length < 2 || !pointerStack.includes(targetPointer))) {
|
|
28920
28951
|
pointerStack.push(targetPointer);
|
|
28921
|
-
this.computeGraph(
|
|
28952
|
+
this.computeGraph(get(this._runner.source, targetPath), targetPath, targetPointer, pointerStack);
|
|
28922
28953
|
pointerStack.pop();
|
|
28923
28954
|
}
|
|
28924
28955
|
}
|
|
@@ -29053,7 +29084,7 @@ var require_runner = __commonJS({
|
|
|
29053
29084
|
var path_1 = (init_index_es(), __toCommonJS(index_es_exports));
|
|
29054
29085
|
var dependency_graph_1 = require_dep_graph();
|
|
29055
29086
|
var immer_1 = require_dist4();
|
|
29056
|
-
var
|
|
29087
|
+
var get = require_get();
|
|
29057
29088
|
var set = require_set2();
|
|
29058
29089
|
var URI = require_URI();
|
|
29059
29090
|
var uri_1 = require_uri();
|
|
@@ -29282,7 +29313,7 @@ var require_runner = __commonJS({
|
|
|
29282
29313
|
});
|
|
29283
29314
|
return resolved;
|
|
29284
29315
|
}
|
|
29285
|
-
resolved.result =
|
|
29316
|
+
resolved.result = get(resolved.result, targetPath);
|
|
29286
29317
|
}
|
|
29287
29318
|
if (resolved.result === void 0) {
|
|
29288
29319
|
resolved.errors.push({
|
|
@@ -29341,7 +29372,7 @@ var require_runner = __commonJS({
|
|
|
29341
29372
|
if (!dependants.length)
|
|
29342
29373
|
continue;
|
|
29343
29374
|
const pointerPath = (0, json_1.pointerToPath)(pointer);
|
|
29344
|
-
const val = pointerPath.length === 0 ? (0, immer_1.original)(draft) :
|
|
29375
|
+
const val = pointerPath.length === 0 ? (0, immer_1.original)(draft) : get(draft, pointerPath);
|
|
29345
29376
|
for (const dependant of dependants) {
|
|
29346
29377
|
let isCircular;
|
|
29347
29378
|
const dependantPath = (0, json_1.pointerToPath)(dependant);
|
|
@@ -29376,7 +29407,7 @@ var require_runner = __commonJS({
|
|
|
29376
29407
|
});
|
|
29377
29408
|
}
|
|
29378
29409
|
if (targetPath) {
|
|
29379
|
-
resolved.result =
|
|
29410
|
+
resolved.result = get(this._source, targetPath);
|
|
29380
29411
|
} else {
|
|
29381
29412
|
resolved.result = this._source;
|
|
29382
29413
|
}
|
|
@@ -37826,12 +37857,12 @@ var require_baseline = __commonJS({
|
|
|
37826
37857
|
});
|
|
37827
37858
|
|
|
37828
37859
|
// ../../node_modules/nimma/dist/legacy/cjs/runtime/codegen-functions/get.js
|
|
37829
|
-
var
|
|
37860
|
+
var require_get2 = __commonJS({
|
|
37830
37861
|
"../../node_modules/nimma/dist/legacy/cjs/runtime/codegen-functions/get.js"(exports2) {
|
|
37831
37862
|
"use strict";
|
|
37832
37863
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
37833
37864
|
var isObject4 = require_is_object();
|
|
37834
|
-
function
|
|
37865
|
+
function get(input, path2) {
|
|
37835
37866
|
if (path2.length === 0 || !isObject4["default"](input)) return input;
|
|
37836
37867
|
let value = input;
|
|
37837
37868
|
for (const segment of path2.slice(0, path2.length - 1)) {
|
|
@@ -37840,7 +37871,7 @@ var require_get = __commonJS({
|
|
|
37840
37871
|
}
|
|
37841
37872
|
return value[path2[path2.length - 1]];
|
|
37842
37873
|
}
|
|
37843
|
-
exports2["default"] =
|
|
37874
|
+
exports2["default"] = get;
|
|
37844
37875
|
}
|
|
37845
37876
|
});
|
|
37846
37877
|
|
|
@@ -38269,11 +38300,11 @@ var require_runtime = __commonJS({
|
|
|
38269
38300
|
"../../node_modules/nimma/dist/legacy/cjs/runtime/index.js"(exports2) {
|
|
38270
38301
|
"use strict";
|
|
38271
38302
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38272
|
-
var
|
|
38303
|
+
var get = require_get2();
|
|
38273
38304
|
var inBounds = require_in_bounds();
|
|
38274
38305
|
var isObject4 = require_is_object();
|
|
38275
38306
|
var scope = require_scope2();
|
|
38276
|
-
exports2.get =
|
|
38307
|
+
exports2.get = get["default"];
|
|
38277
38308
|
exports2.inBounds = inBounds["default"];
|
|
38278
38309
|
exports2.isObject = isObject4["default"];
|
|
38279
38310
|
exports2.Scope = scope["default"];
|
|
@@ -48088,6 +48119,7 @@ __export(src_exports, {
|
|
|
48088
48119
|
BODY_TYPE_NAME: () => BODY_TYPE_NAME,
|
|
48089
48120
|
GetterPropType: () => GetterPropType,
|
|
48090
48121
|
LogLevels: () => LogLevels,
|
|
48122
|
+
NamingConvention: () => NamingConvention,
|
|
48091
48123
|
OutputClient: () => OutputClient,
|
|
48092
48124
|
OutputHttpClient: () => OutputHttpClient,
|
|
48093
48125
|
OutputMockType: () => OutputMockType,
|
|
@@ -48105,6 +48137,7 @@ __export(src_exports, {
|
|
|
48105
48137
|
camel: () => camel,
|
|
48106
48138
|
combineSchemas: () => combineSchemas,
|
|
48107
48139
|
compareVersions: () => compareVersions,
|
|
48140
|
+
conventionName: () => conventionName,
|
|
48108
48141
|
count: () => count,
|
|
48109
48142
|
createDebugger: () => createDebugger,
|
|
48110
48143
|
createLogger: () => createLogger,
|
|
@@ -48218,6 +48251,12 @@ var PropertySortOrder = {
|
|
|
48218
48251
|
ALPHABETICAL: "Alphabetical",
|
|
48219
48252
|
SPECIFICATION: "Specification"
|
|
48220
48253
|
};
|
|
48254
|
+
var NamingConvention = {
|
|
48255
|
+
CAMEL_CASE: "camelCase",
|
|
48256
|
+
PASCAL_CASE: "PascalCase",
|
|
48257
|
+
SNAKE_CASE: "snake_case",
|
|
48258
|
+
KEBAB_CASE: "kebab-case"
|
|
48259
|
+
};
|
|
48221
48260
|
var OutputClient = {
|
|
48222
48261
|
ANGULAR: "angular",
|
|
48223
48262
|
AXIOS: "axios",
|
|
@@ -48297,7 +48336,7 @@ var URL_REGEX = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'
|
|
|
48297
48336
|
var TEMPLATE_TAG_REGEX = /\${(.+?)}/g;
|
|
48298
48337
|
|
|
48299
48338
|
// src/generators/component-definition.ts
|
|
48300
|
-
var
|
|
48339
|
+
var import_lodash4 = __toESM(require("lodash.isempty"));
|
|
48301
48340
|
|
|
48302
48341
|
// src/getters/enum.ts
|
|
48303
48342
|
var import_esutils2 = require("esutils");
|
|
@@ -48994,6 +49033,17 @@ var upper = (s2, fillWith, isDeapostrophe) => {
|
|
|
48994
49033
|
isDeapostrophe
|
|
48995
49034
|
);
|
|
48996
49035
|
};
|
|
49036
|
+
var conventionName = (name, convention) => {
|
|
49037
|
+
let nameConventionTransform = camel;
|
|
49038
|
+
if (convention === NamingConvention.PASCAL_CASE) {
|
|
49039
|
+
nameConventionTransform = pascal;
|
|
49040
|
+
} else if (convention === NamingConvention.SNAKE_CASE) {
|
|
49041
|
+
nameConventionTransform = snake;
|
|
49042
|
+
} else if (convention === NamingConvention.KEBAB_CASE) {
|
|
49043
|
+
nameConventionTransform = kebab;
|
|
49044
|
+
}
|
|
49045
|
+
return nameConventionTransform(name);
|
|
49046
|
+
};
|
|
48997
49047
|
|
|
48998
49048
|
// src/utils/compare-version.ts
|
|
48999
49049
|
var import_compare_versions = require("compare-versions");
|
|
@@ -49211,7 +49261,6 @@ var sortByPriority = (arr) => arr.sort((a3, b3) => {
|
|
|
49211
49261
|
|
|
49212
49262
|
// src/utils/string.ts
|
|
49213
49263
|
var import_esutils = require("esutils");
|
|
49214
|
-
var import_lodash = __toESM(require("lodash.get"));
|
|
49215
49264
|
var stringify = (data) => {
|
|
49216
49265
|
if (isUndefined(data) || isNull(data)) {
|
|
49217
49266
|
return;
|
|
@@ -49284,7 +49333,12 @@ var toObjectString = (props, path2) => {
|
|
|
49284
49333
|
if (!props.length) {
|
|
49285
49334
|
return "";
|
|
49286
49335
|
}
|
|
49287
|
-
const arrayOfString = path2 ? props.map(
|
|
49336
|
+
const arrayOfString = typeof path2 === "string" ? props.map(
|
|
49337
|
+
(prop) => path2.split(".").reduce(
|
|
49338
|
+
(obj, key) => obj && typeof obj === "object" ? obj[key] : void 0,
|
|
49339
|
+
prop
|
|
49340
|
+
)
|
|
49341
|
+
) : props;
|
|
49288
49342
|
return arrayOfString.join(",\n ") + ",";
|
|
49289
49343
|
};
|
|
49290
49344
|
var NUMBERS = {
|
|
@@ -49334,9 +49388,10 @@ var isSyntheticDefaultImportsAllow = (config) => {
|
|
|
49334
49388
|
// src/utils/validator.ts
|
|
49335
49389
|
var ibmOpenapiRuleset = require("@ibm-cloud/openapi-ruleset");
|
|
49336
49390
|
var { Spectral } = require_dist10();
|
|
49337
|
-
var ibmOpenapiValidator = async (specs) => {
|
|
49391
|
+
var ibmOpenapiValidator = async (specs, validation) => {
|
|
49392
|
+
const ruleset = typeof validation === "boolean" ? ibmOpenapiRuleset : validation;
|
|
49338
49393
|
const spectral = new Spectral();
|
|
49339
|
-
spectral.setRuleset(
|
|
49394
|
+
spectral.setRuleset(ruleset);
|
|
49340
49395
|
const results = await spectral.run(specs);
|
|
49341
49396
|
const errors2 = [];
|
|
49342
49397
|
const warnings = [];
|
|
@@ -49452,11 +49507,7 @@ var toNumberKey = (value) => {
|
|
|
49452
49507
|
return `NUMBER_${value}`;
|
|
49453
49508
|
};
|
|
49454
49509
|
|
|
49455
|
-
// src/resolvers/ref.ts
|
|
49456
|
-
var import_lodash4 = __toESM(require("lodash.get"));
|
|
49457
|
-
|
|
49458
49510
|
// src/getters/ref.ts
|
|
49459
|
-
var import_lodash3 = __toESM(require("lodash.get"));
|
|
49460
49511
|
var RefComponentSuffix = {
|
|
49461
49512
|
schemas: "",
|
|
49462
49513
|
responses: "Response",
|
|
@@ -49474,19 +49525,35 @@ var resolveUrl = (from, to) => {
|
|
|
49474
49525
|
};
|
|
49475
49526
|
var getRefInfo = ($ref, context) => {
|
|
49476
49527
|
const [pathname, ref] = $ref.split("#");
|
|
49477
|
-
const refPaths = ref?.slice(1).split("/").map((part) => part.replace(regex2, "/"));
|
|
49478
|
-
const
|
|
49528
|
+
const refPaths = ref?.slice(1).split("/").map((part) => decodeURIComponent(part.replace(regex2, "/")));
|
|
49529
|
+
const getOverrideSuffix = (override, paths) => {
|
|
49530
|
+
const firstLevel = override[paths[0]];
|
|
49531
|
+
if (!firstLevel) return "";
|
|
49532
|
+
const secondLevel = firstLevel[paths[1]];
|
|
49533
|
+
return secondLevel?.suffix ?? "";
|
|
49534
|
+
};
|
|
49535
|
+
const suffix = refPaths ? getOverrideSuffix(context.output.override, refPaths) : "";
|
|
49479
49536
|
const originalName = ref ? refPaths[refPaths.length - 1] : path_exports.getSchemaFileName(pathname);
|
|
49480
49537
|
if (!pathname) {
|
|
49481
49538
|
return {
|
|
49482
|
-
name: pascal(originalName) + suffix,
|
|
49539
|
+
name: sanitize(pascal(originalName) + suffix, {
|
|
49540
|
+
es5keyword: true,
|
|
49541
|
+
es5IdentifierName: true,
|
|
49542
|
+
underscore: true,
|
|
49543
|
+
dash: true
|
|
49544
|
+
}),
|
|
49483
49545
|
originalName,
|
|
49484
49546
|
refPaths
|
|
49485
49547
|
};
|
|
49486
49548
|
}
|
|
49487
49549
|
const path2 = isUrl(context.specKey) ? resolveUrl(context.specKey, pathname) : path_exports.resolve(getFileInfo(context.specKey).dirname, pathname);
|
|
49488
49550
|
return {
|
|
49489
|
-
name: pascal(originalName) + suffix,
|
|
49551
|
+
name: sanitize(pascal(originalName) + suffix, {
|
|
49552
|
+
es5keyword: true,
|
|
49553
|
+
es5IdentifierName: true,
|
|
49554
|
+
underscore: true,
|
|
49555
|
+
dash: true
|
|
49556
|
+
}),
|
|
49490
49557
|
originalName,
|
|
49491
49558
|
specKey: path2,
|
|
49492
49559
|
refPaths
|
|
@@ -49540,7 +49607,10 @@ var resolveRef = (schema, context, imports = []) => {
|
|
|
49540
49607
|
function getSchema(schema, context) {
|
|
49541
49608
|
const refInfo = getRefInfo(schema.$ref, context);
|
|
49542
49609
|
const { specKey, refPaths } = refInfo;
|
|
49543
|
-
let schemaByRefPaths = refPaths && (
|
|
49610
|
+
let schemaByRefPaths = refPaths && Array.isArray(refPaths) ? refPaths.reduce(
|
|
49611
|
+
(obj, key) => obj && key in obj ? obj[key] : void 0,
|
|
49612
|
+
context.specs[specKey || context.specKey]
|
|
49613
|
+
) : void 0;
|
|
49544
49614
|
if (!schemaByRefPaths) {
|
|
49545
49615
|
schemaByRefPaths = context.specs?.[specKey || context.specKey];
|
|
49546
49616
|
}
|
|
@@ -49644,15 +49714,24 @@ var resolveObjectOriginal = ({
|
|
|
49644
49714
|
});
|
|
49645
49715
|
const doc = jsDoc(resolvedValue.originalSchema ?? {});
|
|
49646
49716
|
if (propName && !resolvedValue.isEnum && resolvedValue?.type === "object" && new RegExp(/{|&|\|/).test(resolvedValue.value)) {
|
|
49717
|
+
let model = "";
|
|
49718
|
+
const isConstant = "const" in schema;
|
|
49719
|
+
const constantIsString = "type" in schema && (schema.type === "string" || Array.isArray(schema.type) && schema.type.includes("string"));
|
|
49720
|
+
if (isConstant) {
|
|
49721
|
+
model += `${doc}export const ${propName} = ${constantIsString ? `'${schema.const}'` : schema.const} as const;
|
|
49722
|
+
`;
|
|
49723
|
+
} else {
|
|
49724
|
+
model += `${doc}export type ${propName} = ${resolvedValue.value};
|
|
49725
|
+
`;
|
|
49726
|
+
}
|
|
49647
49727
|
return {
|
|
49648
49728
|
value: propName,
|
|
49649
|
-
imports: [{ name: propName }],
|
|
49729
|
+
imports: [{ name: propName, isConstant }],
|
|
49650
49730
|
schemas: [
|
|
49651
49731
|
...resolvedValue.schemas,
|
|
49652
49732
|
{
|
|
49653
49733
|
name: propName,
|
|
49654
|
-
model
|
|
49655
|
-
`,
|
|
49734
|
+
model,
|
|
49656
49735
|
imports: resolvedValue.imports
|
|
49657
49736
|
}
|
|
49658
49737
|
],
|
|
@@ -49671,7 +49750,7 @@ var resolveObjectOriginal = ({
|
|
|
49671
49750
|
context.output.override.useNativeEnums
|
|
49672
49751
|
);
|
|
49673
49752
|
return {
|
|
49674
|
-
value: context.output.override.useNativeEnums ? `keyof typeof ${propName}` : propName,
|
|
49753
|
+
value: context.output.override.useNativeEnums ? `(keyof typeof ${propName})` : propName,
|
|
49675
49754
|
imports: [{ name: propName }],
|
|
49676
49755
|
schemas: [
|
|
49677
49756
|
...resolvedValue.schemas,
|
|
@@ -49790,7 +49869,7 @@ var getArray = ({
|
|
|
49790
49869
|
|
|
49791
49870
|
// src/getters/res-req-types.ts
|
|
49792
49871
|
var import_esutils3 = require("esutils");
|
|
49793
|
-
var
|
|
49872
|
+
var import_lodash2 = __toESM(require("lodash.uniqby"));
|
|
49794
49873
|
var formDataContentTypes = ["multipart/form-data"];
|
|
49795
49874
|
var formUrlEncodedContentTypes = ["application/x-www-form-urlencoded"];
|
|
49796
49875
|
var getResReqContentTypes = ({
|
|
@@ -49956,7 +50035,7 @@ var getResReqTypes = (responsesOrRequests, name, context, defaultType = "unknown
|
|
|
49956
50035
|
}
|
|
49957
50036
|
];
|
|
49958
50037
|
});
|
|
49959
|
-
return (0,
|
|
50038
|
+
return (0, import_lodash2.default)(
|
|
49960
50039
|
typesArray.flatMap((it) => it),
|
|
49961
50040
|
uniqueKey
|
|
49962
50041
|
);
|
|
@@ -50202,9 +50281,6 @@ var getBody = ({
|
|
|
50202
50281
|
};
|
|
50203
50282
|
};
|
|
50204
50283
|
|
|
50205
|
-
// src/getters/combine.ts
|
|
50206
|
-
var import_lodash6 = __toESM(require("lodash.omit"));
|
|
50207
|
-
|
|
50208
50284
|
// src/getters/keys.ts
|
|
50209
50285
|
var import_esutils4 = require("esutils");
|
|
50210
50286
|
var getKey = (key) => {
|
|
@@ -50293,7 +50369,7 @@ var getObject = ({
|
|
|
50293
50369
|
acc.hasReadonlyProps ||= isReadOnly || false;
|
|
50294
50370
|
acc.imports.push(...resolvedValue.imports);
|
|
50295
50371
|
acc.value += `
|
|
50296
|
-
${doc ? `${doc} ` : ""}${isReadOnly && !context.output.override.suppressReadonlyModifier ? "readonly " : ""}${getKey(key)}${isRequired ? "" : "?"}: ${resolvedValue.value};`;
|
|
50372
|
+
${doc ? `${doc} ` : ""}${isReadOnly && !context.output.override.suppressReadonlyModifier ? "readonly " : ""}${getKey(key)}${isRequired ? "" : "?"}: ${resolvedValue.isEnum && context.output.override.useNativeEnums ? `(keyof typeof ${resolvedValue.value})` : resolvedValue.value};`;
|
|
50297
50373
|
acc.schemas.push(...resolvedValue.schemas);
|
|
50298
50374
|
if (arr.length - 1 === index3) {
|
|
50299
50375
|
if (item.additionalProperties) {
|
|
@@ -50389,8 +50465,7 @@ var getScalar = ({
|
|
|
50389
50465
|
context
|
|
50390
50466
|
}) => {
|
|
50391
50467
|
const isAngularClient = context.output.client === OutputClient.ANGULAR;
|
|
50392
|
-
const
|
|
50393
|
-
const nullable = (typeIncludesNull || item.nullable) && !isAngularClient ? " | null" : "";
|
|
50468
|
+
const nullable = item.nullable && !isAngularClient ? " | null" : "";
|
|
50394
50469
|
const enumItems = item.enum?.filter((enumItem) => enumItem !== null);
|
|
50395
50470
|
if (!item.type && item.items) {
|
|
50396
50471
|
item.type = "array";
|
|
@@ -50493,6 +50568,20 @@ var getScalar = ({
|
|
|
50493
50568
|
};
|
|
50494
50569
|
case "object":
|
|
50495
50570
|
default: {
|
|
50571
|
+
if (Array.isArray(item.type)) {
|
|
50572
|
+
return combineSchemas({
|
|
50573
|
+
schema: {
|
|
50574
|
+
anyOf: item.type.map((type) => ({
|
|
50575
|
+
...item,
|
|
50576
|
+
type
|
|
50577
|
+
}))
|
|
50578
|
+
},
|
|
50579
|
+
name,
|
|
50580
|
+
separator: "anyOf",
|
|
50581
|
+
context,
|
|
50582
|
+
nullable
|
|
50583
|
+
});
|
|
50584
|
+
}
|
|
50496
50585
|
if (enumItems) {
|
|
50497
50586
|
const value3 = `${enumItems.map(
|
|
50498
50587
|
(enumItem) => isString2(enumItem) ? `'${escape2(enumItem)}'` : `${enumItem}`
|
|
@@ -50521,7 +50610,7 @@ var getScalar = ({
|
|
|
50521
50610
|
};
|
|
50522
50611
|
|
|
50523
50612
|
// src/getters/combine.ts
|
|
50524
|
-
var
|
|
50613
|
+
var import_lodash3 = __toESM(require("lodash.uniq"));
|
|
50525
50614
|
var combineValues = ({
|
|
50526
50615
|
resolvedData,
|
|
50527
50616
|
resolvedValue,
|
|
@@ -50533,7 +50622,16 @@ var combineValues = ({
|
|
|
50533
50622
|
return `${resolvedData.values.join(` | `)}${resolvedValue ? ` | ${resolvedValue.value}` : ""}`;
|
|
50534
50623
|
}
|
|
50535
50624
|
if (separator2 === "allOf") {
|
|
50536
|
-
|
|
50625
|
+
const joined = `${resolvedData.values.join(` & `)}${resolvedValue ? ` & ${resolvedValue.value}` : ""}`;
|
|
50626
|
+
const overrideRequiredProperties = resolvedData.requiredProperties.filter(
|
|
50627
|
+
(prop) => !resolvedData.originalSchema.some(
|
|
50628
|
+
(schema) => schema && schema.properties?.[prop] && schema.required?.includes(prop)
|
|
50629
|
+
)
|
|
50630
|
+
);
|
|
50631
|
+
if (overrideRequiredProperties.length) {
|
|
50632
|
+
return `${joined} & Required<Pick<${joined}, '${overrideRequiredProperties.join("' | '")}'>>`;
|
|
50633
|
+
}
|
|
50634
|
+
return joined;
|
|
50537
50635
|
}
|
|
50538
50636
|
let values = resolvedData.values;
|
|
50539
50637
|
const hasObjectSubschemas = resolvedData.allProperties.length;
|
|
@@ -50545,7 +50643,7 @@ var combineValues = ({
|
|
|
50545
50643
|
values.push(resolvedData.values[i3]);
|
|
50546
50644
|
continue;
|
|
50547
50645
|
}
|
|
50548
|
-
const missingProperties = (0,
|
|
50646
|
+
const missingProperties = (0, import_lodash3.default)(
|
|
50549
50647
|
resolvedData.allProperties.filter(
|
|
50550
50648
|
(p2) => !Object.keys(subSchema.properties).includes(p2)
|
|
50551
50649
|
)
|
|
@@ -50574,15 +50672,8 @@ var combineSchemas = ({
|
|
|
50574
50672
|
if (propName && acc.schemas.length) {
|
|
50575
50673
|
propName = propName + pascal(getNumberWord(acc.schemas.length + 1));
|
|
50576
50674
|
}
|
|
50577
|
-
if (separator2 === "allOf" &&
|
|
50578
|
-
|
|
50579
|
-
subSchema = {
|
|
50580
|
-
...subSchema,
|
|
50581
|
-
required: [...schema.required, ...subSchema.required]
|
|
50582
|
-
};
|
|
50583
|
-
} else {
|
|
50584
|
-
subSchema = { ...subSchema, required: schema.required };
|
|
50585
|
-
}
|
|
50675
|
+
if (separator2 === "allOf" && isSchema(subSchema) && subSchema.required) {
|
|
50676
|
+
acc.requiredProperties.push(...subSchema.required);
|
|
50586
50677
|
}
|
|
50587
50678
|
const resolvedValue2 = resolveObject({
|
|
50588
50679
|
schema: subSchema,
|
|
@@ -50617,7 +50708,8 @@ var combineSchemas = ({
|
|
|
50617
50708
|
allProperties: [],
|
|
50618
50709
|
hasReadonlyProps: false,
|
|
50619
50710
|
example: schema.example,
|
|
50620
|
-
examples: resolveExampleRefs(schema.examples, context)
|
|
50711
|
+
examples: resolveExampleRefs(schema.examples, context),
|
|
50712
|
+
requiredProperties: separator2 === "allOf" ? schema.required ?? [] : []
|
|
50621
50713
|
}
|
|
50622
50714
|
);
|
|
50623
50715
|
const isAllEnums = resolvedData.isEnum.every((v2) => v2);
|
|
@@ -50656,7 +50748,13 @@ export const ${pascal(
|
|
|
50656
50748
|
}
|
|
50657
50749
|
let resolvedValue;
|
|
50658
50750
|
if (schema.properties) {
|
|
50659
|
-
resolvedValue = getScalar({
|
|
50751
|
+
resolvedValue = getScalar({
|
|
50752
|
+
item: Object.fromEntries(
|
|
50753
|
+
Object.entries(schema).filter(([key]) => key !== separator2)
|
|
50754
|
+
),
|
|
50755
|
+
name,
|
|
50756
|
+
context
|
|
50757
|
+
});
|
|
50660
50758
|
}
|
|
50661
50759
|
const value = combineValues({
|
|
50662
50760
|
resolvedData,
|
|
@@ -50708,7 +50806,7 @@ var resolveDiscriminators = (schemas, context) => {
|
|
|
50708
50806
|
try {
|
|
50709
50807
|
const { originalName } = getRefInfo(mappingValue, context);
|
|
50710
50808
|
const name = pascal(originalName);
|
|
50711
|
-
subTypeSchema = transformedSchemas[name];
|
|
50809
|
+
subTypeSchema = transformedSchemas[name] ?? transformedSchemas[originalName];
|
|
50712
50810
|
} catch (e3) {
|
|
50713
50811
|
subTypeSchema = transformedSchemas[mappingValue];
|
|
50714
50812
|
}
|
|
@@ -51182,7 +51280,7 @@ var getRouteAsArray = (route) => route.replace(TEMPLATE_TAG_IN_PATH_REGEX, "/$1/
|
|
|
51182
51280
|
|
|
51183
51281
|
// src/generators/component-definition.ts
|
|
51184
51282
|
var generateComponentDefinition = (responses = {}, context, suffix) => {
|
|
51185
|
-
if ((0,
|
|
51283
|
+
if ((0, import_lodash4.default)(responses)) {
|
|
51186
51284
|
return [];
|
|
51187
51285
|
}
|
|
51188
51286
|
return Object.entries(responses).reduce(
|
|
@@ -51221,31 +51319,33 @@ var generateComponentDefinition = (responses = {}, context, suffix) => {
|
|
|
51221
51319
|
};
|
|
51222
51320
|
|
|
51223
51321
|
// src/generators/imports.ts
|
|
51224
|
-
var
|
|
51225
|
-
var
|
|
51322
|
+
var import_lodash5 = __toESM(require("lodash.uniq"));
|
|
51323
|
+
var import_lodash6 = __toESM(require("lodash.uniqwith"));
|
|
51226
51324
|
var generateImports = ({
|
|
51227
51325
|
imports = [],
|
|
51228
51326
|
target,
|
|
51229
51327
|
isRootKey: isRootKey2,
|
|
51230
51328
|
specsName,
|
|
51231
|
-
specKey: currentSpecKey
|
|
51329
|
+
specKey: currentSpecKey,
|
|
51330
|
+
namingConvention = NamingConvention.CAMEL_CASE
|
|
51232
51331
|
}) => {
|
|
51233
51332
|
if (!imports.length) {
|
|
51234
51333
|
return "";
|
|
51235
51334
|
}
|
|
51236
|
-
return (0,
|
|
51335
|
+
return (0, import_lodash6.default)(
|
|
51237
51336
|
imports,
|
|
51238
51337
|
(a3, b3) => a3.name === b3.name && a3.default === b3.default && a3.specKey === b3.specKey
|
|
51239
|
-
).sort().map(({ specKey, name, values, alias }) => {
|
|
51338
|
+
).sort().map(({ specKey, name, values, alias, isConstant }) => {
|
|
51240
51339
|
const isSameSpecKey = currentSpecKey === specKey;
|
|
51340
|
+
const fileName = conventionName(name, namingConvention);
|
|
51241
51341
|
if (specKey && !isSameSpecKey) {
|
|
51242
51342
|
const path2 = specKey !== target ? specsName[specKey] : "";
|
|
51243
51343
|
if (!isRootKey2 && specKey) {
|
|
51244
|
-
return `import ${!values ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from '../${path_exports.join(path2,
|
|
51344
|
+
return `import ${!values && !isConstant ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from '../${path_exports.join(path2, fileName)}';`;
|
|
51245
51345
|
}
|
|
51246
|
-
return `import ${!values ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from './${path_exports.join(path2,
|
|
51346
|
+
return `import ${!values && !isConstant ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from './${path_exports.join(path2, fileName)}';`;
|
|
51247
51347
|
}
|
|
51248
|
-
return `import ${!values ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from './${
|
|
51348
|
+
return `import ${!values && !isConstant ? "type " : ""}{ ${name}${alias ? ` as ${alias}` : ""} } from './${fileName}';`;
|
|
51249
51349
|
}).join("\n");
|
|
51250
51350
|
};
|
|
51251
51351
|
var generateMutatorImports = ({
|
|
@@ -51253,7 +51353,7 @@ var generateMutatorImports = ({
|
|
|
51253
51353
|
implementation,
|
|
51254
51354
|
oneMore
|
|
51255
51355
|
}) => {
|
|
51256
|
-
const imports = (0,
|
|
51356
|
+
const imports = (0, import_lodash6.default)(
|
|
51257
51357
|
mutators,
|
|
51258
51358
|
(a3, b3) => a3.name === b3.name && a3.default === b3.default
|
|
51259
51359
|
).reduce((acc, mutator) => {
|
|
@@ -51291,7 +51391,7 @@ var generateDependency = ({
|
|
|
51291
51391
|
(e3) => e3.default && (isAllowSyntheticDefaultImports || !e3.syntheticDefaultImport)
|
|
51292
51392
|
);
|
|
51293
51393
|
const syntheticDefaultImportDep = !isAllowSyntheticDefaultImports ? deps.find((e3) => e3.syntheticDefaultImport) : void 0;
|
|
51294
|
-
const depsString = (0,
|
|
51394
|
+
const depsString = (0, import_lodash5.default)(
|
|
51295
51395
|
deps.filter((e3) => !e3.default && !e3.syntheticDefaultImport).map(({ name, alias }) => alias ? `${name} as ${alias}` : name)
|
|
51296
51396
|
).sort().join(",\n ");
|
|
51297
51397
|
let importString = "";
|
|
@@ -51305,7 +51405,7 @@ var generateDependency = ({
|
|
|
51305
51405
|
}
|
|
51306
51406
|
importString += `import ${onlyTypes ? "type " : ""}${defaultDep ? `${defaultDep.name}${depsString ? "," : ""}` : ""}${depsString ? `{
|
|
51307
51407
|
${depsString}
|
|
51308
|
-
}` : ""} from '${dependency}${key !== "default" && specsName[key] ? `/${specsName[key]}` : ""}'
|
|
51408
|
+
}` : ""} from '${dependency}${key !== "default" && specsName[key] ? `/${specsName[key]}` : ""}';`;
|
|
51309
51409
|
return importString;
|
|
51310
51410
|
};
|
|
51311
51411
|
var addDependency = ({
|
|
@@ -51352,11 +51452,15 @@ var addDependency = ({
|
|
|
51352
51452
|
});
|
|
51353
51453
|
}
|
|
51354
51454
|
if (types) {
|
|
51455
|
+
let uniqueTypes = types;
|
|
51355
51456
|
if (values) {
|
|
51457
|
+
uniqueTypes = types.filter(
|
|
51458
|
+
(t3) => !values.some((v2) => v2.name === t3.name)
|
|
51459
|
+
);
|
|
51356
51460
|
dep += "\n";
|
|
51357
51461
|
}
|
|
51358
51462
|
dep += generateDependency({
|
|
51359
|
-
deps:
|
|
51463
|
+
deps: uniqueTypes,
|
|
51360
51464
|
isAllowSyntheticDefaultImports,
|
|
51361
51465
|
dependency,
|
|
51362
51466
|
specsName,
|
|
@@ -51365,7 +51469,7 @@ var addDependency = ({
|
|
|
51365
51469
|
});
|
|
51366
51470
|
}
|
|
51367
51471
|
return dep;
|
|
51368
|
-
}).join("\n");
|
|
51472
|
+
}).join("\n") + "\n";
|
|
51369
51473
|
};
|
|
51370
51474
|
var getLibName = (code) => {
|
|
51371
51475
|
const splitString = code.split(" from ");
|
|
@@ -51415,7 +51519,7 @@ var generateVerbImports = ({
|
|
|
51415
51519
|
var generateModelInline = (acc, model) => acc + `${model}
|
|
51416
51520
|
`;
|
|
51417
51521
|
var generateModelsInline = (obj) => {
|
|
51418
|
-
const schemas = Object.values(obj).flatMap((it) => it)
|
|
51522
|
+
const schemas = Object.values(obj).flatMap((it) => it);
|
|
51419
51523
|
return schemas.reduce(
|
|
51420
51524
|
(acc, { model }) => generateModelInline(acc, model),
|
|
51421
51525
|
""
|
|
@@ -51433,7 +51537,7 @@ var getImport = (output, mutator) => {
|
|
|
51433
51537
|
const { pathWithoutExtension } = getFileInfo(
|
|
51434
51538
|
path_exports.relativeSafe(outputFileInfo.dirname, mutatorFileInfo.path)
|
|
51435
51539
|
);
|
|
51436
|
-
return pathWithoutExtension
|
|
51540
|
+
return `${pathWithoutExtension}${mutator.extension || ""}`;
|
|
51437
51541
|
};
|
|
51438
51542
|
var generateMutator = async ({
|
|
51439
51543
|
output,
|
|
@@ -51599,6 +51703,12 @@ var parseFunction = (ast, name) => {
|
|
|
51599
51703
|
numberOfParams: node.params.length,
|
|
51600
51704
|
returnNumberOfParams: returnStatement2.argument.params.length
|
|
51601
51705
|
};
|
|
51706
|
+
} else if (returnStatement2?.argument?.type === "CallExpression" && returnStatement2.argument.arguments?.[0]?.type === "ArrowFunctionExpression") {
|
|
51707
|
+
const arrowFn = returnStatement2.argument.arguments[0];
|
|
51708
|
+
return {
|
|
51709
|
+
numberOfParams: node.params.length,
|
|
51710
|
+
returnNumberOfParams: arrowFn.params.length
|
|
51711
|
+
};
|
|
51602
51712
|
}
|
|
51603
51713
|
return {
|
|
51604
51714
|
numberOfParams: node.params.length
|
|
@@ -51622,6 +51732,12 @@ var parseFunction = (ast, name) => {
|
|
|
51622
51732
|
numberOfParams: declaration.init.params.length,
|
|
51623
51733
|
returnNumberOfParams: returnStatement.argument.params.length
|
|
51624
51734
|
};
|
|
51735
|
+
} else if (returnStatement?.argument?.type === "CallExpression" && returnStatement.argument.arguments?.[0]?.type === "ArrowFunctionExpression") {
|
|
51736
|
+
const arrowFn = returnStatement.argument.arguments[0];
|
|
51737
|
+
return {
|
|
51738
|
+
numberOfParams: declaration.init.params.length,
|
|
51739
|
+
returnNumberOfParams: arrowFn.params.length
|
|
51740
|
+
};
|
|
51625
51741
|
}
|
|
51626
51742
|
return {
|
|
51627
51743
|
numberOfParams: declaration.init.params.length
|
|
@@ -51895,7 +52011,7 @@ var generateParameterDefinition = (parameters = {}, context, suffix) => {
|
|
|
51895
52011
|
};
|
|
51896
52012
|
|
|
51897
52013
|
// src/generators/schema-definition.ts
|
|
51898
|
-
var
|
|
52014
|
+
var import_lodash7 = __toESM(require("lodash.isempty"));
|
|
51899
52015
|
|
|
51900
52016
|
// src/generators/interface.ts
|
|
51901
52017
|
var generateInterface = ({
|
|
@@ -51920,9 +52036,16 @@ var generateInterface = ({
|
|
|
51920
52036
|
}
|
|
51921
52037
|
}
|
|
51922
52038
|
if (scalar.type === "object" && !context?.output.override?.useTypeOverInterfaces) {
|
|
51923
|
-
|
|
51924
|
-
|
|
52039
|
+
if (scalar.type === "object" && schema.properties && Object.values(schema.properties).every((item) => "const" in item)) {
|
|
52040
|
+
const mappedScalarValue = scalar.value.replaceAll(";", ",");
|
|
52041
|
+
model += `export const ${name}Value = ${mappedScalarValue} as const;
|
|
52042
|
+
export type ${name} = typeof ${name}Value;
|
|
51925
52043
|
`;
|
|
52044
|
+
} else {
|
|
52045
|
+
const blankInterfaceValue = scalar.value === "unknown" ? "{}" : scalar.value;
|
|
52046
|
+
model += `export interface ${name} ${blankInterfaceValue}
|
|
52047
|
+
`;
|
|
52048
|
+
}
|
|
51926
52049
|
} else {
|
|
51927
52050
|
model += `export type ${name} = ${scalar.value};
|
|
51928
52051
|
`;
|
|
@@ -51942,7 +52065,7 @@ var generateInterface = ({
|
|
|
51942
52065
|
|
|
51943
52066
|
// src/generators/schema-definition.ts
|
|
51944
52067
|
var generateSchemasDefinition = (schemas = {}, context, suffix, filters) => {
|
|
51945
|
-
if ((0,
|
|
52068
|
+
if ((0, import_lodash7.default)(schemas)) {
|
|
51946
52069
|
return [];
|
|
51947
52070
|
}
|
|
51948
52071
|
const transformedSchemas = resolveDiscriminators(schemas, context);
|
|
@@ -52061,11 +52184,10 @@ var generateVerbOptions = async ({
|
|
|
52061
52184
|
(acc, [tag, options]) => tags.includes(tag) ? mergeDeep(acc, options) : acc,
|
|
52062
52185
|
{}
|
|
52063
52186
|
);
|
|
52064
|
-
const override =
|
|
52065
|
-
|
|
52066
|
-
|
|
52067
|
-
|
|
52068
|
-
};
|
|
52187
|
+
const override = mergeDeep(
|
|
52188
|
+
mergeDeep(output.override, overrideTag),
|
|
52189
|
+
overrideOperation
|
|
52190
|
+
);
|
|
52069
52191
|
const overrideOperationName = overrideOperation?.operationName || output.override?.operationName;
|
|
52070
52192
|
const overriddenOperationName = overrideOperationName ? overrideOperationName(operation, route, verb) : camel(operationId);
|
|
52071
52193
|
const operationName = sanitize(overriddenOperationName, { es5keyword: true });
|
|
@@ -52222,7 +52344,8 @@ var getSchema2 = ({
|
|
|
52222
52344
|
isRootKey: isRootKey2,
|
|
52223
52345
|
specsName,
|
|
52224
52346
|
header,
|
|
52225
|
-
specKey
|
|
52347
|
+
specKey,
|
|
52348
|
+
namingConvention = NamingConvention.CAMEL_CASE
|
|
52226
52349
|
}) => {
|
|
52227
52350
|
let file = header;
|
|
52228
52351
|
file += generateImports({
|
|
@@ -52232,7 +52355,8 @@ var getSchema2 = ({
|
|
|
52232
52355
|
target,
|
|
52233
52356
|
isRootKey: isRootKey2,
|
|
52234
52357
|
specsName,
|
|
52235
|
-
specKey
|
|
52358
|
+
specKey,
|
|
52359
|
+
namingConvention
|
|
52236
52360
|
});
|
|
52237
52361
|
file += imports.length ? "\n\n" : "\n";
|
|
52238
52362
|
file += model;
|
|
@@ -52246,17 +52370,26 @@ var writeSchema = async ({
|
|
|
52246
52370
|
path: path2,
|
|
52247
52371
|
schema,
|
|
52248
52372
|
target,
|
|
52373
|
+
namingConvention,
|
|
52249
52374
|
fileExtension,
|
|
52250
52375
|
specKey,
|
|
52251
52376
|
isRootKey: isRootKey2,
|
|
52252
52377
|
specsName,
|
|
52253
52378
|
header
|
|
52254
52379
|
}) => {
|
|
52255
|
-
const name =
|
|
52380
|
+
const name = conventionName(schema.name, namingConvention);
|
|
52256
52381
|
try {
|
|
52257
52382
|
await import_fs_extra2.default.outputFile(
|
|
52258
52383
|
getPath(path2, name, fileExtension),
|
|
52259
|
-
getSchema2({
|
|
52384
|
+
getSchema2({
|
|
52385
|
+
schema,
|
|
52386
|
+
target,
|
|
52387
|
+
isRootKey: isRootKey2,
|
|
52388
|
+
specsName,
|
|
52389
|
+
header,
|
|
52390
|
+
specKey,
|
|
52391
|
+
namingConvention
|
|
52392
|
+
})
|
|
52260
52393
|
);
|
|
52261
52394
|
} catch (e3) {
|
|
52262
52395
|
throw `Oups... \u{1F37B}. An Error occurred while writing schema ${name} => ${e3}`;
|
|
@@ -52266,6 +52399,7 @@ var writeSchemas = async ({
|
|
|
52266
52399
|
schemaPath,
|
|
52267
52400
|
schemas,
|
|
52268
52401
|
target,
|
|
52402
|
+
namingConvention,
|
|
52269
52403
|
fileExtension,
|
|
52270
52404
|
specKey,
|
|
52271
52405
|
isRootKey: isRootKey2,
|
|
@@ -52279,6 +52413,7 @@ var writeSchemas = async ({
|
|
|
52279
52413
|
path: schemaPath,
|
|
52280
52414
|
schema,
|
|
52281
52415
|
target,
|
|
52416
|
+
namingConvention,
|
|
52282
52417
|
fileExtension,
|
|
52283
52418
|
specKey,
|
|
52284
52419
|
isRootKey: isRootKey2,
|
|
@@ -52312,12 +52447,11 @@ var writeSchemas = async ({
|
|
|
52312
52447
|
const stringData = data.toString();
|
|
52313
52448
|
const ext = fileExtension.endsWith(".ts") ? fileExtension.slice(0, -3) : fileExtension;
|
|
52314
52449
|
const importStatements = schemas.filter((schema) => {
|
|
52315
|
-
|
|
52316
|
-
|
|
52317
|
-
|
|
52318
|
-
|
|
52319
|
-
|
|
52320
|
-
}).map((schema) => `export * from './${camel(schema.name)}${ext}';`);
|
|
52450
|
+
const name = conventionName(schema.name, namingConvention);
|
|
52451
|
+
return !stringData.includes(`export * from './${name}${ext}'`) && !stringData.includes(`export * from "./${name}${ext}"`);
|
|
52452
|
+
}).map(
|
|
52453
|
+
(schema) => `export * from './${conventionName(schema.name, namingConvention)}${ext}';`
|
|
52454
|
+
);
|
|
52321
52455
|
const currentFileExports = stringData.match(/export \* from(.*)('|")/g)?.map((s2) => s2 + ";") ?? [];
|
|
52322
52456
|
const exports2 = [...currentFileExports, ...importStatements].sort().join("\n");
|
|
52323
52457
|
const fileContent = `${header}
|
|
@@ -52362,8 +52496,8 @@ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
|
52362
52496
|
var import_fs_extra3 = __toESM(require("fs-extra"));
|
|
52363
52497
|
|
|
52364
52498
|
// src/writers/generate-imports-for-builder.ts
|
|
52365
|
-
var
|
|
52366
|
-
var generateImportsForBuilder = (output, imports, relativeSchemasPath) => output.schemas && !output.indexFiles ? (0,
|
|
52499
|
+
var import_lodash8 = __toESM(require("lodash.uniqby"));
|
|
52500
|
+
var generateImportsForBuilder = (output, imports, relativeSchemasPath) => output.schemas && !output.indexFiles ? (0, import_lodash8.default)(imports, "name").map((i3) => ({
|
|
52367
52501
|
exports: [i3],
|
|
52368
52502
|
dependency: path_exports.joinSafe(relativeSchemasPath, camel(i3.name))
|
|
52369
52503
|
})) : [{ exports: imports, dependency: relativeSchemasPath }];
|
|
@@ -52546,9 +52680,8 @@ var writeSingleMode = async ({
|
|
|
52546
52680
|
if (!output.schemas && needSchema) {
|
|
52547
52681
|
data += generateModelsInline(builder.schemas);
|
|
52548
52682
|
}
|
|
52549
|
-
data +=
|
|
52550
|
-
|
|
52551
|
-
${implementation}`;
|
|
52683
|
+
data += `${implementation.trim()}
|
|
52684
|
+
`;
|
|
52552
52685
|
if (output.mock) {
|
|
52553
52686
|
data += "\n\n";
|
|
52554
52687
|
data += implementationMock;
|
|
@@ -52698,49 +52831,48 @@ var addDefaultTagIfEmpty = (operation) => ({
|
|
|
52698
52831
|
tags: operation.tags.length ? operation.tags : ["default"]
|
|
52699
52832
|
});
|
|
52700
52833
|
var generateTargetTags = (currentAcc, operation) => {
|
|
52701
|
-
|
|
52702
|
-
|
|
52703
|
-
|
|
52704
|
-
|
|
52705
|
-
|
|
52706
|
-
|
|
52707
|
-
|
|
52708
|
-
|
|
52709
|
-
|
|
52710
|
-
|
|
52711
|
-
|
|
52712
|
-
|
|
52713
|
-
implementationMock: {
|
|
52714
|
-
function: operation.implementationMock.function,
|
|
52715
|
-
handler: operation.implementationMock.handler,
|
|
52716
|
-
handlerName: " " + operation.implementationMock.handlerName + "()"
|
|
52717
|
-
}
|
|
52718
|
-
};
|
|
52719
|
-
return acc;
|
|
52720
|
-
}
|
|
52721
|
-
acc[tag] = {
|
|
52722
|
-
implementation: currentOperation.implementation + operation.implementation,
|
|
52723
|
-
imports: [...currentOperation.imports, ...operation.imports],
|
|
52724
|
-
importsMock: [...currentOperation.importsMock, ...operation.importsMock],
|
|
52834
|
+
const tag = kebab(operation.tags[0]);
|
|
52835
|
+
const currentOperation = currentAcc[tag];
|
|
52836
|
+
if (!currentOperation) {
|
|
52837
|
+
currentAcc[tag] = {
|
|
52838
|
+
imports: operation.imports,
|
|
52839
|
+
importsMock: operation.importsMock,
|
|
52840
|
+
mutators: operation.mutator ? [operation.mutator] : [],
|
|
52841
|
+
clientMutators: operation.clientMutators ?? [],
|
|
52842
|
+
formData: operation.formData ? [operation.formData] : [],
|
|
52843
|
+
formUrlEncoded: operation.formUrlEncoded ? [operation.formUrlEncoded] : [],
|
|
52844
|
+
paramsSerializer: operation.paramsSerializer ? [operation.paramsSerializer] : [],
|
|
52845
|
+
implementation: operation.implementation,
|
|
52725
52846
|
implementationMock: {
|
|
52726
|
-
function:
|
|
52727
|
-
handler:
|
|
52728
|
-
handlerName:
|
|
52729
|
-
}
|
|
52730
|
-
mutators: operation.mutator ? [...currentOperation.mutators ?? [], operation.mutator] : currentOperation.mutators,
|
|
52731
|
-
clientMutators: operation.clientMutators ? [
|
|
52732
|
-
...currentOperation.clientMutators ?? [],
|
|
52733
|
-
...operation.clientMutators
|
|
52734
|
-
] : currentOperation.clientMutators,
|
|
52735
|
-
formData: operation.formData ? [...currentOperation.formData ?? [], operation.formData] : currentOperation.formData,
|
|
52736
|
-
formUrlEncoded: operation.formUrlEncoded ? [...currentOperation.formUrlEncoded ?? [], operation.formUrlEncoded] : currentOperation.formUrlEncoded,
|
|
52737
|
-
paramsSerializer: operation.paramsSerializer ? [
|
|
52738
|
-
...currentOperation.paramsSerializer ?? [],
|
|
52739
|
-
operation.paramsSerializer
|
|
52740
|
-
] : currentOperation.paramsSerializer
|
|
52847
|
+
function: operation.implementationMock.function,
|
|
52848
|
+
handler: operation.implementationMock.handler,
|
|
52849
|
+
handlerName: " " + operation.implementationMock.handlerName + "()"
|
|
52850
|
+
}
|
|
52741
52851
|
};
|
|
52742
|
-
return
|
|
52743
|
-
}
|
|
52852
|
+
return currentAcc;
|
|
52853
|
+
}
|
|
52854
|
+
currentAcc[tag] = {
|
|
52855
|
+
implementation: currentOperation.implementation + operation.implementation,
|
|
52856
|
+
imports: [...currentOperation.imports, ...operation.imports],
|
|
52857
|
+
importsMock: [...currentOperation.importsMock, ...operation.importsMock],
|
|
52858
|
+
implementationMock: {
|
|
52859
|
+
function: currentOperation.implementationMock.function + operation.implementationMock.function,
|
|
52860
|
+
handler: currentOperation.implementationMock.handler + operation.implementationMock.handler,
|
|
52861
|
+
handlerName: currentOperation.implementationMock.handlerName + ",\n " + operation.implementationMock.handlerName + "()"
|
|
52862
|
+
},
|
|
52863
|
+
mutators: operation.mutator ? [...currentOperation.mutators ?? [], operation.mutator] : currentOperation.mutators,
|
|
52864
|
+
clientMutators: operation.clientMutators ? [
|
|
52865
|
+
...currentOperation.clientMutators ?? [],
|
|
52866
|
+
...operation.clientMutators
|
|
52867
|
+
] : currentOperation.clientMutators,
|
|
52868
|
+
formData: operation.formData ? [...currentOperation.formData ?? [], operation.formData] : currentOperation.formData,
|
|
52869
|
+
formUrlEncoded: operation.formUrlEncoded ? [...currentOperation.formUrlEncoded ?? [], operation.formUrlEncoded] : currentOperation.formUrlEncoded,
|
|
52870
|
+
paramsSerializer: operation.paramsSerializer ? [
|
|
52871
|
+
...currentOperation.paramsSerializer ?? [],
|
|
52872
|
+
operation.paramsSerializer
|
|
52873
|
+
] : currentOperation.paramsSerializer
|
|
52874
|
+
};
|
|
52875
|
+
return currentAcc;
|
|
52744
52876
|
};
|
|
52745
52877
|
var generateTargetForTags = (builder, options) => {
|
|
52746
52878
|
const isAngularClient = options.client === OutputClient.ANGULAR;
|
|
@@ -52752,7 +52884,7 @@ var generateTargetForTags = (builder, options) => {
|
|
|
52752
52884
|
const isMutator = !!target.mutators?.some(
|
|
52753
52885
|
(mutator) => isAngularClient ? mutator.hasThirdArg : mutator.hasSecondArg
|
|
52754
52886
|
);
|
|
52755
|
-
const operationNames = Object.values(builder.operations).filter(({ tags }) => tags.map(kebab).
|
|
52887
|
+
const operationNames = Object.values(builder.operations).filter(({ tags }) => tags.map(kebab).indexOf(kebab(tag)) === 0).map(({ operationName }) => operationName);
|
|
52756
52888
|
const typescriptVersion = options.packageJson?.dependencies?.["typescript"] ?? options.packageJson?.devDependencies?.["typescript"] ?? "4.4.0";
|
|
52757
52889
|
const hasAwaitedType = compareVersions(typescriptVersion, "4.5.0");
|
|
52758
52890
|
const titles = builder.title({
|
|
@@ -52832,6 +52964,13 @@ var writeSplitTagsMode = async ({
|
|
|
52832
52964
|
const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(
|
|
52833
52965
|
output.tsconfig
|
|
52834
52966
|
);
|
|
52967
|
+
const indexFilePath = output.mock && !isFunction2(output.mock) && output.mock.indexMockFiles ? path_exports.join(
|
|
52968
|
+
dirname3,
|
|
52969
|
+
"index." + getMockFileExtensionByTypeName(output.mock) + extension
|
|
52970
|
+
) : void 0;
|
|
52971
|
+
if (indexFilePath) {
|
|
52972
|
+
await import_fs_extra5.default.outputFile(indexFilePath, "");
|
|
52973
|
+
}
|
|
52835
52974
|
const generatedFilePathsArray = await Promise.all(
|
|
52836
52975
|
Object.entries(target).map(async ([tag, target2]) => {
|
|
52837
52976
|
try {
|
|
@@ -52943,6 +53082,15 @@ ${implementationMock}`;
|
|
|
52943
53082
|
) : void 0;
|
|
52944
53083
|
if (mockPath) {
|
|
52945
53084
|
await import_fs_extra5.default.outputFile(mockPath, mockData);
|
|
53085
|
+
if (indexFilePath) {
|
|
53086
|
+
const localMockPath = path_exports.joinSafe(
|
|
53087
|
+
"./",
|
|
53088
|
+
tag,
|
|
53089
|
+
tag + "." + getMockFileExtensionByTypeName(output.mock)
|
|
53090
|
+
);
|
|
53091
|
+
import_fs_extra5.default.appendFile(indexFilePath, `export * from '${localMockPath}'
|
|
53092
|
+
`);
|
|
53093
|
+
}
|
|
52946
53094
|
}
|
|
52947
53095
|
return [
|
|
52948
53096
|
implementationPath,
|
|
@@ -53080,6 +53228,7 @@ var writeTagsMode = async ({
|
|
|
53080
53228
|
BODY_TYPE_NAME,
|
|
53081
53229
|
GetterPropType,
|
|
53082
53230
|
LogLevels,
|
|
53231
|
+
NamingConvention,
|
|
53083
53232
|
OutputClient,
|
|
53084
53233
|
OutputHttpClient,
|
|
53085
53234
|
OutputMockType,
|
|
@@ -53097,6 +53246,7 @@ var writeTagsMode = async ({
|
|
|
53097
53246
|
camel,
|
|
53098
53247
|
combineSchemas,
|
|
53099
53248
|
compareVersions,
|
|
53249
|
+
conventionName,
|
|
53100
53250
|
count,
|
|
53101
53251
|
createDebugger,
|
|
53102
53252
|
createLogger,
|