@hey-api/openapi-ts 0.94.4 → 0.94.5
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 +8 -7
- package/dist/clients/angular/utils.ts +1 -1
- package/dist/clients/axios/utils.ts +2 -2
- package/dist/clients/core/types.ts +1 -1
- package/dist/clients/core/utils.ts +1 -1
- package/dist/clients/fetch/utils.ts +1 -1
- package/dist/clients/next/utils.ts +1 -1
- package/dist/clients/nuxt/utils.ts +1 -1
- package/dist/clients/ofetch/utils.ts +1 -1
- package/dist/index.d.mts +246 -159
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-B4xCXgH4.mjs → init-DXg2DSyt.mjs} +423 -374
- package/dist/init-DXg2DSyt.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +5 -5
- package/dist/run.mjs.map +1 -1
- package/dist/{src-B7Bwskcz.mjs → src-onOyaUFS.mjs} +3 -3
- package/dist/src-onOyaUFS.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/init-B4xCXgH4.mjs.map +0 -1
- package/dist/src-B7Bwskcz.mjs.map +0 -1
|
@@ -538,8 +538,8 @@ var TypeTsDsl = class extends TsDsl {};
|
|
|
538
538
|
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/ts-dsl/expr/id.ts
|
|
541
|
-
const Mixed$
|
|
542
|
-
var IdTsDsl = class extends Mixed$
|
|
541
|
+
const Mixed$54 = TsDsl;
|
|
542
|
+
var IdTsDsl = class extends Mixed$54 {
|
|
543
543
|
"~dsl" = "IdTsDsl";
|
|
544
544
|
constructor(name) {
|
|
545
545
|
super();
|
|
@@ -594,8 +594,8 @@ function ArgsMixin(Base) {
|
|
|
594
594
|
|
|
595
595
|
//#endregion
|
|
596
596
|
//#region src/ts-dsl/expr/prefix.ts
|
|
597
|
-
const Mixed$
|
|
598
|
-
var PrefixTsDsl = class extends Mixed$
|
|
597
|
+
const Mixed$53 = TsDsl;
|
|
598
|
+
var PrefixTsDsl = class extends Mixed$53 {
|
|
599
599
|
"~dsl" = "PrefixTsDsl";
|
|
600
600
|
_expr;
|
|
601
601
|
_op;
|
|
@@ -610,7 +610,7 @@ var PrefixTsDsl = class extends Mixed$51 {
|
|
|
610
610
|
}
|
|
611
611
|
/** Returns true when all required builder calls are present. */
|
|
612
612
|
get isValid() {
|
|
613
|
-
return this.missingRequiredCalls().length
|
|
613
|
+
return !this.missingRequiredCalls().length;
|
|
614
614
|
}
|
|
615
615
|
/** Sets the operand (the expression being prefixed). */
|
|
616
616
|
expr(expr) {
|
|
@@ -627,7 +627,7 @@ var PrefixTsDsl = class extends Mixed$51 {
|
|
|
627
627
|
this._op = ts.SyntaxKind.ExclamationToken;
|
|
628
628
|
return this;
|
|
629
629
|
}
|
|
630
|
-
/** Sets the operator (e.g
|
|
630
|
+
/** Sets the operator (e.g., `ts.SyntaxKind.ExclamationToken` for `!`). */
|
|
631
631
|
op(op) {
|
|
632
632
|
this._op = op;
|
|
633
633
|
return this;
|
|
@@ -638,7 +638,7 @@ var PrefixTsDsl = class extends Mixed$51 {
|
|
|
638
638
|
}
|
|
639
639
|
$validate() {
|
|
640
640
|
const missing = this.missingRequiredCalls();
|
|
641
|
-
if (missing.length
|
|
641
|
+
if (!missing.length) return;
|
|
642
642
|
throw new Error(`Prefix unary expression missing ${missing.join(" and ")}`);
|
|
643
643
|
}
|
|
644
644
|
missingRequiredCalls() {
|
|
@@ -694,8 +694,8 @@ function AsMixin(Base) {
|
|
|
694
694
|
|
|
695
695
|
//#endregion
|
|
696
696
|
//#region src/ts-dsl/expr/literal.ts
|
|
697
|
-
const Mixed$
|
|
698
|
-
var LiteralTsDsl = class extends Mixed$
|
|
697
|
+
const Mixed$52 = AsMixin(TsDsl);
|
|
698
|
+
var LiteralTsDsl = class extends Mixed$52 {
|
|
699
699
|
"~dsl" = "LiteralTsDsl";
|
|
700
700
|
value;
|
|
701
701
|
constructor(value) {
|
|
@@ -984,8 +984,8 @@ const safeTypeName = (name) => safeName(name, reserved.type);
|
|
|
984
984
|
|
|
985
985
|
//#endregion
|
|
986
986
|
//#region src/ts-dsl/decl/decorator.ts
|
|
987
|
-
const Mixed$
|
|
988
|
-
var DecoratorTsDsl = class extends Mixed$
|
|
987
|
+
const Mixed$51 = ArgsMixin(TsDsl);
|
|
988
|
+
var DecoratorTsDsl = class extends Mixed$51 {
|
|
989
989
|
"~dsl" = "DecoratorTsDsl";
|
|
990
990
|
nameSanitizer = safeRuntimeName;
|
|
991
991
|
constructor(name, ...args) {
|
|
@@ -1036,7 +1036,7 @@ function accessChainToNode(accessChain) {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
function getAccessChainForNode(node) {
|
|
1038
1038
|
const accessChain = structuralToAccessChain([...getStructuralChainForNode(node, /* @__PURE__ */ new Set())]);
|
|
1039
|
-
if (accessChain.length
|
|
1039
|
+
if (!accessChain.length) return [node.clone()];
|
|
1040
1040
|
return accessChain.map((node) => node.clone());
|
|
1041
1041
|
}
|
|
1042
1042
|
function getScope(node) {
|
|
@@ -1049,7 +1049,7 @@ function getStructuralChainForNode(node, visited) {
|
|
|
1049
1049
|
if (node.structuralParents) for (const [parent] of node.structuralParents) {
|
|
1050
1050
|
if (getScope(parent) !== getScope(node)) continue;
|
|
1051
1051
|
const chain = getStructuralChainForNode(parent, visited);
|
|
1052
|
-
if (chain.length
|
|
1052
|
+
if (chain.length) return [...chain, node];
|
|
1053
1053
|
}
|
|
1054
1054
|
if (!node.root) return [];
|
|
1055
1055
|
return [node];
|
|
@@ -1263,7 +1263,7 @@ function AbstractMixin(Base) {
|
|
|
1263
1263
|
const Mixed = ModifiersMixin(Base);
|
|
1264
1264
|
class Abstract extends Mixed {
|
|
1265
1265
|
abstract(condition) {
|
|
1266
|
-
const cond = arguments.length
|
|
1266
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1267
1267
|
return this._m("abstract", cond);
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
@@ -1276,7 +1276,7 @@ function AsyncMixin(Base) {
|
|
|
1276
1276
|
const Mixed = ModifiersMixin(Base);
|
|
1277
1277
|
class Async extends Mixed {
|
|
1278
1278
|
async(condition) {
|
|
1279
|
-
const cond = arguments.length
|
|
1279
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1280
1280
|
return this._m("async", cond);
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
@@ -1289,7 +1289,7 @@ function ConstMixin(Base) {
|
|
|
1289
1289
|
const Mixed = ModifiersMixin(Base);
|
|
1290
1290
|
class Const extends Mixed {
|
|
1291
1291
|
const(condition) {
|
|
1292
|
-
const cond = arguments.length
|
|
1292
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1293
1293
|
return this._m("const", cond);
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
@@ -1308,7 +1308,7 @@ function DefaultMixin(Base) {
|
|
|
1308
1308
|
* @returns The target object for chaining.
|
|
1309
1309
|
*/
|
|
1310
1310
|
default(condition) {
|
|
1311
|
-
const cond = arguments.length
|
|
1311
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1312
1312
|
return this._m("default", cond);
|
|
1313
1313
|
}
|
|
1314
1314
|
}
|
|
@@ -1327,7 +1327,7 @@ function ExportMixin(Base) {
|
|
|
1327
1327
|
* @returns The target object for chaining.
|
|
1328
1328
|
*/
|
|
1329
1329
|
export(condition) {
|
|
1330
|
-
const cond = arguments.length
|
|
1330
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1331
1331
|
this.exported = cond;
|
|
1332
1332
|
if (this.symbol) this.symbol.setExported(cond);
|
|
1333
1333
|
return this._m("export", cond);
|
|
@@ -1342,7 +1342,7 @@ function PrivateMixin(Base) {
|
|
|
1342
1342
|
const Mixed = ModifiersMixin(Base);
|
|
1343
1343
|
class Private extends Mixed {
|
|
1344
1344
|
private(condition) {
|
|
1345
|
-
const cond = arguments.length
|
|
1345
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1346
1346
|
return this._m("private", cond);
|
|
1347
1347
|
}
|
|
1348
1348
|
}
|
|
@@ -1355,7 +1355,7 @@ function ProtectedMixin(Base) {
|
|
|
1355
1355
|
const Mixed = ModifiersMixin(Base);
|
|
1356
1356
|
class Protected extends Mixed {
|
|
1357
1357
|
protected(condition) {
|
|
1358
|
-
const cond = arguments.length
|
|
1358
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1359
1359
|
return this._m("protected", cond);
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
@@ -1368,7 +1368,7 @@ function PublicMixin(Base) {
|
|
|
1368
1368
|
const Mixed = ModifiersMixin(Base);
|
|
1369
1369
|
class Public extends Mixed {
|
|
1370
1370
|
public(condition) {
|
|
1371
|
-
const cond = arguments.length
|
|
1371
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1372
1372
|
return this._m("public", cond);
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
@@ -1381,7 +1381,7 @@ function ReadonlyMixin(Base) {
|
|
|
1381
1381
|
const Mixed = ModifiersMixin(Base);
|
|
1382
1382
|
class Readonly extends Mixed {
|
|
1383
1383
|
readonly(condition) {
|
|
1384
|
-
const cond = arguments.length
|
|
1384
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1385
1385
|
return this._m("readonly", cond);
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
@@ -1394,7 +1394,7 @@ function StaticMixin(Base) {
|
|
|
1394
1394
|
const Mixed = ModifiersMixin(Base);
|
|
1395
1395
|
class Static extends Mixed {
|
|
1396
1396
|
static(condition) {
|
|
1397
|
-
const cond = arguments.length
|
|
1397
|
+
const cond = !arguments.length ? true : Boolean(condition);
|
|
1398
1398
|
return this._m("static", cond);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
@@ -1403,8 +1403,8 @@ function StaticMixin(Base) {
|
|
|
1403
1403
|
|
|
1404
1404
|
//#endregion
|
|
1405
1405
|
//#region src/ts-dsl/type/param.ts
|
|
1406
|
-
const Mixed$
|
|
1407
|
-
var TypeParamTsDsl = class extends Mixed$
|
|
1406
|
+
const Mixed$50 = TsDsl;
|
|
1407
|
+
var TypeParamTsDsl = class extends Mixed$50 {
|
|
1408
1408
|
"~dsl" = "TypeParamTsDsl";
|
|
1409
1409
|
scope = "type";
|
|
1410
1410
|
constraint;
|
|
@@ -1472,11 +1472,11 @@ function OptionalMixin(Base) {
|
|
|
1472
1472
|
super.analyze(ctx);
|
|
1473
1473
|
}
|
|
1474
1474
|
optional(condition) {
|
|
1475
|
-
this._optional = arguments.length
|
|
1475
|
+
this._optional = !arguments.length ? true : Boolean(condition);
|
|
1476
1476
|
return this;
|
|
1477
1477
|
}
|
|
1478
1478
|
required(condition) {
|
|
1479
|
-
this._optional = arguments.length
|
|
1479
|
+
this._optional = !arguments.length ? false : !condition;
|
|
1480
1480
|
return this;
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
@@ -1543,7 +1543,7 @@ var TokenTsDsl = class extends TsDsl {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
$validate() {
|
|
1545
1545
|
const missing = this.missingRequiredCalls();
|
|
1546
|
-
if (missing.length
|
|
1546
|
+
if (!missing.length) return;
|
|
1547
1547
|
throw new Error(`Token missing ${missing.join(" and ")}`);
|
|
1548
1548
|
}
|
|
1549
1549
|
missingRequiredCalls() {
|
|
@@ -1553,7 +1553,7 @@ var TokenTsDsl = class extends TsDsl {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
/** Returns true when all required builder calls are present. */
|
|
1555
1555
|
get isValid() {
|
|
1556
|
-
return this.missingRequiredCalls().length
|
|
1556
|
+
return !this.missingRequiredCalls().length;
|
|
1557
1557
|
}
|
|
1558
1558
|
};
|
|
1559
1559
|
|
|
@@ -1615,8 +1615,8 @@ function TypeExprMixin(Base) {
|
|
|
1615
1615
|
|
|
1616
1616
|
//#endregion
|
|
1617
1617
|
//#region src/ts-dsl/type/attr.ts
|
|
1618
|
-
const Mixed$
|
|
1619
|
-
var TypeAttrTsDsl = class extends Mixed$
|
|
1618
|
+
const Mixed$49 = TypeExprMixin(TsDsl);
|
|
1619
|
+
var TypeAttrTsDsl = class extends Mixed$49 {
|
|
1620
1620
|
"~dsl" = "TypeAttrTsDsl";
|
|
1621
1621
|
scope = "type";
|
|
1622
1622
|
_base;
|
|
@@ -1638,7 +1638,7 @@ var TypeAttrTsDsl = class extends Mixed$47 {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
/** Returns true when all required builder calls are present. */
|
|
1640
1640
|
get isValid() {
|
|
1641
|
-
return this.missingRequiredCalls().length
|
|
1641
|
+
return !this.missingRequiredCalls().length;
|
|
1642
1642
|
}
|
|
1643
1643
|
base(base) {
|
|
1644
1644
|
if (isRef(base)) this._base = base;
|
|
@@ -1657,7 +1657,7 @@ var TypeAttrTsDsl = class extends Mixed$47 {
|
|
|
1657
1657
|
}
|
|
1658
1658
|
$validate() {
|
|
1659
1659
|
const missing = this.missingRequiredCalls();
|
|
1660
|
-
if (missing.length
|
|
1660
|
+
if (!missing.length) return;
|
|
1661
1661
|
throw new Error(`Type attribute missing ${missing.join(" and ")}`);
|
|
1662
1662
|
}
|
|
1663
1663
|
missingRequiredCalls() {
|
|
@@ -1670,8 +1670,8 @@ var TypeAttrTsDsl = class extends Mixed$47 {
|
|
|
1670
1670
|
|
|
1671
1671
|
//#endregion
|
|
1672
1672
|
//#region src/ts-dsl/type/expr.ts
|
|
1673
|
-
const Mixed$
|
|
1674
|
-
var TypeExprTsDsl = class extends Mixed$
|
|
1673
|
+
const Mixed$48 = TypeArgsMixin(TypeExprMixin(TsDsl));
|
|
1674
|
+
var TypeExprTsDsl = class extends Mixed$48 {
|
|
1675
1675
|
"~dsl" = "TypeExprTsDsl";
|
|
1676
1676
|
scope = "type";
|
|
1677
1677
|
_exprInput;
|
|
@@ -1689,9 +1689,9 @@ var TypeExprTsDsl = class extends Mixed$46 {
|
|
|
1689
1689
|
}
|
|
1690
1690
|
/** Returns true when all required builder calls are present. */
|
|
1691
1691
|
get isValid() {
|
|
1692
|
-
return this.missingRequiredCalls().length
|
|
1692
|
+
return !this.missingRequiredCalls().length;
|
|
1693
1693
|
}
|
|
1694
|
-
/** Accesses a nested type (e.g
|
|
1694
|
+
/** Accesses a nested type (e.g., `Foo.Bar`). */
|
|
1695
1695
|
attr(right) {
|
|
1696
1696
|
this._exprInput = isNode(right) ? ref(right.base(this._exprInput)) : ref(new TypeAttrTsDsl(this._exprInput, right));
|
|
1697
1697
|
return this;
|
|
@@ -1702,7 +1702,7 @@ var TypeExprTsDsl = class extends Mixed$46 {
|
|
|
1702
1702
|
}
|
|
1703
1703
|
$validate() {
|
|
1704
1704
|
const missing = this.missingRequiredCalls();
|
|
1705
|
-
if (missing.length
|
|
1705
|
+
if (!missing.length) return;
|
|
1706
1706
|
throw new Error(`Type expression missing ${missing.join(" and ")}`);
|
|
1707
1707
|
}
|
|
1708
1708
|
missingRequiredCalls() {
|
|
@@ -1715,8 +1715,8 @@ f.type.expr.set((...args) => new TypeExprTsDsl(...args));
|
|
|
1715
1715
|
|
|
1716
1716
|
//#endregion
|
|
1717
1717
|
//#region src/ts-dsl/decl/field.ts
|
|
1718
|
-
const Mixed$
|
|
1719
|
-
var FieldTsDsl = class extends Mixed$
|
|
1718
|
+
const Mixed$47 = DecoratorMixin(DocMixin(OptionalMixin(PrivateMixin(ProtectedMixin(PublicMixin(ReadonlyMixin(StaticMixin(ValueMixin(TsDsl)))))))));
|
|
1719
|
+
var FieldTsDsl = class extends Mixed$47 {
|
|
1720
1720
|
"~dsl" = "FieldTsDsl";
|
|
1721
1721
|
nameSanitizer = safeAccessorName;
|
|
1722
1722
|
_type;
|
|
@@ -1743,8 +1743,8 @@ var FieldTsDsl = class extends Mixed$45 {
|
|
|
1743
1743
|
|
|
1744
1744
|
//#endregion
|
|
1745
1745
|
//#region src/ts-dsl/stmt/stmt.ts
|
|
1746
|
-
const Mixed$
|
|
1747
|
-
var StmtTsDsl = class extends Mixed$
|
|
1746
|
+
const Mixed$46 = TsDsl;
|
|
1747
|
+
var StmtTsDsl = class extends Mixed$46 {
|
|
1748
1748
|
"~dsl" = "StmtTsDsl";
|
|
1749
1749
|
_inner;
|
|
1750
1750
|
constructor(inner) {
|
|
@@ -1791,11 +1791,11 @@ function DoMixin(Base) {
|
|
|
1791
1791
|
|
|
1792
1792
|
//#endregion
|
|
1793
1793
|
//#region src/ts-dsl/decl/pattern.ts
|
|
1794
|
-
const Mixed$
|
|
1794
|
+
const Mixed$45 = TsDsl;
|
|
1795
1795
|
/**
|
|
1796
|
-
* Builds binding patterns (e.g
|
|
1796
|
+
* Builds binding patterns (e.g., `{ foo, bar }`, `[a, b, ...rest]`).
|
|
1797
1797
|
*/
|
|
1798
|
-
var PatternTsDsl = class extends Mixed$
|
|
1798
|
+
var PatternTsDsl = class extends Mixed$45 {
|
|
1799
1799
|
"~dsl" = "PatternTsDsl";
|
|
1800
1800
|
pattern;
|
|
1801
1801
|
_spread;
|
|
@@ -1804,9 +1804,9 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1804
1804
|
}
|
|
1805
1805
|
/** Returns true when all required builder calls are present. */
|
|
1806
1806
|
get isValid() {
|
|
1807
|
-
return this.missingRequiredCalls().length
|
|
1807
|
+
return !this.missingRequiredCalls().length;
|
|
1808
1808
|
}
|
|
1809
|
-
/** Defines an array pattern (e.g
|
|
1809
|
+
/** Defines an array pattern (e.g., `[a, b, c]`). */
|
|
1810
1810
|
array(...props) {
|
|
1811
1811
|
this.pattern = {
|
|
1812
1812
|
kind: "array",
|
|
@@ -1814,7 +1814,7 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1814
1814
|
};
|
|
1815
1815
|
return this;
|
|
1816
1816
|
}
|
|
1817
|
-
/** Defines an object pattern (e.g
|
|
1817
|
+
/** Defines an object pattern (e.g., `{ a, b: alias }`). */
|
|
1818
1818
|
object(...props) {
|
|
1819
1819
|
const entries = {};
|
|
1820
1820
|
for (const p of props) if (typeof p === "string") entries[p] = p;
|
|
@@ -1826,7 +1826,7 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1826
1826
|
};
|
|
1827
1827
|
return this;
|
|
1828
1828
|
}
|
|
1829
|
-
/** Adds a spread element (e.g
|
|
1829
|
+
/** Adds a spread element (e.g., `...rest`, `...options`, `...args`). */
|
|
1830
1830
|
spread(name) {
|
|
1831
1831
|
this._spread = name;
|
|
1832
1832
|
return this;
|
|
@@ -1849,7 +1849,7 @@ var PatternTsDsl = class extends Mixed$43 {
|
|
|
1849
1849
|
}
|
|
1850
1850
|
$validate() {
|
|
1851
1851
|
const missing = this.missingRequiredCalls();
|
|
1852
|
-
if (missing.length
|
|
1852
|
+
if (!missing.length) return;
|
|
1853
1853
|
throw new Error(`Binding pattern missing ${missing.join(" and ")}`);
|
|
1854
1854
|
}
|
|
1855
1855
|
missingRequiredCalls() {
|
|
@@ -1882,7 +1882,7 @@ function PatternMixin(Base) {
|
|
|
1882
1882
|
(this.pattern ??= new PatternTsDsl()).object(...props);
|
|
1883
1883
|
return this;
|
|
1884
1884
|
}
|
|
1885
|
-
/** Adds a spread element (e.g
|
|
1885
|
+
/** Adds a spread element (e.g., `...args`, `...options`) to the pattern. */
|
|
1886
1886
|
spread(name) {
|
|
1887
1887
|
(this.pattern ??= new PatternTsDsl()).spread(name);
|
|
1888
1888
|
return this;
|
|
@@ -1898,8 +1898,8 @@ function PatternMixin(Base) {
|
|
|
1898
1898
|
|
|
1899
1899
|
//#endregion
|
|
1900
1900
|
//#region src/ts-dsl/decl/param.ts
|
|
1901
|
-
const Mixed$
|
|
1902
|
-
var ParamTsDsl = class extends Mixed$
|
|
1901
|
+
const Mixed$44 = DecoratorMixin(OptionalMixin(PatternMixin(ValueMixin(TsDsl))));
|
|
1902
|
+
var ParamTsDsl = class extends Mixed$44 {
|
|
1903
1903
|
"~dsl" = "ParamTsDsl";
|
|
1904
1904
|
_type;
|
|
1905
1905
|
constructor(name, fn) {
|
|
@@ -1917,7 +1917,7 @@ var ParamTsDsl = class extends Mixed$42 {
|
|
|
1917
1917
|
}
|
|
1918
1918
|
/** Returns true when all required builder calls are present. */
|
|
1919
1919
|
get isValid() {
|
|
1920
|
-
return this.missingRequiredCalls().length
|
|
1920
|
+
return !this.missingRequiredCalls().length;
|
|
1921
1921
|
}
|
|
1922
1922
|
/** Sets the parameter type. */
|
|
1923
1923
|
type(type) {
|
|
@@ -1930,7 +1930,7 @@ var ParamTsDsl = class extends Mixed$42 {
|
|
|
1930
1930
|
}
|
|
1931
1931
|
$validate() {
|
|
1932
1932
|
const missing = this.missingRequiredCalls();
|
|
1933
|
-
if (missing.length
|
|
1933
|
+
if (!missing.length) return;
|
|
1934
1934
|
throw new Error(`Parameter missing ${missing.join(" and ")}`);
|
|
1935
1935
|
}
|
|
1936
1936
|
missingRequiredCalls() {
|
|
@@ -1997,8 +1997,8 @@ function LayoutMixin(Base) {
|
|
|
1997
1997
|
|
|
1998
1998
|
//#endregion
|
|
1999
1999
|
//#region src/ts-dsl/stmt/block.ts
|
|
2000
|
-
const Mixed$
|
|
2001
|
-
var BlockTsDsl = class extends Mixed$
|
|
2000
|
+
const Mixed$43 = DoMixin(LayoutMixin(TsDsl));
|
|
2001
|
+
var BlockTsDsl = class extends Mixed$43 {
|
|
2002
2002
|
"~dsl" = "BlockTsDsl";
|
|
2003
2003
|
constructor(...items) {
|
|
2004
2004
|
super();
|
|
@@ -2015,8 +2015,8 @@ var BlockTsDsl = class extends Mixed$41 {
|
|
|
2015
2015
|
|
|
2016
2016
|
//#endregion
|
|
2017
2017
|
//#region src/ts-dsl/decl/init.ts
|
|
2018
|
-
const Mixed$
|
|
2019
|
-
var InitTsDsl = class extends Mixed$
|
|
2018
|
+
const Mixed$42 = DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(TsDsl)))))));
|
|
2019
|
+
var InitTsDsl = class extends Mixed$42 {
|
|
2020
2020
|
"~dsl" = "InitTsDsl";
|
|
2021
2021
|
constructor(fn) {
|
|
2022
2022
|
super();
|
|
@@ -2058,8 +2058,8 @@ function TypeReturnsMixin(Base) {
|
|
|
2058
2058
|
|
|
2059
2059
|
//#endregion
|
|
2060
2060
|
//#region src/ts-dsl/decl/method.ts
|
|
2061
|
-
const Mixed$
|
|
2062
|
-
var MethodTsDsl = class extends Mixed$
|
|
2061
|
+
const Mixed$41 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(OptionalMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl)))))))))))));
|
|
2062
|
+
var MethodTsDsl = class extends Mixed$41 {
|
|
2063
2063
|
"~dsl" = "MethodTsDsl";
|
|
2064
2064
|
nameSanitizer = safeAccessorName;
|
|
2065
2065
|
constructor(name, fn) {
|
|
@@ -2084,8 +2084,8 @@ var MethodTsDsl = class extends Mixed$39 {
|
|
|
2084
2084
|
|
|
2085
2085
|
//#endregion
|
|
2086
2086
|
//#region src/ts-dsl/decl/class.ts
|
|
2087
|
-
const Mixed$
|
|
2088
|
-
var ClassTsDsl = class extends Mixed$
|
|
2087
|
+
const Mixed$40 = AbstractMixin(DecoratorMixin(DefaultMixin(DocMixin(ExportMixin(TypeParamsMixin(TsDsl))))));
|
|
2088
|
+
var ClassTsDsl = class extends Mixed$40 {
|
|
2089
2089
|
"~dsl" = "ClassTsDsl";
|
|
2090
2090
|
nameSanitizer = safeRuntimeName;
|
|
2091
2091
|
baseClass;
|
|
@@ -2108,7 +2108,7 @@ var ClassTsDsl = class extends Mixed$38 {
|
|
|
2108
2108
|
}
|
|
2109
2109
|
/** Returns true if the class has any members. */
|
|
2110
2110
|
get hasBody() {
|
|
2111
|
-
return this.body.length
|
|
2111
|
+
return Boolean(this.body.length);
|
|
2112
2112
|
}
|
|
2113
2113
|
/** Adds one or more class members (fields, methods, etc.). */
|
|
2114
2114
|
do(...items) {
|
|
@@ -2158,8 +2158,8 @@ var ClassTsDsl = class extends Mixed$38 {
|
|
|
2158
2158
|
|
|
2159
2159
|
//#endregion
|
|
2160
2160
|
//#region src/ts-dsl/decl/member.ts
|
|
2161
|
-
const Mixed$
|
|
2162
|
-
var EnumMemberTsDsl = class extends Mixed$
|
|
2161
|
+
const Mixed$39 = DocMixin(TsDsl);
|
|
2162
|
+
var EnumMemberTsDsl = class extends Mixed$39 {
|
|
2163
2163
|
"~dsl" = "EnumMemberTsDsl";
|
|
2164
2164
|
_value;
|
|
2165
2165
|
constructor(name, value) {
|
|
@@ -2185,8 +2185,8 @@ var EnumMemberTsDsl = class extends Mixed$37 {
|
|
|
2185
2185
|
|
|
2186
2186
|
//#endregion
|
|
2187
2187
|
//#region src/ts-dsl/decl/enum.ts
|
|
2188
|
-
const Mixed$
|
|
2189
|
-
var EnumTsDsl = class extends Mixed$
|
|
2188
|
+
const Mixed$38 = ConstMixin(DocMixin(ExportMixin(TsDsl)));
|
|
2189
|
+
var EnumTsDsl = class extends Mixed$38 {
|
|
2190
2190
|
"~dsl" = "EnumTsDsl";
|
|
2191
2191
|
nameSanitizer = safeRuntimeName;
|
|
2192
2192
|
_members = [];
|
|
@@ -2225,8 +2225,8 @@ var EnumTsDsl = class extends Mixed$36 {
|
|
|
2225
2225
|
|
|
2226
2226
|
//#endregion
|
|
2227
2227
|
//#region src/ts-dsl/decl/func.ts
|
|
2228
|
-
const Mixed$
|
|
2229
|
-
var ImplFuncTsDsl = class extends Mixed$
|
|
2228
|
+
const Mixed$37 = AbstractMixin(AsMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl)))))))))))));
|
|
2229
|
+
var ImplFuncTsDsl = class extends Mixed$37 {
|
|
2230
2230
|
"~dsl" = "FuncTsDsl";
|
|
2231
2231
|
nameSanitizer = safeRuntimeName;
|
|
2232
2232
|
mode;
|
|
@@ -2253,7 +2253,7 @@ var ImplFuncTsDsl = class extends Mixed$35 {
|
|
|
2253
2253
|
}
|
|
2254
2254
|
/** Returns true when all required builder calls are present. */
|
|
2255
2255
|
get isValid() {
|
|
2256
|
-
return this.missingRequiredCalls().length
|
|
2256
|
+
return !this.missingRequiredCalls().length;
|
|
2257
2257
|
}
|
|
2258
2258
|
/** Switches the function to an arrow function form. */
|
|
2259
2259
|
arrow() {
|
|
@@ -2286,7 +2286,7 @@ var ImplFuncTsDsl = class extends Mixed$35 {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
$validate() {
|
|
2288
2288
|
const missing = this.missingRequiredCalls();
|
|
2289
|
-
if (missing.length
|
|
2289
|
+
if (!missing.length) return;
|
|
2290
2290
|
throw new Error(`Function ${this.mode} missing ${missing.join(" and ")}`);
|
|
2291
2291
|
}
|
|
2292
2292
|
missingRequiredCalls() {
|
|
@@ -2299,8 +2299,8 @@ const FuncTsDsl = ImplFuncTsDsl;
|
|
|
2299
2299
|
|
|
2300
2300
|
//#endregion
|
|
2301
2301
|
//#region src/ts-dsl/decl/getter.ts
|
|
2302
|
-
const Mixed$
|
|
2303
|
-
var GetterTsDsl = class extends Mixed$
|
|
2302
|
+
const Mixed$36 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeReturnsMixin(TsDsl)))))))))));
|
|
2303
|
+
var GetterTsDsl = class extends Mixed$36 {
|
|
2304
2304
|
"~dsl" = "GetterTsDsl";
|
|
2305
2305
|
nameSanitizer = safeAccessorName;
|
|
2306
2306
|
constructor(name, fn) {
|
|
@@ -2325,8 +2325,8 @@ var GetterTsDsl = class extends Mixed$34 {
|
|
|
2325
2325
|
|
|
2326
2326
|
//#endregion
|
|
2327
2327
|
//#region src/ts-dsl/decl/setter.ts
|
|
2328
|
-
const Mixed$
|
|
2329
|
-
var SetterTsDsl = class extends Mixed$
|
|
2328
|
+
const Mixed$35 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TsDsl))))))))));
|
|
2329
|
+
var SetterTsDsl = class extends Mixed$35 {
|
|
2330
2330
|
"~dsl" = "SetterTsDsl";
|
|
2331
2331
|
nameSanitizer = safeAccessorName;
|
|
2332
2332
|
constructor(name, fn) {
|
|
@@ -2349,10 +2349,33 @@ var SetterTsDsl = class extends Mixed$33 {
|
|
|
2349
2349
|
}
|
|
2350
2350
|
};
|
|
2351
2351
|
|
|
2352
|
+
//#endregion
|
|
2353
|
+
//#region src/ts-dsl/mixins/expr.ts
|
|
2354
|
+
function ExprMixin(Base) {
|
|
2355
|
+
class Expr extends Base {
|
|
2356
|
+
analyze(ctx) {
|
|
2357
|
+
super.analyze(ctx);
|
|
2358
|
+
}
|
|
2359
|
+
attr(...args) {
|
|
2360
|
+
return f.attr(this, ...args);
|
|
2361
|
+
}
|
|
2362
|
+
await() {
|
|
2363
|
+
return f.await(this);
|
|
2364
|
+
}
|
|
2365
|
+
call(...args) {
|
|
2366
|
+
return f.call(this, ...args);
|
|
2367
|
+
}
|
|
2368
|
+
return() {
|
|
2369
|
+
return f.return(this);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
return Expr;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2352
2375
|
//#endregion
|
|
2353
2376
|
//#region src/ts-dsl/expr/array.ts
|
|
2354
|
-
const Mixed$
|
|
2355
|
-
var ArrayTsDsl = class extends Mixed$
|
|
2377
|
+
const Mixed$34 = AsMixin(ExprMixin(LayoutMixin(TsDsl)));
|
|
2378
|
+
var ArrayTsDsl = class extends Mixed$34 {
|
|
2356
2379
|
"~dsl" = "ArrayTsDsl";
|
|
2357
2380
|
_elements = [];
|
|
2358
2381
|
constructor(...exprs) {
|
|
@@ -2394,33 +2417,10 @@ var ArrayTsDsl = class extends Mixed$32 {
|
|
|
2394
2417
|
}
|
|
2395
2418
|
};
|
|
2396
2419
|
|
|
2397
|
-
//#endregion
|
|
2398
|
-
//#region src/ts-dsl/mixins/expr.ts
|
|
2399
|
-
function ExprMixin(Base) {
|
|
2400
|
-
class Expr extends Base {
|
|
2401
|
-
analyze(ctx) {
|
|
2402
|
-
super.analyze(ctx);
|
|
2403
|
-
}
|
|
2404
|
-
attr(...args) {
|
|
2405
|
-
return f.attr(this, ...args);
|
|
2406
|
-
}
|
|
2407
|
-
await() {
|
|
2408
|
-
return f.await(this);
|
|
2409
|
-
}
|
|
2410
|
-
call(...args) {
|
|
2411
|
-
return f.call(this, ...args);
|
|
2412
|
-
}
|
|
2413
|
-
return() {
|
|
2414
|
-
return f.return(this);
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
return Expr;
|
|
2418
|
-
}
|
|
2419
|
-
|
|
2420
2420
|
//#endregion
|
|
2421
2421
|
//#region src/ts-dsl/expr/as.ts
|
|
2422
|
-
const Mixed$
|
|
2423
|
-
var AsTsDsl = class extends Mixed$
|
|
2422
|
+
const Mixed$33 = AsMixin(ExprMixin(TsDsl));
|
|
2423
|
+
var AsTsDsl = class extends Mixed$33 {
|
|
2424
2424
|
"~dsl" = "AsTsDsl";
|
|
2425
2425
|
expr;
|
|
2426
2426
|
type;
|
|
@@ -2442,8 +2442,8 @@ f.as.set((...args) => new AsTsDsl(...args));
|
|
|
2442
2442
|
|
|
2443
2443
|
//#endregion
|
|
2444
2444
|
//#region src/ts-dsl/expr/binary.ts
|
|
2445
|
-
const Mixed$
|
|
2446
|
-
var BinaryTsDsl = class extends Mixed$
|
|
2445
|
+
const Mixed$32 = AsMixin(ExprMixin(TsDsl));
|
|
2446
|
+
var BinaryTsDsl = class extends Mixed$32 {
|
|
2447
2447
|
"~dsl" = "BinaryTsDsl";
|
|
2448
2448
|
_base;
|
|
2449
2449
|
_expr;
|
|
@@ -2461,13 +2461,13 @@ var BinaryTsDsl = class extends Mixed$30 {
|
|
|
2461
2461
|
}
|
|
2462
2462
|
/** Returns true when all required builder calls are present. */
|
|
2463
2463
|
get isValid() {
|
|
2464
|
-
return this.missingRequiredCalls().length
|
|
2464
|
+
return !this.missingRequiredCalls().length;
|
|
2465
2465
|
}
|
|
2466
2466
|
/** Logical AND — `this && expr` */
|
|
2467
2467
|
and(expr) {
|
|
2468
2468
|
return this.opAndExpr("&&", expr);
|
|
2469
2469
|
}
|
|
2470
|
-
/** Creates an assignment expression (e.g
|
|
2470
|
+
/** Creates an assignment expression (e.g., `this = expr`). */
|
|
2471
2471
|
assign(expr) {
|
|
2472
2472
|
return this.opAndExpr("=", expr);
|
|
2473
2473
|
}
|
|
@@ -2539,7 +2539,7 @@ var BinaryTsDsl = class extends Mixed$30 {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
$validate() {
|
|
2541
2541
|
const missing = this.missingRequiredCalls();
|
|
2542
|
-
if (missing.length
|
|
2542
|
+
if (!missing.length) return;
|
|
2543
2543
|
throw new Error(`Binary expression missing ${missing.join(" and ")}`);
|
|
2544
2544
|
}
|
|
2545
2545
|
missingRequiredCalls() {
|
|
@@ -2643,42 +2643,48 @@ function OperatorMixin(Base) {
|
|
|
2643
2643
|
|
|
2644
2644
|
//#endregion
|
|
2645
2645
|
//#region src/ts-dsl/expr/attr.ts
|
|
2646
|
-
const Mixed$
|
|
2647
|
-
var AttrTsDsl = class extends Mixed$
|
|
2646
|
+
const Mixed$31 = AsMixin(ExprMixin(OperatorMixin(OptionalMixin(TsDsl))));
|
|
2647
|
+
var AttrTsDsl = class extends Mixed$31 {
|
|
2648
2648
|
"~dsl" = "AttrTsDsl";
|
|
2649
|
-
|
|
2649
|
+
_computed = false;
|
|
2650
|
+
_left;
|
|
2650
2651
|
constructor(left, right) {
|
|
2651
2652
|
super();
|
|
2652
|
-
this.
|
|
2653
|
+
this._left = ref(left);
|
|
2653
2654
|
this.name.set(right);
|
|
2654
2655
|
}
|
|
2655
2656
|
analyze(ctx) {
|
|
2656
2657
|
super.analyze(ctx);
|
|
2657
|
-
ctx.analyze(this.
|
|
2658
|
+
ctx.analyze(this._left);
|
|
2658
2659
|
ctx.analyze(this.name);
|
|
2659
2660
|
}
|
|
2661
|
+
/** Use computed property access (e.g., `obj[expr]`)? */
|
|
2662
|
+
computed(condition) {
|
|
2663
|
+
this._computed = condition ?? true;
|
|
2664
|
+
return this;
|
|
2665
|
+
}
|
|
2660
2666
|
toAst() {
|
|
2661
|
-
const
|
|
2667
|
+
const left = this.$node(this._left);
|
|
2662
2668
|
regexp.typeScriptIdentifier.lastIndex = 0;
|
|
2663
|
-
|
|
2664
|
-
|
|
2669
|
+
if (this._computed || !regexp.typeScriptIdentifier.test(this.name.toString())) {
|
|
2670
|
+
const right = fromRef(this.name);
|
|
2665
2671
|
let value = isSymbol(right) ? right.finalName : right;
|
|
2666
2672
|
if (typeof value === "string") {
|
|
2667
2673
|
if (value.startsWith("'") && value.endsWith("'") || value.startsWith("\"") && value.endsWith("\"")) value = value.slice(1, -1);
|
|
2668
2674
|
}
|
|
2669
|
-
if (this._optional) return ts.factory.createElementAccessChain(
|
|
2670
|
-
return ts.factory.createElementAccessExpression(
|
|
2675
|
+
if (this._optional) return ts.factory.createElementAccessChain(left, this.$node(new TokenTsDsl().questionDot()), this.$node(this._computed ? this.name : new LiteralTsDsl(value)));
|
|
2676
|
+
return ts.factory.createElementAccessExpression(left, this.$node(this._computed ? this.name : new LiteralTsDsl(value)));
|
|
2671
2677
|
}
|
|
2672
|
-
if (this._optional) return ts.factory.createPropertyAccessChain(
|
|
2673
|
-
return ts.factory.createPropertyAccessExpression(
|
|
2678
|
+
if (this._optional) return ts.factory.createPropertyAccessChain(left, this.$node(new TokenTsDsl().questionDot()), this.$node(this.name));
|
|
2679
|
+
return ts.factory.createPropertyAccessExpression(left, this.$node(this.name));
|
|
2674
2680
|
}
|
|
2675
2681
|
};
|
|
2676
2682
|
f.attr.set((...args) => new AttrTsDsl(...args));
|
|
2677
2683
|
|
|
2678
2684
|
//#endregion
|
|
2679
2685
|
//#region src/ts-dsl/expr/await.ts
|
|
2680
|
-
const Mixed$
|
|
2681
|
-
var AwaitTsDsl = class extends Mixed$
|
|
2686
|
+
const Mixed$30 = ExprMixin(TsDsl);
|
|
2687
|
+
var AwaitTsDsl = class extends Mixed$30 {
|
|
2682
2688
|
"~dsl" = "AwaitTsDsl";
|
|
2683
2689
|
_awaitExpr;
|
|
2684
2690
|
constructor(expr) {
|
|
@@ -2697,8 +2703,8 @@ f.await.set((...args) => new AwaitTsDsl(...args));
|
|
|
2697
2703
|
|
|
2698
2704
|
//#endregion
|
|
2699
2705
|
//#region src/ts-dsl/expr/call.ts
|
|
2700
|
-
const Mixed$
|
|
2701
|
-
var CallTsDsl = class extends Mixed$
|
|
2706
|
+
const Mixed$29 = ArgsMixin(AsMixin(ExprMixin(TypeArgsMixin(TsDsl))));
|
|
2707
|
+
var CallTsDsl = class extends Mixed$29 {
|
|
2702
2708
|
"~dsl" = "CallTsDsl";
|
|
2703
2709
|
_callee;
|
|
2704
2710
|
constructor(callee, ...args) {
|
|
@@ -2718,8 +2724,8 @@ f.call.set((...args) => new CallTsDsl(...args));
|
|
|
2718
2724
|
|
|
2719
2725
|
//#endregion
|
|
2720
2726
|
//#region src/ts-dsl/expr/expr.ts
|
|
2721
|
-
const Mixed$
|
|
2722
|
-
var ExprTsDsl = class extends Mixed$
|
|
2727
|
+
const Mixed$28 = AsMixin(ExprMixin(OperatorMixin(TypeExprMixin(TsDsl))));
|
|
2728
|
+
var ExprTsDsl = class extends Mixed$28 {
|
|
2723
2729
|
"~dsl" = "ExprTsDsl";
|
|
2724
2730
|
_exprInput;
|
|
2725
2731
|
constructor(id) {
|
|
@@ -2790,8 +2796,8 @@ function HintMixin(Base) {
|
|
|
2790
2796
|
|
|
2791
2797
|
//#endregion
|
|
2792
2798
|
//#region src/ts-dsl/expr/prop.ts
|
|
2793
|
-
const Mixed$
|
|
2794
|
-
var ObjectPropTsDsl = class extends Mixed$
|
|
2799
|
+
const Mixed$27 = DocMixin(TsDsl);
|
|
2800
|
+
var ObjectPropTsDsl = class extends Mixed$27 {
|
|
2795
2801
|
"~dsl" = "ObjectPropTsDsl";
|
|
2796
2802
|
_value;
|
|
2797
2803
|
_meta;
|
|
@@ -2810,7 +2816,7 @@ var ObjectPropTsDsl = class extends Mixed$25 {
|
|
|
2810
2816
|
ctx.analyze(this._value);
|
|
2811
2817
|
}
|
|
2812
2818
|
get isValid() {
|
|
2813
|
-
return this.missingRequiredCalls().length
|
|
2819
|
+
return !this.missingRequiredCalls().length;
|
|
2814
2820
|
}
|
|
2815
2821
|
value(value) {
|
|
2816
2822
|
if (typeof value === "function") value(this);
|
|
@@ -2845,7 +2851,7 @@ var ObjectPropTsDsl = class extends Mixed$25 {
|
|
|
2845
2851
|
}
|
|
2846
2852
|
$validate() {
|
|
2847
2853
|
const missing = this.missingRequiredCalls();
|
|
2848
|
-
if (missing.length
|
|
2854
|
+
if (!missing.length) return;
|
|
2849
2855
|
throw new Error(`Object property${this._meta.name ? ` "${this._meta.name}"` : ""} missing ${missing.join(" and ")}`);
|
|
2850
2856
|
}
|
|
2851
2857
|
missingRequiredCalls() {
|
|
@@ -2857,8 +2863,8 @@ var ObjectPropTsDsl = class extends Mixed$25 {
|
|
|
2857
2863
|
|
|
2858
2864
|
//#endregion
|
|
2859
2865
|
//#region src/ts-dsl/expr/object.ts
|
|
2860
|
-
const Mixed$
|
|
2861
|
-
var ObjectTsDsl = class extends Mixed$
|
|
2866
|
+
const Mixed$26 = AsMixin(ExprMixin(HintMixin(LayoutMixin(TsDsl))));
|
|
2867
|
+
var ObjectTsDsl = class extends Mixed$26 {
|
|
2862
2868
|
"~dsl" = "ObjectTsDsl";
|
|
2863
2869
|
_props = /* @__PURE__ */ new Map();
|
|
2864
2870
|
_spreadCounter = 0;
|
|
@@ -2875,7 +2881,7 @@ var ObjectTsDsl = class extends Mixed$24 {
|
|
|
2875
2881
|
if (prop.kind === "spread") return `spread:${this._spreadCounter++}`;
|
|
2876
2882
|
return `${prop.kind}:${prop.propName}`;
|
|
2877
2883
|
}
|
|
2878
|
-
/** Adds a computed property (e.g
|
|
2884
|
+
/** Adds a computed property (e.g., `{ [expr]: value }`), or removes if null. */
|
|
2879
2885
|
computed(name, expr) {
|
|
2880
2886
|
if (expr === null) this._props.delete(`computed:${name}`);
|
|
2881
2887
|
else this._props.set(`computed:${name}`, new ObjectPropTsDsl({
|
|
@@ -2884,7 +2890,7 @@ var ObjectTsDsl = class extends Mixed$24 {
|
|
|
2884
2890
|
}).value(expr));
|
|
2885
2891
|
return this;
|
|
2886
2892
|
}
|
|
2887
|
-
/** Adds a getter property (e.g
|
|
2893
|
+
/** Adds a getter property (e.g., `{ get foo() { ... } }`), or removes if null. */
|
|
2888
2894
|
getter(name, stmt) {
|
|
2889
2895
|
if (stmt === null) this._props.delete(`getter:${name}`);
|
|
2890
2896
|
else this._props.set(`getter:${name}`, new ObjectPropTsDsl({
|
|
@@ -2915,7 +2921,7 @@ var ObjectTsDsl = class extends Mixed$24 {
|
|
|
2915
2921
|
for (const prop of props) this._props.set(this._propKey(prop), prop);
|
|
2916
2922
|
return this;
|
|
2917
2923
|
}
|
|
2918
|
-
/** Adds a setter property (e.g
|
|
2924
|
+
/** Adds a setter property (e.g., `{ set foo(v) { ... } }`), or removes if null. */
|
|
2919
2925
|
setter(name, stmt) {
|
|
2920
2926
|
if (stmt === null) this._props.delete(`setter:${name}`);
|
|
2921
2927
|
else this._props.set(`setter:${name}`, new ObjectPropTsDsl({
|
|
@@ -2924,7 +2930,7 @@ var ObjectTsDsl = class extends Mixed$24 {
|
|
|
2924
2930
|
}).value(stmt));
|
|
2925
2931
|
return this;
|
|
2926
2932
|
}
|
|
2927
|
-
/** Adds a spread property (e.g
|
|
2933
|
+
/** Adds a spread property (e.g., `{ ...options }`). */
|
|
2928
2934
|
spread(expr) {
|
|
2929
2935
|
const key = `spread:${this._spreadCounter++}`;
|
|
2930
2936
|
this._props.set(key, new ObjectPropTsDsl({ kind: "spread" }).value(expr));
|
|
@@ -2961,8 +2967,8 @@ const fromValue$1 = (input, options) => {
|
|
|
2961
2967
|
|
|
2962
2968
|
//#endregion
|
|
2963
2969
|
//#region src/ts-dsl/expr/new.ts
|
|
2964
|
-
const Mixed$
|
|
2965
|
-
var NewTsDsl = class extends Mixed$
|
|
2970
|
+
const Mixed$25 = ArgsMixin(AsMixin(ExprMixin(TypeArgsMixin(TsDsl))));
|
|
2971
|
+
var NewTsDsl = class extends Mixed$25 {
|
|
2966
2972
|
"~dsl" = "NewTsDsl";
|
|
2967
2973
|
_newExpr;
|
|
2968
2974
|
constructor(expr, ...args) {
|
|
@@ -2980,10 +2986,67 @@ var NewTsDsl = class extends Mixed$23 {
|
|
|
2980
2986
|
};
|
|
2981
2987
|
f.new.set((...args) => new NewTsDsl(...args));
|
|
2982
2988
|
|
|
2989
|
+
//#endregion
|
|
2990
|
+
//#region src/ts-dsl/expr/postfix.ts
|
|
2991
|
+
const Mixed$24 = TsDsl;
|
|
2992
|
+
var PostfixTsDsl = class extends Mixed$24 {
|
|
2993
|
+
"~dsl" = "PostfixTsDsl";
|
|
2994
|
+
_expr;
|
|
2995
|
+
_op;
|
|
2996
|
+
constructor(expr, op) {
|
|
2997
|
+
super();
|
|
2998
|
+
this._expr = expr;
|
|
2999
|
+
this._op = op;
|
|
3000
|
+
}
|
|
3001
|
+
analyze(ctx) {
|
|
3002
|
+
super.analyze(ctx);
|
|
3003
|
+
ctx.analyze(this._expr);
|
|
3004
|
+
}
|
|
3005
|
+
/** Returns true when all required builder calls are present. */
|
|
3006
|
+
get isValid() {
|
|
3007
|
+
return !this.missingRequiredCalls().length;
|
|
3008
|
+
}
|
|
3009
|
+
/** Sets the operator to MinusMinusToken for decrement (`--`). */
|
|
3010
|
+
dec() {
|
|
3011
|
+
this._op = ts.SyntaxKind.MinusMinusToken;
|
|
3012
|
+
return this;
|
|
3013
|
+
}
|
|
3014
|
+
/** Sets the operand (the expression being postfixed). */
|
|
3015
|
+
expr(expr) {
|
|
3016
|
+
this._expr = expr;
|
|
3017
|
+
return this;
|
|
3018
|
+
}
|
|
3019
|
+
/** Sets the operator to PlusPlusToken for increment (`++`). */
|
|
3020
|
+
inc() {
|
|
3021
|
+
this._op = ts.SyntaxKind.PlusPlusToken;
|
|
3022
|
+
return this;
|
|
3023
|
+
}
|
|
3024
|
+
/** Sets the operator (e.g., `ts.SyntaxKind.PlusPlusToken` for `++`). */
|
|
3025
|
+
op(op) {
|
|
3026
|
+
this._op = op;
|
|
3027
|
+
return this;
|
|
3028
|
+
}
|
|
3029
|
+
toAst() {
|
|
3030
|
+
this.$validate();
|
|
3031
|
+
return ts.factory.createPostfixUnaryExpression(this.$node(this._expr), this._op);
|
|
3032
|
+
}
|
|
3033
|
+
$validate() {
|
|
3034
|
+
const missing = this.missingRequiredCalls();
|
|
3035
|
+
if (!missing.length) return;
|
|
3036
|
+
throw new Error(`Postfix unary expression missing ${missing.join(" and ")}`);
|
|
3037
|
+
}
|
|
3038
|
+
missingRequiredCalls() {
|
|
3039
|
+
const missing = [];
|
|
3040
|
+
if (!this._expr) missing.push(".expr()");
|
|
3041
|
+
if (!this._op) missing.push("operator (e.g., .inc(), .dec())");
|
|
3042
|
+
return missing;
|
|
3043
|
+
}
|
|
3044
|
+
};
|
|
3045
|
+
|
|
2983
3046
|
//#endregion
|
|
2984
3047
|
//#region src/ts-dsl/expr/regexp.ts
|
|
2985
|
-
const Mixed$
|
|
2986
|
-
var RegExpTsDsl = class extends Mixed$
|
|
3048
|
+
const Mixed$23 = TsDsl;
|
|
3049
|
+
var RegExpTsDsl = class extends Mixed$23 {
|
|
2987
3050
|
"~dsl" = "RegExpTsDsl";
|
|
2988
3051
|
pattern;
|
|
2989
3052
|
flags;
|
|
@@ -3003,8 +3066,8 @@ var RegExpTsDsl = class extends Mixed$22 {
|
|
|
3003
3066
|
|
|
3004
3067
|
//#endregion
|
|
3005
3068
|
//#region src/ts-dsl/expr/template.ts
|
|
3006
|
-
const Mixed$
|
|
3007
|
-
var TemplateTsDsl = class extends Mixed$
|
|
3069
|
+
const Mixed$22 = TsDsl;
|
|
3070
|
+
var TemplateTsDsl = class extends Mixed$22 {
|
|
3008
3071
|
"~dsl" = "TemplateTsDsl";
|
|
3009
3072
|
parts = [];
|
|
3010
3073
|
constructor(value) {
|
|
@@ -3037,7 +3100,7 @@ var TemplateTsDsl = class extends Mixed$21 {
|
|
|
3037
3100
|
} else if (typeof current === "number") normalized.push(String(current));
|
|
3038
3101
|
else normalized.push(current);
|
|
3039
3102
|
}
|
|
3040
|
-
if (normalized.length
|
|
3103
|
+
if (!normalized.length || typeof normalized[0] !== "string") normalized.unshift("");
|
|
3041
3104
|
if (normalized.length === 1 && typeof normalized[0] === "string") return ts.factory.createNoSubstitutionTemplateLiteral(normalized[0]);
|
|
3042
3105
|
if (normalized.length === 2 && typeof normalized[0] === "string" && typeof normalized[1] !== "string") return ts.factory.createTemplateExpression(ts.factory.createTemplateHead(normalized[0]), [ts.factory.createTemplateSpan(normalized[1], ts.factory.createTemplateTail(""))]);
|
|
3043
3106
|
const head = ts.factory.createTemplateHead(normalized.shift());
|
|
@@ -3045,7 +3108,7 @@ var TemplateTsDsl = class extends Mixed$21 {
|
|
|
3045
3108
|
while (normalized.length) {
|
|
3046
3109
|
const expr = normalized.shift();
|
|
3047
3110
|
const next = typeof normalized[0] === "string" ? normalized.shift() : "";
|
|
3048
|
-
const isLast = normalized.length
|
|
3111
|
+
const isLast = !normalized.length;
|
|
3049
3112
|
spans.push(ts.factory.createTemplateSpan(expr, isLast ? ts.factory.createTemplateTail(next) : ts.factory.createTemplateMiddle(next)));
|
|
3050
3113
|
}
|
|
3051
3114
|
return ts.factory.createTemplateExpression(head, spans);
|
|
@@ -3054,8 +3117,8 @@ var TemplateTsDsl = class extends Mixed$21 {
|
|
|
3054
3117
|
|
|
3055
3118
|
//#endregion
|
|
3056
3119
|
//#region src/ts-dsl/expr/ternary.ts
|
|
3057
|
-
const Mixed$
|
|
3058
|
-
var TernaryTsDsl = class extends Mixed$
|
|
3120
|
+
const Mixed$21 = TsDsl;
|
|
3121
|
+
var TernaryTsDsl = class extends Mixed$21 {
|
|
3059
3122
|
"~dsl" = "TernaryTsDsl";
|
|
3060
3123
|
_condition;
|
|
3061
3124
|
_then;
|
|
@@ -3072,7 +3135,7 @@ var TernaryTsDsl = class extends Mixed$20 {
|
|
|
3072
3135
|
}
|
|
3073
3136
|
/** Returns true when all required builder calls are present. */
|
|
3074
3137
|
get isValid() {
|
|
3075
|
-
return this.missingRequiredCalls().length
|
|
3138
|
+
return !this.missingRequiredCalls().length;
|
|
3076
3139
|
}
|
|
3077
3140
|
condition(condition) {
|
|
3078
3141
|
this._condition = condition;
|
|
@@ -3092,7 +3155,7 @@ var TernaryTsDsl = class extends Mixed$20 {
|
|
|
3092
3155
|
}
|
|
3093
3156
|
$validate() {
|
|
3094
3157
|
const missing = this.missingRequiredCalls();
|
|
3095
|
-
if (missing.length
|
|
3158
|
+
if (!missing.length) return;
|
|
3096
3159
|
throw new Error(`Ternary expression missing ${missing.join(" and ")}`);
|
|
3097
3160
|
}
|
|
3098
3161
|
missingRequiredCalls() {
|
|
@@ -3106,8 +3169,8 @@ var TernaryTsDsl = class extends Mixed$20 {
|
|
|
3106
3169
|
|
|
3107
3170
|
//#endregion
|
|
3108
3171
|
//#region src/ts-dsl/expr/typeof.ts
|
|
3109
|
-
const Mixed$
|
|
3110
|
-
var TypeOfExprTsDsl = class extends Mixed$
|
|
3172
|
+
const Mixed$20 = OperatorMixin(TsDsl);
|
|
3173
|
+
var TypeOfExprTsDsl = class extends Mixed$20 {
|
|
3111
3174
|
"~dsl" = "TypeOfExprTsDsl";
|
|
3112
3175
|
_expr;
|
|
3113
3176
|
constructor(expr) {
|
|
@@ -3156,6 +3219,105 @@ var NoteTsDsl = class extends TsDsl {
|
|
|
3156
3219
|
}
|
|
3157
3220
|
};
|
|
3158
3221
|
|
|
3222
|
+
//#endregion
|
|
3223
|
+
//#region src/ts-dsl/stmt/for.ts
|
|
3224
|
+
const Mixed$19 = DoMixin(LayoutMixin(TsDsl));
|
|
3225
|
+
var ImplForTsDsl = class extends Mixed$19 {
|
|
3226
|
+
"~dsl" = "ForTsDsl";
|
|
3227
|
+
_await;
|
|
3228
|
+
_condition;
|
|
3229
|
+
_iterableOrUpdate;
|
|
3230
|
+
_mode = "for";
|
|
3231
|
+
_variableOrInit;
|
|
3232
|
+
constructor(variableOrInit, modeOrCondition, iterableOrUpdate) {
|
|
3233
|
+
super();
|
|
3234
|
+
this._iterableOrUpdate = iterableOrUpdate;
|
|
3235
|
+
this._variableOrInit = variableOrInit;
|
|
3236
|
+
if (typeof modeOrCondition === "string") this._mode = modeOrCondition ?? "for";
|
|
3237
|
+
else this._condition = modeOrCondition;
|
|
3238
|
+
}
|
|
3239
|
+
analyze(ctx) {
|
|
3240
|
+
ctx.analyze(this._condition);
|
|
3241
|
+
ctx.analyze(this._iterableOrUpdate);
|
|
3242
|
+
ctx.analyze(this._variableOrInit);
|
|
3243
|
+
ctx.pushScope();
|
|
3244
|
+
try {
|
|
3245
|
+
super.analyze(ctx);
|
|
3246
|
+
} finally {
|
|
3247
|
+
ctx.popScope();
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
/** Returns true when all required builder calls are present. */
|
|
3251
|
+
get isValid() {
|
|
3252
|
+
return !this.missingRequiredCalls().length;
|
|
3253
|
+
}
|
|
3254
|
+
/** Enables async iteration (`for await...of`). Can only be called on for...of. */
|
|
3255
|
+
await() {
|
|
3256
|
+
this._await = true;
|
|
3257
|
+
this.of();
|
|
3258
|
+
return this;
|
|
3259
|
+
}
|
|
3260
|
+
/** Sets the condition (e.g., `i < n`). */
|
|
3261
|
+
condition(condition) {
|
|
3262
|
+
this._condition = condition;
|
|
3263
|
+
return this;
|
|
3264
|
+
}
|
|
3265
|
+
/** Sets the iteration variable (e.g., `$.const('item')`). */
|
|
3266
|
+
each(variable) {
|
|
3267
|
+
this._variableOrInit = variable;
|
|
3268
|
+
return this;
|
|
3269
|
+
}
|
|
3270
|
+
/** Sets the object to iterate over and switches to for...in. */
|
|
3271
|
+
in(iterable) {
|
|
3272
|
+
this._mode = "in";
|
|
3273
|
+
if (iterable !== void 0) this.iterable(iterable);
|
|
3274
|
+
return this;
|
|
3275
|
+
}
|
|
3276
|
+
/** Sets the initialization (e.g., `let i = 0`). */
|
|
3277
|
+
init(init) {
|
|
3278
|
+
this._variableOrInit = init;
|
|
3279
|
+
return this;
|
|
3280
|
+
}
|
|
3281
|
+
/** Sets the iterable to iterate over. */
|
|
3282
|
+
iterable(iterable) {
|
|
3283
|
+
this._iterableOrUpdate = iterable;
|
|
3284
|
+
return this;
|
|
3285
|
+
}
|
|
3286
|
+
/** Sets the iterable to iterate over and switches to for...of. */
|
|
3287
|
+
of(iterable) {
|
|
3288
|
+
this._mode = "of";
|
|
3289
|
+
if (iterable !== void 0) this.iterable(iterable);
|
|
3290
|
+
return this;
|
|
3291
|
+
}
|
|
3292
|
+
/** Sets the update expression (e.g., `i++`). */
|
|
3293
|
+
update(update) {
|
|
3294
|
+
this._iterableOrUpdate = update;
|
|
3295
|
+
return this;
|
|
3296
|
+
}
|
|
3297
|
+
toAst() {
|
|
3298
|
+
this.$validate();
|
|
3299
|
+
const body = this.$node(new BlockTsDsl(...this._do).pretty());
|
|
3300
|
+
if (this._mode === "of") return ts.factory.createForOfStatement(this._await ? ts.factory.createToken(ts.SyntaxKind.AwaitKeyword) : void 0, this.$node(this._variableOrInit).declarationList, this.$node(this._iterableOrUpdate), body);
|
|
3301
|
+
if (this._mode === "in") return ts.factory.createForInStatement(this.$node(this._variableOrInit).declarationList, this.$node(this._iterableOrUpdate), body);
|
|
3302
|
+
const init = this.$node(this._variableOrInit);
|
|
3303
|
+
return ts.factory.createForStatement(init && ts.isVariableStatement(init) ? init.declarationList : init, this.$node(this._condition), this.$node(this._iterableOrUpdate), body);
|
|
3304
|
+
}
|
|
3305
|
+
$validate() {
|
|
3306
|
+
const missing = this.missingRequiredCalls();
|
|
3307
|
+
if (!missing.length) return;
|
|
3308
|
+
throw new Error(`For${this._mode === "for" ? "" : `...${this._mode}`} statement missing ${missing.join(" and ")}`);
|
|
3309
|
+
}
|
|
3310
|
+
missingRequiredCalls() {
|
|
3311
|
+
const missing = [];
|
|
3312
|
+
if (this._mode !== "for") {
|
|
3313
|
+
if (!this._variableOrInit) missing.push(".each()");
|
|
3314
|
+
if (!this._iterableOrUpdate) missing.push(".iterable()");
|
|
3315
|
+
}
|
|
3316
|
+
return missing;
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
const ForTsDsl = ImplForTsDsl;
|
|
3320
|
+
|
|
3159
3321
|
//#endregion
|
|
3160
3322
|
//#region src/ts-dsl/stmt/if.ts
|
|
3161
3323
|
const Mixed$18 = DoMixin(TsDsl);
|
|
@@ -3181,7 +3343,7 @@ var IfTsDsl = class extends Mixed$18 {
|
|
|
3181
3343
|
}
|
|
3182
3344
|
/** Returns true when all required builder calls are present. */
|
|
3183
3345
|
get isValid() {
|
|
3184
|
-
return this.missingRequiredCalls().length
|
|
3346
|
+
return !this.missingRequiredCalls().length;
|
|
3185
3347
|
}
|
|
3186
3348
|
condition(condition) {
|
|
3187
3349
|
this._condition = condition;
|
|
@@ -3197,13 +3359,13 @@ var IfTsDsl = class extends Mixed$18 {
|
|
|
3197
3359
|
}
|
|
3198
3360
|
$validate() {
|
|
3199
3361
|
const missing = this.missingRequiredCalls();
|
|
3200
|
-
if (missing.length
|
|
3362
|
+
if (!missing.length) return;
|
|
3201
3363
|
throw new Error(`If statement missing ${missing.join(" and ")}`);
|
|
3202
3364
|
}
|
|
3203
3365
|
missingRequiredCalls() {
|
|
3204
3366
|
const missing = [];
|
|
3205
3367
|
if (!this._condition) missing.push(".condition()");
|
|
3206
|
-
if (this._do.length
|
|
3368
|
+
if (!this._do.length) missing.push(".do()");
|
|
3207
3369
|
return missing;
|
|
3208
3370
|
}
|
|
3209
3371
|
};
|
|
@@ -3302,7 +3464,7 @@ var TryTsDsl = class extends Mixed$15 {
|
|
|
3302
3464
|
}
|
|
3303
3465
|
/** Returns true when all required builder calls are present. */
|
|
3304
3466
|
get isValid() {
|
|
3305
|
-
return this.missingRequiredCalls().length
|
|
3467
|
+
return !this.missingRequiredCalls().length;
|
|
3306
3468
|
}
|
|
3307
3469
|
catch(...items) {
|
|
3308
3470
|
this._catch = items;
|
|
@@ -3327,12 +3489,12 @@ var TryTsDsl = class extends Mixed$15 {
|
|
|
3327
3489
|
}
|
|
3328
3490
|
$validate() {
|
|
3329
3491
|
const missing = this.missingRequiredCalls();
|
|
3330
|
-
if (missing.length
|
|
3492
|
+
if (!missing.length) return;
|
|
3331
3493
|
throw new Error(`Try statement missing ${missing.join(" and ")}`);
|
|
3332
3494
|
}
|
|
3333
3495
|
missingRequiredCalls() {
|
|
3334
3496
|
const missing = [];
|
|
3335
|
-
if (!this._try || this._try.length
|
|
3497
|
+
if (!this._try || !this._try.length) missing.push(".try()");
|
|
3336
3498
|
return missing;
|
|
3337
3499
|
}
|
|
3338
3500
|
};
|
|
@@ -3357,7 +3519,7 @@ var VarTsDsl = class extends Mixed$14 {
|
|
|
3357
3519
|
}
|
|
3358
3520
|
/** Returns true when all required builder calls are present. */
|
|
3359
3521
|
get isValid() {
|
|
3360
|
-
return this.missingRequiredCalls().length
|
|
3522
|
+
return !this.missingRequiredCalls().length;
|
|
3361
3523
|
}
|
|
3362
3524
|
const() {
|
|
3363
3525
|
this.kind = ts.NodeFlags.Const;
|
|
@@ -3383,7 +3545,7 @@ var VarTsDsl = class extends Mixed$14 {
|
|
|
3383
3545
|
}
|
|
3384
3546
|
$validate() {
|
|
3385
3547
|
const missing = this.missingRequiredCalls();
|
|
3386
|
-
if (missing.length
|
|
3548
|
+
if (!missing.length) return;
|
|
3387
3549
|
throw new Error(`Variable declaration missing ${missing.join(" and ")}`);
|
|
3388
3550
|
}
|
|
3389
3551
|
missingRequiredCalls() {
|
|
@@ -3414,7 +3576,7 @@ var TypeAliasTsDsl = class extends Mixed$13 {
|
|
|
3414
3576
|
}
|
|
3415
3577
|
/** Returns true when all required builder calls are present. */
|
|
3416
3578
|
get isValid() {
|
|
3417
|
-
return this.missingRequiredCalls().length
|
|
3579
|
+
return !this.missingRequiredCalls().length;
|
|
3418
3580
|
}
|
|
3419
3581
|
/** Sets the type expression on the right-hand side of `= ...`. */
|
|
3420
3582
|
type(node) {
|
|
@@ -3428,13 +3590,13 @@ var TypeAliasTsDsl = class extends Mixed$13 {
|
|
|
3428
3590
|
}
|
|
3429
3591
|
$validate() {
|
|
3430
3592
|
const missing = this.missingRequiredCalls();
|
|
3431
|
-
if (missing.length
|
|
3593
|
+
if (!missing.length) return;
|
|
3432
3594
|
const name = this.name.toString();
|
|
3433
3595
|
throw new Error(`Type alias${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3434
3596
|
}
|
|
3435
3597
|
missingRequiredCalls() {
|
|
3436
3598
|
const missing = [];
|
|
3437
|
-
if (!this.value) missing.push("
|
|
3599
|
+
if (!this.value) missing.push(".type()");
|
|
3438
3600
|
return missing;
|
|
3439
3601
|
}
|
|
3440
3602
|
};
|
|
@@ -3516,7 +3678,7 @@ var TypeIdxSigTsDsl = class extends Mixed$10 {
|
|
|
3516
3678
|
}
|
|
3517
3679
|
/** Returns true when all required builder calls are present. */
|
|
3518
3680
|
get isValid() {
|
|
3519
|
-
return this.missingRequiredCalls().length
|
|
3681
|
+
return !this.missingRequiredCalls().length;
|
|
3520
3682
|
}
|
|
3521
3683
|
/** Sets the key type: `[name: T]` */
|
|
3522
3684
|
key(type) {
|
|
@@ -3535,7 +3697,7 @@ var TypeIdxSigTsDsl = class extends Mixed$10 {
|
|
|
3535
3697
|
}
|
|
3536
3698
|
$validate() {
|
|
3537
3699
|
const missing = this.missingRequiredCalls();
|
|
3538
|
-
if (missing.length
|
|
3700
|
+
if (!missing.length) return;
|
|
3539
3701
|
const name = this.name.toString();
|
|
3540
3702
|
throw new Error(`Index signature${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3541
3703
|
}
|
|
@@ -3573,7 +3735,7 @@ var TypePropTsDsl = class extends Mixed$9 {
|
|
|
3573
3735
|
}
|
|
3574
3736
|
/** Returns true when all required builder calls are present. */
|
|
3575
3737
|
get isValid() {
|
|
3576
|
-
return this.missingRequiredCalls().length
|
|
3738
|
+
return !this.missingRequiredCalls().length;
|
|
3577
3739
|
}
|
|
3578
3740
|
/** Sets the property type. */
|
|
3579
3741
|
type(type) {
|
|
@@ -3588,13 +3750,13 @@ var TypePropTsDsl = class extends Mixed$9 {
|
|
|
3588
3750
|
}
|
|
3589
3751
|
$validate() {
|
|
3590
3752
|
const missing = this.missingRequiredCalls();
|
|
3591
|
-
if (missing.length
|
|
3753
|
+
if (!missing.length) return;
|
|
3592
3754
|
const name = this.name.toString();
|
|
3593
3755
|
throw new Error(`Type property${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3594
3756
|
}
|
|
3595
3757
|
missingRequiredCalls() {
|
|
3596
3758
|
const missing = [];
|
|
3597
|
-
if (!this._type) missing.push("
|
|
3759
|
+
if (!this._type) missing.push(".type()");
|
|
3598
3760
|
return missing;
|
|
3599
3761
|
}
|
|
3600
3762
|
};
|
|
@@ -3695,7 +3857,7 @@ var TypeFuncTsDsl = class extends Mixed$6 {
|
|
|
3695
3857
|
}
|
|
3696
3858
|
/** Returns true when all required builder calls are present. */
|
|
3697
3859
|
get isValid() {
|
|
3698
|
-
return this.missingRequiredCalls().length
|
|
3860
|
+
return !this.missingRequiredCalls().length;
|
|
3699
3861
|
}
|
|
3700
3862
|
toAst() {
|
|
3701
3863
|
this.$validate();
|
|
@@ -3704,7 +3866,7 @@ var TypeFuncTsDsl = class extends Mixed$6 {
|
|
|
3704
3866
|
}
|
|
3705
3867
|
$validate() {
|
|
3706
3868
|
const missing = this.missingRequiredCalls();
|
|
3707
|
-
if (missing.length
|
|
3869
|
+
if (!missing.length) return;
|
|
3708
3870
|
throw new Error(`Function type missing ${missing.join(" and ")}`);
|
|
3709
3871
|
}
|
|
3710
3872
|
missingRequiredCalls() {
|
|
@@ -3734,7 +3896,7 @@ var TypeIdxTsDsl = class extends Mixed$5 {
|
|
|
3734
3896
|
}
|
|
3735
3897
|
/** Returns true when all required builder calls are present. */
|
|
3736
3898
|
get isValid() {
|
|
3737
|
-
return this.missingRequiredCalls().length
|
|
3899
|
+
return !this.missingRequiredCalls().length;
|
|
3738
3900
|
}
|
|
3739
3901
|
base(base) {
|
|
3740
3902
|
this._base = base;
|
|
@@ -3750,7 +3912,7 @@ var TypeIdxTsDsl = class extends Mixed$5 {
|
|
|
3750
3912
|
}
|
|
3751
3913
|
$validate() {
|
|
3752
3914
|
const missing = this.missingRequiredCalls();
|
|
3753
|
-
if (missing.length
|
|
3915
|
+
if (!missing.length) return;
|
|
3754
3916
|
throw new Error(`Indexed access type missing ${missing.join(" and ")}`);
|
|
3755
3917
|
}
|
|
3756
3918
|
missingRequiredCalls() {
|
|
@@ -3785,7 +3947,7 @@ var TypeMappedTsDsl = class extends Mixed$4 {
|
|
|
3785
3947
|
}
|
|
3786
3948
|
/** Returns true when all required builder calls are present. */
|
|
3787
3949
|
get isValid() {
|
|
3788
|
-
return this.missingRequiredCalls().length
|
|
3950
|
+
return !this.missingRequiredCalls().length;
|
|
3789
3951
|
}
|
|
3790
3952
|
/** Sets the key constraint: `[K in Constraint]` */
|
|
3791
3953
|
key(type) {
|
|
@@ -3823,7 +3985,7 @@ var TypeMappedTsDsl = class extends Mixed$4 {
|
|
|
3823
3985
|
}
|
|
3824
3986
|
$validate() {
|
|
3825
3987
|
const missing = this.missingRequiredCalls();
|
|
3826
|
-
if (missing.length
|
|
3988
|
+
if (!missing.length) return;
|
|
3827
3989
|
const name = this.name.toString();
|
|
3828
3990
|
throw new Error(`Mapped type${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
|
|
3829
3991
|
}
|
|
@@ -3894,7 +4056,7 @@ var TypeOperatorTsDsl = class extends Mixed$3 {
|
|
|
3894
4056
|
/** Throws if required fields are not set. */
|
|
3895
4057
|
$validate() {
|
|
3896
4058
|
const missing = this.missingRequiredCalls();
|
|
3897
|
-
if (missing.length
|
|
4059
|
+
if (!missing.length) return;
|
|
3898
4060
|
throw new Error(`Type operator missing ${missing.join(" and ")}`);
|
|
3899
4061
|
}
|
|
3900
4062
|
missingRequiredCalls() {
|
|
@@ -3992,7 +4154,7 @@ var TypeTemplateTsDsl = class extends Mixed {
|
|
|
3992
4154
|
normalized.push(merged);
|
|
3993
4155
|
} else normalized.push(current);
|
|
3994
4156
|
}
|
|
3995
|
-
if (normalized.length
|
|
4157
|
+
if (!normalized.length || typeof normalized[0] !== "string") normalized.unshift("");
|
|
3996
4158
|
if (normalized.length === 1 && typeof normalized[0] === "string") return ts.factory.createTemplateLiteralType(ts.factory.createTemplateHead(normalized[0]), []);
|
|
3997
4159
|
if (normalized.length === 2 && typeof normalized[0] === "string" && typeof normalized[1] !== "string") return ts.factory.createTemplateLiteralType(ts.factory.createTemplateHead(normalized[0]), [ts.factory.createTemplateLiteralTypeSpan(normalized[1], ts.factory.createTemplateTail(""))]);
|
|
3998
4160
|
const head = ts.factory.createTemplateHead(normalized.shift());
|
|
@@ -4000,7 +4162,7 @@ var TypeTemplateTsDsl = class extends Mixed {
|
|
|
4000
4162
|
while (normalized.length) {
|
|
4001
4163
|
const type = normalized.shift();
|
|
4002
4164
|
const next = typeof normalized[0] === "string" ? normalized.shift() : "";
|
|
4003
|
-
const isLast = normalized.length
|
|
4165
|
+
const isLast = !normalized.length;
|
|
4004
4166
|
spans.push(ts.factory.createTemplateLiteralTypeSpan(type, isLast ? ts.factory.createTemplateTail(next) : ts.factory.createTemplateMiddle(next)));
|
|
4005
4167
|
}
|
|
4006
4168
|
return ts.factory.createTemplateLiteralType(head, spans);
|
|
@@ -4165,7 +4327,7 @@ var TypeScriptRenderer = class TypeScriptRenderer {
|
|
|
4165
4327
|
const specifiers = group.imports.map((imp) => {
|
|
4166
4328
|
return ts.factory.createImportSpecifier(imp.isTypeOnly, imp.sourceName !== imp.localName ? $.id(imp.sourceName).toAst() : void 0, $.id(imp.localName).toAst());
|
|
4167
4329
|
});
|
|
4168
|
-
const importClause = ts.factory.createImportClause(group.isTypeOnly, group.kind === "default" ? $.id(group.localName ?? "").toAst() : void 0, group.kind === "namespace" ? ts.factory.createNamespaceImport($.id(group.localName ?? "").toAst()) : specifiers.length
|
|
4330
|
+
const importClause = ts.factory.createImportClause(group.isTypeOnly, group.kind === "default" ? $.id(group.localName ?? "").toAst() : void 0, group.kind === "namespace" ? ts.factory.createNamespaceImport($.id(group.localName ?? "").toAst()) : specifiers.length ? ts.factory.createNamedImports(specifiers) : void 0);
|
|
4169
4331
|
return ts.factory.createImportDeclaration(void 0, importClause, $.literal(group.modulePath).toAst());
|
|
4170
4332
|
}
|
|
4171
4333
|
getExports(ctx) {
|
|
@@ -4275,22 +4437,24 @@ const tsDsl = {
|
|
|
4275
4437
|
call: (...args) => new CallTsDsl(...args),
|
|
4276
4438
|
class: (...args) => new ClassTsDsl(...args),
|
|
4277
4439
|
const: (...args) => new VarTsDsl(...args).const(),
|
|
4440
|
+
dec: (...args) => new PostfixTsDsl(...args).dec(),
|
|
4278
4441
|
decorator: (...args) => new DecoratorTsDsl(...args),
|
|
4279
4442
|
doc: (...args) => new DocTsDsl(...args),
|
|
4280
4443
|
enum: (...args) => new EnumTsDsl(...args),
|
|
4281
4444
|
expr: (...args) => new ExprTsDsl(...args),
|
|
4282
4445
|
field: (...args) => new FieldTsDsl(...args),
|
|
4446
|
+
for: ((...args) => new ForTsDsl(...args)),
|
|
4283
4447
|
fromValue: (...args) => fromValue$1(...args),
|
|
4284
4448
|
func: ((nameOrFn, fn) => {
|
|
4285
4449
|
if (nameOrFn === void 0) return new FuncTsDsl();
|
|
4286
|
-
if (typeof nameOrFn !== "string") return new FuncTsDsl(nameOrFn);
|
|
4287
|
-
if (fn === void 0) return new FuncTsDsl(nameOrFn);
|
|
4450
|
+
if (typeof nameOrFn !== "string" || fn === void 0) return new FuncTsDsl(nameOrFn);
|
|
4288
4451
|
return new FuncTsDsl(nameOrFn, fn);
|
|
4289
4452
|
}),
|
|
4290
4453
|
getter: (...args) => new GetterTsDsl(...args),
|
|
4291
4454
|
hint: (...args) => new HintTsDsl(...args),
|
|
4292
4455
|
id: (...args) => new IdTsDsl(...args),
|
|
4293
4456
|
if: (...args) => new IfTsDsl(...args),
|
|
4457
|
+
inc: (...args) => new PostfixTsDsl(...args).inc(),
|
|
4294
4458
|
init: (...args) => new InitTsDsl(...args),
|
|
4295
4459
|
lazy: (...args) => new LazyTsDsl(...args),
|
|
4296
4460
|
let: (...args) => new VarTsDsl(...args).let(),
|
|
@@ -4409,7 +4573,7 @@ const operationAuth = ({ operation, plugin }) => {
|
|
|
4409
4573
|
//#region src/plugins/@hey-api/sdk/shared/signature.ts
|
|
4410
4574
|
/**
|
|
4411
4575
|
* Collects and resolves all operation parameters for flattened SDK signatures.
|
|
4412
|
-
* - Prefixes all conflicting names with their location (e.g
|
|
4576
|
+
* - Prefixes all conflicting names with their location (e.g., path_foo, query_foo)
|
|
4413
4577
|
* - Returns a flat map of resolved parameter names to their metadata
|
|
4414
4578
|
*/
|
|
4415
4579
|
function getSignatureParameters({ operation }) {
|
|
@@ -5226,33 +5390,11 @@ function toHttpResourceNode(model, plugin) {
|
|
|
5226
5390
|
const handler$13 = ({ plugin }) => {
|
|
5227
5391
|
plugin.symbol("HttpRequest", {
|
|
5228
5392
|
external: "@angular/common/http",
|
|
5229
|
-
kind: "type"
|
|
5230
|
-
meta: {
|
|
5231
|
-
category: "external",
|
|
5232
|
-
resource: "@angular/common/http.HttpRequest"
|
|
5233
|
-
}
|
|
5234
|
-
});
|
|
5235
|
-
plugin.symbol("inject", {
|
|
5236
|
-
external: "@angular/core",
|
|
5237
|
-
meta: {
|
|
5238
|
-
category: "external",
|
|
5239
|
-
resource: "@angular/core.inject"
|
|
5240
|
-
}
|
|
5241
|
-
});
|
|
5242
|
-
plugin.symbol("Injectable", {
|
|
5243
|
-
external: "@angular/core",
|
|
5244
|
-
meta: {
|
|
5245
|
-
category: "external",
|
|
5246
|
-
resource: "@angular/core.Injectable"
|
|
5247
|
-
}
|
|
5248
|
-
});
|
|
5249
|
-
plugin.symbol("httpResource", {
|
|
5250
|
-
external: "@angular/common/http",
|
|
5251
|
-
meta: {
|
|
5252
|
-
category: "external",
|
|
5253
|
-
resource: "@angular/common/http.httpResource"
|
|
5254
|
-
}
|
|
5393
|
+
kind: "type"
|
|
5255
5394
|
});
|
|
5395
|
+
plugin.symbol("inject", { external: "@angular/core" });
|
|
5396
|
+
plugin.symbol("Injectable", { external: "@angular/core" });
|
|
5397
|
+
plugin.symbol("httpResource", { external: "@angular/common/http" });
|
|
5256
5398
|
const httpRequestStructure = new StructureModel();
|
|
5257
5399
|
const httpResourceStructure = new StructureModel();
|
|
5258
5400
|
if (plugin.config.httpRequests.enabled) {
|
|
@@ -6150,7 +6292,6 @@ const createTypeOptions = ({ plugin }) => {
|
|
|
6150
6292
|
external: clientModule,
|
|
6151
6293
|
kind: "type",
|
|
6152
6294
|
meta: {
|
|
6153
|
-
category: "external",
|
|
6154
6295
|
resource: "client.Client",
|
|
6155
6296
|
tool: client.name
|
|
6156
6297
|
}
|
|
@@ -6182,7 +6323,6 @@ const handlerV1$3 = ({ plugin }) => {
|
|
|
6182
6323
|
plugin.symbol("formDataBodySerializer", {
|
|
6183
6324
|
external: clientModule,
|
|
6184
6325
|
meta: {
|
|
6185
|
-
category: "external",
|
|
6186
6326
|
resource: "client.formDataBodySerializer",
|
|
6187
6327
|
tool: client.name
|
|
6188
6328
|
}
|
|
@@ -6190,7 +6330,6 @@ const handlerV1$3 = ({ plugin }) => {
|
|
|
6190
6330
|
plugin.symbol("urlSearchParamsBodySerializer", {
|
|
6191
6331
|
external: clientModule,
|
|
6192
6332
|
meta: {
|
|
6193
|
-
category: "external",
|
|
6194
6333
|
resource: "client.urlSearchParamsBodySerializer",
|
|
6195
6334
|
tool: client.name
|
|
6196
6335
|
}
|
|
@@ -6198,7 +6337,6 @@ const handlerV1$3 = ({ plugin }) => {
|
|
|
6198
6337
|
plugin.symbol("buildClientParams", {
|
|
6199
6338
|
external: clientModule,
|
|
6200
6339
|
meta: {
|
|
6201
|
-
category: "external",
|
|
6202
6340
|
resource: "client.buildClientParams",
|
|
6203
6341
|
tool: client.name
|
|
6204
6342
|
}
|
|
@@ -6207,18 +6345,11 @@ const handlerV1$3 = ({ plugin }) => {
|
|
|
6207
6345
|
external: clientModule,
|
|
6208
6346
|
kind: "type",
|
|
6209
6347
|
meta: {
|
|
6210
|
-
category: "external",
|
|
6211
6348
|
resource: "client.Composable",
|
|
6212
6349
|
tool: client.name
|
|
6213
6350
|
}
|
|
6214
6351
|
});
|
|
6215
|
-
if (isAngularClient) plugin.symbol("Injectable", {
|
|
6216
|
-
external: "@angular/core",
|
|
6217
|
-
meta: {
|
|
6218
|
-
category: "external",
|
|
6219
|
-
resource: "@angular/core.Injectable"
|
|
6220
|
-
}
|
|
6221
|
-
});
|
|
6352
|
+
if (isAngularClient) plugin.symbol("Injectable", { external: "@angular/core" });
|
|
6222
6353
|
createTypeOptions({ plugin });
|
|
6223
6354
|
const structure = new StructureModel();
|
|
6224
6355
|
const shell = createShell$1(plugin);
|
|
@@ -6322,16 +6453,16 @@ const defineConfig$16 = definePluginConfig(defaultConfig$16);
|
|
|
6322
6453
|
//#region src/plugins/@hey-api/transformers/expressions.ts
|
|
6323
6454
|
const bigIntExpressions = ({ dataExpression, schema }) => {
|
|
6324
6455
|
if (schema.type !== "integer" || schema.format !== "int64") return;
|
|
6325
|
-
const bigIntCallExpression = dataExpression !== void 0 ? $("BigInt").call(
|
|
6456
|
+
const bigIntCallExpression = dataExpression !== void 0 ? $("BigInt").call($(dataExpression).attr("toString").call()) : void 0;
|
|
6326
6457
|
if (bigIntCallExpression) {
|
|
6327
6458
|
if (typeof dataExpression === "string") return [bigIntCallExpression];
|
|
6328
|
-
if (dataExpression) return [
|
|
6459
|
+
if (dataExpression) return [$(dataExpression).assign(bigIntCallExpression)];
|
|
6329
6460
|
}
|
|
6330
6461
|
};
|
|
6331
6462
|
const dateExpressions = ({ dataExpression, schema }) => {
|
|
6332
6463
|
if (schema.type !== "string" || !(schema.format === "date" || schema.format === "date-time")) return;
|
|
6333
6464
|
if (typeof dataExpression === "string") return [$.new("Date").arg(dataExpression)];
|
|
6334
|
-
if (dataExpression) return [
|
|
6465
|
+
if (dataExpression) return [$(dataExpression).assign($.new("Date").arg(dataExpression))];
|
|
6335
6466
|
};
|
|
6336
6467
|
|
|
6337
6468
|
//#endregion
|
|
@@ -6419,6 +6550,17 @@ function processSchemaType({ dataExpression, plugin, schema }) {
|
|
|
6419
6550
|
if (required.includes(name) && noNullableTypesInSchema) nodes = nodes.concat(propertyNodes);
|
|
6420
6551
|
else nodes.push($.if(propertyAccessExpression).do(...propertyNodes));
|
|
6421
6552
|
}
|
|
6553
|
+
if (schema.additionalProperties && dataExpression) {
|
|
6554
|
+
const entryValueNodes = processSchemaType({
|
|
6555
|
+
dataExpression: $(dataExpression).attr("key").computed(),
|
|
6556
|
+
plugin,
|
|
6557
|
+
schema: schema.additionalProperties
|
|
6558
|
+
});
|
|
6559
|
+
if (entryValueNodes.length) {
|
|
6560
|
+
const properties = Object.keys(schema.properties ?? {});
|
|
6561
|
+
nodes.push($.for($.const("key")).of($("Object").attr("keys").call(dataExpression)).$if(properties.length, (f) => f.do($.if($.not($.array(...properties).attr("includes").call("key"))).do(...entryValueNodes)), (f) => f.do(...entryValueNodes)));
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6422
6564
|
return nodes;
|
|
6423
6565
|
}
|
|
6424
6566
|
if (schema.items) {
|
|
@@ -6815,9 +6957,9 @@ function itemsNode$4(ctx) {
|
|
|
6815
6957
|
function baseNode$61(ctx) {
|
|
6816
6958
|
const { schema } = ctx;
|
|
6817
6959
|
const items = schema.items ?? [];
|
|
6818
|
-
if (items.length
|
|
6960
|
+
if (!items.length) return $.type("never");
|
|
6819
6961
|
const literalTypes = items.filter((item) => item.const !== void 0).map((item) => $.type.fromValue(item.const));
|
|
6820
|
-
return literalTypes.length
|
|
6962
|
+
return literalTypes.length ? $.type.or(...literalTypes) : $.type("string");
|
|
6821
6963
|
}
|
|
6822
6964
|
function enumResolver$4(ctx) {
|
|
6823
6965
|
return ctx.nodes.base(ctx);
|
|
@@ -6966,16 +7108,16 @@ function baseNode$56(ctx) {
|
|
|
6966
7108
|
const ir = schema.patternProperties[pattern];
|
|
6967
7109
|
indexSchemas.unshift(ir);
|
|
6968
7110
|
}
|
|
6969
|
-
const hasPatterns =
|
|
7111
|
+
const hasPatterns = schema.patternProperties && Object.keys(schema.patternProperties).length;
|
|
6970
7112
|
const addPropsRaw = schema.additionalProperties;
|
|
6971
7113
|
const addPropsObj = addPropsRaw !== false && addPropsRaw ? addPropsRaw : void 0;
|
|
6972
|
-
if (hasPatterns ||
|
|
7114
|
+
if (hasPatterns || addPropsObj && (addPropsObj.type !== "never" || !indexSchemas.length)) {
|
|
6973
7115
|
const addProps = addPropsObj;
|
|
6974
7116
|
if (addProps && addProps.type !== "never") if (addProps.type === "unknown") indexSchemas = [addProps, ...schema.patternProperties ? Object.values(schema.patternProperties) : []];
|
|
6975
7117
|
else indexSchemas.unshift(addProps);
|
|
6976
7118
|
else if (!hasPatterns && !indexSchemas.length && addProps && addProps.type === "never") indexSchemas = [addProps];
|
|
6977
7119
|
if (hasOptionalProperties && addProps?.type !== "unknown") indexSchemas.push({ type: "undefined" });
|
|
6978
|
-
if (indexSchemas.length
|
|
7120
|
+
if (indexSchemas.length) {
|
|
6979
7121
|
const indexType = walk(indexSchemas.length === 1 ? indexSchemas[0] : deduplicateSchema({ schema: {
|
|
6980
7122
|
items: indexSchemas,
|
|
6981
7123
|
logicalOperator: "or"
|
|
@@ -7350,7 +7492,7 @@ function createVisitor$4(config) {
|
|
|
7350
7492
|
resource: "definition",
|
|
7351
7493
|
resourceId: $ref
|
|
7352
7494
|
});
|
|
7353
|
-
if (schema.omit && schema.omit.length
|
|
7495
|
+
if (schema.omit && schema.omit.length) {
|
|
7354
7496
|
const omittedKeys = schema.omit.length === 1 ? $.type.literal(schema.omit[0]) : $.type.or(...schema.omit.map((key) => $.type.literal(key)));
|
|
7355
7497
|
return {
|
|
7356
7498
|
meta: defaultMeta$2(schema),
|
|
@@ -7564,7 +7706,7 @@ const operationToType = ({ operation, path, plugin, tags }) => {
|
|
|
7564
7706
|
if (data.properties.path.required) dataRequired.push("path");
|
|
7565
7707
|
if (data.properties.query.required) dataRequired.push("query");
|
|
7566
7708
|
dataRequired.push("url");
|
|
7567
|
-
if (dataRequired.length
|
|
7709
|
+
if (dataRequired.length) data.required = dataRequired;
|
|
7568
7710
|
const dataResult = processor.process({
|
|
7569
7711
|
export: false,
|
|
7570
7712
|
meta: {
|
|
@@ -7850,7 +7992,7 @@ const handlerV1$2 = ({ plugin }) => {
|
|
|
7850
7992
|
plugin,
|
|
7851
7993
|
servers
|
|
7852
7994
|
});
|
|
7853
|
-
if (webhooks.length
|
|
7995
|
+
if (webhooks.length) {
|
|
7854
7996
|
const symbol = plugin.registerSymbol(buildSymbolIn({
|
|
7855
7997
|
meta: {
|
|
7856
7998
|
category: "type",
|
|
@@ -8070,20 +8212,14 @@ const createQueryKeyFunction$1 = ({ plugin }) => {
|
|
|
8070
8212
|
});
|
|
8071
8213
|
const symbolClient = plugin.getSymbol({ category: "client" });
|
|
8072
8214
|
const clientModule = clientFolderAbsolutePath(getTypedConfig(plugin));
|
|
8073
|
-
const symbolSerializeQueryValue = plugin.symbol("serializeQueryKeyValue", {
|
|
8074
|
-
external: clientModule,
|
|
8075
|
-
meta: {
|
|
8076
|
-
category: "external",
|
|
8077
|
-
resource: `${clientModule}.serializeQueryKeyValue`
|
|
8078
|
-
}
|
|
8079
|
-
});
|
|
8215
|
+
const symbolSerializeQueryValue = plugin.symbol("serializeQueryKeyValue", { external: clientModule });
|
|
8080
8216
|
const fn = $.const(symbolCreateQueryKey).assign($.func().param("id", (p) => p.type("string")).param("options", (p) => p.optional().type(TOptionsType$1)).param("tags", (p) => p.optional().type("ReadonlyArray<string>")).returns($.type.tuple(returnType)).generic(TOptionsType$1, (g) => g.extends(symbolOptions)).do($.const("params").type(returnType).assign($.object().prop("_id", "id").prop(baseUrlKey, $("options").attr(baseUrlKey).optional().or($("options").attr("client").optional().$if(symbolClient, (a, v) => a.coalesce(v)).attr("getConfig").call().attr(baseUrlKey))).as(returnType)), $.if("tags").do($("params").attr("tags").assign($("tags").as("unknown").as(symbolJsonValue))), $.if($("options").attr("body").optional().neq($.id("undefined"))).do($.const("normalizedBody").assign($(symbolSerializeQueryValue).call($("options").attr("body"))), $.if($("normalizedBody").neq($.id("undefined"))).do($("params").attr("body").assign("normalizedBody"))), $.if($("options").attr("path").optional()).do($("params").attr("path").assign($("options").attr("path"))), $.if($("options").attr("query").optional().neq($.id("undefined"))).do($.const("normalizedQuery").assign($(symbolSerializeQueryValue).call($("options").attr("query"))), $.if($("normalizedQuery").neq($.id("undefined"))).do($("params").attr("query").assign("normalizedQuery"))), $.return($.array($("params")))));
|
|
8081
8217
|
plugin.node(fn);
|
|
8082
8218
|
};
|
|
8083
8219
|
const createQueryKeyLiteral$1 = ({ id, operation, plugin }) => {
|
|
8084
8220
|
const config = plugin.config.queryKeys;
|
|
8085
8221
|
let tagsExpression;
|
|
8086
|
-
if (config.tags && operation.tags && operation.tags.length
|
|
8222
|
+
if (config.tags && operation.tags && operation.tags.length) tagsExpression = $.array(...operation.tags.map((tag) => $.literal(tag)));
|
|
8087
8223
|
return $(plugin.referenceSymbol({
|
|
8088
8224
|
category: "utility",
|
|
8089
8225
|
resource: "createQueryKey",
|
|
@@ -8153,7 +8289,7 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
|
|
|
8153
8289
|
tool: plugin.name
|
|
8154
8290
|
});
|
|
8155
8291
|
let tagsExpr;
|
|
8156
|
-
if (plugin.config.queryKeys.tags && operation.tags && operation.tags.length
|
|
8292
|
+
if (plugin.config.queryKeys.tags && operation.tags && operation.tags.length) tagsExpr = $.array(...operation.tags.map((t) => $.literal(t)));
|
|
8157
8293
|
keyExpression = $(symbolCreateQueryKey).call($.literal(operation.id), optionsParamName$2, tagsExpr);
|
|
8158
8294
|
}
|
|
8159
8295
|
const typeData = getPublicTypeData({
|
|
@@ -8191,44 +8327,22 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
|
|
|
8191
8327
|
//#endregion
|
|
8192
8328
|
//#region src/plugins/@pinia/colada/v0/plugin.ts
|
|
8193
8329
|
const handlerV0 = ({ plugin }) => {
|
|
8194
|
-
plugin.symbol("defineQueryOptions", {
|
|
8195
|
-
external: plugin.name,
|
|
8196
|
-
meta: {
|
|
8197
|
-
category: "external",
|
|
8198
|
-
resource: `${plugin.name}.defineQueryOptions`
|
|
8199
|
-
}
|
|
8200
|
-
});
|
|
8330
|
+
plugin.symbol("defineQueryOptions", { external: plugin.name });
|
|
8201
8331
|
plugin.symbol("UseMutationOptions", {
|
|
8202
8332
|
external: plugin.name,
|
|
8203
|
-
kind: "type"
|
|
8204
|
-
meta: {
|
|
8205
|
-
category: "external",
|
|
8206
|
-
resource: `${plugin.name}.UseMutationOptions`
|
|
8207
|
-
}
|
|
8333
|
+
kind: "type"
|
|
8208
8334
|
});
|
|
8209
8335
|
plugin.symbol("UseQueryOptions", {
|
|
8210
8336
|
external: plugin.name,
|
|
8211
|
-
kind: "type"
|
|
8212
|
-
meta: {
|
|
8213
|
-
category: "external",
|
|
8214
|
-
resource: `${plugin.name}.UseQueryOptions`
|
|
8215
|
-
}
|
|
8337
|
+
kind: "type"
|
|
8216
8338
|
});
|
|
8217
8339
|
plugin.symbol("_JSONValue", {
|
|
8218
8340
|
external: plugin.name,
|
|
8219
|
-
kind: "type"
|
|
8220
|
-
meta: {
|
|
8221
|
-
category: "external",
|
|
8222
|
-
resource: `${plugin.name}._JSONValue`
|
|
8223
|
-
}
|
|
8341
|
+
kind: "type"
|
|
8224
8342
|
});
|
|
8225
8343
|
plugin.symbol("AxiosError", {
|
|
8226
8344
|
external: "axios",
|
|
8227
|
-
kind: "type"
|
|
8228
|
-
meta: {
|
|
8229
|
-
category: "external",
|
|
8230
|
-
resource: "axios.AxiosError"
|
|
8231
|
-
}
|
|
8345
|
+
kind: "type"
|
|
8232
8346
|
});
|
|
8233
8347
|
plugin.forEach("operation", ({ operation }) => {
|
|
8234
8348
|
if (plugin.hooks.operation.isQuery(operation)) {
|
|
@@ -8357,7 +8471,7 @@ const createQueryKeyFunction = ({ plugin }) => {
|
|
|
8357
8471
|
const createQueryKeyLiteral = ({ id, isInfinite, operation, plugin }) => {
|
|
8358
8472
|
const config = isInfinite ? plugin.config.infiniteQueryKeys : plugin.config.queryKeys;
|
|
8359
8473
|
let tagsArray;
|
|
8360
|
-
if (config.tags && operation.tags && operation.tags.length
|
|
8474
|
+
if (config.tags && operation.tags && operation.tags.length) tagsArray = $.array().elements(...operation.tags);
|
|
8361
8475
|
return $(plugin.referenceSymbol({
|
|
8362
8476
|
category: "utility",
|
|
8363
8477
|
resource: "createQueryKey",
|
|
@@ -8641,64 +8755,25 @@ const createUseQuery = ({ operation, plugin }) => {
|
|
|
8641
8755
|
const handlerV5 = ({ plugin }) => {
|
|
8642
8756
|
plugin.symbol("DefaultError", {
|
|
8643
8757
|
external: plugin.name,
|
|
8644
|
-
kind: "type"
|
|
8645
|
-
meta: {
|
|
8646
|
-
category: "external",
|
|
8647
|
-
resource: `${plugin.name}.DefaultError`
|
|
8648
|
-
}
|
|
8758
|
+
kind: "type"
|
|
8649
8759
|
});
|
|
8650
8760
|
plugin.symbol("InfiniteData", {
|
|
8651
8761
|
external: plugin.name,
|
|
8652
|
-
kind: "type"
|
|
8653
|
-
meta: {
|
|
8654
|
-
category: "external",
|
|
8655
|
-
resource: `${plugin.name}.InfiniteData`
|
|
8656
|
-
}
|
|
8762
|
+
kind: "type"
|
|
8657
8763
|
});
|
|
8658
8764
|
const mutationsType = plugin.name === "@tanstack/angular-query-experimental" || plugin.name === "@tanstack/svelte-query" || plugin.name === "@tanstack/solid-query" ? "MutationOptions" : "UseMutationOptions";
|
|
8659
8765
|
plugin.symbol(mutationsType, {
|
|
8660
8766
|
external: plugin.name,
|
|
8661
8767
|
kind: "type",
|
|
8662
|
-
meta: {
|
|
8663
|
-
category: "external",
|
|
8664
|
-
resource: `${plugin.name}.MutationOptions`
|
|
8665
|
-
}
|
|
8666
|
-
});
|
|
8667
|
-
plugin.symbol("infiniteQueryOptions", {
|
|
8668
|
-
external: plugin.name,
|
|
8669
|
-
meta: {
|
|
8670
|
-
category: "external",
|
|
8671
|
-
resource: `${plugin.name}.infiniteQueryOptions`
|
|
8672
|
-
}
|
|
8673
|
-
});
|
|
8674
|
-
plugin.symbol("queryOptions", {
|
|
8675
|
-
external: plugin.name,
|
|
8676
|
-
meta: {
|
|
8677
|
-
category: "external",
|
|
8678
|
-
resource: `${plugin.name}.queryOptions`
|
|
8679
|
-
}
|
|
8680
|
-
});
|
|
8681
|
-
plugin.symbol("useMutation", {
|
|
8682
|
-
external: plugin.name,
|
|
8683
|
-
meta: {
|
|
8684
|
-
category: "external",
|
|
8685
|
-
resource: `${plugin.name}.useMutation`
|
|
8686
|
-
}
|
|
8687
|
-
});
|
|
8688
|
-
plugin.symbol("useQuery", {
|
|
8689
|
-
external: plugin.name,
|
|
8690
|
-
meta: {
|
|
8691
|
-
category: "external",
|
|
8692
|
-
resource: `${plugin.name}.useQuery`
|
|
8693
|
-
}
|
|
8768
|
+
meta: { resource: `${plugin.name}.MutationOptions` }
|
|
8694
8769
|
});
|
|
8770
|
+
plugin.symbol("infiniteQueryOptions", { external: plugin.name });
|
|
8771
|
+
plugin.symbol("queryOptions", { external: plugin.name });
|
|
8772
|
+
plugin.symbol("useMutation", { external: plugin.name });
|
|
8773
|
+
plugin.symbol("useQuery", { external: plugin.name });
|
|
8695
8774
|
plugin.symbol("AxiosError", {
|
|
8696
8775
|
external: "axios",
|
|
8697
|
-
kind: "type"
|
|
8698
|
-
meta: {
|
|
8699
|
-
category: "external",
|
|
8700
|
-
resource: "axios.AxiosError"
|
|
8701
|
-
}
|
|
8776
|
+
kind: "type"
|
|
8702
8777
|
});
|
|
8703
8778
|
plugin.forEach("operation", ({ operation }) => {
|
|
8704
8779
|
if (plugin.hooks.operation.isQuery(operation)) {
|
|
@@ -9628,13 +9703,7 @@ function handleComponent({ plugin, schema, state }) {
|
|
|
9628
9703
|
});
|
|
9629
9704
|
}
|
|
9630
9705
|
const handlerV2$1 = ({ plugin }) => {
|
|
9631
|
-
plugin.symbol("type", {
|
|
9632
|
-
external: "arktype",
|
|
9633
|
-
meta: {
|
|
9634
|
-
category: "external",
|
|
9635
|
-
resource: "arktype.type"
|
|
9636
|
-
}
|
|
9637
|
-
});
|
|
9706
|
+
plugin.symbol("type", { external: "arktype" });
|
|
9638
9707
|
plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
|
|
9639
9708
|
const state = refs({
|
|
9640
9709
|
hasLazyExpression: false,
|
|
@@ -10088,9 +10157,9 @@ function normalizeConfig(input, context) {
|
|
|
10088
10157
|
//#endregion
|
|
10089
10158
|
//#region src/plugins/orpc/shared/operation.ts
|
|
10090
10159
|
function hasInput(operation) {
|
|
10091
|
-
const hasPathParams = Boolean(operation.parameters?.path && Object.keys(operation.parameters.path).length
|
|
10092
|
-
const hasQueryParams = Boolean(operation.parameters?.query && Object.keys(operation.parameters.query).length
|
|
10093
|
-
const hasHeaderParams = Boolean(operation.parameters?.header && Object.keys(operation.parameters.header).length
|
|
10160
|
+
const hasPathParams = Boolean(operation.parameters?.path && Object.keys(operation.parameters.path).length);
|
|
10161
|
+
const hasQueryParams = Boolean(operation.parameters?.query && Object.keys(operation.parameters.query).length);
|
|
10162
|
+
const hasHeaderParams = Boolean(operation.parameters?.header && Object.keys(operation.parameters.header).length);
|
|
10094
10163
|
const hasBody = Boolean(operation.body);
|
|
10095
10164
|
return hasPathParams || hasQueryParams || hasHeaderParams || hasBody;
|
|
10096
10165
|
}
|
|
@@ -10108,7 +10177,7 @@ function getSuccessResponse(operation) {
|
|
|
10108
10177
|
};
|
|
10109
10178
|
}
|
|
10110
10179
|
function getTags(operation, defaultTag) {
|
|
10111
|
-
return operation.tags && operation.tags.length
|
|
10180
|
+
return operation.tags && operation.tags.length ? [...operation.tags] : [defaultTag];
|
|
10112
10181
|
}
|
|
10113
10182
|
|
|
10114
10183
|
//#endregion
|
|
@@ -10135,10 +10204,10 @@ function createContractSymbol(plugin, item) {
|
|
|
10135
10204
|
tool: plugin.name
|
|
10136
10205
|
} });
|
|
10137
10206
|
}
|
|
10138
|
-
function createContractExpression(plugin, operation
|
|
10207
|
+
function createContractExpression(plugin, operation) {
|
|
10139
10208
|
const successResponse = getSuccessResponse(operation);
|
|
10140
10209
|
const tags = getTags(operation, plugin.config.contracts.strategyDefaultTag);
|
|
10141
|
-
let expression = $(
|
|
10210
|
+
let expression = $(plugin.external("@orpc/contract.oc")).attr("route").call($.object().$if(operation.deprecated, (o, v) => o.prop("deprecated", $.literal(v))).$if(operation.description, (o, v) => o.prop("description", $.literal(v))).prop("inputStructure", $.literal("detailed")).prop("method", $.literal(operation.method.toUpperCase())).$if(operation.operationId, (o, v) => o.prop("operationId", $.literal(v))).prop("path", $.literal(operation.path)).$if(successResponse.hasOutput && successResponse.statusCode !== 200 && successResponse.statusCode, (o, v) => o.prop("successStatus", $.literal(v))).$if(operation.summary, (o, v) => o.prop("summary", $.literal(v))).$if(Boolean(tags.length) && tags, (o, v) => o.prop("tags", $.fromValue(v))));
|
|
10142
10211
|
if (hasInput(operation) && plugin.config.validator.input) expression = expression.attr("input").call(plugin.referenceSymbol({
|
|
10143
10212
|
category: "schema",
|
|
10144
10213
|
resource: "operation",
|
|
@@ -10191,14 +10260,14 @@ function createShell(plugin) {
|
|
|
10191
10260
|
};
|
|
10192
10261
|
} };
|
|
10193
10262
|
}
|
|
10194
|
-
function toNode$1(model, plugin
|
|
10263
|
+
function toNode$1(model, plugin) {
|
|
10195
10264
|
if (model.virtual) {
|
|
10196
10265
|
const nodes = [];
|
|
10197
10266
|
const symbols = /* @__PURE__ */ new Map();
|
|
10198
10267
|
for (const item of model.itemsFrom(source)) {
|
|
10199
10268
|
const { operation } = item.data;
|
|
10200
10269
|
const contractSymbol = createContractSymbol(plugin, item);
|
|
10201
|
-
const expression = createContractExpression(plugin, operation
|
|
10270
|
+
const expression = createContractExpression(plugin, operation);
|
|
10202
10271
|
const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
|
|
10203
10272
|
nodes.push(node);
|
|
10204
10273
|
symbols.set(operation.id, contractSymbol);
|
|
@@ -10214,7 +10283,7 @@ function toNode$1(model, plugin, baseSymbol) {
|
|
|
10214
10283
|
for (const item of model.itemsFrom(source)) {
|
|
10215
10284
|
const { operation } = item.data;
|
|
10216
10285
|
const contractSymbol = createContractSymbol(plugin, item);
|
|
10217
|
-
const expression = createContractExpression(plugin, operation
|
|
10286
|
+
const expression = createContractExpression(plugin, operation);
|
|
10218
10287
|
const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
|
|
10219
10288
|
nodes.push(node);
|
|
10220
10289
|
symbols.set(operation.id, contractSymbol);
|
|
@@ -10258,10 +10327,7 @@ function resolveStrategy(plugin) {
|
|
|
10258
10327
|
//#endregion
|
|
10259
10328
|
//#region src/plugins/orpc/v1/plugin.ts
|
|
10260
10329
|
const handlerV1$1 = ({ plugin }) => {
|
|
10261
|
-
|
|
10262
|
-
const baseSymbol = plugin.symbol("base");
|
|
10263
|
-
const baseNode = $.const(baseSymbol).export().assign($(oc).attr("$route").call($.object().prop("inputStructure", $.literal("detailed"))));
|
|
10264
|
-
plugin.node(baseNode);
|
|
10330
|
+
plugin.symbol("oc", { external: "@orpc/contract" });
|
|
10265
10331
|
const structure = new StructureModel();
|
|
10266
10332
|
const shell = createShell(plugin);
|
|
10267
10333
|
const strategy = resolveStrategy(plugin);
|
|
@@ -10281,7 +10347,7 @@ const handlerV1$1 = ({ plugin }) => {
|
|
|
10281
10347
|
}, { order: "declarations" });
|
|
10282
10348
|
const allNodes = [];
|
|
10283
10349
|
for (const node of structure.walk()) {
|
|
10284
|
-
const { nodes } = toNode$1(node, plugin
|
|
10350
|
+
const { nodes } = toNode$1(node, plugin);
|
|
10285
10351
|
allNodes.push(...nodes);
|
|
10286
10352
|
}
|
|
10287
10353
|
for (const node of allNodes) plugin.node(node);
|
|
@@ -10333,7 +10399,7 @@ const defineConfig$3 = definePluginConfig(defaultConfig$3);
|
|
|
10333
10399
|
//#region src/plugins/swr/v2/useSwr.ts
|
|
10334
10400
|
const createUseSwr = ({ operation, plugin }) => {
|
|
10335
10401
|
if (hasOperationSse({ operation })) return;
|
|
10336
|
-
const symbolUseSwr = plugin.external("swr");
|
|
10402
|
+
const symbolUseSwr = plugin.external("swr.useSWR");
|
|
10337
10403
|
const symbolUseQueryFn = plugin.symbol(applyNaming(operation.id, plugin.config.useSwr));
|
|
10338
10404
|
const awaitSdkFn = $.lazy((ctx) => ctx.access(plugin.referenceSymbol({
|
|
10339
10405
|
category: "sdk",
|
|
@@ -10353,11 +10419,7 @@ const handlerV2 = ({ plugin }) => {
|
|
|
10353
10419
|
plugin.symbol("useSWR", {
|
|
10354
10420
|
external: "swr",
|
|
10355
10421
|
importKind: "default",
|
|
10356
|
-
kind: "function"
|
|
10357
|
-
meta: {
|
|
10358
|
-
category: "external",
|
|
10359
|
-
resource: "swr"
|
|
10360
|
-
}
|
|
10422
|
+
kind: "function"
|
|
10361
10423
|
});
|
|
10362
10424
|
plugin.forEach("operation", ({ operation }) => {
|
|
10363
10425
|
if (plugin.hooks.operation.isQuery(operation)) {
|
|
@@ -10718,7 +10780,7 @@ function push(target, result) {
|
|
|
10718
10780
|
}
|
|
10719
10781
|
function toNode(pipes, plugin) {
|
|
10720
10782
|
if (!(pipes instanceof Array)) return pipes;
|
|
10721
|
-
if (pipes.length
|
|
10783
|
+
if (!pipes.length) return $(plugin.external("valibot.v")).attr(identifiers$1.schemas.unknown).call();
|
|
10722
10784
|
if (pipes.length === 1) return pipes[0];
|
|
10723
10785
|
return $(plugin.external("valibot.v")).attr(identifiers$1.methods.pipe).call(...pipes);
|
|
10724
10786
|
}
|
|
@@ -11234,7 +11296,7 @@ function enumToPipes({ plugin, schema }) {
|
|
|
11234
11296
|
function baseNode$45(ctx) {
|
|
11235
11297
|
const { applyModifiers, childResults, plugin, symbols } = ctx;
|
|
11236
11298
|
const { v } = symbols;
|
|
11237
|
-
if (childResults.length
|
|
11299
|
+
if (!childResults.length) return $(v).attr(identifiers$1.schemas.any).call();
|
|
11238
11300
|
if (childResults.length === 1) return applyModifiers(childResults[0]).pipes;
|
|
11239
11301
|
const itemNodes = childResults.map((item) => pipesToNode(item.pipes, plugin));
|
|
11240
11302
|
return $(v).attr(identifiers$1.schemas.intersect).call($.array(...itemNodes));
|
|
@@ -11695,7 +11757,7 @@ function baseNode$37(ctx) {
|
|
|
11695
11757
|
const schema = schemas[index];
|
|
11696
11758
|
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
|
|
11697
11759
|
});
|
|
11698
|
-
if (nonNullItems.length
|
|
11760
|
+
if (!nonNullItems.length) return $(v).attr(identifiers$1.schemas.null).call();
|
|
11699
11761
|
if (nonNullItems.length === 1) return nonNullItems[0].pipes;
|
|
11700
11762
|
const itemNodes = nonNullItems.map((i) => pipesToNode(i.pipes, plugin));
|
|
11701
11763
|
return $(v).attr(identifiers$1.schemas.union).call($.array(...itemNodes));
|
|
@@ -12089,11 +12151,7 @@ function createProcessor$3(plugin) {
|
|
|
12089
12151
|
const handlerV1 = ({ plugin }) => {
|
|
12090
12152
|
plugin.symbol("v", {
|
|
12091
12153
|
external: "valibot",
|
|
12092
|
-
importKind: "namespace"
|
|
12093
|
-
meta: {
|
|
12094
|
-
category: "external",
|
|
12095
|
-
resource: "valibot.v"
|
|
12096
|
-
}
|
|
12154
|
+
importKind: "namespace"
|
|
12097
12155
|
});
|
|
12098
12156
|
const processor = createProcessor$3(plugin);
|
|
12099
12157
|
plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
|
|
@@ -12900,7 +12958,7 @@ function baseNode$32(ctx) {
|
|
|
12900
12958
|
const { symbols } = ctx;
|
|
12901
12959
|
const { z } = symbols;
|
|
12902
12960
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
12903
|
-
if (allStrings && enumMembers.length
|
|
12961
|
+
if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
12904
12962
|
if (literalMembers.length === 1) return literalMembers[0];
|
|
12905
12963
|
return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
12906
12964
|
}
|
|
@@ -13030,7 +13088,7 @@ function numberResolver$2(ctx) {
|
|
|
13030
13088
|
if (minNode) checks.push(minNode);
|
|
13031
13089
|
const maxNode = ctx.nodes.max(ctx);
|
|
13032
13090
|
if (maxNode) checks.push(maxNode);
|
|
13033
|
-
if (checks.length
|
|
13091
|
+
if (checks.length) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
|
|
13034
13092
|
return ctx.chain.current;
|
|
13035
13093
|
}
|
|
13036
13094
|
function numberToNode$2({ plugin, schema }) {
|
|
@@ -13061,7 +13119,7 @@ function numberToNode$2({ plugin, schema }) {
|
|
|
13061
13119
|
//#region src/plugins/zod/mini/toAst/object.ts
|
|
13062
13120
|
function additionalPropertiesNode$2(ctx) {
|
|
13063
13121
|
const { _childResults, applyModifiers, schema, walk, walkerCtx } = ctx;
|
|
13064
|
-
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length
|
|
13122
|
+
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
|
|
13065
13123
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
13066
13124
|
_childResults.push(additionalResult);
|
|
13067
13125
|
return applyModifiers(additionalResult, {}).expression;
|
|
@@ -13193,7 +13251,7 @@ function stringResolver$2(ctx) {
|
|
|
13193
13251
|
}
|
|
13194
13252
|
const patternNode = ctx.nodes.pattern(ctx);
|
|
13195
13253
|
if (patternNode) checks.push(patternNode);
|
|
13196
|
-
if (checks.length
|
|
13254
|
+
if (checks.length) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
|
|
13197
13255
|
return ctx.chain.current;
|
|
13198
13256
|
}
|
|
13199
13257
|
function stringToNode$2({ plugin, schema }) {
|
|
@@ -13224,7 +13282,7 @@ function baseNode$26(ctx) {
|
|
|
13224
13282
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
13225
13283
|
const { z } = symbols;
|
|
13226
13284
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
13227
|
-
if (childResults.length
|
|
13285
|
+
if (!childResults.length) return tupleFn.call($.array());
|
|
13228
13286
|
const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
|
|
13229
13287
|
return tupleFn.call($.array(...tupleElements));
|
|
13230
13288
|
}
|
|
@@ -13576,7 +13634,7 @@ function createVisitor$2(config) {
|
|
|
13576
13634
|
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
|
|
13577
13635
|
});
|
|
13578
13636
|
let expression;
|
|
13579
|
-
if (nonNullItems.length
|
|
13637
|
+
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
13580
13638
|
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
13581
13639
|
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
13582
13640
|
return {
|
|
@@ -13673,10 +13731,7 @@ const handlerMini = ({ plugin }) => {
|
|
|
13673
13731
|
plugin.symbol("z", {
|
|
13674
13732
|
external: getZodModule({ plugin }),
|
|
13675
13733
|
importKind: "namespace",
|
|
13676
|
-
meta: {
|
|
13677
|
-
category: "external",
|
|
13678
|
-
resource: "zod.z"
|
|
13679
|
-
}
|
|
13734
|
+
meta: { resource: "zod.z" }
|
|
13680
13735
|
});
|
|
13681
13736
|
const processor = createProcessor$2(plugin);
|
|
13682
13737
|
plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
|
|
@@ -13937,7 +13992,7 @@ function baseNode$20(ctx) {
|
|
|
13937
13992
|
const { symbols } = ctx;
|
|
13938
13993
|
const { z } = symbols;
|
|
13939
13994
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
13940
|
-
if (allStrings && enumMembers.length
|
|
13995
|
+
if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
13941
13996
|
else if (literalMembers.length === 1) return literalMembers[0];
|
|
13942
13997
|
else return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
13943
13998
|
}
|
|
@@ -14089,7 +14144,7 @@ function numberToNode$1({ plugin, schema }) {
|
|
|
14089
14144
|
//#region src/plugins/zod/v3/toAst/object.ts
|
|
14090
14145
|
function additionalPropertiesNode$1(ctx) {
|
|
14091
14146
|
const { applyModifiers, schema, walk, walkerCtx } = ctx;
|
|
14092
|
-
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length
|
|
14147
|
+
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
|
|
14093
14148
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
14094
14149
|
ctx._childResults.push(additionalResult);
|
|
14095
14150
|
return applyModifiers(additionalResult, {}).expression;
|
|
@@ -14244,7 +14299,7 @@ function baseNode$14(ctx) {
|
|
|
14244
14299
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
14245
14300
|
const { z } = symbols;
|
|
14246
14301
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
14247
|
-
if (childResults.length
|
|
14302
|
+
if (!childResults.length) return tupleFn.call($.array());
|
|
14248
14303
|
const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
|
|
14249
14304
|
return tupleFn.call($.array(...tupleElements));
|
|
14250
14305
|
}
|
|
@@ -14594,7 +14649,7 @@ function createVisitor$1(config) {
|
|
|
14594
14649
|
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
|
|
14595
14650
|
});
|
|
14596
14651
|
let expression;
|
|
14597
|
-
if (nonNullItems.length
|
|
14652
|
+
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
14598
14653
|
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
14599
14654
|
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
14600
14655
|
return {
|
|
@@ -14690,10 +14745,7 @@ function createProcessor$1(plugin) {
|
|
|
14690
14745
|
const handlerV3 = ({ plugin }) => {
|
|
14691
14746
|
plugin.symbol("z", {
|
|
14692
14747
|
external: getZodModule({ plugin }),
|
|
14693
|
-
meta: {
|
|
14694
|
-
category: "external",
|
|
14695
|
-
resource: "zod.z"
|
|
14696
|
-
}
|
|
14748
|
+
meta: { resource: "zod.z" }
|
|
14697
14749
|
});
|
|
14698
14750
|
const processor = createProcessor$1(plugin);
|
|
14699
14751
|
plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
|
|
@@ -14954,7 +15006,7 @@ function baseNode$8(ctx) {
|
|
|
14954
15006
|
const { symbols } = ctx;
|
|
14955
15007
|
const { z } = symbols;
|
|
14956
15008
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
14957
|
-
if (allStrings && enumMembers.length
|
|
15009
|
+
if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
14958
15010
|
if (literalMembers.length === 1) return literalMembers[0];
|
|
14959
15011
|
return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
14960
15012
|
}
|
|
@@ -15111,7 +15163,7 @@ function numberToNode({ plugin, schema }) {
|
|
|
15111
15163
|
//#region src/plugins/zod/v4/toAst/object.ts
|
|
15112
15164
|
function additionalPropertiesNode(ctx) {
|
|
15113
15165
|
const { _childResults, applyModifiers, schema, walk, walkerCtx } = ctx;
|
|
15114
|
-
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length
|
|
15166
|
+
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
|
|
15115
15167
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
15116
15168
|
_childResults.push(additionalResult);
|
|
15117
15169
|
return applyModifiers(additionalResult, {}).expression;
|
|
@@ -15268,7 +15320,7 @@ function baseNode$2(ctx) {
|
|
|
15268
15320
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
15269
15321
|
const { z } = symbols;
|
|
15270
15322
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
15271
|
-
if (childResults.length
|
|
15323
|
+
if (!childResults.length) return tupleFn.call($.array());
|
|
15272
15324
|
const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
|
|
15273
15325
|
return tupleFn.call($.array(...tupleElements));
|
|
15274
15326
|
}
|
|
@@ -15624,7 +15676,7 @@ function createVisitor(config) {
|
|
|
15624
15676
|
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
|
|
15625
15677
|
});
|
|
15626
15678
|
let expression;
|
|
15627
|
-
if (nonNullItems.length
|
|
15679
|
+
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
15628
15680
|
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
15629
15681
|
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
15630
15682
|
return {
|
|
@@ -15721,10 +15773,7 @@ const handlerV4 = ({ plugin }) => {
|
|
|
15721
15773
|
plugin.symbol("z", {
|
|
15722
15774
|
external: getZodModule({ plugin }),
|
|
15723
15775
|
importKind: "namespace",
|
|
15724
|
-
meta: {
|
|
15725
|
-
category: "external",
|
|
15726
|
-
resource: "zod.z"
|
|
15727
|
-
}
|
|
15776
|
+
meta: { resource: "zod.z" }
|
|
15728
15777
|
});
|
|
15729
15778
|
const processor = createProcessor(plugin);
|
|
15730
15779
|
plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
|
|
@@ -16221,4 +16270,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
16221
16270
|
|
|
16222
16271
|
//#endregion
|
|
16223
16272
|
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 };
|
|
16224
|
-
//# sourceMappingURL=init-
|
|
16273
|
+
//# sourceMappingURL=init-DXg2DSyt.mjs.map
|