@hey-api/openapi-ts 0.91.1 → 0.92.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/README.md +7 -7
- package/dist/index.d.mts +289 -452
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-CvGgSlz8.mjs → init-DlaW5Djq.mjs} +316 -74
- package/dist/init-DlaW5Djq.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-Dgh53q8K.mjs → src-BYA2YioO.mjs} +2 -5
- package/dist/{src-Dgh53q8K.mjs.map → src-BYA2YioO.mjs.map} +1 -1
- package/package.json +5 -5
- package/dist/init-CvGgSlz8.mjs.map +0 -1
|
@@ -140,6 +140,7 @@ function getOutput(userConfig) {
|
|
|
140
140
|
const output = valueToObject({
|
|
141
141
|
defaultValue: {
|
|
142
142
|
clean: true,
|
|
143
|
+
entryFile: true,
|
|
143
144
|
fileName: {
|
|
144
145
|
case: "preserve",
|
|
145
146
|
name: "{{name}}",
|
|
@@ -147,7 +148,6 @@ function getOutput(userConfig) {
|
|
|
147
148
|
},
|
|
148
149
|
format: null,
|
|
149
150
|
header: "// This file is auto-generated by @hey-api/openapi-ts",
|
|
150
|
-
indexFile: true,
|
|
151
151
|
lint: null,
|
|
152
152
|
path: "",
|
|
153
153
|
postProcess: [],
|
|
@@ -395,12 +395,12 @@ function getTypedConfig(plugin) {
|
|
|
395
395
|
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region src/plugins/@hey-api/client-core/utils.ts
|
|
398
|
-
|
|
398
|
+
function getClientBaseUrlKey(config) {
|
|
399
399
|
const client = getClientPlugin(config);
|
|
400
400
|
if (client.name === "@hey-api/client-axios" || client.name === "@hey-api/client-nuxt") return "baseURL";
|
|
401
401
|
return "baseUrl";
|
|
402
|
-
}
|
|
403
|
-
|
|
402
|
+
}
|
|
403
|
+
function getClientPlugin(config) {
|
|
404
404
|
for (const name of config.pluginOrder) {
|
|
405
405
|
const plugin = config.plugins[name];
|
|
406
406
|
if (plugin?.tags?.includes("client")) return plugin;
|
|
@@ -409,7 +409,7 @@ const getClientPlugin = (config) => {
|
|
|
409
409
|
config: { name: "" },
|
|
410
410
|
name: ""
|
|
411
411
|
};
|
|
412
|
-
}
|
|
412
|
+
}
|
|
413
413
|
|
|
414
414
|
//#endregion
|
|
415
415
|
//#region src/ts-dsl/base.ts
|
|
@@ -587,6 +587,10 @@ var PrefixTsDsl = class extends Mixed$51 {
|
|
|
587
587
|
super.analyze(ctx$1);
|
|
588
588
|
ctx$1.analyze(this._expr);
|
|
589
589
|
}
|
|
590
|
+
/** Returns true when all required builder calls are present. */
|
|
591
|
+
get isValid() {
|
|
592
|
+
return this.missingRequiredCalls().length === 0;
|
|
593
|
+
}
|
|
590
594
|
/** Sets the operand (the expression being prefixed). */
|
|
591
595
|
expr(expr) {
|
|
592
596
|
this._expr = expr;
|
|
@@ -608,10 +612,20 @@ var PrefixTsDsl = class extends Mixed$51 {
|
|
|
608
612
|
return this;
|
|
609
613
|
}
|
|
610
614
|
toAst() {
|
|
611
|
-
|
|
612
|
-
if (!this._op) throw new Error("Missing operator for prefix unary expression");
|
|
615
|
+
this.$validate();
|
|
613
616
|
return ts.factory.createPrefixUnaryExpression(this._op, this.$node(this._expr));
|
|
614
617
|
}
|
|
618
|
+
$validate() {
|
|
619
|
+
const missing = this.missingRequiredCalls();
|
|
620
|
+
if (missing.length === 0) return;
|
|
621
|
+
throw new Error(`Prefix unary expression missing ${missing.join(" and ")}`);
|
|
622
|
+
}
|
|
623
|
+
missingRequiredCalls() {
|
|
624
|
+
const missing = [];
|
|
625
|
+
if (!this._expr) missing.push(".expr()");
|
|
626
|
+
if (!this._op) missing.push("operator (e.g., .not(), .neg())");
|
|
627
|
+
return missing;
|
|
628
|
+
}
|
|
615
629
|
};
|
|
616
630
|
|
|
617
631
|
//#endregion
|
|
@@ -876,7 +890,7 @@ const safePropName = (name) => {
|
|
|
876
890
|
const safeName = (name, reserved$1) => {
|
|
877
891
|
let sanitized = "";
|
|
878
892
|
let index;
|
|
879
|
-
const first = name[0];
|
|
893
|
+
const first = name[0] ?? "";
|
|
880
894
|
regexp.illegalStartCharacters.lastIndex = 0;
|
|
881
895
|
if (regexp.illegalStartCharacters.test(first)) {
|
|
882
896
|
sanitized += "_";
|
|
@@ -886,7 +900,7 @@ const safeName = (name, reserved$1) => {
|
|
|
886
900
|
index = 1;
|
|
887
901
|
}
|
|
888
902
|
while (index < name.length) {
|
|
889
|
-
const char = name[index];
|
|
903
|
+
const char = name[index] ?? "";
|
|
890
904
|
sanitized += /^[\u200c\u200d\p{ID_Continue}]$/u.test(char) ? char : "_";
|
|
891
905
|
index += 1;
|
|
892
906
|
}
|
|
@@ -1451,9 +1465,23 @@ var TokenTsDsl = class extends TsDsl {
|
|
|
1451
1465
|
return this.kind(ts.SyntaxKind.DotDotDotToken);
|
|
1452
1466
|
}
|
|
1453
1467
|
toAst() {
|
|
1454
|
-
|
|
1468
|
+
this.$validate();
|
|
1455
1469
|
return ts.factory.createToken(this._kind);
|
|
1456
1470
|
}
|
|
1471
|
+
$validate() {
|
|
1472
|
+
const missing = this.missingRequiredCalls();
|
|
1473
|
+
if (missing.length === 0) return;
|
|
1474
|
+
throw new Error(`Token missing ${missing.join(" and ")}`);
|
|
1475
|
+
}
|
|
1476
|
+
missingRequiredCalls() {
|
|
1477
|
+
const missing = [];
|
|
1478
|
+
if (!this._kind) missing.push(".kind()");
|
|
1479
|
+
return missing;
|
|
1480
|
+
}
|
|
1481
|
+
/** Returns true when all required builder calls are present. */
|
|
1482
|
+
get isValid() {
|
|
1483
|
+
return this.missingRequiredCalls().length === 0;
|
|
1484
|
+
}
|
|
1457
1485
|
};
|
|
1458
1486
|
|
|
1459
1487
|
//#endregion
|
|
@@ -1535,6 +1563,10 @@ var TypeAttrTsDsl = class extends Mixed$47 {
|
|
|
1535
1563
|
ctx$1.analyze(this._base);
|
|
1536
1564
|
ctx$1.analyze(this._right);
|
|
1537
1565
|
}
|
|
1566
|
+
/** Returns true when all required builder calls are present. */
|
|
1567
|
+
get isValid() {
|
|
1568
|
+
return this.missingRequiredCalls().length === 0;
|
|
1569
|
+
}
|
|
1538
1570
|
base(base) {
|
|
1539
1571
|
if (isRef(base)) this._base = base;
|
|
1540
1572
|
else this._base = base ? ref(base) : void 0;
|
|
@@ -1545,11 +1577,22 @@ var TypeAttrTsDsl = class extends Mixed$47 {
|
|
|
1545
1577
|
return this;
|
|
1546
1578
|
}
|
|
1547
1579
|
toAst() {
|
|
1548
|
-
|
|
1580
|
+
this.$validate();
|
|
1549
1581
|
const left = this.$node(this._base);
|
|
1550
1582
|
if (!ts.isEntityName(left)) throw new Error("TypeAttrTsDsl: base must be an EntityName");
|
|
1551
1583
|
return ts.factory.createQualifiedName(left, this.$node(this._right));
|
|
1552
1584
|
}
|
|
1585
|
+
$validate() {
|
|
1586
|
+
const missing = this.missingRequiredCalls();
|
|
1587
|
+
if (missing.length === 0) return;
|
|
1588
|
+
throw new Error(`Type attribute missing ${missing.join(" and ")}`);
|
|
1589
|
+
}
|
|
1590
|
+
missingRequiredCalls() {
|
|
1591
|
+
const missing = [];
|
|
1592
|
+
if (!this._base) missing.push(".base()");
|
|
1593
|
+
if (!this._right) missing.push(".right()");
|
|
1594
|
+
return missing;
|
|
1595
|
+
}
|
|
1553
1596
|
};
|
|
1554
1597
|
|
|
1555
1598
|
//#endregion
|
|
@@ -1571,15 +1614,29 @@ var TypeExprTsDsl = class extends Mixed$46 {
|
|
|
1571
1614
|
super.analyze(ctx$1);
|
|
1572
1615
|
ctx$1.analyze(this._exprInput);
|
|
1573
1616
|
}
|
|
1617
|
+
/** Returns true when all required builder calls are present. */
|
|
1618
|
+
get isValid() {
|
|
1619
|
+
return this.missingRequiredCalls().length === 0;
|
|
1620
|
+
}
|
|
1574
1621
|
/** Accesses a nested type (e.g. `Foo.Bar`). */
|
|
1575
1622
|
attr(right) {
|
|
1576
1623
|
this._exprInput = isNode(right) ? ref(right.base(this._exprInput)) : ref(new TypeAttrTsDsl(this._exprInput, right));
|
|
1577
1624
|
return this;
|
|
1578
1625
|
}
|
|
1579
1626
|
toAst() {
|
|
1580
|
-
|
|
1627
|
+
this.$validate();
|
|
1581
1628
|
return ts.factory.createTypeReferenceNode(this.$type(this._exprInput), this.$generics());
|
|
1582
1629
|
}
|
|
1630
|
+
$validate() {
|
|
1631
|
+
const missing = this.missingRequiredCalls();
|
|
1632
|
+
if (missing.length === 0) return;
|
|
1633
|
+
throw new Error(`Type expression missing ${missing.join(" and ")}`);
|
|
1634
|
+
}
|
|
1635
|
+
missingRequiredCalls() {
|
|
1636
|
+
const missing = [];
|
|
1637
|
+
if (!this._exprInput) missing.push("name or .attr()");
|
|
1638
|
+
return missing;
|
|
1639
|
+
}
|
|
1583
1640
|
};
|
|
1584
1641
|
f.type.expr.set((...args) => new TypeExprTsDsl(...args));
|
|
1585
1642
|
|
|
@@ -1672,6 +1729,10 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1672
1729
|
analyze(ctx$1) {
|
|
1673
1730
|
super.analyze(ctx$1);
|
|
1674
1731
|
}
|
|
1732
|
+
/** Returns true when all required builder calls are present. */
|
|
1733
|
+
get isValid() {
|
|
1734
|
+
return this.missingRequiredCalls().length === 0;
|
|
1735
|
+
}
|
|
1675
1736
|
/** Defines an array pattern (e.g. `[a, b, c]`). */
|
|
1676
1737
|
array(...props) {
|
|
1677
1738
|
this.pattern = {
|
|
@@ -1698,7 +1759,7 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1698
1759
|
return this;
|
|
1699
1760
|
}
|
|
1700
1761
|
toAst() {
|
|
1701
|
-
|
|
1762
|
+
this.$validate();
|
|
1702
1763
|
if (this.pattern.kind === "object") {
|
|
1703
1764
|
const elements = Object.entries(this.pattern.values).map(([key, alias]) => key === alias ? ts.factory.createBindingElement(void 0, void 0, key, void 0) : ts.factory.createBindingElement(void 0, key, alias, void 0));
|
|
1704
1765
|
const spread = this.createSpread();
|
|
@@ -1713,6 +1774,16 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1713
1774
|
}
|
|
1714
1775
|
throw new Error("PatternTsDsl requires object() or array() pattern");
|
|
1715
1776
|
}
|
|
1777
|
+
$validate() {
|
|
1778
|
+
const missing = this.missingRequiredCalls();
|
|
1779
|
+
if (missing.length === 0) return;
|
|
1780
|
+
throw new Error(`Binding pattern missing ${missing.join(" and ")}`);
|
|
1781
|
+
}
|
|
1782
|
+
missingRequiredCalls() {
|
|
1783
|
+
const missing = [];
|
|
1784
|
+
if (!this.pattern) missing.push(".array() or .object()");
|
|
1785
|
+
return missing;
|
|
1786
|
+
}
|
|
1716
1787
|
createSpread() {
|
|
1717
1788
|
return this._spread ? ts.factory.createBindingElement(this.$node(new TokenTsDsl().spread()), void 0, this.$node(new IdTsDsl(this._spread))) : void 0;
|
|
1718
1789
|
}
|
|
@@ -1771,15 +1842,28 @@ var ParamTsDsl = class extends Mixed$42 {
|
|
|
1771
1842
|
ctx$1.analyze(this.name);
|
|
1772
1843
|
ctx$1.analyze(this._type);
|
|
1773
1844
|
}
|
|
1845
|
+
/** Returns true when all required builder calls are present. */
|
|
1846
|
+
get isValid() {
|
|
1847
|
+
return this.missingRequiredCalls().length === 0;
|
|
1848
|
+
}
|
|
1774
1849
|
/** Sets the parameter type. */
|
|
1775
1850
|
type(type) {
|
|
1776
1851
|
this._type = type instanceof TypeTsDsl ? type : new TypeExprTsDsl(type);
|
|
1777
1852
|
return this;
|
|
1778
1853
|
}
|
|
1779
1854
|
toAst() {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1855
|
+
this.$validate();
|
|
1856
|
+
return ts.factory.createParameterDeclaration(this.$decorators(), void 0, this.$pattern() ?? this.name.toString(), this._optional ? this.$node(new TokenTsDsl().optional()) : void 0, this.$type(this._type), this.$value());
|
|
1857
|
+
}
|
|
1858
|
+
$validate() {
|
|
1859
|
+
const missing = this.missingRequiredCalls();
|
|
1860
|
+
if (missing.length === 0) return;
|
|
1861
|
+
throw new Error(`Parameter missing ${missing.join(" and ")}`);
|
|
1862
|
+
}
|
|
1863
|
+
missingRequiredCalls() {
|
|
1864
|
+
const missing = [];
|
|
1865
|
+
if (!this.$pattern() && !this.name.toString()) missing.push("name or pattern (.array()/.object())");
|
|
1866
|
+
return missing;
|
|
1783
1867
|
}
|
|
1784
1868
|
};
|
|
1785
1869
|
|
|
@@ -2094,6 +2178,10 @@ var ImplFuncTsDsl = class extends Mixed$35 {
|
|
|
2094
2178
|
ctx$1.popScope();
|
|
2095
2179
|
}
|
|
2096
2180
|
}
|
|
2181
|
+
/** Returns true when all required builder calls are present. */
|
|
2182
|
+
get isValid() {
|
|
2183
|
+
return this.missingRequiredCalls().length === 0;
|
|
2184
|
+
}
|
|
2097
2185
|
/** Switches the function to an arrow function form. */
|
|
2098
2186
|
arrow() {
|
|
2099
2187
|
this.mode = "arrow";
|
|
@@ -2110,9 +2198,9 @@ var ImplFuncTsDsl = class extends Mixed$35 {
|
|
|
2110
2198
|
return this;
|
|
2111
2199
|
}
|
|
2112
2200
|
toAst() {
|
|
2201
|
+
this.$validate();
|
|
2113
2202
|
const body = this.$node(new BlockTsDsl(...this._do).pretty());
|
|
2114
2203
|
if (this.mode === "decl") {
|
|
2115
|
-
if (!this.name.toString()) throw new Error("Function declaration requires a name");
|
|
2116
2204
|
const node$1 = ts.factory.createFunctionDeclaration([...this.$decorators(), ...this.modifiers], void 0, this.$node(this.name), this.$generics(), this.$params(), this.$returns(), body);
|
|
2117
2205
|
return this.$docs(node$1);
|
|
2118
2206
|
}
|
|
@@ -2123,6 +2211,16 @@ var ImplFuncTsDsl = class extends Mixed$35 {
|
|
|
2123
2211
|
const node = ts.factory.createArrowFunction(this.modifiers, this.$generics(), this.$params(), this.$returns(), void 0, body.statements.length === 1 && ts.isReturnStatement(body.statements[0]) && body.statements[0].expression ? body.statements[0].expression : body);
|
|
2124
2212
|
return this.$docs(node);
|
|
2125
2213
|
}
|
|
2214
|
+
$validate() {
|
|
2215
|
+
const missing = this.missingRequiredCalls();
|
|
2216
|
+
if (missing.length === 0) return;
|
|
2217
|
+
throw new Error(`Function ${this.mode} missing ${missing.join(" and ")}`);
|
|
2218
|
+
}
|
|
2219
|
+
missingRequiredCalls() {
|
|
2220
|
+
const missing = [];
|
|
2221
|
+
if (this.mode === "decl" && !this.name.toString()) missing.push("name");
|
|
2222
|
+
return missing;
|
|
2223
|
+
}
|
|
2126
2224
|
};
|
|
2127
2225
|
const FuncTsDsl = ImplFuncTsDsl;
|
|
2128
2226
|
|
|
@@ -2288,6 +2386,10 @@ var BinaryTsDsl = class extends Mixed$30 {
|
|
|
2288
2386
|
ctx$1.analyze(this._base);
|
|
2289
2387
|
ctx$1.analyze(this._expr);
|
|
2290
2388
|
}
|
|
2389
|
+
/** Returns true when all required builder calls are present. */
|
|
2390
|
+
get isValid() {
|
|
2391
|
+
return this.missingRequiredCalls().length === 0;
|
|
2392
|
+
}
|
|
2291
2393
|
/** Logical AND — `this && expr` */
|
|
2292
2394
|
and(expr) {
|
|
2293
2395
|
return this.opAndExpr("&&", expr);
|
|
@@ -2357,12 +2459,21 @@ var BinaryTsDsl = class extends Mixed$30 {
|
|
|
2357
2459
|
return this.opAndExpr("*", expr);
|
|
2358
2460
|
}
|
|
2359
2461
|
toAst() {
|
|
2360
|
-
|
|
2361
|
-
const expr = this.$node(this._expr);
|
|
2362
|
-
if (!expr) throw new Error("BinaryTsDsl: missing right-hand expression");
|
|
2462
|
+
this.$validate();
|
|
2363
2463
|
const base = this.$node(this._base);
|
|
2364
2464
|
const operator = typeof this._op === "string" ? this.opToToken(this._op) : this._op;
|
|
2365
|
-
return ts.factory.createBinaryExpression(base, operator,
|
|
2465
|
+
return ts.factory.createBinaryExpression(base, operator, this.$node(this._expr));
|
|
2466
|
+
}
|
|
2467
|
+
$validate() {
|
|
2468
|
+
const missing = this.missingRequiredCalls();
|
|
2469
|
+
if (missing.length === 0) return;
|
|
2470
|
+
throw new Error(`Binary expression missing ${missing.join(" and ")}`);
|
|
2471
|
+
}
|
|
2472
|
+
missingRequiredCalls() {
|
|
2473
|
+
const missing = [];
|
|
2474
|
+
if (!this._op) missing.push("operator (e.g., .eq(), .plus())");
|
|
2475
|
+
if (!this._expr) missing.push("right-hand expression");
|
|
2476
|
+
return missing;
|
|
2366
2477
|
}
|
|
2367
2478
|
/** Sets the binary operator and right-hand operand for this expression. */
|
|
2368
2479
|
opAndExpr(op, expr) {
|
|
@@ -2886,6 +2997,10 @@ var TernaryTsDsl = class extends Mixed$20 {
|
|
|
2886
2997
|
ctx$1.analyze(this._then);
|
|
2887
2998
|
ctx$1.analyze(this._else);
|
|
2888
2999
|
}
|
|
3000
|
+
/** Returns true when all required builder calls are present. */
|
|
3001
|
+
get isValid() {
|
|
3002
|
+
return this.missingRequiredCalls().length === 0;
|
|
3003
|
+
}
|
|
2889
3004
|
condition(condition) {
|
|
2890
3005
|
this._condition = condition;
|
|
2891
3006
|
return this;
|
|
@@ -2899,11 +3014,21 @@ var TernaryTsDsl = class extends Mixed$20 {
|
|
|
2899
3014
|
return this;
|
|
2900
3015
|
}
|
|
2901
3016
|
toAst() {
|
|
2902
|
-
|
|
2903
|
-
if (!this._then) throw new Error("Missing then expression in ternary");
|
|
2904
|
-
if (!this._else) throw new Error("Missing else expression in ternary");
|
|
3017
|
+
this.$validate();
|
|
2905
3018
|
return ts.factory.createConditionalExpression(this.$node(this._condition), void 0, this.$node(this._then), void 0, this.$node(this._else));
|
|
2906
3019
|
}
|
|
3020
|
+
$validate() {
|
|
3021
|
+
const missing = this.missingRequiredCalls();
|
|
3022
|
+
if (missing.length === 0) return;
|
|
3023
|
+
throw new Error(`Ternary expression missing ${missing.join(" and ")}`);
|
|
3024
|
+
}
|
|
3025
|
+
missingRequiredCalls() {
|
|
3026
|
+
const missing = [];
|
|
3027
|
+
if (!this._condition) missing.push(".condition()");
|
|
3028
|
+
if (!this._then) missing.push(".do()");
|
|
3029
|
+
if (!this._else) missing.push(".otherwise()");
|
|
3030
|
+
return missing;
|
|
3031
|
+
}
|
|
2907
3032
|
};
|
|
2908
3033
|
|
|
2909
3034
|
//#endregion
|
|
@@ -2981,6 +3106,10 @@ var IfTsDsl = class extends Mixed$18 {
|
|
|
2981
3106
|
}
|
|
2982
3107
|
}
|
|
2983
3108
|
}
|
|
3109
|
+
/** Returns true when all required builder calls are present. */
|
|
3110
|
+
get isValid() {
|
|
3111
|
+
return this.missingRequiredCalls().length === 0;
|
|
3112
|
+
}
|
|
2984
3113
|
condition(condition) {
|
|
2985
3114
|
this._condition = condition;
|
|
2986
3115
|
return this;
|
|
@@ -2990,10 +3119,20 @@ var IfTsDsl = class extends Mixed$18 {
|
|
|
2990
3119
|
return this;
|
|
2991
3120
|
}
|
|
2992
3121
|
toAst() {
|
|
2993
|
-
|
|
2994
|
-
if (!this._do) throw new Error("Missing then block in if");
|
|
3122
|
+
this.$validate();
|
|
2995
3123
|
return ts.factory.createIfStatement(this.$node(this._condition), this.$node(new BlockTsDsl(...this._do).pretty()), this._else ? this.$node(new BlockTsDsl(...this._else).pretty()) : void 0);
|
|
2996
3124
|
}
|
|
3125
|
+
$validate() {
|
|
3126
|
+
const missing = this.missingRequiredCalls();
|
|
3127
|
+
if (missing.length === 0) return;
|
|
3128
|
+
throw new Error(`If statement missing ${missing.join(" and ")}`);
|
|
3129
|
+
}
|
|
3130
|
+
missingRequiredCalls() {
|
|
3131
|
+
const missing = [];
|
|
3132
|
+
if (!this._condition) missing.push(".condition()");
|
|
3133
|
+
if (this._do.length === 0) missing.push(".do()");
|
|
3134
|
+
return missing;
|
|
3135
|
+
}
|
|
2997
3136
|
};
|
|
2998
3137
|
|
|
2999
3138
|
//#endregion
|
|
@@ -3088,6 +3227,10 @@ var TryTsDsl = class extends Mixed$15 {
|
|
|
3088
3227
|
}
|
|
3089
3228
|
}
|
|
3090
3229
|
}
|
|
3230
|
+
/** Returns true when all required builder calls are present. */
|
|
3231
|
+
get isValid() {
|
|
3232
|
+
return this.missingRequiredCalls().length === 0;
|
|
3233
|
+
}
|
|
3091
3234
|
catch(...items) {
|
|
3092
3235
|
this._catch = items;
|
|
3093
3236
|
return this;
|
|
@@ -3105,10 +3248,20 @@ var TryTsDsl = class extends Mixed$15 {
|
|
|
3105
3248
|
return this;
|
|
3106
3249
|
}
|
|
3107
3250
|
toAst() {
|
|
3108
|
-
|
|
3251
|
+
this.$validate();
|
|
3109
3252
|
const catchParam = this._catchArg ? this.$node(this._catchArg) : void 0;
|
|
3110
3253
|
return ts.factory.createTryStatement(this.$node(new BlockTsDsl(...this._try).pretty()), ts.factory.createCatchClause(catchParam ? ts.factory.createVariableDeclaration(catchParam) : void 0, this.$node(new BlockTsDsl(...this._catch ?? []).pretty())), this._finally ? this.$node(new BlockTsDsl(...this._finally).pretty()) : void 0);
|
|
3111
3254
|
}
|
|
3255
|
+
$validate() {
|
|
3256
|
+
const missing = this.missingRequiredCalls();
|
|
3257
|
+
if (missing.length === 0) return;
|
|
3258
|
+
throw new Error(`Try statement missing ${missing.join(" and ")}`);
|
|
3259
|
+
}
|
|
3260
|
+
missingRequiredCalls() {
|
|
3261
|
+
const missing = [];
|
|
3262
|
+
if (!this._try || this._try.length === 0) missing.push(".try()");
|
|
3263
|
+
return missing;
|
|
3264
|
+
}
|
|
3112
3265
|
};
|
|
3113
3266
|
|
|
3114
3267
|
//#endregion
|
|
@@ -3129,6 +3282,10 @@ var VarTsDsl = class extends Mixed$14 {
|
|
|
3129
3282
|
ctx$1.analyze(this.name);
|
|
3130
3283
|
ctx$1.analyze(this._type);
|
|
3131
3284
|
}
|
|
3285
|
+
/** Returns true when all required builder calls are present. */
|
|
3286
|
+
get isValid() {
|
|
3287
|
+
return this.missingRequiredCalls().length === 0;
|
|
3288
|
+
}
|
|
3132
3289
|
const() {
|
|
3133
3290
|
this.kind = ts.NodeFlags.Const;
|
|
3134
3291
|
return this;
|
|
@@ -3147,11 +3304,20 @@ var VarTsDsl = class extends Mixed$14 {
|
|
|
3147
3304
|
return this;
|
|
3148
3305
|
}
|
|
3149
3306
|
toAst() {
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
const node = ts.factory.createVariableStatement(this.modifiers, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(name, void 0, this.$type(this._type), this.$value())], this.kind));
|
|
3307
|
+
this.$validate();
|
|
3308
|
+
const node = ts.factory.createVariableStatement(this.modifiers, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(this.$pattern() ?? this.$node(this.name), void 0, this.$type(this._type), this.$value())], this.kind));
|
|
3153
3309
|
return this.$docs(this.$hint(node));
|
|
3154
3310
|
}
|
|
3311
|
+
$validate() {
|
|
3312
|
+
const missing = this.missingRequiredCalls();
|
|
3313
|
+
if (missing.length === 0) return;
|
|
3314
|
+
throw new Error(`Variable declaration missing ${missing.join(" and ")}`);
|
|
3315
|
+
}
|
|
3316
|
+
missingRequiredCalls() {
|
|
3317
|
+
const missing = [];
|
|
3318
|
+
if (!this.$pattern() && !this.name.toString()) missing.push("name or pattern (.array()/.object())");
|
|
3319
|
+
return missing;
|
|
3320
|
+
}
|
|
3155
3321
|
};
|
|
3156
3322
|
|
|
3157
3323
|
//#endregion
|
|
@@ -3173,16 +3339,31 @@ var TypeAliasTsDsl = class extends Mixed$13 {
|
|
|
3173
3339
|
ctx$1.analyze(this.name);
|
|
3174
3340
|
ctx$1.analyze(this.value);
|
|
3175
3341
|
}
|
|
3342
|
+
/** Returns true when all required builder calls are present. */
|
|
3343
|
+
get isValid() {
|
|
3344
|
+
return this.missingRequiredCalls().length === 0;
|
|
3345
|
+
}
|
|
3176
3346
|
/** Sets the type expression on the right-hand side of `= ...`. */
|
|
3177
3347
|
type(node) {
|
|
3178
3348
|
this.value = node;
|
|
3179
3349
|
return this;
|
|
3180
3350
|
}
|
|
3181
3351
|
toAst() {
|
|
3182
|
-
|
|
3352
|
+
this.$validate();
|
|
3183
3353
|
const node = ts.factory.createTypeAliasDeclaration(this.modifiers, this.$node(this.name), this.$generics(), this.$type(this.value));
|
|
3184
3354
|
return this.$docs(node);
|
|
3185
3355
|
}
|
|
3356
|
+
$validate() {
|
|
3357
|
+
const missing = this.missingRequiredCalls();
|
|
3358
|
+
if (missing.length === 0) return;
|
|
3359
|
+
const name = this.name.toString();
|
|
3360
|
+
throw new Error(`Type alias${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3361
|
+
}
|
|
3362
|
+
missingRequiredCalls() {
|
|
3363
|
+
const missing = [];
|
|
3364
|
+
if (!this.value) missing.push(".type()");
|
|
3365
|
+
return missing;
|
|
3366
|
+
}
|
|
3186
3367
|
};
|
|
3187
3368
|
|
|
3188
3369
|
//#endregion
|
|
@@ -3317,17 +3498,32 @@ var TypePropTsDsl = class extends Mixed$9 {
|
|
|
3317
3498
|
super.analyze(ctx$1);
|
|
3318
3499
|
ctx$1.analyze(this._type);
|
|
3319
3500
|
}
|
|
3501
|
+
/** Returns true when all required builder calls are present. */
|
|
3502
|
+
get isValid() {
|
|
3503
|
+
return this.missingRequiredCalls().length === 0;
|
|
3504
|
+
}
|
|
3320
3505
|
/** Sets the property type. */
|
|
3321
3506
|
type(type) {
|
|
3322
3507
|
this._type = ref(type);
|
|
3323
3508
|
return this;
|
|
3324
3509
|
}
|
|
3325
3510
|
toAst() {
|
|
3511
|
+
this.$validate();
|
|
3326
3512
|
const name = this.name.toString();
|
|
3327
|
-
if (!this._type || !name) throw new Error(`Type not specified for property '${name}'`);
|
|
3328
3513
|
const node = ts.factory.createPropertySignature(this.modifiers, this.$node(safePropName(name)), this._optional ? this.$node(new TokenTsDsl().optional()) : void 0, this.$type(this._type));
|
|
3329
3514
|
return this.$docs(node);
|
|
3330
3515
|
}
|
|
3516
|
+
$validate() {
|
|
3517
|
+
const missing = this.missingRequiredCalls();
|
|
3518
|
+
if (missing.length === 0) return;
|
|
3519
|
+
const name = this.name.toString();
|
|
3520
|
+
throw new Error(`Type property${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3521
|
+
}
|
|
3522
|
+
missingRequiredCalls() {
|
|
3523
|
+
const missing = [];
|
|
3524
|
+
if (!this._type) missing.push(".type()");
|
|
3525
|
+
return missing;
|
|
3526
|
+
}
|
|
3331
3527
|
};
|
|
3332
3528
|
|
|
3333
3529
|
//#endregion
|
|
@@ -3424,12 +3620,25 @@ var TypeFuncTsDsl = class extends Mixed$6 {
|
|
|
3424
3620
|
analyze(ctx$1) {
|
|
3425
3621
|
super.analyze(ctx$1);
|
|
3426
3622
|
}
|
|
3623
|
+
/** Returns true when all required builder calls are present. */
|
|
3624
|
+
get isValid() {
|
|
3625
|
+
return this.missingRequiredCalls().length === 0;
|
|
3626
|
+
}
|
|
3427
3627
|
toAst() {
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
const node = ts.factory.createFunctionTypeNode(this.$generics(), this.$params(), returns);
|
|
3628
|
+
this.$validate();
|
|
3629
|
+
const node = ts.factory.createFunctionTypeNode(this.$generics(), this.$params(), this.$returns());
|
|
3431
3630
|
return this.$docs(node);
|
|
3432
3631
|
}
|
|
3632
|
+
$validate() {
|
|
3633
|
+
const missing = this.missingRequiredCalls();
|
|
3634
|
+
if (missing.length === 0) return;
|
|
3635
|
+
throw new Error(`Function type missing ${missing.join(" and ")}`);
|
|
3636
|
+
}
|
|
3637
|
+
missingRequiredCalls() {
|
|
3638
|
+
const missing = [];
|
|
3639
|
+
if (this.$returns() === void 0) missing.push(".returns()");
|
|
3640
|
+
return missing;
|
|
3641
|
+
}
|
|
3433
3642
|
};
|
|
3434
3643
|
|
|
3435
3644
|
//#endregion
|
|
@@ -3450,6 +3659,10 @@ var TypeIdxTsDsl = class extends Mixed$5 {
|
|
|
3450
3659
|
ctx$1.analyze(this._base);
|
|
3451
3660
|
ctx$1.analyze(this._index);
|
|
3452
3661
|
}
|
|
3662
|
+
/** Returns true when all required builder calls are present. */
|
|
3663
|
+
get isValid() {
|
|
3664
|
+
return this.missingRequiredCalls().length === 0;
|
|
3665
|
+
}
|
|
3453
3666
|
base(base) {
|
|
3454
3667
|
this._base = base;
|
|
3455
3668
|
return this;
|
|
@@ -3459,8 +3672,20 @@ var TypeIdxTsDsl = class extends Mixed$5 {
|
|
|
3459
3672
|
return this;
|
|
3460
3673
|
}
|
|
3461
3674
|
toAst() {
|
|
3675
|
+
this.$validate();
|
|
3462
3676
|
return ts.factory.createIndexedAccessTypeNode(this.$type(this._base), this.$type(this._index));
|
|
3463
3677
|
}
|
|
3678
|
+
$validate() {
|
|
3679
|
+
const missing = this.missingRequiredCalls();
|
|
3680
|
+
if (missing.length === 0) return;
|
|
3681
|
+
throw new Error(`Indexed access type missing ${missing.join(" and ")}`);
|
|
3682
|
+
}
|
|
3683
|
+
missingRequiredCalls() {
|
|
3684
|
+
const missing = [];
|
|
3685
|
+
if (this._base === void 0) missing.push(".base()");
|
|
3686
|
+
if (this._index === void 0) missing.push(".index()");
|
|
3687
|
+
return missing;
|
|
3688
|
+
}
|
|
3464
3689
|
};
|
|
3465
3690
|
f.type.idx.set((...args) => new TypeIdxTsDsl(...args));
|
|
3466
3691
|
|
|
@@ -3751,7 +3976,7 @@ function astToString(node) {
|
|
|
3751
3976
|
return result;
|
|
3752
3977
|
}
|
|
3753
3978
|
}
|
|
3754
|
-
|
|
3979
|
+
function moduleSortKey({ file, fromFile, preferFileExtension, root }) {
|
|
3755
3980
|
const filePath = file.finalPath.split(path.sep).join("/");
|
|
3756
3981
|
let modulePath = fromFile.finalPath.split(path.sep).join("/");
|
|
3757
3982
|
if (fromFile.external && !path.isAbsolute(modulePath)) return [
|
|
@@ -3781,7 +4006,7 @@ const moduleSortKey = ({ file, fromFile, preferFileExtension, root }) => {
|
|
|
3781
4006
|
parentCount,
|
|
3782
4007
|
modulePath
|
|
3783
4008
|
];
|
|
3784
|
-
}
|
|
4009
|
+
}
|
|
3785
4010
|
|
|
3786
4011
|
//#endregion
|
|
3787
4012
|
//#region src/ts-dsl/utils/render.ts
|
|
@@ -4472,8 +4697,8 @@ function isInstance(plugin) {
|
|
|
4472
4697
|
return config.container === "class" && config.methods === "instance" && config.strategy !== "flat";
|
|
4473
4698
|
}
|
|
4474
4699
|
function attachComment$1(args) {
|
|
4475
|
-
const { node, operation } = args;
|
|
4476
|
-
return node.$if(createOperationComment(operation), (n, v) => n.doc(v));
|
|
4700
|
+
const { node, operation, plugin } = args;
|
|
4701
|
+
return node.$if(plugin.config.comments && createOperationComment(operation), (n, v) => n.doc(v));
|
|
4477
4702
|
}
|
|
4478
4703
|
function createShellMeta(node) {
|
|
4479
4704
|
return {
|
|
@@ -4614,7 +4839,8 @@ function toNode(model, plugin) {
|
|
|
4614
4839
|
}));
|
|
4615
4840
|
node$1 = attachComment$1({
|
|
4616
4841
|
node: node$1,
|
|
4617
|
-
operation
|
|
4842
|
+
operation,
|
|
4843
|
+
plugin
|
|
4618
4844
|
});
|
|
4619
4845
|
nodes$1.push(node$1);
|
|
4620
4846
|
exampleIntent(node$1, operation, plugin);
|
|
@@ -4634,7 +4860,8 @@ function toNode(model, plugin) {
|
|
|
4634
4860
|
const method = implementFn({
|
|
4635
4861
|
node: $.method(createFnSymbol(plugin, item), (m) => attachComment$1({
|
|
4636
4862
|
node: m,
|
|
4637
|
-
operation
|
|
4863
|
+
operation,
|
|
4864
|
+
plugin
|
|
4638
4865
|
}).public().static(!isAngularClient && !isInstance(plugin))),
|
|
4639
4866
|
operation,
|
|
4640
4867
|
plugin
|
|
@@ -4694,8 +4921,8 @@ function hasOperationSse({ operation }) {
|
|
|
4694
4921
|
//#region src/plugins/@angular/common/shared/node.ts
|
|
4695
4922
|
const source = globalThis.Symbol("@angular/common");
|
|
4696
4923
|
function attachComment(args) {
|
|
4697
|
-
const { node, operation } = args;
|
|
4698
|
-
return node.$if(createOperationComment(operation), (n, v) => n.doc(v));
|
|
4924
|
+
const { node, operation, plugin } = args;
|
|
4925
|
+
return node.$if(plugin.config.comments && createOperationComment(operation), (n, v) => n.doc(v));
|
|
4699
4926
|
}
|
|
4700
4927
|
function createHttpRequestFnMeta(operation) {
|
|
4701
4928
|
return {
|
|
@@ -4841,7 +5068,8 @@ function toHttpRequestNode(model, plugin) {
|
|
|
4841
5068
|
}));
|
|
4842
5069
|
node$1 = attachComment({
|
|
4843
5070
|
node: node$1,
|
|
4844
|
-
operation
|
|
5071
|
+
operation,
|
|
5072
|
+
plugin
|
|
4845
5073
|
});
|
|
4846
5074
|
nodes$1.push(node$1);
|
|
4847
5075
|
}
|
|
@@ -4858,7 +5086,8 @@ function toHttpRequestNode(model, plugin) {
|
|
|
4858
5086
|
node.do(implementHttpRequestFn({
|
|
4859
5087
|
node: $.method(createHttpRequestFnSymbol(plugin, item), (m) => attachComment({
|
|
4860
5088
|
node: m,
|
|
4861
|
-
operation
|
|
5089
|
+
operation,
|
|
5090
|
+
plugin
|
|
4862
5091
|
}).public()),
|
|
4863
5092
|
operation,
|
|
4864
5093
|
plugin
|
|
@@ -4887,7 +5116,8 @@ function toHttpResourceNode(model, plugin) {
|
|
|
4887
5116
|
}));
|
|
4888
5117
|
node$1 = attachComment({
|
|
4889
5118
|
node: node$1,
|
|
4890
|
-
operation
|
|
5119
|
+
operation,
|
|
5120
|
+
plugin
|
|
4891
5121
|
});
|
|
4892
5122
|
nodes$1.push(node$1);
|
|
4893
5123
|
}
|
|
@@ -4904,7 +5134,8 @@ function toHttpResourceNode(model, plugin) {
|
|
|
4904
5134
|
node.do(implementHttpResourceFn({
|
|
4905
5135
|
node: $.method(createHttpResourceFnSymbol(plugin, item), (m) => attachComment({
|
|
4906
5136
|
node: m,
|
|
4907
|
-
operation
|
|
5137
|
+
operation,
|
|
5138
|
+
plugin
|
|
4908
5139
|
}).public()),
|
|
4909
5140
|
operation,
|
|
4910
5141
|
plugin
|
|
@@ -5005,7 +5236,10 @@ const handler$11 = ({ plugin }) => {
|
|
|
5005
5236
|
//#endregion
|
|
5006
5237
|
//#region src/plugins/@angular/common/config.ts
|
|
5007
5238
|
const defaultConfig$23 = {
|
|
5008
|
-
config: {
|
|
5239
|
+
config: {
|
|
5240
|
+
comments: true,
|
|
5241
|
+
includeInEntry: false
|
|
5242
|
+
},
|
|
5009
5243
|
dependencies: ["@hey-api/client-angular", "@hey-api/sdk"],
|
|
5010
5244
|
handler: handler$11,
|
|
5011
5245
|
name: "@angular/common",
|
|
@@ -5032,7 +5266,7 @@ const defaultConfig$22 = {
|
|
|
5032
5266
|
api: new Api$4(),
|
|
5033
5267
|
config: {
|
|
5034
5268
|
case: "camelCase",
|
|
5035
|
-
|
|
5269
|
+
includeInEntry: false
|
|
5036
5270
|
},
|
|
5037
5271
|
handler: () => {},
|
|
5038
5272
|
name: "@faker-js/faker",
|
|
@@ -5063,7 +5297,7 @@ const defineConfig$22 = definePluginConfig(defaultConfig$22);
|
|
|
5063
5297
|
const clientDefaultConfig = {
|
|
5064
5298
|
baseUrl: true,
|
|
5065
5299
|
bundle: true,
|
|
5066
|
-
|
|
5300
|
+
includeInEntry: false
|
|
5067
5301
|
};
|
|
5068
5302
|
const clientDefaultMeta = {
|
|
5069
5303
|
dependencies: ["@hey-api/typescript"],
|
|
@@ -5074,8 +5308,14 @@ const clientDefaultMeta = {
|
|
|
5074
5308
|
//#region src/generate/client.ts
|
|
5075
5309
|
const __filename = fileURLToPath(import.meta.url);
|
|
5076
5310
|
const __dirname = path.dirname(__filename);
|
|
5311
|
+
/**
|
|
5312
|
+
* Dev mode: 'src' appears after 'dist' (or dist doesn't exist), and 'generate' follows 'src'
|
|
5313
|
+
*/
|
|
5077
5314
|
function isDevMode() {
|
|
5078
|
-
|
|
5315
|
+
const normalized = __dirname.split(path.sep);
|
|
5316
|
+
const srcIndex = normalized.lastIndexOf("src");
|
|
5317
|
+
const distIndex = normalized.lastIndexOf("dist");
|
|
5318
|
+
return srcIndex !== -1 && srcIndex > distIndex && srcIndex === normalized.length - 2 && normalized[srcIndex + 1] === "generate";
|
|
5079
5319
|
}
|
|
5080
5320
|
/**
|
|
5081
5321
|
* Returns paths to client bundle files based on execution context
|
|
@@ -5653,7 +5893,7 @@ const handler$10 = ({ plugin }) => {
|
|
|
5653
5893
|
//#region src/plugins/@hey-api/schemas/config.ts
|
|
5654
5894
|
const defaultConfig$14 = {
|
|
5655
5895
|
config: {
|
|
5656
|
-
|
|
5896
|
+
includeInEntry: false,
|
|
5657
5897
|
nameBuilder: (name) => `${name}Schema`,
|
|
5658
5898
|
type: "json"
|
|
5659
5899
|
},
|
|
@@ -5963,7 +6203,8 @@ const defaultConfig$13 = {
|
|
|
5963
6203
|
config: {
|
|
5964
6204
|
auth: true,
|
|
5965
6205
|
client: true,
|
|
5966
|
-
|
|
6206
|
+
comments: true,
|
|
6207
|
+
includeInEntry: true,
|
|
5967
6208
|
paramsStructure: "grouped",
|
|
5968
6209
|
responseStyle: "fields",
|
|
5969
6210
|
transformer: false,
|
|
@@ -6183,7 +6424,7 @@ const defaultConfig$12 = {
|
|
|
6183
6424
|
config: {
|
|
6184
6425
|
bigInt: true,
|
|
6185
6426
|
dates: true,
|
|
6186
|
-
|
|
6427
|
+
includeInEntry: false,
|
|
6187
6428
|
transformers: [],
|
|
6188
6429
|
typeTransformers: []
|
|
6189
6430
|
},
|
|
@@ -6284,10 +6525,10 @@ const exportType = ({ plugin, schema, state, type }) => {
|
|
|
6284
6525
|
tags: fromRef(state.tags),
|
|
6285
6526
|
tool: "typescript"
|
|
6286
6527
|
} });
|
|
6287
|
-
const objectNode = $.const(symbolObject).export().$if(createSchemaComment(schema), (c, v) => c.doc(v)).assign($.object(...enumObject.obj.map((item) => $.prop({
|
|
6528
|
+
const objectNode = $.const(symbolObject).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).assign($.object(...enumObject.obj.map((item) => $.prop({
|
|
6288
6529
|
kind: "prop",
|
|
6289
6530
|
name: item.key
|
|
6290
|
-
}).$if(createSchemaComment(item.schema), (p, v) => p.doc(v)).value($.fromValue(item.schema.const)))).as("const"));
|
|
6531
|
+
}).$if(plugin.config.comments && createSchemaComment(item.schema), (p, v) => p.doc(v)).value($.fromValue(item.schema.const)))).as("const"));
|
|
6291
6532
|
plugin.node(objectNode);
|
|
6292
6533
|
const symbol$1 = plugin.symbol(applyNaming(refToName($ref), plugin.config.definitions), { meta: {
|
|
6293
6534
|
category: "type",
|
|
@@ -6297,7 +6538,7 @@ const exportType = ({ plugin, schema, state, type }) => {
|
|
|
6297
6538
|
tags: fromRef(state.tags),
|
|
6298
6539
|
tool: "typescript"
|
|
6299
6540
|
} });
|
|
6300
|
-
const node$1 = $.type.alias(symbol$1).export().$if(createSchemaComment(schema), (t, v) => t.doc(v)).type($.type(symbol$1).idx($.type(symbol$1).typeofType().keyof()).typeofType());
|
|
6541
|
+
const node$1 = $.type.alias(symbol$1).export().$if(plugin.config.comments && createSchemaComment(schema), (t, v) => t.doc(v)).type($.type(symbol$1).idx($.type(symbol$1).typeofType().keyof()).typeofType());
|
|
6301
6542
|
plugin.node(node$1);
|
|
6302
6543
|
return;
|
|
6303
6544
|
} else if (plugin.config.enums.mode === "typescript" || plugin.config.enums.mode === "typescript-const") {
|
|
@@ -6310,7 +6551,7 @@ const exportType = ({ plugin, schema, state, type }) => {
|
|
|
6310
6551
|
tags: fromRef(state.tags),
|
|
6311
6552
|
tool: "typescript"
|
|
6312
6553
|
} });
|
|
6313
|
-
const enumNode = $.enum(symbol$1).export().$if(createSchemaComment(schema), (e, v) => e.doc(v)).const(plugin.config.enums.mode === "typescript-const").members(...enumObject.obj.map((item) => $.member(item.key).$if(createSchemaComment(item.schema), (m, v) => m.doc(v)).value($.fromValue(item.schema.const))));
|
|
6554
|
+
const enumNode = $.enum(symbol$1).export().$if(plugin.config.comments && createSchemaComment(schema), (e, v) => e.doc(v)).const(plugin.config.enums.mode === "typescript-const").members(...enumObject.obj.map((item) => $.member(item.key).$if(plugin.config.comments && createSchemaComment(item.schema), (m, v) => m.doc(v)).value($.fromValue(item.schema.const))));
|
|
6314
6555
|
plugin.node(enumNode);
|
|
6315
6556
|
return;
|
|
6316
6557
|
}
|
|
@@ -6324,7 +6565,7 @@ const exportType = ({ plugin, schema, state, type }) => {
|
|
|
6324
6565
|
tags: fromRef(state.tags),
|
|
6325
6566
|
tool: "typescript"
|
|
6326
6567
|
} });
|
|
6327
|
-
const node = $.type.alias(symbol).export().$if(createSchemaComment(schema), (t, v) => t.doc(v)).type(type);
|
|
6568
|
+
const node = $.type.alias(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (t, v) => t.doc(v)).type(type);
|
|
6328
6569
|
plugin.node(node);
|
|
6329
6570
|
};
|
|
6330
6571
|
|
|
@@ -6484,7 +6725,7 @@ const operationToDataType = ({ operation, plugin, state }) => {
|
|
|
6484
6725
|
tags: fromRef(state.tags),
|
|
6485
6726
|
tool: "typescript"
|
|
6486
6727
|
} });
|
|
6487
|
-
const node$1 = $.type.alias(symbolWebhookPayload).export().$if(createSchemaComment(operation.body.schema), (t, v) => t.doc(v)).type(irSchemaToAst$5({
|
|
6728
|
+
const node$1 = $.type.alias(symbolWebhookPayload).export().$if(plugin.config.comments && createSchemaComment(operation.body.schema), (t, v) => t.doc(v)).type(irSchemaToAst$5({
|
|
6488
6729
|
plugin,
|
|
6489
6730
|
schema: operation.body.schema,
|
|
6490
6731
|
state
|
|
@@ -6618,7 +6859,7 @@ const objectToAst$5 = ({ plugin, schema, state }) => {
|
|
|
6618
6859
|
}
|
|
6619
6860
|
});
|
|
6620
6861
|
const isRequired = required.includes(name);
|
|
6621
|
-
shape.prop(name, (p) => p.$if(createSchemaComment(property), (p$1, v) => p$1.doc(v)).readonly(property.accessScope === "read").required(isRequired).type(propertyType));
|
|
6862
|
+
shape.prop(name, (p) => p.$if(plugin.config.comments && createSchemaComment(property), (p$1, v) => p$1.doc(v)).readonly(property.accessScope === "read").required(isRequired).type(propertyType));
|
|
6622
6863
|
indexSchemas.push(property);
|
|
6623
6864
|
if (!isRequired) hasOptionalProperties = true;
|
|
6624
6865
|
}
|
|
@@ -6953,7 +7194,8 @@ const defaultConfig$11 = {
|
|
|
6953
7194
|
api: new Api$3(),
|
|
6954
7195
|
config: {
|
|
6955
7196
|
case: "PascalCase",
|
|
6956
|
-
|
|
7197
|
+
comments: true,
|
|
7198
|
+
includeInEntry: true,
|
|
6957
7199
|
topType: "unknown"
|
|
6958
7200
|
},
|
|
6959
7201
|
handler: handler$7,
|
|
@@ -7325,7 +7567,7 @@ const defaultConfig$10 = {
|
|
|
7325
7567
|
config: {
|
|
7326
7568
|
case: "camelCase",
|
|
7327
7569
|
comments: true,
|
|
7328
|
-
|
|
7570
|
+
includeInEntry: false
|
|
7329
7571
|
},
|
|
7330
7572
|
dependencies: ["@hey-api/typescript", "@hey-api/sdk"],
|
|
7331
7573
|
handler: handler$6,
|
|
@@ -7779,7 +8021,7 @@ const defaultConfig$9 = {
|
|
|
7779
8021
|
config: {
|
|
7780
8022
|
case: "camelCase",
|
|
7781
8023
|
comments: true,
|
|
7782
|
-
|
|
8024
|
+
includeInEntry: false
|
|
7783
8025
|
},
|
|
7784
8026
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
7785
8027
|
handler: handler$5,
|
|
@@ -7866,7 +8108,7 @@ const defaultConfig$8 = {
|
|
|
7866
8108
|
config: {
|
|
7867
8109
|
case: "camelCase",
|
|
7868
8110
|
comments: true,
|
|
7869
|
-
|
|
8111
|
+
includeInEntry: false
|
|
7870
8112
|
},
|
|
7871
8113
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
7872
8114
|
handler: handler$5,
|
|
@@ -7982,7 +8224,7 @@ const defaultConfig$7 = {
|
|
|
7982
8224
|
config: {
|
|
7983
8225
|
case: "camelCase",
|
|
7984
8226
|
comments: true,
|
|
7985
|
-
|
|
8227
|
+
includeInEntry: false
|
|
7986
8228
|
},
|
|
7987
8229
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
7988
8230
|
handler: handler$5,
|
|
@@ -8069,7 +8311,7 @@ const defaultConfig$6 = {
|
|
|
8069
8311
|
config: {
|
|
8070
8312
|
case: "camelCase",
|
|
8071
8313
|
comments: true,
|
|
8072
|
-
|
|
8314
|
+
includeInEntry: false
|
|
8073
8315
|
},
|
|
8074
8316
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8075
8317
|
handler: handler$5,
|
|
@@ -8156,7 +8398,7 @@ const defaultConfig$5 = {
|
|
|
8156
8398
|
config: {
|
|
8157
8399
|
case: "camelCase",
|
|
8158
8400
|
comments: true,
|
|
8159
|
-
|
|
8401
|
+
includeInEntry: false
|
|
8160
8402
|
},
|
|
8161
8403
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8162
8404
|
handler: handler$5,
|
|
@@ -8648,7 +8890,7 @@ const defaultConfig$4 = {
|
|
|
8648
8890
|
config: {
|
|
8649
8891
|
case: "PascalCase",
|
|
8650
8892
|
comments: true,
|
|
8651
|
-
|
|
8893
|
+
includeInEntry: false,
|
|
8652
8894
|
metadata: false
|
|
8653
8895
|
},
|
|
8654
8896
|
handler: handler$4,
|
|
@@ -8911,7 +9153,7 @@ const handler$3 = ({ plugin }) => {
|
|
|
8911
9153
|
//#endregion
|
|
8912
9154
|
//#region src/plugins/fastify/config.ts
|
|
8913
9155
|
const defaultConfig$3 = {
|
|
8914
|
-
config: {
|
|
9156
|
+
config: { includeInEntry: false },
|
|
8915
9157
|
dependencies: ["@hey-api/typescript"],
|
|
8916
9158
|
handler: handler$3,
|
|
8917
9159
|
name: "fastify"
|
|
@@ -8971,7 +9213,7 @@ const defaultConfig$2 = {
|
|
|
8971
9213
|
config: {
|
|
8972
9214
|
case: "camelCase",
|
|
8973
9215
|
comments: true,
|
|
8974
|
-
|
|
9216
|
+
includeInEntry: false
|
|
8975
9217
|
},
|
|
8976
9218
|
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
8977
9219
|
handler: handler$2,
|
|
@@ -10391,7 +10633,7 @@ const defaultConfig$1 = {
|
|
|
10391
10633
|
config: {
|
|
10392
10634
|
case: "camelCase",
|
|
10393
10635
|
comments: true,
|
|
10394
|
-
|
|
10636
|
+
includeInEntry: false,
|
|
10395
10637
|
metadata: false
|
|
10396
10638
|
},
|
|
10397
10639
|
handler: handler$1,
|
|
@@ -13177,7 +13419,7 @@ const defaultConfig = {
|
|
|
13177
13419
|
config: {
|
|
13178
13420
|
case: "camelCase",
|
|
13179
13421
|
comments: true,
|
|
13180
|
-
|
|
13422
|
+
includeInEntry: false,
|
|
13181
13423
|
metadata: false
|
|
13182
13424
|
},
|
|
13183
13425
|
handler,
|
|
@@ -13587,4 +13829,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
13587
13829
|
|
|
13588
13830
|
//#endregion
|
|
13589
13831
|
export { postProcessors as _, clientDefaultConfig as a, TypeScriptRenderer as c, reserved as d, keywords as f, getTypedConfig as g, getClientPlugin as h, generateClientBundle as i, TsDslContext as l, TsDsl as m, defaultPlugins as n, clientDefaultMeta as o, regexp as p, clientPluginHandler as r, $ as s, resolveJobs as t, ctx as u };
|
|
13590
|
-
//# sourceMappingURL=init-
|
|
13832
|
+
//# sourceMappingURL=init-DlaW5Djq.mjs.map
|