@hey-api/openapi-ts 0.94.4 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { StructureModel, detectInteractiveSession, fromRef, isNode, isRef, isSymbol, loadConfigFile, log, nodeBrand, ref, refs } from "@hey-api/codegen-core";
3
- import { ConfigError, OperationPath, OperationStrategy, applyNaming, buildSymbolIn, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, isEnvironment, mappers, operationPagination, operationResponsesMap, outputHeaderToPrefix, parseUrl, pathToJsonPointer, pathToName, refToName, resolveSource, satisfies, statusCodeToGroup, toCase, valueToObject } from "@hey-api/shared";
3
+ import { ConfigError, OperationPath, OperationStrategy, applyNaming, buildSymbolIn, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, isEnvironment, mappers, operationPagination, operationResponsesMap, outputHeaderToPrefix, parseUrl, pathToJsonPointer, pathToName, refToName, requestValidatorLayers, resolveSource, resolveValidatorLayer, satisfies, statusCodeToGroup, toCase, valueToObject } from "@hey-api/shared";
4
4
  import colors from "ansi-colors";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -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$52 = TsDsl;
542
- var IdTsDsl = class extends Mixed$52 {
541
+ const Mixed$56 = TsDsl;
542
+ var IdTsDsl = class extends Mixed$56 {
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$51 = TsDsl;
598
- var PrefixTsDsl = class extends Mixed$51 {
597
+ const Mixed$55 = TsDsl;
598
+ var PrefixTsDsl = class extends Mixed$55 {
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 === 0;
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. `ts.SyntaxKind.ExclamationToken` for `!`). */
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 === 0) return;
641
+ if (!missing.length) return;
642
642
  throw new Error(`Prefix unary expression missing ${missing.join(" and ")}`);
643
643
  }
644
644
  missingRequiredCalls() {
@@ -667,13 +667,16 @@ const f = {
667
667
  attr: createFactory("attr"),
668
668
  await: createFactory("await"),
669
669
  call: createFactory("call"),
670
+ method: createFactory("method"),
670
671
  new: createFactory("new"),
671
672
  return: createFactory("return"),
673
+ spread: createFactory("spread"),
672
674
  type: {
673
675
  expr: createFactory("type.expr"),
674
676
  idx: createFactory("type.idx"),
675
677
  operator: createFactory("type.operator"),
676
- query: createFactory("type.query")
678
+ query: createFactory("type.query"),
679
+ tupleMember: createFactory("type.tupleMember")
677
680
  },
678
681
  typeofExpr: createFactory("typeofExpr")
679
682
  };
@@ -694,8 +697,8 @@ function AsMixin(Base) {
694
697
 
695
698
  //#endregion
696
699
  //#region src/ts-dsl/expr/literal.ts
697
- const Mixed$50 = AsMixin(TsDsl);
698
- var LiteralTsDsl = class extends Mixed$50 {
700
+ const Mixed$54 = AsMixin(TsDsl);
701
+ var LiteralTsDsl = class extends Mixed$54 {
699
702
  "~dsl" = "LiteralTsDsl";
700
703
  value;
701
704
  constructor(value) {
@@ -984,8 +987,8 @@ const safeTypeName = (name) => safeName(name, reserved.type);
984
987
 
985
988
  //#endregion
986
989
  //#region src/ts-dsl/decl/decorator.ts
987
- const Mixed$49 = ArgsMixin(TsDsl);
988
- var DecoratorTsDsl = class extends Mixed$49 {
990
+ const Mixed$53 = ArgsMixin(TsDsl);
991
+ var DecoratorTsDsl = class extends Mixed$53 {
989
992
  "~dsl" = "DecoratorTsDsl";
990
993
  nameSanitizer = safeRuntimeName;
991
994
  constructor(name, ...args) {
@@ -1036,7 +1039,7 @@ function accessChainToNode(accessChain) {
1036
1039
  }
1037
1040
  function getAccessChainForNode(node) {
1038
1041
  const accessChain = structuralToAccessChain([...getStructuralChainForNode(node, /* @__PURE__ */ new Set())]);
1039
- if (accessChain.length === 0) return [node.clone()];
1042
+ if (!accessChain.length) return [node.clone()];
1040
1043
  return accessChain.map((node) => node.clone());
1041
1044
  }
1042
1045
  function getScope(node) {
@@ -1049,7 +1052,7 @@ function getStructuralChainForNode(node, visited) {
1049
1052
  if (node.structuralParents) for (const [parent] of node.structuralParents) {
1050
1053
  if (getScope(parent) !== getScope(node)) continue;
1051
1054
  const chain = getStructuralChainForNode(parent, visited);
1052
- if (chain.length > 0) return [...chain, node];
1055
+ if (chain.length) return [...chain, node];
1053
1056
  }
1054
1057
  if (!node.root) return [];
1055
1058
  return [node];
@@ -1263,7 +1266,7 @@ function AbstractMixin(Base) {
1263
1266
  const Mixed = ModifiersMixin(Base);
1264
1267
  class Abstract extends Mixed {
1265
1268
  abstract(condition) {
1266
- const cond = arguments.length === 0 ? true : Boolean(condition);
1269
+ const cond = !arguments.length ? true : Boolean(condition);
1267
1270
  return this._m("abstract", cond);
1268
1271
  }
1269
1272
  }
@@ -1276,7 +1279,7 @@ function AsyncMixin(Base) {
1276
1279
  const Mixed = ModifiersMixin(Base);
1277
1280
  class Async extends Mixed {
1278
1281
  async(condition) {
1279
- const cond = arguments.length === 0 ? true : Boolean(condition);
1282
+ const cond = !arguments.length ? true : Boolean(condition);
1280
1283
  return this._m("async", cond);
1281
1284
  }
1282
1285
  }
@@ -1289,7 +1292,7 @@ function ConstMixin(Base) {
1289
1292
  const Mixed = ModifiersMixin(Base);
1290
1293
  class Const extends Mixed {
1291
1294
  const(condition) {
1292
- const cond = arguments.length === 0 ? true : Boolean(condition);
1295
+ const cond = !arguments.length ? true : Boolean(condition);
1293
1296
  return this._m("const", cond);
1294
1297
  }
1295
1298
  }
@@ -1308,7 +1311,7 @@ function DefaultMixin(Base) {
1308
1311
  * @returns The target object for chaining.
1309
1312
  */
1310
1313
  default(condition) {
1311
- const cond = arguments.length === 0 ? true : Boolean(condition);
1314
+ const cond = !arguments.length ? true : Boolean(condition);
1312
1315
  return this._m("default", cond);
1313
1316
  }
1314
1317
  }
@@ -1327,7 +1330,7 @@ function ExportMixin(Base) {
1327
1330
  * @returns The target object for chaining.
1328
1331
  */
1329
1332
  export(condition) {
1330
- const cond = arguments.length === 0 ? true : Boolean(condition);
1333
+ const cond = !arguments.length ? true : Boolean(condition);
1331
1334
  this.exported = cond;
1332
1335
  if (this.symbol) this.symbol.setExported(cond);
1333
1336
  return this._m("export", cond);
@@ -1342,7 +1345,7 @@ function PrivateMixin(Base) {
1342
1345
  const Mixed = ModifiersMixin(Base);
1343
1346
  class Private extends Mixed {
1344
1347
  private(condition) {
1345
- const cond = arguments.length === 0 ? true : Boolean(condition);
1348
+ const cond = !arguments.length ? true : Boolean(condition);
1346
1349
  return this._m("private", cond);
1347
1350
  }
1348
1351
  }
@@ -1355,7 +1358,7 @@ function ProtectedMixin(Base) {
1355
1358
  const Mixed = ModifiersMixin(Base);
1356
1359
  class Protected extends Mixed {
1357
1360
  protected(condition) {
1358
- const cond = arguments.length === 0 ? true : Boolean(condition);
1361
+ const cond = !arguments.length ? true : Boolean(condition);
1359
1362
  return this._m("protected", cond);
1360
1363
  }
1361
1364
  }
@@ -1368,7 +1371,7 @@ function PublicMixin(Base) {
1368
1371
  const Mixed = ModifiersMixin(Base);
1369
1372
  class Public extends Mixed {
1370
1373
  public(condition) {
1371
- const cond = arguments.length === 0 ? true : Boolean(condition);
1374
+ const cond = !arguments.length ? true : Boolean(condition);
1372
1375
  return this._m("public", cond);
1373
1376
  }
1374
1377
  }
@@ -1381,7 +1384,7 @@ function ReadonlyMixin(Base) {
1381
1384
  const Mixed = ModifiersMixin(Base);
1382
1385
  class Readonly extends Mixed {
1383
1386
  readonly(condition) {
1384
- const cond = arguments.length === 0 ? true : Boolean(condition);
1387
+ const cond = !arguments.length ? true : Boolean(condition);
1385
1388
  return this._m("readonly", cond);
1386
1389
  }
1387
1390
  }
@@ -1394,7 +1397,7 @@ function StaticMixin(Base) {
1394
1397
  const Mixed = ModifiersMixin(Base);
1395
1398
  class Static extends Mixed {
1396
1399
  static(condition) {
1397
- const cond = arguments.length === 0 ? true : Boolean(condition);
1400
+ const cond = !arguments.length ? true : Boolean(condition);
1398
1401
  return this._m("static", cond);
1399
1402
  }
1400
1403
  }
@@ -1403,8 +1406,8 @@ function StaticMixin(Base) {
1403
1406
 
1404
1407
  //#endregion
1405
1408
  //#region src/ts-dsl/type/param.ts
1406
- const Mixed$48 = TsDsl;
1407
- var TypeParamTsDsl = class extends Mixed$48 {
1409
+ const Mixed$52 = TsDsl;
1410
+ var TypeParamTsDsl = class extends Mixed$52 {
1408
1411
  "~dsl" = "TypeParamTsDsl";
1409
1412
  scope = "type";
1410
1413
  constraint;
@@ -1472,11 +1475,11 @@ function OptionalMixin(Base) {
1472
1475
  super.analyze(ctx);
1473
1476
  }
1474
1477
  optional(condition) {
1475
- this._optional = arguments.length === 0 ? true : Boolean(condition);
1478
+ this._optional = !arguments.length ? true : Boolean(condition);
1476
1479
  return this;
1477
1480
  }
1478
1481
  required(condition) {
1479
- this._optional = arguments.length === 0 ? false : !condition;
1482
+ this._optional = !arguments.length ? false : !condition;
1480
1483
  return this;
1481
1484
  }
1482
1485
  }
@@ -1543,7 +1546,7 @@ var TokenTsDsl = class extends TsDsl {
1543
1546
  }
1544
1547
  $validate() {
1545
1548
  const missing = this.missingRequiredCalls();
1546
- if (missing.length === 0) return;
1549
+ if (!missing.length) return;
1547
1550
  throw new Error(`Token missing ${missing.join(" and ")}`);
1548
1551
  }
1549
1552
  missingRequiredCalls() {
@@ -1553,7 +1556,7 @@ var TokenTsDsl = class extends TsDsl {
1553
1556
  }
1554
1557
  /** Returns true when all required builder calls are present. */
1555
1558
  get isValid() {
1556
- return this.missingRequiredCalls().length === 0;
1559
+ return !this.missingRequiredCalls().length;
1557
1560
  }
1558
1561
  };
1559
1562
 
@@ -1615,8 +1618,8 @@ function TypeExprMixin(Base) {
1615
1618
 
1616
1619
  //#endregion
1617
1620
  //#region src/ts-dsl/type/attr.ts
1618
- const Mixed$47 = TypeExprMixin(TsDsl);
1619
- var TypeAttrTsDsl = class extends Mixed$47 {
1621
+ const Mixed$51 = TypeExprMixin(TsDsl);
1622
+ var TypeAttrTsDsl = class extends Mixed$51 {
1620
1623
  "~dsl" = "TypeAttrTsDsl";
1621
1624
  scope = "type";
1622
1625
  _base;
@@ -1638,7 +1641,7 @@ var TypeAttrTsDsl = class extends Mixed$47 {
1638
1641
  }
1639
1642
  /** Returns true when all required builder calls are present. */
1640
1643
  get isValid() {
1641
- return this.missingRequiredCalls().length === 0;
1644
+ return !this.missingRequiredCalls().length;
1642
1645
  }
1643
1646
  base(base) {
1644
1647
  if (isRef(base)) this._base = base;
@@ -1657,7 +1660,7 @@ var TypeAttrTsDsl = class extends Mixed$47 {
1657
1660
  }
1658
1661
  $validate() {
1659
1662
  const missing = this.missingRequiredCalls();
1660
- if (missing.length === 0) return;
1663
+ if (!missing.length) return;
1661
1664
  throw new Error(`Type attribute missing ${missing.join(" and ")}`);
1662
1665
  }
1663
1666
  missingRequiredCalls() {
@@ -1670,8 +1673,8 @@ var TypeAttrTsDsl = class extends Mixed$47 {
1670
1673
 
1671
1674
  //#endregion
1672
1675
  //#region src/ts-dsl/type/expr.ts
1673
- const Mixed$46 = TypeArgsMixin(TypeExprMixin(TsDsl));
1674
- var TypeExprTsDsl = class extends Mixed$46 {
1676
+ const Mixed$50 = TypeArgsMixin(TypeExprMixin(TsDsl));
1677
+ var TypeExprTsDsl = class extends Mixed$50 {
1675
1678
  "~dsl" = "TypeExprTsDsl";
1676
1679
  scope = "type";
1677
1680
  _exprInput;
@@ -1689,9 +1692,9 @@ var TypeExprTsDsl = class extends Mixed$46 {
1689
1692
  }
1690
1693
  /** Returns true when all required builder calls are present. */
1691
1694
  get isValid() {
1692
- return this.missingRequiredCalls().length === 0;
1695
+ return !this.missingRequiredCalls().length;
1693
1696
  }
1694
- /** Accesses a nested type (e.g. `Foo.Bar`). */
1697
+ /** Accesses a nested type (e.g., `Foo.Bar`). */
1695
1698
  attr(right) {
1696
1699
  this._exprInput = isNode(right) ? ref(right.base(this._exprInput)) : ref(new TypeAttrTsDsl(this._exprInput, right));
1697
1700
  return this;
@@ -1702,7 +1705,7 @@ var TypeExprTsDsl = class extends Mixed$46 {
1702
1705
  }
1703
1706
  $validate() {
1704
1707
  const missing = this.missingRequiredCalls();
1705
- if (missing.length === 0) return;
1708
+ if (!missing.length) return;
1706
1709
  throw new Error(`Type expression missing ${missing.join(" and ")}`);
1707
1710
  }
1708
1711
  missingRequiredCalls() {
@@ -1715,8 +1718,8 @@ f.type.expr.set((...args) => new TypeExprTsDsl(...args));
1715
1718
 
1716
1719
  //#endregion
1717
1720
  //#region src/ts-dsl/decl/field.ts
1718
- const Mixed$45 = DecoratorMixin(DocMixin(OptionalMixin(PrivateMixin(ProtectedMixin(PublicMixin(ReadonlyMixin(StaticMixin(ValueMixin(TsDsl)))))))));
1719
- var FieldTsDsl = class extends Mixed$45 {
1721
+ const Mixed$49 = DecoratorMixin(DocMixin(OptionalMixin(PrivateMixin(ProtectedMixin(PublicMixin(ReadonlyMixin(StaticMixin(ValueMixin(TsDsl)))))))));
1722
+ var FieldTsDsl = class extends Mixed$49 {
1720
1723
  "~dsl" = "FieldTsDsl";
1721
1724
  nameSanitizer = safeAccessorName;
1722
1725
  _type;
@@ -1743,8 +1746,8 @@ var FieldTsDsl = class extends Mixed$45 {
1743
1746
 
1744
1747
  //#endregion
1745
1748
  //#region src/ts-dsl/stmt/stmt.ts
1746
- const Mixed$44 = TsDsl;
1747
- var StmtTsDsl = class extends Mixed$44 {
1749
+ const Mixed$48 = TsDsl;
1750
+ var StmtTsDsl = class extends Mixed$48 {
1748
1751
  "~dsl" = "StmtTsDsl";
1749
1752
  _inner;
1750
1753
  constructor(inner) {
@@ -1791,11 +1794,11 @@ function DoMixin(Base) {
1791
1794
 
1792
1795
  //#endregion
1793
1796
  //#region src/ts-dsl/decl/pattern.ts
1794
- const Mixed$43 = TsDsl;
1797
+ const Mixed$47 = TsDsl;
1795
1798
  /**
1796
- * Builds binding patterns (e.g. `{ foo, bar }`, `[a, b, ...rest]`).
1799
+ * Builds binding patterns (e.g., `{ foo, bar }`, `[a, b, ...rest]`).
1797
1800
  */
1798
- var PatternTsDsl = class extends Mixed$43 {
1801
+ var PatternTsDsl = class extends Mixed$47 {
1799
1802
  "~dsl" = "PatternTsDsl";
1800
1803
  pattern;
1801
1804
  _spread;
@@ -1804,9 +1807,9 @@ var PatternTsDsl = class extends Mixed$43 {
1804
1807
  }
1805
1808
  /** Returns true when all required builder calls are present. */
1806
1809
  get isValid() {
1807
- return this.missingRequiredCalls().length === 0;
1810
+ return !this.missingRequiredCalls().length;
1808
1811
  }
1809
- /** Defines an array pattern (e.g. `[a, b, c]`). */
1812
+ /** Defines an array pattern (e.g., `[a, b, c]`). */
1810
1813
  array(...props) {
1811
1814
  this.pattern = {
1812
1815
  kind: "array",
@@ -1814,7 +1817,7 @@ var PatternTsDsl = class extends Mixed$43 {
1814
1817
  };
1815
1818
  return this;
1816
1819
  }
1817
- /** Defines an object pattern (e.g. `{ a, b: alias }`). */
1820
+ /** Defines an object pattern (e.g., `{ a, b: alias }`). */
1818
1821
  object(...props) {
1819
1822
  const entries = {};
1820
1823
  for (const p of props) if (typeof p === "string") entries[p] = p;
@@ -1826,7 +1829,7 @@ var PatternTsDsl = class extends Mixed$43 {
1826
1829
  };
1827
1830
  return this;
1828
1831
  }
1829
- /** Adds a spread element (e.g. `...rest`, `...options`, `...args`). */
1832
+ /** Adds a spread element (e.g., `...rest`, `...options`, `...args`). */
1830
1833
  spread(name) {
1831
1834
  this._spread = name;
1832
1835
  return this;
@@ -1849,7 +1852,7 @@ var PatternTsDsl = class extends Mixed$43 {
1849
1852
  }
1850
1853
  $validate() {
1851
1854
  const missing = this.missingRequiredCalls();
1852
- if (missing.length === 0) return;
1855
+ if (!missing.length) return;
1853
1856
  throw new Error(`Binding pattern missing ${missing.join(" and ")}`);
1854
1857
  }
1855
1858
  missingRequiredCalls() {
@@ -1882,7 +1885,7 @@ function PatternMixin(Base) {
1882
1885
  (this.pattern ??= new PatternTsDsl()).object(...props);
1883
1886
  return this;
1884
1887
  }
1885
- /** Adds a spread element (e.g. `...args`, `...options`) to the pattern. */
1888
+ /** Adds a spread element (e.g., `...args`, `...options`) to the pattern. */
1886
1889
  spread(name) {
1887
1890
  (this.pattern ??= new PatternTsDsl()).spread(name);
1888
1891
  return this;
@@ -1898,8 +1901,8 @@ function PatternMixin(Base) {
1898
1901
 
1899
1902
  //#endregion
1900
1903
  //#region src/ts-dsl/decl/param.ts
1901
- const Mixed$42 = DecoratorMixin(OptionalMixin(PatternMixin(ValueMixin(TsDsl))));
1902
- var ParamTsDsl = class extends Mixed$42 {
1904
+ const Mixed$46 = DecoratorMixin(OptionalMixin(PatternMixin(ValueMixin(TsDsl))));
1905
+ var ParamTsDsl = class extends Mixed$46 {
1903
1906
  "~dsl" = "ParamTsDsl";
1904
1907
  _type;
1905
1908
  constructor(name, fn) {
@@ -1917,11 +1920,11 @@ var ParamTsDsl = class extends Mixed$42 {
1917
1920
  }
1918
1921
  /** Returns true when all required builder calls are present. */
1919
1922
  get isValid() {
1920
- return this.missingRequiredCalls().length === 0;
1923
+ return !this.missingRequiredCalls().length;
1921
1924
  }
1922
1925
  /** Sets the parameter type. */
1923
- type(type) {
1924
- this._type = type instanceof TypeTsDsl ? type : new TypeExprTsDsl(type);
1926
+ type(node) {
1927
+ this._type = node instanceof TypeTsDsl ? node : new TypeExprTsDsl(node);
1925
1928
  return this;
1926
1929
  }
1927
1930
  toAst() {
@@ -1930,7 +1933,7 @@ var ParamTsDsl = class extends Mixed$42 {
1930
1933
  }
1931
1934
  $validate() {
1932
1935
  const missing = this.missingRequiredCalls();
1933
- if (missing.length === 0) return;
1936
+ if (!missing.length) return;
1934
1937
  throw new Error(`Parameter missing ${missing.join(" and ")}`);
1935
1938
  }
1936
1939
  missingRequiredCalls() {
@@ -1997,8 +2000,8 @@ function LayoutMixin(Base) {
1997
2000
 
1998
2001
  //#endregion
1999
2002
  //#region src/ts-dsl/stmt/block.ts
2000
- const Mixed$41 = DoMixin(LayoutMixin(TsDsl));
2001
- var BlockTsDsl = class extends Mixed$41 {
2003
+ const Mixed$45 = DoMixin(LayoutMixin(TsDsl));
2004
+ var BlockTsDsl = class extends Mixed$45 {
2002
2005
  "~dsl" = "BlockTsDsl";
2003
2006
  constructor(...items) {
2004
2007
  super();
@@ -2015,8 +2018,8 @@ var BlockTsDsl = class extends Mixed$41 {
2015
2018
 
2016
2019
  //#endregion
2017
2020
  //#region src/ts-dsl/decl/init.ts
2018
- const Mixed$40 = DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(TsDsl)))))));
2019
- var InitTsDsl = class extends Mixed$40 {
2021
+ const Mixed$44 = DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(TsDsl)))))));
2022
+ var InitTsDsl = class extends Mixed$44 {
2020
2023
  "~dsl" = "InitTsDsl";
2021
2024
  constructor(fn) {
2022
2025
  super();
@@ -2058,8 +2061,8 @@ function TypeReturnsMixin(Base) {
2058
2061
 
2059
2062
  //#endregion
2060
2063
  //#region src/ts-dsl/decl/method.ts
2061
- const Mixed$39 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(OptionalMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl)))))))))))));
2062
- var MethodTsDsl = class extends Mixed$39 {
2064
+ const Mixed$43 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(OptionalMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl)))))))))))));
2065
+ var MethodTsDsl = class extends Mixed$43 {
2063
2066
  "~dsl" = "MethodTsDsl";
2064
2067
  nameSanitizer = safeAccessorName;
2065
2068
  constructor(name, fn) {
@@ -2081,11 +2084,12 @@ var MethodTsDsl = class extends Mixed$39 {
2081
2084
  return this.$docs(node);
2082
2085
  }
2083
2086
  };
2087
+ f.method.set((...args) => new MethodTsDsl(...args));
2084
2088
 
2085
2089
  //#endregion
2086
2090
  //#region src/ts-dsl/decl/class.ts
2087
- const Mixed$38 = AbstractMixin(DecoratorMixin(DefaultMixin(DocMixin(ExportMixin(TypeParamsMixin(TsDsl))))));
2088
- var ClassTsDsl = class extends Mixed$38 {
2091
+ const Mixed$42 = AbstractMixin(DecoratorMixin(DefaultMixin(DocMixin(ExportMixin(TypeParamsMixin(TsDsl))))));
2092
+ var ClassTsDsl = class extends Mixed$42 {
2089
2093
  "~dsl" = "ClassTsDsl";
2090
2094
  nameSanitizer = safeRuntimeName;
2091
2095
  baseClass;
@@ -2108,7 +2112,7 @@ var ClassTsDsl = class extends Mixed$38 {
2108
2112
  }
2109
2113
  /** Returns true if the class has any members. */
2110
2114
  get hasBody() {
2111
- return this.body.length > 0;
2115
+ return Boolean(this.body.length);
2112
2116
  }
2113
2117
  /** Adds one or more class members (fields, methods, etc.). */
2114
2118
  do(...items) {
@@ -2158,8 +2162,8 @@ var ClassTsDsl = class extends Mixed$38 {
2158
2162
 
2159
2163
  //#endregion
2160
2164
  //#region src/ts-dsl/decl/member.ts
2161
- const Mixed$37 = DocMixin(TsDsl);
2162
- var EnumMemberTsDsl = class extends Mixed$37 {
2165
+ const Mixed$41 = DocMixin(TsDsl);
2166
+ var EnumMemberTsDsl = class extends Mixed$41 {
2163
2167
  "~dsl" = "EnumMemberTsDsl";
2164
2168
  _value;
2165
2169
  constructor(name, value) {
@@ -2185,8 +2189,8 @@ var EnumMemberTsDsl = class extends Mixed$37 {
2185
2189
 
2186
2190
  //#endregion
2187
2191
  //#region src/ts-dsl/decl/enum.ts
2188
- const Mixed$36 = ConstMixin(DocMixin(ExportMixin(TsDsl)));
2189
- var EnumTsDsl = class extends Mixed$36 {
2192
+ const Mixed$40 = ConstMixin(DocMixin(ExportMixin(TsDsl)));
2193
+ var EnumTsDsl = class extends Mixed$40 {
2190
2194
  "~dsl" = "EnumTsDsl";
2191
2195
  nameSanitizer = safeRuntimeName;
2192
2196
  _members = [];
@@ -2225,8 +2229,8 @@ var EnumTsDsl = class extends Mixed$36 {
2225
2229
 
2226
2230
  //#endregion
2227
2231
  //#region src/ts-dsl/decl/func.ts
2228
- const Mixed$35 = AbstractMixin(AsMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl)))))))))))));
2229
- var ImplFuncTsDsl = class extends Mixed$35 {
2232
+ const Mixed$39 = AbstractMixin(AsMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ExportMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl))))))))))))));
2233
+ var ImplFuncTsDsl = class extends Mixed$39 {
2230
2234
  "~dsl" = "FuncTsDsl";
2231
2235
  nameSanitizer = safeRuntimeName;
2232
2236
  mode;
@@ -2253,7 +2257,7 @@ var ImplFuncTsDsl = class extends Mixed$35 {
2253
2257
  }
2254
2258
  /** Returns true when all required builder calls are present. */
2255
2259
  get isValid() {
2256
- return this.missingRequiredCalls().length === 0;
2260
+ return !this.missingRequiredCalls().length;
2257
2261
  }
2258
2262
  /** Switches the function to an arrow function form. */
2259
2263
  arrow() {
@@ -2286,7 +2290,7 @@ var ImplFuncTsDsl = class extends Mixed$35 {
2286
2290
  }
2287
2291
  $validate() {
2288
2292
  const missing = this.missingRequiredCalls();
2289
- if (missing.length === 0) return;
2293
+ if (!missing.length) return;
2290
2294
  throw new Error(`Function ${this.mode} missing ${missing.join(" and ")}`);
2291
2295
  }
2292
2296
  missingRequiredCalls() {
@@ -2299,8 +2303,8 @@ const FuncTsDsl = ImplFuncTsDsl;
2299
2303
 
2300
2304
  //#endregion
2301
2305
  //#region src/ts-dsl/decl/getter.ts
2302
- const Mixed$34 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeReturnsMixin(TsDsl)))))))))));
2303
- var GetterTsDsl = class extends Mixed$34 {
2306
+ const Mixed$38 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TypeReturnsMixin(TsDsl)))))))))));
2307
+ var GetterTsDsl = class extends Mixed$38 {
2304
2308
  "~dsl" = "GetterTsDsl";
2305
2309
  nameSanitizer = safeAccessorName;
2306
2310
  constructor(name, fn) {
@@ -2325,8 +2329,8 @@ var GetterTsDsl = class extends Mixed$34 {
2325
2329
 
2326
2330
  //#endregion
2327
2331
  //#region src/ts-dsl/decl/setter.ts
2328
- const Mixed$33 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TsDsl))))))))));
2329
- var SetterTsDsl = class extends Mixed$33 {
2332
+ const Mixed$37 = AbstractMixin(AsyncMixin(DecoratorMixin(DoMixin(DocMixin(ParamMixin(PrivateMixin(ProtectedMixin(PublicMixin(StaticMixin(TsDsl))))))))));
2333
+ var SetterTsDsl = class extends Mixed$37 {
2330
2334
  "~dsl" = "SetterTsDsl";
2331
2335
  nameSanitizer = safeAccessorName;
2332
2336
  constructor(name, fn) {
@@ -2349,10 +2353,47 @@ var SetterTsDsl = class extends Mixed$33 {
2349
2353
  }
2350
2354
  };
2351
2355
 
2356
+ //#endregion
2357
+ //#region src/ts-dsl/mixins/expr.ts
2358
+ function ExprMixin(Base) {
2359
+ class Expr extends Base {
2360
+ analyze(ctx) {
2361
+ super.analyze(ctx);
2362
+ }
2363
+ attr(...args) {
2364
+ return f.attr(this, ...args);
2365
+ }
2366
+ await() {
2367
+ return f.await(this);
2368
+ }
2369
+ call(...args) {
2370
+ return f.call(this, ...args);
2371
+ }
2372
+ return() {
2373
+ return f.return(this);
2374
+ }
2375
+ }
2376
+ return Expr;
2377
+ }
2378
+
2379
+ //#endregion
2380
+ //#region src/ts-dsl/mixins/spread.ts
2381
+ function SpreadMixin(Base) {
2382
+ class Spread extends Base {
2383
+ analyze(ctx) {
2384
+ super.analyze(ctx);
2385
+ }
2386
+ spread() {
2387
+ return f.spread(this);
2388
+ }
2389
+ }
2390
+ return Spread;
2391
+ }
2392
+
2352
2393
  //#endregion
2353
2394
  //#region src/ts-dsl/expr/array.ts
2354
- const Mixed$32 = AsMixin(LayoutMixin(TsDsl));
2355
- var ArrayTsDsl = class extends Mixed$32 {
2395
+ const Mixed$36 = AsMixin(ExprMixin(LayoutMixin(SpreadMixin(TsDsl))));
2396
+ var ArrayTsDsl = class extends Mixed$36 {
2356
2397
  "~dsl" = "ArrayTsDsl";
2357
2398
  _elements = [];
2358
2399
  constructor(...exprs) {
@@ -2361,15 +2402,12 @@ var ArrayTsDsl = class extends Mixed$32 {
2361
2402
  }
2362
2403
  analyze(ctx) {
2363
2404
  super.analyze(ctx);
2364
- for (const item of this._elements) ctx.analyze(item.expr);
2405
+ for (const item of this._elements) ctx.analyze(item);
2365
2406
  }
2366
2407
  /** Adds a single array element. */
2367
2408
  element(expr) {
2368
2409
  const node = typeof expr === "string" || typeof expr === "number" || typeof expr === "boolean" ? new LiteralTsDsl(expr) : expr;
2369
- this._elements.push({
2370
- expr: node,
2371
- kind: "element"
2372
- });
2410
+ this._elements.push(node);
2373
2411
  return this;
2374
2412
  }
2375
2413
  /** Adds multiple array elements. */
@@ -2377,50 +2415,15 @@ var ArrayTsDsl = class extends Mixed$32 {
2377
2415
  for (const expr of exprs) this.element(expr);
2378
2416
  return this;
2379
2417
  }
2380
- /** Adds a spread element (`...expr`). */
2381
- spread(expr) {
2382
- this._elements.push({
2383
- expr,
2384
- kind: "spread"
2385
- });
2386
- return this;
2387
- }
2388
2418
  toAst() {
2389
- const elements = this._elements.map((item) => {
2390
- const node = this.$node(item.expr);
2391
- return item.kind === "spread" ? ts.factory.createSpreadElement(node) : node;
2392
- });
2393
- return ts.factory.createArrayLiteralExpression(elements, this.$multiline(this._elements.length));
2419
+ return ts.factory.createArrayLiteralExpression(this._elements.map((item) => this.$node(item)), this.$multiline(this._elements.length));
2394
2420
  }
2395
2421
  };
2396
2422
 
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
2423
  //#endregion
2421
2424
  //#region src/ts-dsl/expr/as.ts
2422
- const Mixed$31 = AsMixin(ExprMixin(TsDsl));
2423
- var AsTsDsl = class extends Mixed$31 {
2425
+ const Mixed$35 = AsMixin(ExprMixin(TsDsl));
2426
+ var AsTsDsl = class extends Mixed$35 {
2424
2427
  "~dsl" = "AsTsDsl";
2425
2428
  expr;
2426
2429
  type;
@@ -2442,8 +2445,8 @@ f.as.set((...args) => new AsTsDsl(...args));
2442
2445
 
2443
2446
  //#endregion
2444
2447
  //#region src/ts-dsl/expr/binary.ts
2445
- const Mixed$30 = AsMixin(ExprMixin(TsDsl));
2446
- var BinaryTsDsl = class extends Mixed$30 {
2448
+ const Mixed$34 = AsMixin(ExprMixin(TsDsl));
2449
+ var BinaryTsDsl = class extends Mixed$34 {
2447
2450
  "~dsl" = "BinaryTsDsl";
2448
2451
  _base;
2449
2452
  _expr;
@@ -2461,13 +2464,13 @@ var BinaryTsDsl = class extends Mixed$30 {
2461
2464
  }
2462
2465
  /** Returns true when all required builder calls are present. */
2463
2466
  get isValid() {
2464
- return this.missingRequiredCalls().length === 0;
2467
+ return !this.missingRequiredCalls().length;
2465
2468
  }
2466
2469
  /** Logical AND — `this && expr` */
2467
2470
  and(expr) {
2468
2471
  return this.opAndExpr("&&", expr);
2469
2472
  }
2470
- /** Creates an assignment expression (e.g. `this = expr`). */
2473
+ /** Creates an assignment expression (e.g., `this = expr`). */
2471
2474
  assign(expr) {
2472
2475
  return this.opAndExpr("=", expr);
2473
2476
  }
@@ -2539,7 +2542,7 @@ var BinaryTsDsl = class extends Mixed$30 {
2539
2542
  }
2540
2543
  $validate() {
2541
2544
  const missing = this.missingRequiredCalls();
2542
- if (missing.length === 0) return;
2545
+ if (!missing.length) return;
2543
2546
  throw new Error(`Binary expression missing ${missing.join(" and ")}`);
2544
2547
  }
2545
2548
  missingRequiredCalls() {
@@ -2643,42 +2646,48 @@ function OperatorMixin(Base) {
2643
2646
 
2644
2647
  //#endregion
2645
2648
  //#region src/ts-dsl/expr/attr.ts
2646
- const Mixed$29 = AsMixin(ExprMixin(OperatorMixin(OptionalMixin(TsDsl))));
2647
- var AttrTsDsl = class extends Mixed$29 {
2649
+ const Mixed$33 = AsMixin(ExprMixin(OperatorMixin(OptionalMixin(SpreadMixin(TsDsl)))));
2650
+ var AttrTsDsl = class extends Mixed$33 {
2648
2651
  "~dsl" = "AttrTsDsl";
2649
- left;
2652
+ _computed = false;
2653
+ _left;
2650
2654
  constructor(left, right) {
2651
2655
  super();
2652
- this.left = ref(left);
2656
+ this._left = ref(left);
2653
2657
  this.name.set(right);
2654
2658
  }
2655
2659
  analyze(ctx) {
2656
2660
  super.analyze(ctx);
2657
- ctx.analyze(this.left);
2661
+ ctx.analyze(this._left);
2658
2662
  ctx.analyze(this.name);
2659
2663
  }
2664
+ /** Use computed property access (e.g., `obj[expr]`)? */
2665
+ computed(condition) {
2666
+ this._computed = condition ?? true;
2667
+ return this;
2668
+ }
2660
2669
  toAst() {
2661
- const leftNode = this.$node(this.left);
2670
+ const left = this.$node(this._left);
2662
2671
  regexp.typeScriptIdentifier.lastIndex = 0;
2663
- const right = fromRef(this.name);
2664
- if (!regexp.typeScriptIdentifier.test(this.name.toString())) {
2672
+ if (this._computed || !regexp.typeScriptIdentifier.test(this.name.toString())) {
2673
+ const right = fromRef(this.name);
2665
2674
  let value = isSymbol(right) ? right.finalName : right;
2666
2675
  if (typeof value === "string") {
2667
2676
  if (value.startsWith("'") && value.endsWith("'") || value.startsWith("\"") && value.endsWith("\"")) value = value.slice(1, -1);
2668
2677
  }
2669
- if (this._optional) return ts.factory.createElementAccessChain(leftNode, this.$node(new TokenTsDsl().questionDot()), this.$node(new LiteralTsDsl(value)));
2670
- return ts.factory.createElementAccessExpression(leftNode, this.$node(new LiteralTsDsl(value)));
2678
+ if (this._optional) return ts.factory.createElementAccessChain(left, this.$node(new TokenTsDsl().questionDot()), this.$node(this._computed ? this.name : new LiteralTsDsl(value)));
2679
+ return ts.factory.createElementAccessExpression(left, this.$node(this._computed ? this.name : new LiteralTsDsl(value)));
2671
2680
  }
2672
- if (this._optional) return ts.factory.createPropertyAccessChain(leftNode, this.$node(new TokenTsDsl().questionDot()), this.$node(this.name));
2673
- return ts.factory.createPropertyAccessExpression(leftNode, this.$node(this.name));
2681
+ if (this._optional) return ts.factory.createPropertyAccessChain(left, this.$node(new TokenTsDsl().questionDot()), this.$node(this.name));
2682
+ return ts.factory.createPropertyAccessExpression(left, this.$node(this.name));
2674
2683
  }
2675
2684
  };
2676
2685
  f.attr.set((...args) => new AttrTsDsl(...args));
2677
2686
 
2678
2687
  //#endregion
2679
2688
  //#region src/ts-dsl/expr/await.ts
2680
- const Mixed$28 = ExprMixin(TsDsl);
2681
- var AwaitTsDsl = class extends Mixed$28 {
2689
+ const Mixed$32 = ExprMixin(TsDsl);
2690
+ var AwaitTsDsl = class extends Mixed$32 {
2682
2691
  "~dsl" = "AwaitTsDsl";
2683
2692
  _awaitExpr;
2684
2693
  constructor(expr) {
@@ -2697,8 +2706,8 @@ f.await.set((...args) => new AwaitTsDsl(...args));
2697
2706
 
2698
2707
  //#endregion
2699
2708
  //#region src/ts-dsl/expr/call.ts
2700
- const Mixed$27 = ArgsMixin(AsMixin(ExprMixin(TypeArgsMixin(TsDsl))));
2701
- var CallTsDsl = class extends Mixed$27 {
2709
+ const Mixed$31 = ArgsMixin(AsMixin(ExprMixin(SpreadMixin(TypeArgsMixin(TsDsl)))));
2710
+ var CallTsDsl = class extends Mixed$31 {
2702
2711
  "~dsl" = "CallTsDsl";
2703
2712
  _callee;
2704
2713
  constructor(callee, ...args) {
@@ -2718,8 +2727,8 @@ f.call.set((...args) => new CallTsDsl(...args));
2718
2727
 
2719
2728
  //#endregion
2720
2729
  //#region src/ts-dsl/expr/expr.ts
2721
- const Mixed$26 = AsMixin(ExprMixin(OperatorMixin(TypeExprMixin(TsDsl))));
2722
- var ExprTsDsl = class extends Mixed$26 {
2730
+ const Mixed$30 = AsMixin(ExprMixin(OperatorMixin(SpreadMixin(TypeExprMixin(TsDsl)))));
2731
+ var ExprTsDsl = class extends Mixed$30 {
2723
2732
  "~dsl" = "ExprTsDsl";
2724
2733
  _exprInput;
2725
2734
  constructor(id) {
@@ -2790,8 +2799,8 @@ function HintMixin(Base) {
2790
2799
 
2791
2800
  //#endregion
2792
2801
  //#region src/ts-dsl/expr/prop.ts
2793
- const Mixed$25 = DocMixin(TsDsl);
2794
- var ObjectPropTsDsl = class extends Mixed$25 {
2802
+ const Mixed$29 = DocMixin(TsDsl);
2803
+ var ObjectPropTsDsl = class extends Mixed$29 {
2795
2804
  "~dsl" = "ObjectPropTsDsl";
2796
2805
  _value;
2797
2806
  _meta;
@@ -2799,22 +2808,21 @@ var ObjectPropTsDsl = class extends Mixed$25 {
2799
2808
  super();
2800
2809
  this._meta = meta;
2801
2810
  }
2802
- get kind() {
2803
- return this._meta.kind;
2804
- }
2805
- get propName() {
2806
- return this._meta.name;
2807
- }
2808
2811
  analyze(ctx) {
2809
2812
  super.analyze(ctx);
2810
2813
  ctx.analyze(this._value);
2811
2814
  }
2812
2815
  get isValid() {
2813
- return this.missingRequiredCalls().length === 0;
2816
+ return !this.missingRequiredCalls().length;
2817
+ }
2818
+ get kind() {
2819
+ return this._meta.kind;
2820
+ }
2821
+ get propName() {
2822
+ return this._meta.name;
2814
2823
  }
2815
2824
  value(value) {
2816
- if (typeof value === "function") value(this);
2817
- else this._value = ref(value);
2825
+ this._value = ref(value);
2818
2826
  return this;
2819
2827
  }
2820
2828
  toAst() {
@@ -2835,6 +2843,7 @@ var ObjectPropTsDsl = class extends Mixed$25 {
2835
2843
  const result = this.$node(setter);
2836
2844
  return this.$docs(result);
2837
2845
  }
2846
+ if (this._meta.kind === "method") return this.$docs(node);
2838
2847
  if (ts.isIdentifier(node) && node.text === this._meta.name) {
2839
2848
  const result = ts.factory.createShorthandPropertyAssignment(this._meta.name);
2840
2849
  return this.$docs(result);
@@ -2845,7 +2854,7 @@ var ObjectPropTsDsl = class extends Mixed$25 {
2845
2854
  }
2846
2855
  $validate() {
2847
2856
  const missing = this.missingRequiredCalls();
2848
- if (missing.length === 0) return;
2857
+ if (!missing.length) return;
2849
2858
  throw new Error(`Object property${this._meta.name ? ` "${this._meta.name}"` : ""} missing ${missing.join(" and ")}`);
2850
2859
  }
2851
2860
  missingRequiredCalls() {
@@ -2857,14 +2866,15 @@ var ObjectPropTsDsl = class extends Mixed$25 {
2857
2866
 
2858
2867
  //#endregion
2859
2868
  //#region src/ts-dsl/expr/object.ts
2860
- const Mixed$24 = AsMixin(ExprMixin(HintMixin(LayoutMixin(TsDsl))));
2861
- var ObjectTsDsl = class extends Mixed$24 {
2869
+ const Mixed$28 = AsMixin(ExprMixin(HintMixin(LayoutMixin(TsDsl))));
2870
+ var ObjectTsDsl = class extends Mixed$28 {
2862
2871
  "~dsl" = "ObjectTsDsl";
2863
2872
  _props = /* @__PURE__ */ new Map();
2864
2873
  _spreadCounter = 0;
2865
2874
  constructor(...props) {
2866
2875
  super();
2867
- this.props(...props);
2876
+ if (props.length === 1 && typeof props[0] === "function") props[0](this);
2877
+ else this.props(...props);
2868
2878
  }
2869
2879
  analyze(ctx) {
2870
2880
  super.analyze(ctx);
@@ -2875,7 +2885,7 @@ var ObjectTsDsl = class extends Mixed$24 {
2875
2885
  if (prop.kind === "spread") return `spread:${this._spreadCounter++}`;
2876
2886
  return `${prop.kind}:${prop.propName}`;
2877
2887
  }
2878
- /** Adds a computed property (e.g. `{ [expr]: value }`), or removes if null. */
2888
+ /** Adds a computed property (e.g., `{ [expr]: value }`), or removes if null. */
2879
2889
  computed(name, expr) {
2880
2890
  if (expr === null) this._props.delete(`computed:${name}`);
2881
2891
  else this._props.set(`computed:${name}`, new ObjectPropTsDsl({
@@ -2884,7 +2894,7 @@ var ObjectTsDsl = class extends Mixed$24 {
2884
2894
  }).value(expr));
2885
2895
  return this;
2886
2896
  }
2887
- /** Adds a getter property (e.g. `{ get foo() { ... } }`), or removes if null. */
2897
+ /** Adds a getter property (e.g., `{ get foo() { ... } }`), or removes if null. */
2888
2898
  getter(name, stmt) {
2889
2899
  if (stmt === null) this._props.delete(`getter:${name}`);
2890
2900
  else this._props.set(`getter:${name}`, new ObjectPropTsDsl({
@@ -2901,6 +2911,15 @@ var ObjectTsDsl = class extends Mixed$24 {
2901
2911
  get isEmpty() {
2902
2912
  return this._props.size === 0;
2903
2913
  }
2914
+ /** Adds a method property (e.g., `{ foo() { ... } }`), or removes if null. */
2915
+ method(name, fn) {
2916
+ if (fn === null) this._props.delete(`method:${name}`);
2917
+ else this._props.set(`method:${name}`, new ObjectPropTsDsl({
2918
+ kind: "method",
2919
+ name
2920
+ }).value(f.method(name, fn)));
2921
+ return this;
2922
+ }
2904
2923
  /** Adds a property assignment, or removes if null. */
2905
2924
  prop(name, expr) {
2906
2925
  if (expr === null) this._props.delete(`prop:${name}`);
@@ -2915,7 +2934,7 @@ var ObjectTsDsl = class extends Mixed$24 {
2915
2934
  for (const prop of props) this._props.set(this._propKey(prop), prop);
2916
2935
  return this;
2917
2936
  }
2918
- /** Adds a setter property (e.g. `{ set foo(v) { ... } }`), or removes if null. */
2937
+ /** Adds a setter property (e.g., `{ set foo(v) { ... } }`), or removes if null. */
2919
2938
  setter(name, stmt) {
2920
2939
  if (stmt === null) this._props.delete(`setter:${name}`);
2921
2940
  else this._props.set(`setter:${name}`, new ObjectPropTsDsl({
@@ -2924,7 +2943,7 @@ var ObjectTsDsl = class extends Mixed$24 {
2924
2943
  }).value(stmt));
2925
2944
  return this;
2926
2945
  }
2927
- /** Adds a spread property (e.g. `{ ...options }`). */
2946
+ /** Adds a spread property (e.g., `{ ...options }`). */
2928
2947
  spread(expr) {
2929
2948
  const key = `spread:${this._spreadCounter++}`;
2930
2949
  this._props.set(key, new ObjectPropTsDsl({ kind: "spread" }).value(expr));
@@ -2938,7 +2957,7 @@ var ObjectTsDsl = class extends Mixed$24 {
2938
2957
  };
2939
2958
 
2940
2959
  //#endregion
2941
- //#region src/ts-dsl/expr/fromValue.ts
2960
+ //#region src/ts-dsl/expr/from-value.ts
2942
2961
  const fromValue$1 = (input, options) => {
2943
2962
  if (isNode(input)) return input;
2944
2963
  if (input === null || typeof input === "number" || typeof input === "boolean" || typeof input === "string" || typeof input === "bigint") return new LiteralTsDsl(input);
@@ -2961,8 +2980,8 @@ const fromValue$1 = (input, options) => {
2961
2980
 
2962
2981
  //#endregion
2963
2982
  //#region src/ts-dsl/expr/new.ts
2964
- const Mixed$23 = ArgsMixin(AsMixin(ExprMixin(TypeArgsMixin(TsDsl))));
2965
- var NewTsDsl = class extends Mixed$23 {
2983
+ const Mixed$27 = ArgsMixin(AsMixin(ExprMixin(SpreadMixin(TypeArgsMixin(TsDsl)))));
2984
+ var NewTsDsl = class extends Mixed$27 {
2966
2985
  "~dsl" = "NewTsDsl";
2967
2986
  _newExpr;
2968
2987
  constructor(expr, ...args) {
@@ -2980,10 +2999,67 @@ var NewTsDsl = class extends Mixed$23 {
2980
2999
  };
2981
3000
  f.new.set((...args) => new NewTsDsl(...args));
2982
3001
 
3002
+ //#endregion
3003
+ //#region src/ts-dsl/expr/postfix.ts
3004
+ const Mixed$26 = TsDsl;
3005
+ var PostfixTsDsl = class extends Mixed$26 {
3006
+ "~dsl" = "PostfixTsDsl";
3007
+ _expr;
3008
+ _op;
3009
+ constructor(expr, op) {
3010
+ super();
3011
+ this._expr = expr;
3012
+ this._op = op;
3013
+ }
3014
+ analyze(ctx) {
3015
+ super.analyze(ctx);
3016
+ ctx.analyze(this._expr);
3017
+ }
3018
+ /** Returns true when all required builder calls are present. */
3019
+ get isValid() {
3020
+ return !this.missingRequiredCalls().length;
3021
+ }
3022
+ /** Sets the operator to MinusMinusToken for decrement (`--`). */
3023
+ dec() {
3024
+ this._op = ts.SyntaxKind.MinusMinusToken;
3025
+ return this;
3026
+ }
3027
+ /** Sets the operand (the expression being postfixed). */
3028
+ expr(expr) {
3029
+ this._expr = expr;
3030
+ return this;
3031
+ }
3032
+ /** Sets the operator to PlusPlusToken for increment (`++`). */
3033
+ inc() {
3034
+ this._op = ts.SyntaxKind.PlusPlusToken;
3035
+ return this;
3036
+ }
3037
+ /** Sets the operator (e.g., `ts.SyntaxKind.PlusPlusToken` for `++`). */
3038
+ op(op) {
3039
+ this._op = op;
3040
+ return this;
3041
+ }
3042
+ toAst() {
3043
+ this.$validate();
3044
+ return ts.factory.createPostfixUnaryExpression(this.$node(this._expr), this._op);
3045
+ }
3046
+ $validate() {
3047
+ const missing = this.missingRequiredCalls();
3048
+ if (!missing.length) return;
3049
+ throw new Error(`Postfix unary expression missing ${missing.join(" and ")}`);
3050
+ }
3051
+ missingRequiredCalls() {
3052
+ const missing = [];
3053
+ if (!this._expr) missing.push(".expr()");
3054
+ if (!this._op) missing.push("operator (e.g., .inc(), .dec())");
3055
+ return missing;
3056
+ }
3057
+ };
3058
+
2983
3059
  //#endregion
2984
3060
  //#region src/ts-dsl/expr/regexp.ts
2985
- const Mixed$22 = TsDsl;
2986
- var RegExpTsDsl = class extends Mixed$22 {
3061
+ const Mixed$25 = TsDsl;
3062
+ var RegExpTsDsl = class extends Mixed$25 {
2987
3063
  "~dsl" = "RegExpTsDsl";
2988
3064
  pattern;
2989
3065
  flags;
@@ -3001,10 +3077,30 @@ var RegExpTsDsl = class extends Mixed$22 {
3001
3077
  }
3002
3078
  };
3003
3079
 
3080
+ //#endregion
3081
+ //#region src/ts-dsl/expr/spread.ts
3082
+ const Mixed$24 = TsDsl;
3083
+ var SpreadTsDsl = class extends Mixed$24 {
3084
+ "~dsl" = "SpreadTsDsl";
3085
+ _expr;
3086
+ constructor(expr) {
3087
+ super();
3088
+ this._expr = ref(expr);
3089
+ }
3090
+ analyze(ctx) {
3091
+ super.analyze(ctx);
3092
+ ctx.analyze(this._expr);
3093
+ }
3094
+ toAst() {
3095
+ return ts.factory.createSpreadElement(this.$node(this._expr));
3096
+ }
3097
+ };
3098
+ f.spread.set((...args) => new SpreadTsDsl(...args));
3099
+
3004
3100
  //#endregion
3005
3101
  //#region src/ts-dsl/expr/template.ts
3006
- const Mixed$21 = TsDsl;
3007
- var TemplateTsDsl = class extends Mixed$21 {
3102
+ const Mixed$23 = TsDsl;
3103
+ var TemplateTsDsl = class extends Mixed$23 {
3008
3104
  "~dsl" = "TemplateTsDsl";
3009
3105
  parts = [];
3010
3106
  constructor(value) {
@@ -3037,7 +3133,7 @@ var TemplateTsDsl = class extends Mixed$21 {
3037
3133
  } else if (typeof current === "number") normalized.push(String(current));
3038
3134
  else normalized.push(current);
3039
3135
  }
3040
- if (normalized.length === 0 || typeof normalized[0] !== "string") normalized.unshift("");
3136
+ if (!normalized.length || typeof normalized[0] !== "string") normalized.unshift("");
3041
3137
  if (normalized.length === 1 && typeof normalized[0] === "string") return ts.factory.createNoSubstitutionTemplateLiteral(normalized[0]);
3042
3138
  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
3139
  const head = ts.factory.createTemplateHead(normalized.shift());
@@ -3045,7 +3141,7 @@ var TemplateTsDsl = class extends Mixed$21 {
3045
3141
  while (normalized.length) {
3046
3142
  const expr = normalized.shift();
3047
3143
  const next = typeof normalized[0] === "string" ? normalized.shift() : "";
3048
- const isLast = normalized.length === 0;
3144
+ const isLast = !normalized.length;
3049
3145
  spans.push(ts.factory.createTemplateSpan(expr, isLast ? ts.factory.createTemplateTail(next) : ts.factory.createTemplateMiddle(next)));
3050
3146
  }
3051
3147
  return ts.factory.createTemplateExpression(head, spans);
@@ -3054,8 +3150,8 @@ var TemplateTsDsl = class extends Mixed$21 {
3054
3150
 
3055
3151
  //#endregion
3056
3152
  //#region src/ts-dsl/expr/ternary.ts
3057
- const Mixed$20 = TsDsl;
3058
- var TernaryTsDsl = class extends Mixed$20 {
3153
+ const Mixed$22 = TsDsl;
3154
+ var TernaryTsDsl = class extends Mixed$22 {
3059
3155
  "~dsl" = "TernaryTsDsl";
3060
3156
  _condition;
3061
3157
  _then;
@@ -3072,7 +3168,7 @@ var TernaryTsDsl = class extends Mixed$20 {
3072
3168
  }
3073
3169
  /** Returns true when all required builder calls are present. */
3074
3170
  get isValid() {
3075
- return this.missingRequiredCalls().length === 0;
3171
+ return !this.missingRequiredCalls().length;
3076
3172
  }
3077
3173
  condition(condition) {
3078
3174
  this._condition = condition;
@@ -3092,7 +3188,7 @@ var TernaryTsDsl = class extends Mixed$20 {
3092
3188
  }
3093
3189
  $validate() {
3094
3190
  const missing = this.missingRequiredCalls();
3095
- if (missing.length === 0) return;
3191
+ if (!missing.length) return;
3096
3192
  throw new Error(`Ternary expression missing ${missing.join(" and ")}`);
3097
3193
  }
3098
3194
  missingRequiredCalls() {
@@ -3106,8 +3202,8 @@ var TernaryTsDsl = class extends Mixed$20 {
3106
3202
 
3107
3203
  //#endregion
3108
3204
  //#region src/ts-dsl/expr/typeof.ts
3109
- const Mixed$19 = OperatorMixin(TsDsl);
3110
- var TypeOfExprTsDsl = class extends Mixed$19 {
3205
+ const Mixed$21 = OperatorMixin(TsDsl);
3206
+ var TypeOfExprTsDsl = class extends Mixed$21 {
3111
3207
  "~dsl" = "TypeOfExprTsDsl";
3112
3208
  _expr;
3113
3209
  constructor(expr) {
@@ -3156,10 +3252,109 @@ var NoteTsDsl = class extends TsDsl {
3156
3252
  }
3157
3253
  };
3158
3254
 
3255
+ //#endregion
3256
+ //#region src/ts-dsl/stmt/for.ts
3257
+ const Mixed$20 = DoMixin(LayoutMixin(TsDsl));
3258
+ var ImplForTsDsl = class extends Mixed$20 {
3259
+ "~dsl" = "ForTsDsl";
3260
+ _await;
3261
+ _condition;
3262
+ _iterableOrUpdate;
3263
+ _mode = "for";
3264
+ _variableOrInit;
3265
+ constructor(variableOrInit, modeOrCondition, iterableOrUpdate) {
3266
+ super();
3267
+ this._iterableOrUpdate = iterableOrUpdate;
3268
+ this._variableOrInit = variableOrInit;
3269
+ if (typeof modeOrCondition === "string") this._mode = modeOrCondition ?? "for";
3270
+ else this._condition = modeOrCondition;
3271
+ }
3272
+ analyze(ctx) {
3273
+ ctx.analyze(this._condition);
3274
+ ctx.analyze(this._iterableOrUpdate);
3275
+ ctx.analyze(this._variableOrInit);
3276
+ ctx.pushScope();
3277
+ try {
3278
+ super.analyze(ctx);
3279
+ } finally {
3280
+ ctx.popScope();
3281
+ }
3282
+ }
3283
+ /** Returns true when all required builder calls are present. */
3284
+ get isValid() {
3285
+ return !this.missingRequiredCalls().length;
3286
+ }
3287
+ /** Enables async iteration (`for await...of`). Can only be called on for...of. */
3288
+ await() {
3289
+ this._await = true;
3290
+ this.of();
3291
+ return this;
3292
+ }
3293
+ /** Sets the condition (e.g., `i < n`). */
3294
+ condition(condition) {
3295
+ this._condition = condition;
3296
+ return this;
3297
+ }
3298
+ /** Sets the iteration variable (e.g., `$.const('item')`). */
3299
+ each(variable) {
3300
+ this._variableOrInit = variable;
3301
+ return this;
3302
+ }
3303
+ /** Sets the object to iterate over and switches to for...in. */
3304
+ in(iterable) {
3305
+ this._mode = "in";
3306
+ if (iterable !== void 0) this.iterable(iterable);
3307
+ return this;
3308
+ }
3309
+ /** Sets the initialization (e.g., `let i = 0`). */
3310
+ init(init) {
3311
+ this._variableOrInit = init;
3312
+ return this;
3313
+ }
3314
+ /** Sets the iterable to iterate over. */
3315
+ iterable(iterable) {
3316
+ this._iterableOrUpdate = iterable;
3317
+ return this;
3318
+ }
3319
+ /** Sets the iterable to iterate over and switches to for...of. */
3320
+ of(iterable) {
3321
+ this._mode = "of";
3322
+ if (iterable !== void 0) this.iterable(iterable);
3323
+ return this;
3324
+ }
3325
+ /** Sets the update expression (e.g., `i++`). */
3326
+ update(update) {
3327
+ this._iterableOrUpdate = update;
3328
+ return this;
3329
+ }
3330
+ toAst() {
3331
+ this.$validate();
3332
+ const body = this.$node(new BlockTsDsl(...this._do).pretty());
3333
+ 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);
3334
+ if (this._mode === "in") return ts.factory.createForInStatement(this.$node(this._variableOrInit).declarationList, this.$node(this._iterableOrUpdate), body);
3335
+ const init = this.$node(this._variableOrInit);
3336
+ return ts.factory.createForStatement(init && ts.isVariableStatement(init) ? init.declarationList : init, this.$node(this._condition), this.$node(this._iterableOrUpdate), body);
3337
+ }
3338
+ $validate() {
3339
+ const missing = this.missingRequiredCalls();
3340
+ if (!missing.length) return;
3341
+ throw new Error(`For${this._mode === "for" ? "" : `...${this._mode}`} statement missing ${missing.join(" and ")}`);
3342
+ }
3343
+ missingRequiredCalls() {
3344
+ const missing = [];
3345
+ if (this._mode !== "for") {
3346
+ if (!this._variableOrInit) missing.push(".each()");
3347
+ if (!this._iterableOrUpdate) missing.push(".iterable()");
3348
+ }
3349
+ return missing;
3350
+ }
3351
+ };
3352
+ const ForTsDsl = ImplForTsDsl;
3353
+
3159
3354
  //#endregion
3160
3355
  //#region src/ts-dsl/stmt/if.ts
3161
- const Mixed$18 = DoMixin(TsDsl);
3162
- var IfTsDsl = class extends Mixed$18 {
3356
+ const Mixed$19 = DoMixin(TsDsl);
3357
+ var IfTsDsl = class extends Mixed$19 {
3163
3358
  "~dsl" = "IfTsDsl";
3164
3359
  _condition;
3165
3360
  _else;
@@ -3181,7 +3376,7 @@ var IfTsDsl = class extends Mixed$18 {
3181
3376
  }
3182
3377
  /** Returns true when all required builder calls are present. */
3183
3378
  get isValid() {
3184
- return this.missingRequiredCalls().length === 0;
3379
+ return !this.missingRequiredCalls().length;
3185
3380
  }
3186
3381
  condition(condition) {
3187
3382
  this._condition = condition;
@@ -3197,21 +3392,21 @@ var IfTsDsl = class extends Mixed$18 {
3197
3392
  }
3198
3393
  $validate() {
3199
3394
  const missing = this.missingRequiredCalls();
3200
- if (missing.length === 0) return;
3395
+ if (!missing.length) return;
3201
3396
  throw new Error(`If statement missing ${missing.join(" and ")}`);
3202
3397
  }
3203
3398
  missingRequiredCalls() {
3204
3399
  const missing = [];
3205
3400
  if (!this._condition) missing.push(".condition()");
3206
- if (this._do.length === 0) missing.push(".do()");
3401
+ if (!this._do.length) missing.push(".do()");
3207
3402
  return missing;
3208
3403
  }
3209
3404
  };
3210
3405
 
3211
3406
  //#endregion
3212
3407
  //#region src/ts-dsl/stmt/return.ts
3213
- const Mixed$17 = TsDsl;
3214
- var ReturnTsDsl = class extends Mixed$17 {
3408
+ const Mixed$18 = TsDsl;
3409
+ var ReturnTsDsl = class extends Mixed$18 {
3215
3410
  "~dsl" = "ReturnTsDsl";
3216
3411
  _returnExpr;
3217
3412
  constructor(expr) {
@@ -3230,8 +3425,8 @@ f.return.set((...args) => new ReturnTsDsl(...args));
3230
3425
 
3231
3426
  //#endregion
3232
3427
  //#region src/ts-dsl/stmt/throw.ts
3233
- const Mixed$16 = TsDsl;
3234
- var ThrowTsDsl = class extends Mixed$16 {
3428
+ const Mixed$17 = TsDsl;
3429
+ var ThrowTsDsl = class extends Mixed$17 {
3235
3430
  "~dsl" = "ThrowTsDsl";
3236
3431
  error;
3237
3432
  msg;
@@ -3261,8 +3456,8 @@ var ThrowTsDsl = class extends Mixed$16 {
3261
3456
 
3262
3457
  //#endregion
3263
3458
  //#region src/ts-dsl/stmt/try.ts
3264
- const Mixed$15 = TsDsl;
3265
- var TryTsDsl = class extends Mixed$15 {
3459
+ const Mixed$16 = TsDsl;
3460
+ var TryTsDsl = class extends Mixed$16 {
3266
3461
  "~dsl" = "TryTsDsl";
3267
3462
  _catch;
3268
3463
  _catchArg;
@@ -3302,7 +3497,7 @@ var TryTsDsl = class extends Mixed$15 {
3302
3497
  }
3303
3498
  /** Returns true when all required builder calls are present. */
3304
3499
  get isValid() {
3305
- return this.missingRequiredCalls().length === 0;
3500
+ return !this.missingRequiredCalls().length;
3306
3501
  }
3307
3502
  catch(...items) {
3308
3503
  this._catch = items;
@@ -3327,20 +3522,20 @@ var TryTsDsl = class extends Mixed$15 {
3327
3522
  }
3328
3523
  $validate() {
3329
3524
  const missing = this.missingRequiredCalls();
3330
- if (missing.length === 0) return;
3525
+ if (!missing.length) return;
3331
3526
  throw new Error(`Try statement missing ${missing.join(" and ")}`);
3332
3527
  }
3333
3528
  missingRequiredCalls() {
3334
3529
  const missing = [];
3335
- if (!this._try || this._try.length === 0) missing.push(".try()");
3530
+ if (!this._try || !this._try.length) missing.push(".try()");
3336
3531
  return missing;
3337
3532
  }
3338
3533
  };
3339
3534
 
3340
3535
  //#endregion
3341
3536
  //#region src/ts-dsl/stmt/var.ts
3342
- const Mixed$14 = DefaultMixin(DocMixin(ExportMixin(HintMixin(PatternMixin(ValueMixin(TsDsl))))));
3343
- var VarTsDsl = class extends Mixed$14 {
3537
+ const Mixed$15 = DefaultMixin(DocMixin(ExportMixin(HintMixin(PatternMixin(ValueMixin(TsDsl))))));
3538
+ var VarTsDsl = class extends Mixed$15 {
3344
3539
  "~dsl" = "VarTsDsl";
3345
3540
  nameSanitizer = safeRuntimeName;
3346
3541
  kind = ts.NodeFlags.None;
@@ -3357,7 +3552,7 @@ var VarTsDsl = class extends Mixed$14 {
3357
3552
  }
3358
3553
  /** Returns true when all required builder calls are present. */
3359
3554
  get isValid() {
3360
- return this.missingRequiredCalls().length === 0;
3555
+ return !this.missingRequiredCalls().length;
3361
3556
  }
3362
3557
  const() {
3363
3558
  this.kind = ts.NodeFlags.Const;
@@ -3368,8 +3563,8 @@ var VarTsDsl = class extends Mixed$14 {
3368
3563
  return this;
3369
3564
  }
3370
3565
  /** Sets the variable type. */
3371
- type(type) {
3372
- this._type = type instanceof TypeTsDsl ? type : new TypeExprTsDsl(type);
3566
+ type(node) {
3567
+ this._type = node instanceof TypeTsDsl ? node : new TypeExprTsDsl(node);
3373
3568
  return this;
3374
3569
  }
3375
3570
  var() {
@@ -3383,7 +3578,7 @@ var VarTsDsl = class extends Mixed$14 {
3383
3578
  }
3384
3579
  $validate() {
3385
3580
  const missing = this.missingRequiredCalls();
3386
- if (missing.length === 0) return;
3581
+ if (!missing.length) return;
3387
3582
  throw new Error(`Variable declaration missing ${missing.join(" and ")}`);
3388
3583
  }
3389
3584
  missingRequiredCalls() {
@@ -3395,8 +3590,8 @@ var VarTsDsl = class extends Mixed$14 {
3395
3590
 
3396
3591
  //#endregion
3397
3592
  //#region src/ts-dsl/type/alias.ts
3398
- const Mixed$13 = DocMixin(ExportMixin(TypeParamsMixin(TsDsl)));
3399
- var TypeAliasTsDsl = class extends Mixed$13 {
3593
+ const Mixed$14 = DocMixin(ExportMixin(TypeParamsMixin(TsDsl)));
3594
+ var TypeAliasTsDsl = class extends Mixed$14 {
3400
3595
  "~dsl" = "TypeAliasTsDsl";
3401
3596
  nameSanitizer = safeTypeName;
3402
3597
  scope = "type";
@@ -3414,7 +3609,7 @@ var TypeAliasTsDsl = class extends Mixed$13 {
3414
3609
  }
3415
3610
  /** Returns true when all required builder calls are present. */
3416
3611
  get isValid() {
3417
- return this.missingRequiredCalls().length === 0;
3612
+ return !this.missingRequiredCalls().length;
3418
3613
  }
3419
3614
  /** Sets the type expression on the right-hand side of `= ...`. */
3420
3615
  type(node) {
@@ -3428,21 +3623,21 @@ var TypeAliasTsDsl = class extends Mixed$13 {
3428
3623
  }
3429
3624
  $validate() {
3430
3625
  const missing = this.missingRequiredCalls();
3431
- if (missing.length === 0) return;
3626
+ if (!missing.length) return;
3432
3627
  const name = this.name.toString();
3433
3628
  throw new Error(`Type alias${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
3434
3629
  }
3435
3630
  missingRequiredCalls() {
3436
3631
  const missing = [];
3437
- if (!this.value) missing.push(".type()");
3632
+ if (!this.value) missing.push(".​type()");
3438
3633
  return missing;
3439
3634
  }
3440
3635
  };
3441
3636
 
3442
3637
  //#endregion
3443
3638
  //#region src/ts-dsl/type/and.ts
3444
- const Mixed$12 = TsDsl;
3445
- var TypeAndTsDsl = class extends Mixed$12 {
3639
+ const Mixed$13 = TsDsl;
3640
+ var TypeAndTsDsl = class extends Mixed$13 {
3446
3641
  "~dsl" = "TypeAndTsDsl";
3447
3642
  scope = "type";
3448
3643
  _types = [];
@@ -3471,8 +3666,8 @@ var TypeAndTsDsl = class extends Mixed$12 {
3471
3666
 
3472
3667
  //#endregion
3473
3668
  //#region src/ts-dsl/type/literal.ts
3474
- const Mixed$11 = TsDsl;
3475
- var TypeLiteralTsDsl = class extends Mixed$11 {
3669
+ const Mixed$12 = TsDsl;
3670
+ var TypeLiteralTsDsl = class extends Mixed$12 {
3476
3671
  "~dsl" = "TypeLiteralTsDsl";
3477
3672
  scope = "type";
3478
3673
  value;
@@ -3490,8 +3685,8 @@ var TypeLiteralTsDsl = class extends Mixed$11 {
3490
3685
 
3491
3686
  //#endregion
3492
3687
  //#region src/ts-dsl/type/idx-sig.ts
3493
- const Mixed$10 = DocMixin(ReadonlyMixin(TsDsl));
3494
- var TypeIdxSigTsDsl = class extends Mixed$10 {
3688
+ const Mixed$11 = DocMixin(ReadonlyMixin(TsDsl));
3689
+ var TypeIdxSigTsDsl = class extends Mixed$11 {
3495
3690
  "~dsl" = "TypeIdxSigTsDsl";
3496
3691
  scope = "type";
3497
3692
  _key;
@@ -3516,7 +3711,7 @@ var TypeIdxSigTsDsl = class extends Mixed$10 {
3516
3711
  }
3517
3712
  /** Returns true when all required builder calls are present. */
3518
3713
  get isValid() {
3519
- return this.missingRequiredCalls().length === 0;
3714
+ return !this.missingRequiredCalls().length;
3520
3715
  }
3521
3716
  /** Sets the key type: `[name: T]` */
3522
3717
  key(type) {
@@ -3535,7 +3730,7 @@ var TypeIdxSigTsDsl = class extends Mixed$10 {
3535
3730
  }
3536
3731
  $validate() {
3537
3732
  const missing = this.missingRequiredCalls();
3538
- if (missing.length === 0) return;
3733
+ if (!missing.length) return;
3539
3734
  const name = this.name.toString();
3540
3735
  throw new Error(`Index signature${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
3541
3736
  }
@@ -3549,8 +3744,8 @@ var TypeIdxSigTsDsl = class extends Mixed$10 {
3549
3744
 
3550
3745
  //#endregion
3551
3746
  //#region src/ts-dsl/type/prop.ts
3552
- const Mixed$9 = DocMixin(OptionalMixin(ReadonlyMixin(TsDsl)));
3553
- var TypePropTsDsl = class extends Mixed$9 {
3747
+ const Mixed$10 = DocMixin(OptionalMixin(ReadonlyMixin(TsDsl)));
3748
+ var TypePropTsDsl = class extends Mixed$10 {
3554
3749
  "~dsl" = "TypePropTsDsl";
3555
3750
  scope = "type";
3556
3751
  _type;
@@ -3573,7 +3768,7 @@ var TypePropTsDsl = class extends Mixed$9 {
3573
3768
  }
3574
3769
  /** Returns true when all required builder calls are present. */
3575
3770
  get isValid() {
3576
- return this.missingRequiredCalls().length === 0;
3771
+ return !this.missingRequiredCalls().length;
3577
3772
  }
3578
3773
  /** Sets the property type. */
3579
3774
  type(type) {
@@ -3588,21 +3783,21 @@ var TypePropTsDsl = class extends Mixed$9 {
3588
3783
  }
3589
3784
  $validate() {
3590
3785
  const missing = this.missingRequiredCalls();
3591
- if (missing.length === 0) return;
3786
+ if (!missing.length) return;
3592
3787
  const name = this.name.toString();
3593
3788
  throw new Error(`Type property${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
3594
3789
  }
3595
3790
  missingRequiredCalls() {
3596
3791
  const missing = [];
3597
- if (!this._type) missing.push(".type()");
3792
+ if (!this._type) missing.push(".​type()");
3598
3793
  return missing;
3599
3794
  }
3600
3795
  };
3601
3796
 
3602
3797
  //#endregion
3603
3798
  //#region src/ts-dsl/type/object.ts
3604
- const Mixed$8 = TsDsl;
3605
- var TypeObjectTsDsl = class extends Mixed$8 {
3799
+ const Mixed$9 = TsDsl;
3800
+ var TypeObjectTsDsl = class extends Mixed$9 {
3606
3801
  "~dsl" = "TypeObjectTsDsl";
3607
3802
  scope = "type";
3608
3803
  _props = /* @__PURE__ */ new Map();
@@ -3644,8 +3839,8 @@ var TypeObjectTsDsl = class extends Mixed$8 {
3644
3839
 
3645
3840
  //#endregion
3646
3841
  //#region src/ts-dsl/type/tuple.ts
3647
- const Mixed$7 = TsDsl;
3648
- var TypeTupleTsDsl = class extends Mixed$7 {
3842
+ const Mixed$8 = TsDsl;
3843
+ var TypeTupleTsDsl = class extends Mixed$8 {
3649
3844
  "~dsl" = "TypeTupleTsDsl";
3650
3845
  scope = "type";
3651
3846
  _elements = [];
@@ -3667,7 +3862,7 @@ var TypeTupleTsDsl = class extends Mixed$7 {
3667
3862
  };
3668
3863
 
3669
3864
  //#endregion
3670
- //#region src/ts-dsl/type/fromValue.ts
3865
+ //#region src/ts-dsl/type/from-value.ts
3671
3866
  const fromValue = (input) => {
3672
3867
  if (isNode(input)) return input;
3673
3868
  if (input === null) return new TypeLiteralTsDsl(input);
@@ -3686,8 +3881,8 @@ const fromValue = (input) => {
3686
3881
 
3687
3882
  //#endregion
3688
3883
  //#region src/ts-dsl/type/func.ts
3689
- const Mixed$6 = DocMixin(ParamMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl))));
3690
- var TypeFuncTsDsl = class extends Mixed$6 {
3884
+ const Mixed$7 = DocMixin(ParamMixin(TypeParamsMixin(TypeReturnsMixin(TsDsl))));
3885
+ var TypeFuncTsDsl = class extends Mixed$7 {
3691
3886
  "~dsl" = "TypeFuncTsDsl";
3692
3887
  scope = "type";
3693
3888
  analyze(ctx) {
@@ -3695,7 +3890,7 @@ var TypeFuncTsDsl = class extends Mixed$6 {
3695
3890
  }
3696
3891
  /** Returns true when all required builder calls are present. */
3697
3892
  get isValid() {
3698
- return this.missingRequiredCalls().length === 0;
3893
+ return !this.missingRequiredCalls().length;
3699
3894
  }
3700
3895
  toAst() {
3701
3896
  this.$validate();
@@ -3704,7 +3899,7 @@ var TypeFuncTsDsl = class extends Mixed$6 {
3704
3899
  }
3705
3900
  $validate() {
3706
3901
  const missing = this.missingRequiredCalls();
3707
- if (missing.length === 0) return;
3902
+ if (!missing.length) return;
3708
3903
  throw new Error(`Function type missing ${missing.join(" and ")}`);
3709
3904
  }
3710
3905
  missingRequiredCalls() {
@@ -3716,8 +3911,8 @@ var TypeFuncTsDsl = class extends Mixed$6 {
3716
3911
 
3717
3912
  //#endregion
3718
3913
  //#region src/ts-dsl/type/idx.ts
3719
- const Mixed$5 = TypeExprMixin(TsDsl);
3720
- var TypeIdxTsDsl = class extends Mixed$5 {
3914
+ const Mixed$6 = TypeExprMixin(TsDsl);
3915
+ var TypeIdxTsDsl = class extends Mixed$6 {
3721
3916
  "~dsl" = "TypeIdxTsDsl";
3722
3917
  scope = "type";
3723
3918
  _base;
@@ -3734,7 +3929,7 @@ var TypeIdxTsDsl = class extends Mixed$5 {
3734
3929
  }
3735
3930
  /** Returns true when all required builder calls are present. */
3736
3931
  get isValid() {
3737
- return this.missingRequiredCalls().length === 0;
3932
+ return !this.missingRequiredCalls().length;
3738
3933
  }
3739
3934
  base(base) {
3740
3935
  this._base = base;
@@ -3750,7 +3945,7 @@ var TypeIdxTsDsl = class extends Mixed$5 {
3750
3945
  }
3751
3946
  $validate() {
3752
3947
  const missing = this.missingRequiredCalls();
3753
- if (missing.length === 0) return;
3948
+ if (!missing.length) return;
3754
3949
  throw new Error(`Indexed access type missing ${missing.join(" and ")}`);
3755
3950
  }
3756
3951
  missingRequiredCalls() {
@@ -3764,8 +3959,8 @@ f.type.idx.set((...args) => new TypeIdxTsDsl(...args));
3764
3959
 
3765
3960
  //#endregion
3766
3961
  //#region src/ts-dsl/type/mapped.ts
3767
- const Mixed$4 = TsDsl;
3768
- var TypeMappedTsDsl = class extends Mixed$4 {
3962
+ const Mixed$5 = TsDsl;
3963
+ var TypeMappedTsDsl = class extends Mixed$5 {
3769
3964
  "~dsl" = "TypeMappedTsDsl";
3770
3965
  scope = "type";
3771
3966
  questionToken;
@@ -3785,7 +3980,7 @@ var TypeMappedTsDsl = class extends Mixed$4 {
3785
3980
  }
3786
3981
  /** Returns true when all required builder calls are present. */
3787
3982
  get isValid() {
3788
- return this.missingRequiredCalls().length === 0;
3983
+ return !this.missingRequiredCalls().length;
3789
3984
  }
3790
3985
  /** Sets the key constraint: `[K in Constraint]` */
3791
3986
  key(type) {
@@ -3823,7 +4018,7 @@ var TypeMappedTsDsl = class extends Mixed$4 {
3823
4018
  }
3824
4019
  $validate() {
3825
4020
  const missing = this.missingRequiredCalls();
3826
- if (missing.length === 0) return;
4021
+ if (!missing.length) return;
3827
4022
  const name = this.name.toString();
3828
4023
  throw new Error(`Mapped type${name ? ` "${name}"` : ""} missing ${missing.join(" and ")}`);
3829
4024
  }
@@ -3837,7 +4032,7 @@ var TypeMappedTsDsl = class extends Mixed$4 {
3837
4032
 
3838
4033
  //#endregion
3839
4034
  //#region src/ts-dsl/type/operator.ts
3840
- const Mixed$3 = TsDsl;
4035
+ const Mixed$4 = TsDsl;
3841
4036
  /**
3842
4037
  * Builds a TypeScript `TypeOperatorNode`, such as:
3843
4038
  *
@@ -3850,7 +4045,7 @@ const Mixed$3 = TsDsl;
3850
4045
  *
3851
4046
  * The node will throw during render if required fields are missing.
3852
4047
  */
3853
- var TypeOperatorTsDsl = class extends Mixed$3 {
4048
+ var TypeOperatorTsDsl = class extends Mixed$4 {
3854
4049
  "~dsl" = "TypeOperatorTsDsl";
3855
4050
  scope = "type";
3856
4051
  _op;
@@ -3894,7 +4089,7 @@ var TypeOperatorTsDsl = class extends Mixed$3 {
3894
4089
  /** Throws if required fields are not set. */
3895
4090
  $validate() {
3896
4091
  const missing = this.missingRequiredCalls();
3897
- if (missing.length === 0) return;
4092
+ if (!missing.length) return;
3898
4093
  throw new Error(`Type operator missing ${missing.join(" and ")}`);
3899
4094
  }
3900
4095
  missingRequiredCalls() {
@@ -3908,8 +4103,8 @@ f.type.operator.set((...args) => new TypeOperatorTsDsl(...args));
3908
4103
 
3909
4104
  //#endregion
3910
4105
  //#region src/ts-dsl/type/or.ts
3911
- const Mixed$2 = TsDsl;
3912
- var TypeOrTsDsl = class extends Mixed$2 {
4106
+ const Mixed$3 = TsDsl;
4107
+ var TypeOrTsDsl = class extends Mixed$3 {
3913
4108
  "~dsl" = "TypeOrTsDsl";
3914
4109
  scope = "type";
3915
4110
  _types = [];
@@ -3938,8 +4133,8 @@ var TypeOrTsDsl = class extends Mixed$2 {
3938
4133
 
3939
4134
  //#endregion
3940
4135
  //#region src/ts-dsl/type/query.ts
3941
- const Mixed$1 = TypeExprMixin(TsDsl);
3942
- var TypeQueryTsDsl = class extends Mixed$1 {
4136
+ const Mixed$2 = TypeExprMixin(TsDsl);
4137
+ var TypeQueryTsDsl = class extends Mixed$2 {
3943
4138
  "~dsl" = "TypeQueryTsDsl";
3944
4139
  scope = "type";
3945
4140
  _expr;
@@ -3960,8 +4155,8 @@ f.type.query.set((...args) => new TypeQueryTsDsl(...args));
3960
4155
 
3961
4156
  //#endregion
3962
4157
  //#region src/ts-dsl/type/template.ts
3963
- const Mixed = TsDsl;
3964
- var TypeTemplateTsDsl = class extends Mixed {
4158
+ const Mixed$1 = TsDsl;
4159
+ var TypeTemplateTsDsl = class extends Mixed$1 {
3965
4160
  "~dsl" = "TypeTemplateTsDsl";
3966
4161
  scope = "type";
3967
4162
  parts = [];
@@ -3992,7 +4187,7 @@ var TypeTemplateTsDsl = class extends Mixed {
3992
4187
  normalized.push(merged);
3993
4188
  } else normalized.push(current);
3994
4189
  }
3995
- if (normalized.length === 0 || typeof normalized[0] !== "string") normalized.unshift("");
4190
+ if (!normalized.length || typeof normalized[0] !== "string") normalized.unshift("");
3996
4191
  if (normalized.length === 1 && typeof normalized[0] === "string") return ts.factory.createTemplateLiteralType(ts.factory.createTemplateHead(normalized[0]), []);
3997
4192
  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
4193
  const head = ts.factory.createTemplateHead(normalized.shift());
@@ -4000,13 +4195,54 @@ var TypeTemplateTsDsl = class extends Mixed {
4000
4195
  while (normalized.length) {
4001
4196
  const type = normalized.shift();
4002
4197
  const next = typeof normalized[0] === "string" ? normalized.shift() : "";
4003
- const isLast = normalized.length === 0;
4198
+ const isLast = !normalized.length;
4004
4199
  spans.push(ts.factory.createTemplateLiteralTypeSpan(type, isLast ? ts.factory.createTemplateTail(next) : ts.factory.createTemplateMiddle(next)));
4005
4200
  }
4006
4201
  return ts.factory.createTemplateLiteralType(head, spans);
4007
4202
  }
4008
4203
  };
4009
4204
 
4205
+ //#endregion
4206
+ //#region src/ts-dsl/type/tuple-member.ts
4207
+ const Mixed = OptionalMixin(TsDsl);
4208
+ var TypeTupleMemberTsDsl = class extends Mixed {
4209
+ "~dsl" = "TypeTupleMemberTsDsl";
4210
+ scope = "type";
4211
+ _type;
4212
+ constructor(name) {
4213
+ super();
4214
+ this.name.set(name);
4215
+ }
4216
+ analyze(ctx) {
4217
+ super.analyze(ctx);
4218
+ ctx.analyze(this.name);
4219
+ ctx.analyze(this._type);
4220
+ }
4221
+ /** Returns true when all required builder calls are present. */
4222
+ get isValid() {
4223
+ return !this.missingRequiredCalls().length;
4224
+ }
4225
+ type(node) {
4226
+ this._type = ref(node);
4227
+ return this;
4228
+ }
4229
+ toAst() {
4230
+ this.$validate();
4231
+ return ts.factory.createNamedTupleMember(void 0, this.$node(this.name), this._optional ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : void 0, this.$type(this._type));
4232
+ }
4233
+ $validate() {
4234
+ const missing = this.missingRequiredCalls();
4235
+ if (!missing.length) return;
4236
+ throw new Error(`Tuple member missing ${missing.join(" and ")}`);
4237
+ }
4238
+ missingRequiredCalls() {
4239
+ const missing = [];
4240
+ if (!this._type) missing.push(".​type()");
4241
+ return missing;
4242
+ }
4243
+ };
4244
+ f.type.tupleMember.set((name) => new TypeTupleMemberTsDsl(name));
4245
+
4010
4246
  //#endregion
4011
4247
  //#region src/ts-dsl/utils/lazy.ts
4012
4248
  var LazyTsDsl = class extends TsDsl {
@@ -4165,7 +4401,7 @@ var TypeScriptRenderer = class TypeScriptRenderer {
4165
4401
  const specifiers = group.imports.map((imp) => {
4166
4402
  return ts.factory.createImportSpecifier(imp.isTypeOnly, imp.sourceName !== imp.localName ? $.id(imp.sourceName).toAst() : void 0, $.id(imp.localName).toAst());
4167
4403
  });
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 > 0 ? ts.factory.createNamedImports(specifiers) : void 0);
4404
+ 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
4405
  return ts.factory.createImportDeclaration(void 0, importClause, $.literal(group.modulePath).toAst());
4170
4406
  }
4171
4407
  getExports(ctx) {
@@ -4275,22 +4511,24 @@ const tsDsl = {
4275
4511
  call: (...args) => new CallTsDsl(...args),
4276
4512
  class: (...args) => new ClassTsDsl(...args),
4277
4513
  const: (...args) => new VarTsDsl(...args).const(),
4514
+ dec: (...args) => new PostfixTsDsl(...args).dec(),
4278
4515
  decorator: (...args) => new DecoratorTsDsl(...args),
4279
4516
  doc: (...args) => new DocTsDsl(...args),
4280
4517
  enum: (...args) => new EnumTsDsl(...args),
4281
4518
  expr: (...args) => new ExprTsDsl(...args),
4282
4519
  field: (...args) => new FieldTsDsl(...args),
4520
+ for: ((...args) => new ForTsDsl(...args)),
4283
4521
  fromValue: (...args) => fromValue$1(...args),
4284
4522
  func: ((nameOrFn, fn) => {
4285
4523
  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);
4524
+ if (typeof nameOrFn !== "string" || fn === void 0) return new FuncTsDsl(nameOrFn);
4288
4525
  return new FuncTsDsl(nameOrFn, fn);
4289
4526
  }),
4290
4527
  getter: (...args) => new GetterTsDsl(...args),
4291
4528
  hint: (...args) => new HintTsDsl(...args),
4292
4529
  id: (...args) => new IdTsDsl(...args),
4293
4530
  if: (...args) => new IfTsDsl(...args),
4531
+ inc: (...args) => new PostfixTsDsl(...args).inc(),
4294
4532
  init: (...args) => new InitTsDsl(...args),
4295
4533
  lazy: (...args) => new LazyTsDsl(...args),
4296
4534
  let: (...args) => new VarTsDsl(...args).let(),
@@ -4310,6 +4548,7 @@ const tsDsl = {
4310
4548
  regexp: (...args) => new RegExpTsDsl(...args),
4311
4549
  return: (...args) => new ReturnTsDsl(...args),
4312
4550
  setter: (...args) => new SetterTsDsl(...args),
4551
+ spread: (...args) => new SpreadTsDsl(...args),
4313
4552
  stmt: (...args) => new StmtTsDsl(...args),
4314
4553
  template: (...args) => new TemplateTsDsl(...args),
4315
4554
  ternary: (...args) => new TernaryTsDsl(...args),
@@ -4332,7 +4571,8 @@ const tsDsl = {
4332
4571
  param: (...args) => new TypeParamTsDsl(...args),
4333
4572
  query: (...args) => new TypeQueryTsDsl(...args),
4334
4573
  template: (...args) => new TypeTemplateTsDsl(...args),
4335
- tuple: (...args) => new TypeTupleTsDsl(...args)
4574
+ tuple: (...args) => new TypeTupleTsDsl(...args),
4575
+ tupleMember: (...args) => new TypeTupleMemberTsDsl(...args)
4336
4576
  }),
4337
4577
  typeofExpr: (...args) => new TypeOfExprTsDsl(...args),
4338
4578
  var: (...args) => new VarTsDsl(...args)
@@ -4347,7 +4587,7 @@ const createRegistryClass = ({ plugin, sdkSymbol, symbol }) => {
4347
4587
  return $.class(symbol).generic("T").field(symbolDefaultKey, (f) => f.private().readonly().assign($.literal("default"))).newline().field(symbolInstances, (f) => f.private().readonly().type($.type("Map").generics("string", "T")).assign($.new("Map"))).newline().method("get", (m) => m.returns("T").param("key", (p) => p.type("string").optional()).do($.const("instance").assign($("this").attr(symbolInstances).attr("get").call($("key").coalesce($("this").attr(symbolDefaultKey)))), $.if($.not("instance")).do($.throw("Error").message($.template("No SDK client found. Create one with \"new ").add(sdkSymbol).add("()\" to fix this error."))), $.return("instance"))).newline().method("set", (m) => m.returns("void").param("value", (p) => p.type("T")).param("key", (p) => p.type("string").optional()).do($("this").attr(symbolInstances).attr("set").call($("key").coalesce($("this").attr(symbolDefaultKey)), "value")));
4348
4588
  };
4349
4589
  const createClientClass = ({ plugin, symbol }) => {
4350
- const symClient = plugin.getSymbol({ category: "client" });
4590
+ const symClient = plugin.querySymbol({ category: "client" });
4351
4591
  const optionalClient = Boolean(plugin.config.client && symClient);
4352
4592
  const symbolClient = plugin.external("client.Client");
4353
4593
  return $.class(symbol).field("client", (f) => f.protected().type(symbolClient)).newline().init((i) => i.param("args", (p) => p.optional(optionalClient).type($.type.object().prop("client", (p) => p.optional(optionalClient).type(symbolClient)))).do($("this").attr("client").assign($("args").attr("client").optional(optionalClient).$if(optionalClient, (a) => a.coalesce(symClient)))));
@@ -4409,7 +4649,7 @@ const operationAuth = ({ operation, plugin }) => {
4409
4649
  //#region src/plugins/@hey-api/sdk/shared/signature.ts
4410
4650
  /**
4411
4651
  * Collects and resolves all operation parameters for flattened SDK signatures.
4412
- * - Prefixes all conflicting names with their location (e.g. path_foo, query_foo)
4652
+ * - Prefixes all conflicting names with their location (e.g., path_foo, query_foo)
4413
4653
  * - Returns a flat map of resolved parameter names to their metadata
4414
4654
  */
4415
4655
  function getSignatureParameters({ operation }) {
@@ -4514,16 +4754,16 @@ function getSignatureParameters({ operation }) {
4514
4754
 
4515
4755
  //#endregion
4516
4756
  //#region src/plugins/@hey-api/sdk/shared/validator.ts
4517
- const createRequestValidator = ({ operation, plugin }) => {
4757
+ function createRequestValidator({ plugin, ...args }) {
4518
4758
  if (!plugin.config.validator.request) return;
4519
4759
  const validator = plugin.getPluginOrThrow(plugin.config.validator.request);
4520
4760
  if (!validator.api.createRequestValidator) return;
4521
4761
  return validator.api.createRequestValidator({
4522
- operation,
4762
+ ...args,
4523
4763
  plugin: validator
4524
4764
  });
4525
- };
4526
- const createResponseValidator = ({ operation, plugin }) => {
4765
+ }
4766
+ function createResponseValidator({ operation, plugin }) {
4527
4767
  if (!plugin.config.validator.response) return;
4528
4768
  const validator = plugin.getPluginOrThrow(plugin.config.validator.response);
4529
4769
  if (!validator.api.createResponseValidator) return;
@@ -4531,7 +4771,7 @@ const createResponseValidator = ({ operation, plugin }) => {
4531
4771
  operation,
4532
4772
  plugin: validator
4533
4773
  });
4534
- };
4774
+ }
4535
4775
 
4536
4776
  //#endregion
4537
4777
  //#region src/plugins/@hey-api/sdk/shared/operation.ts
@@ -4559,6 +4799,15 @@ const operationOptionsType = ({ isDataAllowed = true, operation, plugin, throwOn
4559
4799
  });
4560
4800
  return $.type(symbolOptions).generic(nuxtTypeComposable).generic(isDataAllowed ? symbolDataType ?? "unknown" : "never").generic(symbolResponseType ?? "unknown").generic(nuxtTypeDefault);
4561
4801
  }
4802
+ if (hasOperationSse({ operation })) {
4803
+ const symbolResponseType = plugin.querySymbol({
4804
+ category: "type",
4805
+ resource: "operation",
4806
+ resourceId: operation.id,
4807
+ role: "response"
4808
+ });
4809
+ return $.type(symbolOptions).generic(isDataAllowed ? symbolDataType ?? "unknown" : "never").generic(throwOnError !== void 0 ? throwOnError : "boolean").generic(symbolResponseType ?? "unknown");
4810
+ }
4562
4811
  if (throwOnError) return $.type(symbolOptions).generic(isDataAllowed ? symbolDataType ?? "unknown" : "never").generic(throwOnError);
4563
4812
  return $.type(symbolOptions).$if(!isDataAllowed || symbolDataType, (t) => t.generic(isDataAllowed ? symbolDataType : "never"));
4564
4813
  };
@@ -4739,7 +4988,7 @@ function operationStatements({ isRequiredOptions, opParameters, operation, plugi
4739
4988
  reqOptions.prop("headers", headers);
4740
4989
  }
4741
4990
  }
4742
- const symbolClient = plugin.config.client ? plugin.getSymbol({ category: "client" }) : void 0;
4991
+ const symbolClient = plugin.config.client ? plugin.querySymbol({ category: "client" }) : void 0;
4743
4992
  let clientExpression;
4744
4993
  const optionsClient = $("options").attr("client").required(isRequiredOptions);
4745
4994
  if (isInstance(plugin)) clientExpression = optionsClient.coalesce($("this").attr("client"));
@@ -4839,7 +5088,7 @@ function enrichRootClass(args) {
4839
5088
  sdkSymbol: symbol,
4840
5089
  symbol: symbolRegistry
4841
5090
  }));
4842
- const isClientRequired = !plugin.config.client || !plugin.getSymbol({ category: "client" });
5091
+ const isClientRequired = !plugin.config.client || !plugin.querySymbol({ category: "client" });
4843
5092
  const registry = plugin.symbol("__registry");
4844
5093
  node.toAccessNode = (node, options) => {
4845
5094
  if (options.context) return;
@@ -5075,7 +5324,7 @@ function implementHttpRequestFn(args) {
5075
5324
  operation
5076
5325
  });
5077
5326
  const symbolHttpRequest = plugin.external("@angular/common/http.HttpRequest");
5078
- const symbolClient = plugin.getSymbol({ category: "client" });
5327
+ const symbolClient = plugin.querySymbol({ category: "client" });
5079
5328
  const symbolOptions = plugin.referenceSymbol({
5080
5329
  category: "type",
5081
5330
  resource: "client-options",
@@ -5226,33 +5475,11 @@ function toHttpResourceNode(model, plugin) {
5226
5475
  const handler$13 = ({ plugin }) => {
5227
5476
  plugin.symbol("HttpRequest", {
5228
5477
  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
- }
5478
+ kind: "type"
5255
5479
  });
5480
+ plugin.symbol("inject", { external: "@angular/core" });
5481
+ plugin.symbol("Injectable", { external: "@angular/core" });
5482
+ plugin.symbol("httpResource", { external: "@angular/common/http" });
5256
5483
  const httpRequestStructure = new StructureModel();
5257
5484
  const httpResourceStructure = new StructureModel();
5258
5485
  if (plugin.config.httpRequests.enabled) {
@@ -6150,7 +6377,6 @@ const createTypeOptions = ({ plugin }) => {
6150
6377
  external: clientModule,
6151
6378
  kind: "type",
6152
6379
  meta: {
6153
- category: "external",
6154
6380
  resource: "client.Client",
6155
6381
  tool: client.name
6156
6382
  }
@@ -6164,7 +6390,7 @@ const createTypeOptions = ({ plugin }) => {
6164
6390
  resource: "client-options",
6165
6391
  tool: "sdk"
6166
6392
  } });
6167
- const typeOptions = $.type.alias(symbolOptions).export().$if(isNuxtClient, (t) => t.generic("TComposable", (g) => g.extends(plugin.external("client.Composable")).default($.type.literal("$fetch"))).generic("TData", (g) => g.extends(symbolTDataShape).default(symbolTDataShape)).generic(nuxtTypeResponse, (g) => g.default("unknown")).generic(nuxtTypeDefault, (g) => g.default("undefined")), (t) => t.generic("TData", (g) => g.extends(symbolTDataShape).default(symbolTDataShape)).generic("ThrowOnError", (g) => g.extends("boolean").default("boolean"))).type($.type.and($.type(symbolClientOptions).$if(isNuxtClient, (t) => t.generic("TComposable").generic("TData").generic(nuxtTypeResponse).generic(nuxtTypeDefault), (t) => t.generic("TData").generic("ThrowOnError")), $.type.object().prop("client", (p) => p.doc([
6393
+ const typeOptions = $.type.alias(symbolOptions).export().$if(isNuxtClient, (t) => t.generic("TComposable", (g) => g.extends(plugin.external("client.Composable")).default($.type.literal("$fetch"))).generic("TData", (g) => g.extends(symbolTDataShape).default(symbolTDataShape)).generic(nuxtTypeResponse, (g) => g.default("unknown")).generic(nuxtTypeDefault, (g) => g.default("undefined")), (t) => t.generic("TData", (g) => g.extends(symbolTDataShape).default(symbolTDataShape)).generic("ThrowOnError", (g) => g.extends("boolean").default("boolean")).generic("TResponse", (g) => g.default("unknown"))).type($.type.and($.type(symbolClientOptions).$if(isNuxtClient, (t) => t.generic("TComposable").generic("TData").generic(nuxtTypeResponse).generic(nuxtTypeDefault), (t) => t.generic("TData").generic("ThrowOnError").generic("TResponse")), $.type.object().prop("client", (p) => p.doc([
6168
6394
  "You can provide a client instance returned by `createClient()` instead of",
6169
6395
  "individual options. This might be also useful if you want to implement a",
6170
6396
  "custom client."
@@ -6182,7 +6408,6 @@ const handlerV1$3 = ({ plugin }) => {
6182
6408
  plugin.symbol("formDataBodySerializer", {
6183
6409
  external: clientModule,
6184
6410
  meta: {
6185
- category: "external",
6186
6411
  resource: "client.formDataBodySerializer",
6187
6412
  tool: client.name
6188
6413
  }
@@ -6190,7 +6415,6 @@ const handlerV1$3 = ({ plugin }) => {
6190
6415
  plugin.symbol("urlSearchParamsBodySerializer", {
6191
6416
  external: clientModule,
6192
6417
  meta: {
6193
- category: "external",
6194
6418
  resource: "client.urlSearchParamsBodySerializer",
6195
6419
  tool: client.name
6196
6420
  }
@@ -6198,7 +6422,6 @@ const handlerV1$3 = ({ plugin }) => {
6198
6422
  plugin.symbol("buildClientParams", {
6199
6423
  external: clientModule,
6200
6424
  meta: {
6201
- category: "external",
6202
6425
  resource: "client.buildClientParams",
6203
6426
  tool: client.name
6204
6427
  }
@@ -6207,18 +6430,11 @@ const handlerV1$3 = ({ plugin }) => {
6207
6430
  external: clientModule,
6208
6431
  kind: "type",
6209
6432
  meta: {
6210
- category: "external",
6211
6433
  resource: "client.Composable",
6212
6434
  tool: client.name
6213
6435
  }
6214
6436
  });
6215
- if (isAngularClient) plugin.symbol("Injectable", {
6216
- external: "@angular/core",
6217
- meta: {
6218
- category: "external",
6219
- resource: "@angular/core.Injectable"
6220
- }
6221
- });
6437
+ if (isAngularClient) plugin.symbol("Injectable", { external: "@angular/core" });
6222
6438
  createTypeOptions({ plugin });
6223
6439
  const structure = new StructureModel();
6224
6440
  const shell = createShell$1(plugin);
@@ -6322,16 +6538,16 @@ const defineConfig$16 = definePluginConfig(defaultConfig$16);
6322
6538
  //#region src/plugins/@hey-api/transformers/expressions.ts
6323
6539
  const bigIntExpressions = ({ dataExpression, schema }) => {
6324
6540
  if (schema.type !== "integer" || schema.format !== "int64") return;
6325
- const bigIntCallExpression = dataExpression !== void 0 ? $("BigInt").call($.expr(dataExpression).attr("toString").call()) : void 0;
6541
+ const bigIntCallExpression = dataExpression !== void 0 ? $("BigInt").call($(dataExpression).attr("toString").call()) : void 0;
6326
6542
  if (bigIntCallExpression) {
6327
6543
  if (typeof dataExpression === "string") return [bigIntCallExpression];
6328
- if (dataExpression) return [$.expr(dataExpression).assign(bigIntCallExpression)];
6544
+ if (dataExpression) return [$(dataExpression).assign(bigIntCallExpression)];
6329
6545
  }
6330
6546
  };
6331
6547
  const dateExpressions = ({ dataExpression, schema }) => {
6332
6548
  if (schema.type !== "string" || !(schema.format === "date" || schema.format === "date-time")) return;
6333
6549
  if (typeof dataExpression === "string") return [$.new("Date").arg(dataExpression)];
6334
- if (dataExpression) return [$.expr(dataExpression).assign($.new("Date").arg(dataExpression))];
6550
+ if (dataExpression) return [$(dataExpression).assign($.new("Date").arg(dataExpression))];
6335
6551
  };
6336
6552
 
6337
6553
  //#endregion
@@ -6360,7 +6576,7 @@ function processSchemaType({ dataExpression, plugin, schema }) {
6360
6576
  resource: "definition",
6361
6577
  resourceId: schema.$ref
6362
6578
  };
6363
- const symbol = plugin.getSymbol(query) ?? plugin.symbol(applyNaming(refToName(schema.$ref), {
6579
+ const symbol = plugin.querySymbol(query) ?? plugin.symbol(applyNaming(refToName(schema.$ref), {
6364
6580
  case: "camelCase",
6365
6581
  name: "{{name}}SchemaResponseTransformer"
6366
6582
  }), { meta: query });
@@ -6419,6 +6635,17 @@ function processSchemaType({ dataExpression, plugin, schema }) {
6419
6635
  if (required.includes(name) && noNullableTypesInSchema) nodes = nodes.concat(propertyNodes);
6420
6636
  else nodes.push($.if(propertyAccessExpression).do(...propertyNodes));
6421
6637
  }
6638
+ if (schema.additionalProperties && dataExpression) {
6639
+ const entryValueNodes = processSchemaType({
6640
+ dataExpression: $(dataExpression).attr("key").computed(),
6641
+ plugin,
6642
+ schema: schema.additionalProperties
6643
+ });
6644
+ if (entryValueNodes.length) {
6645
+ const properties = Object.keys(schema.properties ?? {});
6646
+ 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)));
6647
+ }
6648
+ }
6422
6649
  return nodes;
6423
6650
  }
6424
6651
  if (schema.items) {
@@ -6815,9 +7042,9 @@ function itemsNode$4(ctx) {
6815
7042
  function baseNode$61(ctx) {
6816
7043
  const { schema } = ctx;
6817
7044
  const items = schema.items ?? [];
6818
- if (items.length === 0) return $.type("never");
7045
+ if (!items.length) return $.type("never");
6819
7046
  const literalTypes = items.filter((item) => item.const !== void 0).map((item) => $.type.fromValue(item.const));
6820
- return literalTypes.length > 0 ? $.type.or(...literalTypes) : $.type("string");
7047
+ return literalTypes.length ? $.type.or(...literalTypes) : $.type("string");
6821
7048
  }
6822
7049
  function enumResolver$4(ctx) {
6823
7050
  return ctx.nodes.base(ctx);
@@ -6966,16 +7193,16 @@ function baseNode$56(ctx) {
6966
7193
  const ir = schema.patternProperties[pattern];
6967
7194
  indexSchemas.unshift(ir);
6968
7195
  }
6969
- const hasPatterns = !!schema.patternProperties && Object.keys(schema.patternProperties).length > 0;
7196
+ const hasPatterns = schema.patternProperties && Object.keys(schema.patternProperties).length;
6970
7197
  const addPropsRaw = schema.additionalProperties;
6971
7198
  const addPropsObj = addPropsRaw !== false && addPropsRaw ? addPropsRaw : void 0;
6972
- if (hasPatterns || !!addPropsObj && (addPropsObj.type !== "never" || !indexSchemas.length)) {
7199
+ if (hasPatterns || addPropsObj && (addPropsObj.type !== "never" || !indexSchemas.length)) {
6973
7200
  const addProps = addPropsObj;
6974
7201
  if (addProps && addProps.type !== "never") if (addProps.type === "unknown") indexSchemas = [addProps, ...schema.patternProperties ? Object.values(schema.patternProperties) : []];
6975
7202
  else indexSchemas.unshift(addProps);
6976
7203
  else if (!hasPatterns && !indexSchemas.length && addProps && addProps.type === "never") indexSchemas = [addProps];
6977
7204
  if (hasOptionalProperties && addProps?.type !== "unknown") indexSchemas.push({ type: "undefined" });
6978
- if (indexSchemas.length > 0) {
7205
+ if (indexSchemas.length) {
6979
7206
  const indexType = walk(indexSchemas.length === 1 ? indexSchemas[0] : deduplicateSchema({ schema: {
6980
7207
  items: indexSchemas,
6981
7208
  logicalOperator: "or"
@@ -7038,14 +7265,14 @@ function formatNode$4(ctx) {
7038
7265
  resourceId: typeidBase,
7039
7266
  tool: "typescript"
7040
7267
  };
7041
- if (!plugin.getSymbol(typeidQuery)) {
7268
+ if (!plugin.querySymbol(typeidQuery)) {
7042
7269
  const containerQuery = {
7043
7270
  category: "type",
7044
7271
  resource: "type-id",
7045
7272
  tool: "typescript",
7046
7273
  variant: "container"
7047
7274
  };
7048
- if (!plugin.getSymbol(containerQuery)) {
7275
+ if (!plugin.querySymbol(containerQuery)) {
7049
7276
  const symbolTypeId = plugin.symbol("TypeID", { meta: containerQuery });
7050
7277
  const nodeTypeId = $.type.alias(symbolTypeId).export().generic("T", (g) => g.extends("string")).type($.type.template().add($.type("T")).add("_").add($.type("string")));
7051
7278
  plugin.node(nodeTypeId);
@@ -7208,7 +7435,7 @@ function voidToAst$3({ plugin, schema }) {
7208
7435
 
7209
7436
  //#endregion
7210
7437
  //#region src/plugins/@hey-api/typescript/v1/walker.ts
7211
- function createVisitor$4(config) {
7438
+ function createVisitor$4(config = {}) {
7212
7439
  const { schemaExtractor } = config;
7213
7440
  return {
7214
7441
  applyModifiers(result) {
@@ -7350,7 +7577,7 @@ function createVisitor$4(config) {
7350
7577
  resource: "definition",
7351
7578
  resourceId: $ref
7352
7579
  });
7353
- if (schema.omit && schema.omit.length > 0) {
7580
+ if (schema.omit && schema.omit.length) {
7354
7581
  const omittedKeys = schema.omit.length === 1 ? $.type.literal(schema.omit[0]) : $.type.or(...schema.omit.map((key) => $.type.literal(key)));
7355
7582
  return {
7356
7583
  meta: defaultMeta$2(schema),
@@ -7436,7 +7663,7 @@ function createProcessor$4(plugin) {
7436
7663
  const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
7437
7664
  function extractor(ctx) {
7438
7665
  if (processor.hasEmitted(ctx.path)) return ctx.schema;
7439
- for (const hook of extractorHooks) if (hook?.(ctx)) {
7666
+ for (const hook of extractorHooks) if (typeof hook === "boolean" ? hook : hook?.(ctx) ?? false) {
7440
7667
  process({
7441
7668
  namingAnchor: processor.context.anchor,
7442
7669
  tags: processor.context.tags,
@@ -7564,7 +7791,7 @@ const operationToType = ({ operation, path, plugin, tags }) => {
7564
7791
  if (data.properties.path.required) dataRequired.push("path");
7565
7792
  if (data.properties.query.required) dataRequired.push("query");
7566
7793
  dataRequired.push("url");
7567
- if (dataRequired.length > 0) data.required = dataRequired;
7794
+ if (dataRequired.length) data.required = dataRequired;
7568
7795
  const dataResult = processor.process({
7569
7796
  export: false,
7570
7797
  meta: {
@@ -7850,7 +8077,7 @@ const handlerV1$2 = ({ plugin }) => {
7850
8077
  plugin,
7851
8078
  servers
7852
8079
  });
7853
- if (webhooks.length > 0) {
8080
+ if (webhooks.length) {
7854
8081
  const symbol = plugin.registerSymbol(buildSymbolIn({
7855
8082
  meta: {
7856
8083
  category: "type",
@@ -8068,22 +8295,16 @@ const createQueryKeyFunction$1 = ({ plugin }) => {
8068
8295
  resource: "client-options",
8069
8296
  tool: "sdk"
8070
8297
  });
8071
- const symbolClient = plugin.getSymbol({ category: "client" });
8298
+ const symbolClient = plugin.querySymbol({ category: "client" });
8072
8299
  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
- });
8300
+ const symbolSerializeQueryValue = plugin.symbol("serializeQueryKeyValue", { external: clientModule });
8080
8301
  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
8302
  plugin.node(fn);
8082
8303
  };
8083
8304
  const createQueryKeyLiteral$1 = ({ id, operation, plugin }) => {
8084
8305
  const config = plugin.config.queryKeys;
8085
8306
  let tagsExpression;
8086
- if (config.tags && operation.tags && operation.tags.length > 0) tagsExpression = $.array(...operation.tags.map((tag) => $.literal(tag)));
8307
+ if (config.tags && operation.tags && operation.tags.length) tagsExpression = $.array(...operation.tags.map((tag) => $.literal(tag)));
8087
8308
  return $(plugin.referenceSymbol({
8088
8309
  category: "utility",
8089
8310
  resource: "createQueryKey",
@@ -8128,7 +8349,7 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
8128
8349
  context: plugin.context,
8129
8350
  operation
8130
8351
  });
8131
- if (!plugin.getSymbol({
8352
+ if (!plugin.querySymbol({
8132
8353
  category: "utility",
8133
8354
  resource: "createQueryKey",
8134
8355
  tool: plugin.name
@@ -8153,7 +8374,7 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
8153
8374
  tool: plugin.name
8154
8375
  });
8155
8376
  let tagsExpr;
8156
- if (plugin.config.queryKeys.tags && operation.tags && operation.tags.length > 0) tagsExpr = $.array(...operation.tags.map((t) => $.literal(t)));
8377
+ if (plugin.config.queryKeys.tags && operation.tags && operation.tags.length) tagsExpr = $.array(...operation.tags.map((t) => $.literal(t)));
8157
8378
  keyExpression = $(symbolCreateQueryKey).call($.literal(operation.id), optionsParamName$2, tagsExpr);
8158
8379
  }
8159
8380
  const typeData = getPublicTypeData({
@@ -8191,44 +8412,22 @@ const createQueryOptions$1 = ({ operation, plugin }) => {
8191
8412
  //#endregion
8192
8413
  //#region src/plugins/@pinia/colada/v0/plugin.ts
8193
8414
  const handlerV0 = ({ plugin }) => {
8194
- plugin.symbol("defineQueryOptions", {
8195
- external: plugin.name,
8196
- meta: {
8197
- category: "external",
8198
- resource: `${plugin.name}.defineQueryOptions`
8199
- }
8200
- });
8415
+ plugin.symbol("defineQueryOptions", { external: plugin.name });
8201
8416
  plugin.symbol("UseMutationOptions", {
8202
8417
  external: plugin.name,
8203
- kind: "type",
8204
- meta: {
8205
- category: "external",
8206
- resource: `${plugin.name}.UseMutationOptions`
8207
- }
8418
+ kind: "type"
8208
8419
  });
8209
8420
  plugin.symbol("UseQueryOptions", {
8210
8421
  external: plugin.name,
8211
- kind: "type",
8212
- meta: {
8213
- category: "external",
8214
- resource: `${plugin.name}.UseQueryOptions`
8215
- }
8422
+ kind: "type"
8216
8423
  });
8217
8424
  plugin.symbol("_JSONValue", {
8218
8425
  external: plugin.name,
8219
- kind: "type",
8220
- meta: {
8221
- category: "external",
8222
- resource: `${plugin.name}._JSONValue`
8223
- }
8426
+ kind: "type"
8224
8427
  });
8225
8428
  plugin.symbol("AxiosError", {
8226
8429
  external: "axios",
8227
- kind: "type",
8228
- meta: {
8229
- category: "external",
8230
- resource: "axios.AxiosError"
8231
- }
8430
+ kind: "type"
8232
8431
  });
8233
8432
  plugin.forEach("operation", ({ operation }) => {
8234
8433
  if (plugin.hooks.operation.isQuery(operation)) {
@@ -8344,7 +8543,7 @@ const createQueryKeyFunction = ({ plugin }) => {
8344
8543
  tool: plugin.name
8345
8544
  });
8346
8545
  const baseUrlKey = getClientBaseUrlKey(getTypedConfig(plugin));
8347
- const symbolClient = plugin.getSymbol({ category: "client" });
8546
+ const symbolClient = plugin.querySymbol({ category: "client" });
8348
8547
  const symbolOptions = plugin.referenceSymbol({
8349
8548
  category: "type",
8350
8549
  resource: "client-options",
@@ -8357,7 +8556,7 @@ const createQueryKeyFunction = ({ plugin }) => {
8357
8556
  const createQueryKeyLiteral = ({ id, isInfinite, operation, plugin }) => {
8358
8557
  const config = isInfinite ? plugin.config.infiniteQueryKeys : plugin.config.queryKeys;
8359
8558
  let tagsArray;
8360
- if (config.tags && operation.tags && operation.tags.length > 0) tagsArray = $.array().elements(...operation.tags);
8559
+ if (config.tags && operation.tags && operation.tags.length) tagsArray = $.array().elements(...operation.tags);
8361
8560
  return $(plugin.referenceSymbol({
8362
8561
  category: "utility",
8363
8562
  resource: "createQueryKey",
@@ -8422,7 +8621,7 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
8422
8621
  context: plugin.context,
8423
8622
  operation
8424
8623
  });
8425
- if (!plugin.getSymbol({
8624
+ if (!plugin.querySymbol({
8426
8625
  category: "utility",
8427
8626
  resource: "createQueryKey",
8428
8627
  tool: plugin.name
@@ -8430,7 +8629,7 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
8430
8629
  createQueryKeyType({ plugin });
8431
8630
  createQueryKeyFunction({ plugin });
8432
8631
  }
8433
- if (!plugin.getSymbol({
8632
+ if (!plugin.querySymbol({
8434
8633
  category: "utility",
8435
8634
  resource: "createInfiniteParams",
8436
8635
  tool: plugin.name
@@ -8530,7 +8729,7 @@ const createQueryOptions = ({ operation, plugin }) => {
8530
8729
  context: plugin.context,
8531
8730
  operation
8532
8731
  });
8533
- if (!plugin.getSymbol({
8732
+ if (!plugin.querySymbol({
8534
8733
  category: "utility",
8535
8734
  resource: "createQueryKey",
8536
8735
  tool: plugin.name
@@ -8641,64 +8840,25 @@ const createUseQuery = ({ operation, plugin }) => {
8641
8840
  const handlerV5 = ({ plugin }) => {
8642
8841
  plugin.symbol("DefaultError", {
8643
8842
  external: plugin.name,
8644
- kind: "type",
8645
- meta: {
8646
- category: "external",
8647
- resource: `${plugin.name}.DefaultError`
8648
- }
8843
+ kind: "type"
8649
8844
  });
8650
8845
  plugin.symbol("InfiniteData", {
8651
8846
  external: plugin.name,
8652
- kind: "type",
8653
- meta: {
8654
- category: "external",
8655
- resource: `${plugin.name}.InfiniteData`
8656
- }
8847
+ kind: "type"
8657
8848
  });
8658
8849
  const mutationsType = plugin.name === "@tanstack/angular-query-experimental" || plugin.name === "@tanstack/svelte-query" || plugin.name === "@tanstack/solid-query" ? "MutationOptions" : "UseMutationOptions";
8659
8850
  plugin.symbol(mutationsType, {
8660
8851
  external: plugin.name,
8661
8852
  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
- }
8853
+ meta: { resource: `${plugin.name}.MutationOptions` }
8694
8854
  });
8855
+ plugin.symbol("infiniteQueryOptions", { external: plugin.name });
8856
+ plugin.symbol("queryOptions", { external: plugin.name });
8857
+ plugin.symbol("useMutation", { external: plugin.name });
8858
+ plugin.symbol("useQuery", { external: plugin.name });
8695
8859
  plugin.symbol("AxiosError", {
8696
8860
  external: "axios",
8697
- kind: "type",
8698
- meta: {
8699
- category: "external",
8700
- resource: "axios.AxiosError"
8701
- }
8861
+ kind: "type"
8702
8862
  });
8703
8863
  plugin.forEach("operation", ({ operation }) => {
8704
8864
  if (plugin.hooks.operation.isQuery(operation)) {
@@ -9258,8 +9418,8 @@ const defineConfig$7 = definePluginConfig(defaultConfig$7);
9258
9418
 
9259
9419
  //#endregion
9260
9420
  //#region src/plugins/arktype/v2/api.ts
9261
- const createRequestValidatorV2 = ({ operation, plugin }) => {
9262
- const symbol = plugin.getSymbol({
9421
+ function createRequestValidatorV2({ operation, plugin }) {
9422
+ const symbol = plugin.querySymbol({
9263
9423
  category: "schema",
9264
9424
  resource: "operation",
9265
9425
  resourceId: operation.id,
@@ -9269,9 +9429,9 @@ const createRequestValidatorV2 = ({ operation, plugin }) => {
9269
9429
  if (!symbol) return;
9270
9430
  const dataParameterName = "data";
9271
9431
  return $.func().async().param(dataParameterName).do($(symbol).attr("parseAsync").call(dataParameterName).await().return());
9272
- };
9273
- const createResponseValidatorV2 = ({ operation, plugin }) => {
9274
- const symbol = plugin.getSymbol({
9432
+ }
9433
+ function createResponseValidatorV2({ operation, plugin }) {
9434
+ const symbol = plugin.querySymbol({
9275
9435
  category: "schema",
9276
9436
  resource: "operation",
9277
9437
  resourceId: operation.id,
@@ -9281,7 +9441,7 @@ const createResponseValidatorV2 = ({ operation, plugin }) => {
9281
9441
  if (!symbol) return;
9282
9442
  const dataParameterName = "data";
9283
9443
  return $.func().async().param(dataParameterName).do($(symbol).attr("parseAsync").call(dataParameterName).await().return());
9284
- };
9444
+ }
9285
9445
 
9286
9446
  //#endregion
9287
9447
  //#region src/plugins/arktype/api.ts
@@ -9628,13 +9788,7 @@ function handleComponent({ plugin, schema, state }) {
9628
9788
  });
9629
9789
  }
9630
9790
  const handlerV2$1 = ({ plugin }) => {
9631
- plugin.symbol("type", {
9632
- external: "arktype",
9633
- meta: {
9634
- category: "external",
9635
- resource: "arktype.type"
9636
- }
9637
- });
9791
+ plugin.symbol("type", { external: "arktype" });
9638
9792
  plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
9639
9793
  const state = refs({
9640
9794
  hasLazyExpression: false,
@@ -10088,9 +10242,9 @@ function normalizeConfig(input, context) {
10088
10242
  //#endregion
10089
10243
  //#region src/plugins/orpc/shared/operation.ts
10090
10244
  function hasInput(operation) {
10091
- const hasPathParams = Boolean(operation.parameters?.path && Object.keys(operation.parameters.path).length > 0);
10092
- const hasQueryParams = Boolean(operation.parameters?.query && Object.keys(operation.parameters.query).length > 0);
10093
- const hasHeaderParams = Boolean(operation.parameters?.header && Object.keys(operation.parameters.header).length > 0);
10245
+ const hasPathParams = Boolean(operation.parameters?.path && Object.keys(operation.parameters.path).length);
10246
+ const hasQueryParams = Boolean(operation.parameters?.query && Object.keys(operation.parameters.query).length);
10247
+ const hasHeaderParams = Boolean(operation.parameters?.header && Object.keys(operation.parameters.header).length);
10094
10248
  const hasBody = Boolean(operation.body);
10095
10249
  return hasPathParams || hasQueryParams || hasHeaderParams || hasBody;
10096
10250
  }
@@ -10108,7 +10262,7 @@ function getSuccessResponse(operation) {
10108
10262
  };
10109
10263
  }
10110
10264
  function getTags(operation, defaultTag) {
10111
- return operation.tags && operation.tags.length > 0 ? [...operation.tags] : [defaultTag];
10265
+ return operation.tags && operation.tags.length ? [...operation.tags] : [defaultTag];
10112
10266
  }
10113
10267
 
10114
10268
  //#endregion
@@ -10135,17 +10289,29 @@ function createContractSymbol(plugin, item) {
10135
10289
  tool: plugin.name
10136
10290
  } });
10137
10291
  }
10138
- function createContractExpression(plugin, operation, baseSymbol) {
10292
+ function createContractExpression(plugin, operation) {
10139
10293
  const successResponse = getSuccessResponse(operation);
10140
10294
  const tags = getTags(operation, plugin.config.contracts.strategyDefaultTag);
10141
- let expression = $(baseSymbol).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("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(tags.length > 0 && tags, (o, v) => o.prop("tags", $.fromValue(v))));
10142
- if (hasInput(operation) && plugin.config.validator.input) expression = expression.attr("input").call(plugin.referenceSymbol({
10143
- category: "schema",
10144
- resource: "operation",
10145
- resourceId: operation.id,
10146
- role: "data",
10147
- tool: plugin.config.validator.input
10148
- }));
10295
+ 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))));
10296
+ if (hasInput(operation) && plugin.config.validator.input) {
10297
+ const validator = plugin.getPluginOrThrow(plugin.config.validator.input);
10298
+ if ("createRequestSchema" in validator.api) {
10299
+ const requestSchema = validator.api.createRequestSchema({
10300
+ layers: {
10301
+ body: { whenEmpty: "omit" },
10302
+ headers: { whenEmpty: "omit" },
10303
+ path: {
10304
+ as: "params",
10305
+ whenEmpty: "omit"
10306
+ },
10307
+ query: { whenEmpty: "omit" }
10308
+ },
10309
+ operation,
10310
+ plugin: validator
10311
+ });
10312
+ if (requestSchema) expression = expression.attr("input").call(requestSchema);
10313
+ }
10314
+ }
10149
10315
  if (successResponse.hasOutput && plugin.config.validator.output) expression = expression.attr("output").call(plugin.referenceSymbol({
10150
10316
  category: "schema",
10151
10317
  resource: "operation",
@@ -10191,14 +10357,14 @@ function createShell(plugin) {
10191
10357
  };
10192
10358
  } };
10193
10359
  }
10194
- function toNode$1(model, plugin, baseSymbol) {
10360
+ function toNode$1(model, plugin) {
10195
10361
  if (model.virtual) {
10196
10362
  const nodes = [];
10197
10363
  const symbols = /* @__PURE__ */ new Map();
10198
10364
  for (const item of model.itemsFrom(source)) {
10199
10365
  const { operation } = item.data;
10200
10366
  const contractSymbol = createContractSymbol(plugin, item);
10201
- const expression = createContractExpression(plugin, operation, baseSymbol);
10367
+ const expression = createContractExpression(plugin, operation);
10202
10368
  const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
10203
10369
  nodes.push(node);
10204
10370
  symbols.set(operation.id, contractSymbol);
@@ -10214,7 +10380,7 @@ function toNode$1(model, plugin, baseSymbol) {
10214
10380
  for (const item of model.itemsFrom(source)) {
10215
10381
  const { operation } = item.data;
10216
10382
  const contractSymbol = createContractSymbol(plugin, item);
10217
- const expression = createContractExpression(plugin, operation, baseSymbol);
10383
+ const expression = createContractExpression(plugin, operation);
10218
10384
  const node = $.const(contractSymbol).export().$if(createOperationComment(operation), (n, v) => n.doc(v)).assign(expression);
10219
10385
  nodes.push(node);
10220
10386
  symbols.set(operation.id, contractSymbol);
@@ -10258,10 +10424,7 @@ function resolveStrategy(plugin) {
10258
10424
  //#endregion
10259
10425
  //#region src/plugins/orpc/v1/plugin.ts
10260
10426
  const handlerV1$1 = ({ plugin }) => {
10261
- const oc = plugin.symbol("oc", { external: "@orpc/contract" });
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);
10427
+ plugin.symbol("oc", { external: "@orpc/contract" });
10265
10428
  const structure = new StructureModel();
10266
10429
  const shell = createShell(plugin);
10267
10430
  const strategy = resolveStrategy(plugin);
@@ -10281,7 +10444,7 @@ const handlerV1$1 = ({ plugin }) => {
10281
10444
  }, { order: "declarations" });
10282
10445
  const allNodes = [];
10283
10446
  for (const node of structure.walk()) {
10284
- const { nodes } = toNode$1(node, plugin, baseSymbol);
10447
+ const { nodes } = toNode$1(node, plugin);
10285
10448
  allNodes.push(...nodes);
10286
10449
  }
10287
10450
  for (const node of allNodes) plugin.node(node);
@@ -10333,7 +10496,7 @@ const defineConfig$3 = definePluginConfig(defaultConfig$3);
10333
10496
  //#region src/plugins/swr/v2/useSwr.ts
10334
10497
  const createUseSwr = ({ operation, plugin }) => {
10335
10498
  if (hasOperationSse({ operation })) return;
10336
- const symbolUseSwr = plugin.external("swr");
10499
+ const symbolUseSwr = plugin.external("swr.useSWR");
10337
10500
  const symbolUseQueryFn = plugin.symbol(applyNaming(operation.id, plugin.config.useSwr));
10338
10501
  const awaitSdkFn = $.lazy((ctx) => ctx.access(plugin.referenceSymbol({
10339
10502
  category: "sdk",
@@ -10353,11 +10516,7 @@ const handlerV2 = ({ plugin }) => {
10353
10516
  plugin.symbol("useSWR", {
10354
10517
  external: "swr",
10355
10518
  importKind: "default",
10356
- kind: "function",
10357
- meta: {
10358
- category: "external",
10359
- resource: "swr"
10360
- }
10519
+ kind: "function"
10361
10520
  });
10362
10521
  plugin.forEach("operation", ({ operation }) => {
10363
10522
  if (plugin.hooks.operation.isQuery(operation)) {
@@ -10718,7 +10877,7 @@ function push(target, result) {
10718
10877
  }
10719
10878
  function toNode(pipes, plugin) {
10720
10879
  if (!(pipes instanceof Array)) return pipes;
10721
- if (pipes.length === 0) return $(plugin.external("valibot.v")).attr(identifiers$1.schemas.unknown).call();
10880
+ if (!pipes.length) return $(plugin.external("valibot.v")).attr(identifiers$1.schemas.unknown).call();
10722
10881
  if (pipes.length === 1) return pipes[0];
10723
10882
  return $(plugin.external("valibot.v")).attr(identifiers$1.methods.pipe).call(...pipes);
10724
10883
  }
@@ -10739,82 +10898,27 @@ function pipesToNode(pipes, plugin) {
10739
10898
  }
10740
10899
 
10741
10900
  //#endregion
10742
- //#region src/plugins/valibot/v1/api.ts
10743
- const validatorResolver$3 = (ctx) => {
10744
- const { schema, v } = ctx.symbols;
10745
- return $(v).attr(identifiers$1.async.parseAsync).call(schema, "data").await().return();
10746
- };
10747
- const createRequestValidatorV1 = ({ operation, plugin }) => {
10748
- const symbol = plugin.getSymbol({
10749
- category: "schema",
10750
- resource: "operation",
10751
- resourceId: operation.id,
10752
- role: "data",
10753
- tool: "valibot"
10754
- });
10755
- if (!symbol) return;
10756
- const ctx = {
10757
- $,
10758
- operation,
10759
- pipes: {
10760
- ...pipes,
10761
- current: []
10762
- },
10763
- plugin,
10764
- symbols: {
10765
- schema: symbol,
10766
- v: plugin.external("valibot.v")
10767
- }
10768
- };
10769
- const validator = plugin.config["~resolvers"]?.validator;
10770
- const candidates = [typeof validator === "function" ? validator : validator?.request, validatorResolver$3];
10771
- for (const candidate of candidates) {
10772
- const statements = candidate?.(ctx);
10773
- if (statements === null) return;
10774
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
10775
- }
10776
- };
10777
- const createResponseValidatorV1 = ({ operation, plugin }) => {
10778
- const symbol = plugin.getSymbol({
10779
- category: "schema",
10780
- resource: "operation",
10781
- resourceId: operation.id,
10782
- role: "responses",
10783
- tool: "valibot"
10784
- });
10785
- if (!symbol) return;
10786
- const ctx = {
10787
- $,
10788
- operation,
10789
- pipes: {
10790
- ...pipes,
10791
- current: []
10901
+ //#region src/plugins/valibot/shared/export.ts
10902
+ function exportAst$1({ final, meta, naming, namingAnchor, path, plugin, schema, tags }) {
10903
+ const v = plugin.external("valibot.v");
10904
+ const name = pathToName(path, { anchor: namingAnchor });
10905
+ const symbol = plugin.registerSymbol(buildSymbolIn({
10906
+ meta: {
10907
+ category: "schema",
10908
+ path,
10909
+ tags,
10910
+ tool: "valibot",
10911
+ ...meta
10792
10912
  },
10913
+ name,
10914
+ naming,
10793
10915
  plugin,
10794
- symbols: {
10795
- schema: symbol,
10796
- v: plugin.external("valibot.v")
10797
- }
10798
- };
10799
- const validator = plugin.config["~resolvers"]?.validator;
10800
- const candidates = [typeof validator === "function" ? validator : validator?.response, validatorResolver$3];
10801
- for (const candidate of candidates) {
10802
- const statements = candidate?.(ctx);
10803
- if (statements === null) return;
10804
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
10805
- }
10806
- };
10807
-
10808
- //#endregion
10809
- //#region src/plugins/valibot/api.ts
10810
- var Api$1 = class {
10811
- createRequestValidator(args) {
10812
- return createRequestValidatorV1(args);
10813
- }
10814
- createResponseValidator(args) {
10815
- return createResponseValidatorV1(args);
10816
- }
10817
- };
10916
+ schema
10917
+ }));
10918
+ const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(v).attr(final.typeName))).assign(pipesToNode(final.pipes, plugin));
10919
+ plugin.node(statement);
10920
+ return symbol;
10921
+ }
10818
10922
 
10819
10923
  //#endregion
10820
10924
  //#region src/plugins/valibot/shared/operation-schema.ts
@@ -10864,85 +10968,300 @@ function buildOperationSchema$1(operation) {
10864
10968
  }
10865
10969
 
10866
10970
  //#endregion
10867
- //#region src/plugins/valibot/shared/operation.ts
10868
- function irOperationToAst$1({ operation, path, plugin, processor, tags }) {
10869
- if (plugin.config.requests.enabled) {
10870
- const { schema } = buildOperationSchema$1(operation);
10871
- processor.process({
10872
- meta: {
10873
- resource: "operation",
10874
- resourceId: operation.id,
10875
- role: "data"
10876
- },
10877
- naming: plugin.config.requests,
10878
- namingAnchor: operation.id,
10879
- path,
10880
- plugin,
10881
- schema,
10882
- tags
10883
- });
10884
- }
10885
- if (plugin.config.responses.enabled) {
10886
- if (operation.responses) {
10887
- const { response } = operationResponsesMap(operation);
10888
- if (response) processor.process({
10889
- meta: {
10890
- resource: "operation",
10891
- resourceId: operation.id,
10892
- role: "responses"
10893
- },
10894
- naming: plugin.config.responses,
10895
- namingAnchor: operation.id,
10896
- path: [...path, "responses"],
10897
- plugin,
10898
- schema: response,
10899
- tags
10900
- });
10971
+ //#region src/plugins/valibot/shared/validator.ts
10972
+ function getDefaultRequestValidatorLayers$1(operation) {
10973
+ const { schema } = buildOperationSchema$1(operation);
10974
+ return {
10975
+ body: {
10976
+ as: "body",
10977
+ optional: !schema.required?.includes("body"),
10978
+ whenEmpty: "strict"
10979
+ },
10980
+ headers: {
10981
+ as: "headers",
10982
+ optional: !schema.required?.includes("headers"),
10983
+ whenEmpty: "omit"
10984
+ },
10985
+ path: {
10986
+ as: "path",
10987
+ optional: !schema.required?.includes("path"),
10988
+ whenEmpty: "strict"
10989
+ },
10990
+ query: {
10991
+ as: "query",
10992
+ optional: !schema.required?.includes("query"),
10993
+ whenEmpty: "strict"
10901
10994
  }
10902
- }
10995
+ };
10903
10996
  }
10904
10997
 
10905
10998
  //#endregion
10906
- //#region src/plugins/valibot/shared/webhook.ts
10907
- function irWebhookToAst$1({ operation, path, plugin, processor, tags }) {
10908
- if (plugin.config.webhooks.enabled) {
10909
- const { schema } = buildOperationSchema$1(operation);
10910
- processor.process({
10911
- meta: {
10912
- resource: "webhook",
10913
- resourceId: operation.id,
10914
- role: "data"
10915
- },
10916
- naming: plugin.config.webhooks,
10917
- namingAnchor: operation.id,
10918
- path,
10919
- plugin,
10920
- schema,
10921
- tags
10999
+ //#region src/plugins/valibot/v1/api.ts
11000
+ function emptyNode$3(ctx) {
11001
+ const { v } = ctx.symbols;
11002
+ if (ctx.layer.whenEmpty === "omit") throw new Error(`Cannot create empty schema for layer "${ctx.layer.as}" with whenEmpty: 'omit'`);
11003
+ if (ctx.layer.whenEmpty === "strict") return $(v).attr(identifiers$1.schemas.never).call();
11004
+ return $(v).attr(identifiers$1.schemas.object).call($.object());
11005
+ }
11006
+ function optionalNode$3(ctx) {
11007
+ if (!ctx.layer.optional) return ctx.schema;
11008
+ const v = ctx.symbols.v;
11009
+ return $(v).attr(identifiers$1.schemas.optional).call(ctx.schema);
11010
+ }
11011
+ function compositeNode$3(ctx) {
11012
+ const { v } = ctx.symbols;
11013
+ const obj = $.object();
11014
+ const defaultValues = getDefaultRequestValidatorLayers$1(ctx.operation);
11015
+ for (const key of requestValidatorLayers) {
11016
+ const layer = resolveValidatorLayer(ctx.layers, key, defaultValues);
11017
+ const layerSchema = ctx.plugin.querySymbol({
11018
+ category: "schema",
11019
+ resource: "operation",
11020
+ resourceId: ctx.operation.id,
11021
+ role: `request-${key}`,
11022
+ tool: "valibot"
11023
+ });
11024
+ if (layerSchema) {
11025
+ obj.prop(layer.as, ctx.nodes.optional({
11026
+ ...ctx,
11027
+ layer,
11028
+ schema: $(layerSchema)
11029
+ }));
11030
+ continue;
11031
+ }
11032
+ if (layer.whenEmpty === "omit") continue;
11033
+ const empty = ctx.nodes.empty({
11034
+ ...ctx,
11035
+ layer
10922
11036
  });
11037
+ obj.prop(layer.as, ctx.nodes.optional({
11038
+ ...ctx,
11039
+ layer,
11040
+ schema: empty
11041
+ }));
10923
11042
  }
11043
+ if (obj.isEmpty) return;
11044
+ return $(v).attr(identifiers$1.schemas.object).call(obj);
10924
11045
  }
10925
-
10926
- //#endregion
10927
- //#region src/plugins/valibot/shared/export.ts
10928
- function exportAst$1({ final, meta, naming, namingAnchor, path, plugin, schema, tags }) {
10929
- const v = plugin.external("valibot.v");
10930
- const name = pathToName(path, { anchor: namingAnchor });
10931
- const symbol = plugin.registerSymbol(buildSymbolIn({
10932
- meta: {
10933
- category: "schema",
10934
- path,
10935
- tags,
10936
- tool: "valibot",
10937
- ...meta
10938
- },
10939
- name,
10940
- naming,
10941
- plugin,
10942
- schema
10943
- }));
10944
- const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(v).attr(final.typeName))).assign(pipesToNode(final.pipes, plugin));
10945
- plugin.node(statement);
11046
+ function requestValidatorResolver$3(ctx) {
11047
+ const { schema, v } = ctx.symbols;
11048
+ return $(v).attr(identifiers$1.async.parseAsync).call(schema, "data").await().return();
11049
+ }
11050
+ function responseValidatorResolver$3(ctx) {
11051
+ const { schema, v } = ctx.symbols;
11052
+ return $(v).attr(identifiers$1.async.parseAsync).call(schema, "data").await().return();
11053
+ }
11054
+ function runRequestResolver$3(ctx) {
11055
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
11056
+ const candidates = [typeof validator === "function" ? validator : validator?.request, requestValidatorResolver$3];
11057
+ for (const candidate of candidates) {
11058
+ const statements = candidate?.(ctx);
11059
+ if (statements === null) return;
11060
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
11061
+ }
11062
+ }
11063
+ function runResponseResolver$3(ctx) {
11064
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
11065
+ const candidates = [typeof validator === "function" ? validator : validator?.response, responseValidatorResolver$3];
11066
+ for (const candidate of candidates) {
11067
+ const statements = candidate?.(ctx);
11068
+ if (statements === null) return;
11069
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
11070
+ }
11071
+ }
11072
+ function createRequestSchemaContext$3(ctx) {
11073
+ const { plugin } = ctx;
11074
+ const v = plugin.external("valibot.v");
11075
+ return {
11076
+ ...ctx,
11077
+ $,
11078
+ nodes: {
11079
+ composite: compositeNode$3,
11080
+ empty: emptyNode$3,
11081
+ optional: optionalNode$3
11082
+ },
11083
+ pipes: {
11084
+ ...pipes,
11085
+ current: []
11086
+ },
11087
+ symbols: {
11088
+ schema: $(""),
11089
+ v
11090
+ }
11091
+ };
11092
+ }
11093
+ function createRequestSchemaV1(ctx) {
11094
+ const { operation, plugin } = ctx;
11095
+ const baseCtx = createRequestSchemaContext$3(ctx);
11096
+ const schema = baseCtx.nodes.composite(baseCtx);
11097
+ if (!schema) return;
11098
+ if (!plugin.config.requests.shouldExtract({ operation })) return schema;
11099
+ return exportAst$1({
11100
+ final: { pipes: [schema] },
11101
+ meta: {
11102
+ resource: "operation",
11103
+ resourceId: operation.id,
11104
+ role: "data"
11105
+ },
11106
+ naming: plugin.config.requests,
11107
+ namingAnchor: operation.id,
11108
+ path: [],
11109
+ plugin,
11110
+ schema: {}
11111
+ });
11112
+ }
11113
+ function createRequestValidatorV1(ctx) {
11114
+ const symbolOrSchema = createRequestSchemaV1(ctx);
11115
+ if (!symbolOrSchema) return;
11116
+ const baseCtx = createRequestSchemaContext$3(ctx);
11117
+ return runRequestResolver$3({
11118
+ ...baseCtx,
11119
+ symbols: {
11120
+ ...baseCtx.symbols,
11121
+ schema: symbolOrSchema
11122
+ }
11123
+ });
11124
+ }
11125
+ function createResponseValidatorV1({ operation, plugin }) {
11126
+ const symbol = plugin.querySymbol({
11127
+ category: "schema",
11128
+ resource: "operation",
11129
+ resourceId: operation.id,
11130
+ role: "responses",
11131
+ tool: "valibot"
11132
+ });
11133
+ if (!symbol) return;
11134
+ const v = plugin.external("valibot.v");
11135
+ return runResponseResolver$3({
11136
+ $,
11137
+ operation,
11138
+ pipes: {
11139
+ ...pipes,
11140
+ current: []
11141
+ },
11142
+ plugin,
11143
+ symbols: {
11144
+ schema: symbol,
11145
+ v
11146
+ }
11147
+ });
11148
+ }
11149
+
11150
+ //#endregion
11151
+ //#region src/plugins/valibot/api.ts
11152
+ var Api$1 = class {
11153
+ createRequestSchema(ctx) {
11154
+ const { plugin } = ctx;
11155
+ if (!plugin.config.requests.enabled) return;
11156
+ return createRequestSchemaV1(ctx);
11157
+ }
11158
+ createRequestValidator(args) {
11159
+ const { plugin } = args;
11160
+ if (!plugin.config.requests.enabled) return;
11161
+ return createRequestValidatorV1(args);
11162
+ }
11163
+ createResponseValidator(args) {
11164
+ return createResponseValidatorV1(args);
11165
+ }
11166
+ };
11167
+
11168
+ //#endregion
11169
+ //#region src/plugins/valibot/shared/operation.ts
11170
+ function irOperationToAst$1({ operation, path, plugin, processor, tags }) {
11171
+ if (plugin.config.requests.enabled) {
11172
+ const { schema } = buildOperationSchema$1(operation);
11173
+ if (schema.properties?.body && schema.properties.body.type !== "never") processor.process({
11174
+ meta: {
11175
+ resource: "operation",
11176
+ resourceId: operation.id,
11177
+ role: "request-body"
11178
+ },
11179
+ naming: plugin.config.requests.body,
11180
+ namingAnchor: operation.id,
11181
+ path: [...path, "body"],
11182
+ plugin,
11183
+ schema: schema.properties.body,
11184
+ tags
11185
+ });
11186
+ if (schema.properties?.headers && schema.properties.headers.type === "object") processor.process({
11187
+ meta: {
11188
+ resource: "operation",
11189
+ resourceId: operation.id,
11190
+ role: "request-headers"
11191
+ },
11192
+ naming: plugin.config.requests.headers,
11193
+ namingAnchor: operation.id,
11194
+ path: [...path, "headers"],
11195
+ plugin,
11196
+ schema: schema.properties.headers,
11197
+ tags
11198
+ });
11199
+ if (schema.properties?.path && schema.properties.path.type === "object") processor.process({
11200
+ meta: {
11201
+ resource: "operation",
11202
+ resourceId: operation.id,
11203
+ role: "request-path"
11204
+ },
11205
+ naming: plugin.config.requests.path,
11206
+ namingAnchor: operation.id,
11207
+ path: [...path, "path"],
11208
+ plugin,
11209
+ schema: schema.properties.path,
11210
+ tags
11211
+ });
11212
+ if (schema.properties?.query && schema.properties.query.type === "object") processor.process({
11213
+ meta: {
11214
+ resource: "operation",
11215
+ resourceId: operation.id,
11216
+ role: "request-query"
11217
+ },
11218
+ naming: plugin.config.requests.query,
11219
+ namingAnchor: operation.id,
11220
+ path: [...path, "query"],
11221
+ plugin,
11222
+ schema: schema.properties.query,
11223
+ tags
11224
+ });
11225
+ }
11226
+ if (plugin.config.responses.enabled) {
11227
+ if (operation.responses) {
11228
+ const { response } = operationResponsesMap(operation);
11229
+ if (response) processor.process({
11230
+ meta: {
11231
+ resource: "operation",
11232
+ resourceId: operation.id,
11233
+ role: "responses"
11234
+ },
11235
+ naming: plugin.config.responses,
11236
+ namingAnchor: operation.id,
11237
+ path: [...path, "responses"],
11238
+ plugin,
11239
+ schema: response,
11240
+ tags
11241
+ });
11242
+ }
11243
+ }
11244
+ }
11245
+
11246
+ //#endregion
11247
+ //#region src/plugins/valibot/shared/webhook.ts
11248
+ function irWebhookToAst$1({ operation, path, plugin, processor, tags }) {
11249
+ if (plugin.config.webhooks.enabled) {
11250
+ const { schema } = buildOperationSchema$1(operation);
11251
+ processor.process({
11252
+ meta: {
11253
+ resource: "webhook",
11254
+ resourceId: operation.id,
11255
+ role: "data"
11256
+ },
11257
+ naming: plugin.config.webhooks,
11258
+ namingAnchor: operation.id,
11259
+ path,
11260
+ plugin,
11261
+ schema,
11262
+ tags
11263
+ });
11264
+ }
10946
11265
  }
10947
11266
 
10948
11267
  //#endregion
@@ -11234,7 +11553,7 @@ function enumToPipes({ plugin, schema }) {
11234
11553
  function baseNode$45(ctx) {
11235
11554
  const { applyModifiers, childResults, plugin, symbols } = ctx;
11236
11555
  const { v } = symbols;
11237
- if (childResults.length === 0) return $(v).attr(identifiers$1.schemas.any).call();
11556
+ if (!childResults.length) return $(v).attr(identifiers$1.schemas.any).call();
11238
11557
  if (childResults.length === 1) return applyModifiers(childResults[0]).pipes;
11239
11558
  const itemNodes = childResults.map((item) => pipesToNode(item.pipes, plugin));
11240
11559
  return $(v).attr(identifiers$1.schemas.intersect).call($.array(...itemNodes));
@@ -11695,7 +12014,7 @@ function baseNode$37(ctx) {
11695
12014
  const schema = schemas[index];
11696
12015
  if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
11697
12016
  });
11698
- if (nonNullItems.length === 0) return $(v).attr(identifiers$1.schemas.null).call();
12017
+ if (!nonNullItems.length) return $(v).attr(identifiers$1.schemas.null).call();
11699
12018
  if (nonNullItems.length === 1) return nonNullItems[0].pipes;
11700
12019
  const itemNodes = nonNullItems.map((i) => pipesToNode(i.pipes, plugin));
11701
12020
  return $(v).attr(identifiers$1.schemas.union).call($.array(...itemNodes));
@@ -11764,7 +12083,7 @@ function voidToPipes({ plugin, schema }) {
11764
12083
  function getDefaultValue(meta) {
11765
12084
  return meta.format ? maybeBigInt(meta.default, meta.format) : $.fromValue(meta.default);
11766
12085
  }
11767
- function createVisitor$3(config) {
12086
+ function createVisitor$3(config = {}) {
11768
12087
  const { schemaExtractor } = config;
11769
12088
  return {
11770
12089
  applyModifiers(result, ctx, options = {}) {
@@ -11849,6 +12168,10 @@ function createVisitor$3(config) {
11849
12168
  });
11850
12169
  if (extracted !== schema) return walk(extracted, ctx);
11851
12170
  }
12171
+ if (schema.symbolRef) return {
12172
+ meta: defaultMeta$1(schema),
12173
+ pipes: [$(schema.symbolRef)]
12174
+ };
11852
12175
  },
11853
12176
  intersection(items, schemas, parentSchema, ctx) {
11854
12177
  const applyModifiers = (result, opts) => this.applyModifiers(result, ctx, opts);
@@ -12044,7 +12367,7 @@ function createProcessor$3(plugin) {
12044
12367
  const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
12045
12368
  function extractor(ctx) {
12046
12369
  if (processor.hasEmitted(ctx.path)) return ctx.schema;
12047
- for (const hook of extractorHooks) if (hook?.(ctx)) {
12370
+ for (const hook of extractorHooks) if (typeof hook === "boolean" ? hook : hook?.(ctx) ?? false) {
12048
12371
  process({
12049
12372
  namingAnchor: processor.context.anchor,
12050
12373
  tags: processor.context.tags,
@@ -12089,11 +12412,7 @@ function createProcessor$3(plugin) {
12089
12412
  const handlerV1 = ({ plugin }) => {
12090
12413
  plugin.symbol("v", {
12091
12414
  external: "valibot",
12092
- importKind: "namespace",
12093
- meta: {
12094
- category: "external",
12095
- resource: "valibot.v"
12096
- }
12415
+ importKind: "namespace"
12097
12416
  });
12098
12417
  const processor = createProcessor$3(plugin);
12099
12418
  plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
@@ -12187,11 +12506,58 @@ const defaultConfig$1 = {
12187
12506
  });
12188
12507
  plugin.config.requests = context.valueToObject({
12189
12508
  defaultValue: {
12509
+ body: {
12510
+ case: plugin.config.case ?? "camelCase",
12511
+ enabled: true,
12512
+ name: "v{{name}}Body"
12513
+ },
12190
12514
  case: plugin.config.case ?? "camelCase",
12191
12515
  enabled: true,
12192
- name: "v{{name}}Data"
12516
+ headers: {
12517
+ case: plugin.config.case ?? "camelCase",
12518
+ enabled: true,
12519
+ name: "v{{name}}Headers"
12520
+ },
12521
+ name: "v{{name}}Data",
12522
+ path: {
12523
+ case: plugin.config.case ?? "camelCase",
12524
+ enabled: true,
12525
+ name: "v{{name}}Path"
12526
+ },
12527
+ query: {
12528
+ case: plugin.config.case ?? "camelCase",
12529
+ enabled: true,
12530
+ name: "v{{name}}Query"
12531
+ },
12532
+ shouldExtract: () => false
12533
+ },
12534
+ mappers: {
12535
+ ...mappers,
12536
+ object: (fields, defaultValue) => ({
12537
+ ...fields,
12538
+ body: context.valueToObject({
12539
+ defaultValue: defaultValue.body,
12540
+ mappers,
12541
+ value: fields.body
12542
+ }),
12543
+ headers: context.valueToObject({
12544
+ defaultValue: defaultValue.headers,
12545
+ mappers,
12546
+ value: fields.headers
12547
+ }),
12548
+ path: context.valueToObject({
12549
+ defaultValue: defaultValue.path,
12550
+ mappers,
12551
+ value: fields.path
12552
+ }),
12553
+ query: context.valueToObject({
12554
+ defaultValue: defaultValue.query,
12555
+ mappers,
12556
+ value: fields.query
12557
+ }),
12558
+ shouldExtract: fields.shouldExtract !== void 0 ? typeof fields.shouldExtract === "function" ? fields.shouldExtract : () => Boolean(fields.shouldExtract) : defaultValue.shouldExtract
12559
+ })
12193
12560
  },
12194
- mappers,
12195
12561
  value: plugin.config.requests
12196
12562
  });
12197
12563
  plugin.config.responses = context.valueToObject({
@@ -12285,42 +12651,248 @@ const identifiers = {
12285
12651
  void: "void"
12286
12652
  };
12287
12653
 
12654
+ //#endregion
12655
+ //#region src/plugins/zod/shared/export.ts
12656
+ function exportAst({ final, meta, naming, namingAnchor, path, plugin, schema, tags }) {
12657
+ const z = plugin.external("zod.z");
12658
+ const name = pathToName(path, { anchor: namingAnchor });
12659
+ const symbol = plugin.registerSymbol(buildSymbolIn({
12660
+ meta: {
12661
+ category: "schema",
12662
+ path,
12663
+ tags,
12664
+ tool: "zod",
12665
+ ...meta
12666
+ },
12667
+ name,
12668
+ naming,
12669
+ plugin,
12670
+ schema
12671
+ }));
12672
+ const typeInferSymbol = naming.types.infer.enabled ? plugin.registerSymbol(buildSymbolIn({
12673
+ meta: {
12674
+ category: "type",
12675
+ path,
12676
+ tags,
12677
+ tool: "zod",
12678
+ variant: "infer",
12679
+ ...meta
12680
+ },
12681
+ name,
12682
+ naming: naming.types.infer,
12683
+ plugin,
12684
+ schema
12685
+ })) : void 0;
12686
+ const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(z).attr(final.typeName))).assign(final.expression);
12687
+ plugin.node(statement);
12688
+ if (typeInferSymbol) {
12689
+ const inferType = $.type.alias(typeInferSymbol).export().type($.type(z).attr(identifiers.infer).generic($(symbol).typeofType()));
12690
+ plugin.node(inferType);
12691
+ }
12692
+ return symbol;
12693
+ }
12694
+
12695
+ //#endregion
12696
+ //#region src/plugins/zod/shared/operation-schema.ts
12697
+ function buildOperationSchema(operation) {
12698
+ const requiredProperties = /* @__PURE__ */ new Set();
12699
+ const schema = {
12700
+ properties: {
12701
+ body: { type: "never" },
12702
+ path: { type: "never" },
12703
+ query: { type: "never" }
12704
+ },
12705
+ type: "object"
12706
+ };
12707
+ if (operation.parameters) for (const location of [
12708
+ "header",
12709
+ "path",
12710
+ "query"
12711
+ ]) {
12712
+ const params = operation.parameters[location];
12713
+ if (!params) continue;
12714
+ const properties = {};
12715
+ const required = [];
12716
+ const propKey = location === "header" ? "headers" : location;
12717
+ for (const key in params) {
12718
+ const parameter = params[key];
12719
+ properties[parameter.name] = parameter.schema;
12720
+ if (parameter.required) {
12721
+ required.push(parameter.name);
12722
+ requiredProperties.add(propKey);
12723
+ }
12724
+ }
12725
+ if (Object.keys(properties).length) schema.properties[propKey] = {
12726
+ properties,
12727
+ required,
12728
+ type: "object"
12729
+ };
12730
+ }
12731
+ if (operation.body) {
12732
+ schema.properties.body = operation.body.schema;
12733
+ if (operation.body.required) requiredProperties.add("body");
12734
+ }
12735
+ schema.required = [...requiredProperties];
12736
+ return {
12737
+ required: schema.required,
12738
+ schema
12739
+ };
12740
+ }
12741
+
12742
+ //#endregion
12743
+ //#region src/plugins/zod/shared/validator.ts
12744
+ function getDefaultRequestValidatorLayers(operation) {
12745
+ const { schema } = buildOperationSchema(operation);
12746
+ return {
12747
+ body: {
12748
+ as: "body",
12749
+ optional: !schema.required?.includes("body"),
12750
+ whenEmpty: "strict"
12751
+ },
12752
+ headers: {
12753
+ as: "headers",
12754
+ optional: !schema.required?.includes("headers"),
12755
+ whenEmpty: "omit"
12756
+ },
12757
+ path: {
12758
+ as: "path",
12759
+ optional: !schema.required?.includes("path"),
12760
+ whenEmpty: "strict"
12761
+ },
12762
+ query: {
12763
+ as: "query",
12764
+ optional: !schema.required?.includes("query"),
12765
+ whenEmpty: "strict"
12766
+ }
12767
+ };
12768
+ }
12769
+
12288
12770
  //#endregion
12289
12771
  //#region src/plugins/zod/mini/api.ts
12290
- const validatorResolver$2 = (ctx) => {
12772
+ function emptyNode$2(ctx) {
12773
+ const { z } = ctx.symbols;
12774
+ if (ctx.layer.whenEmpty === "omit") throw new Error(`Cannot create empty schema for layer "${ctx.layer.as}" with whenEmpty: 'omit'`);
12775
+ if (ctx.layer.whenEmpty === "strict") return $(z).attr(identifiers.never).call();
12776
+ return $(z).attr(identifiers.object).call($.object());
12777
+ }
12778
+ function optionalNode$2(ctx) {
12779
+ if (!ctx.layer.optional) return ctx.schema;
12780
+ const { z } = ctx.symbols;
12781
+ return $(z).attr(identifiers.optional).call(ctx.schema);
12782
+ }
12783
+ function compositeNode$2(ctx) {
12784
+ const { z } = ctx.symbols;
12785
+ const obj = $.object();
12786
+ const defaultValues = getDefaultRequestValidatorLayers(ctx.operation);
12787
+ for (const key of requestValidatorLayers) {
12788
+ const layer = resolveValidatorLayer(ctx.layers, key, defaultValues);
12789
+ const layerSchema = ctx.plugin.querySymbol({
12790
+ category: "schema",
12791
+ resource: "operation",
12792
+ resourceId: ctx.operation.id,
12793
+ role: `request-${key}`,
12794
+ tool: "zod"
12795
+ });
12796
+ if (layerSchema) {
12797
+ obj.prop(layer.as, ctx.nodes.optional({
12798
+ ...ctx,
12799
+ layer,
12800
+ schema: $(layerSchema)
12801
+ }));
12802
+ continue;
12803
+ }
12804
+ if (layer.whenEmpty === "omit") continue;
12805
+ const empty = ctx.nodes.empty({
12806
+ ...ctx,
12807
+ layer
12808
+ });
12809
+ obj.prop(layer.as, ctx.nodes.optional({
12810
+ ...ctx,
12811
+ layer,
12812
+ schema: empty
12813
+ }));
12814
+ }
12815
+ if (obj.isEmpty) return;
12816
+ return $(z).attr(identifiers.object).call(obj);
12817
+ }
12818
+ function requestValidatorResolver$2(ctx) {
12291
12819
  const { schema } = ctx.symbols;
12292
12820
  return $(schema).attr(identifiers.parseAsync).call("data").await().return();
12293
- };
12294
- const createRequestValidatorMini = ({ operation, plugin }) => {
12295
- const symbol = plugin.getSymbol({
12296
- category: "schema",
12297
- resource: "operation",
12298
- resourceId: operation.id,
12299
- role: "data",
12300
- tool: "zod"
12301
- });
12302
- if (!symbol) return;
12821
+ }
12822
+ function responseValidatorResolver$2(ctx) {
12823
+ const { schema } = ctx.symbols;
12824
+ return $(schema).attr(identifiers.parseAsync).call("data").await().return();
12825
+ }
12826
+ function runRequestResolver$2(ctx) {
12827
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
12828
+ const candidates = [typeof validator === "function" ? validator : validator?.request, requestValidatorResolver$2];
12829
+ for (const candidate of candidates) {
12830
+ const statements = candidate?.(ctx);
12831
+ if (statements === null) return;
12832
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12833
+ }
12834
+ }
12835
+ function runResponseResolver$2(ctx) {
12836
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
12837
+ const candidates = [typeof validator === "function" ? validator : validator?.response, responseValidatorResolver$2];
12838
+ for (const candidate of candidates) {
12839
+ const statements = candidate?.(ctx);
12840
+ if (statements === null) return;
12841
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12842
+ }
12843
+ }
12844
+ function createRequestSchemaContext$2(ctx) {
12845
+ const { plugin } = ctx;
12303
12846
  const z = plugin.external("zod.z");
12304
- const ctx = {
12847
+ return {
12848
+ ...ctx,
12305
12849
  $,
12306
12850
  chain: { current: $(z) },
12307
- operation,
12308
- plugin,
12851
+ nodes: {
12852
+ composite: compositeNode$2,
12853
+ empty: emptyNode$2,
12854
+ optional: optionalNode$2
12855
+ },
12309
12856
  symbols: {
12310
- schema: symbol,
12857
+ schema: $(""),
12311
12858
  z
12312
12859
  }
12313
12860
  };
12314
- const validator = plugin.config["~resolvers"]?.validator;
12315
- const candidates = [typeof validator === "function" ? validator : validator?.request, validatorResolver$2];
12316
- for (const candidate of candidates) {
12317
- const statements = candidate?.(ctx);
12318
- if (statements === null) return;
12319
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12320
- }
12321
- };
12322
- const createResponseValidatorMini = ({ operation, plugin }) => {
12323
- const symbol = plugin.getSymbol({
12861
+ }
12862
+ function createRequestSchemaMini(ctx) {
12863
+ const { operation, plugin } = ctx;
12864
+ const baseCtx = createRequestSchemaContext$2(ctx);
12865
+ const schema = baseCtx.nodes.composite(baseCtx);
12866
+ if (!schema) return;
12867
+ if (!plugin.config.requests.shouldExtract({ operation })) return schema;
12868
+ return exportAst({
12869
+ final: { expression: schema },
12870
+ meta: {
12871
+ resource: "operation",
12872
+ resourceId: operation.id,
12873
+ role: "data"
12874
+ },
12875
+ naming: plugin.config.requests,
12876
+ namingAnchor: operation.id,
12877
+ path: [],
12878
+ plugin,
12879
+ schema: {}
12880
+ });
12881
+ }
12882
+ function createRequestValidatorMini(ctx) {
12883
+ const symbolOrSchema = createRequestSchemaMini(ctx);
12884
+ if (!symbolOrSchema) return;
12885
+ const baseCtx = createRequestSchemaContext$2(ctx);
12886
+ return runRequestResolver$2({
12887
+ ...baseCtx,
12888
+ symbols: {
12889
+ ...baseCtx.symbols,
12890
+ schema: symbolOrSchema
12891
+ }
12892
+ });
12893
+ }
12894
+ function createResponseValidatorMini({ operation, plugin }) {
12895
+ const symbol = plugin.querySymbol({
12324
12896
  category: "schema",
12325
12897
  resource: "operation",
12326
12898
  resourceId: operation.id,
@@ -12329,7 +12901,7 @@ const createResponseValidatorMini = ({ operation, plugin }) => {
12329
12901
  });
12330
12902
  if (!symbol) return;
12331
12903
  const z = plugin.external("zod.z");
12332
- const ctx = {
12904
+ return runResponseResolver$2({
12333
12905
  $,
12334
12906
  chain: { current: $(z) },
12335
12907
  operation,
@@ -12338,33 +12910,143 @@ const createResponseValidatorMini = ({ operation, plugin }) => {
12338
12910
  schema: symbol,
12339
12911
  z
12340
12912
  }
12341
- };
12342
- const validator = plugin.config["~resolvers"]?.validator;
12343
- const candidates = [typeof validator === "function" ? validator : validator?.response, validatorResolver$2];
12344
- for (const candidate of candidates) {
12345
- const statements = candidate?.(ctx);
12346
- if (statements === null) return;
12347
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12348
- }
12349
- };
12913
+ });
12914
+ }
12350
12915
 
12351
12916
  //#endregion
12352
12917
  //#region src/plugins/zod/v3/api.ts
12353
- const validatorResolver$1 = (ctx) => {
12918
+ function emptyNode$1(ctx) {
12919
+ const { z } = ctx.symbols;
12920
+ if (ctx.layer.whenEmpty === "omit") throw new Error(`Cannot create empty schema for layer "${ctx.layer.as}" with whenEmpty: 'omit'`);
12921
+ if (ctx.layer.whenEmpty === "strict") return $(z).attr(identifiers.never).call();
12922
+ return $(z).attr(identifiers.object).call($.object());
12923
+ }
12924
+ function optionalNode$1(ctx) {
12925
+ if (!ctx.layer.optional) return ctx.schema;
12926
+ return $(ctx.schema).attr(identifiers.optional).call();
12927
+ }
12928
+ function compositeNode$1(ctx) {
12929
+ const { z } = ctx.symbols;
12930
+ const obj = $.object();
12931
+ const defaultValues = getDefaultRequestValidatorLayers(ctx.operation);
12932
+ for (const key of requestValidatorLayers) {
12933
+ const layer = resolveValidatorLayer(ctx.layers, key, defaultValues);
12934
+ const layerSchema = ctx.plugin.querySymbol({
12935
+ category: "schema",
12936
+ resource: "operation",
12937
+ resourceId: ctx.operation.id,
12938
+ role: `request-${key}`,
12939
+ tool: "zod"
12940
+ });
12941
+ if (layerSchema) {
12942
+ obj.prop(layer.as, ctx.nodes.optional({
12943
+ ...ctx,
12944
+ layer,
12945
+ schema: $(layerSchema)
12946
+ }));
12947
+ continue;
12948
+ }
12949
+ if (layer.whenEmpty === "omit") continue;
12950
+ const empty = ctx.nodes.empty({
12951
+ ...ctx,
12952
+ layer
12953
+ });
12954
+ obj.prop(layer.as, ctx.nodes.optional({
12955
+ ...ctx,
12956
+ layer,
12957
+ schema: empty
12958
+ }));
12959
+ }
12960
+ if (obj.isEmpty) return;
12961
+ return $(z).attr(identifiers.object).call(obj);
12962
+ }
12963
+ function requestValidatorResolver$1(ctx) {
12354
12964
  const { schema } = ctx.symbols;
12355
12965
  return $(schema).attr(identifiers.parseAsync).call("data").await().return();
12356
- };
12357
- const createRequestValidatorV3 = ({ operation, plugin }) => {
12358
- const symbol = plugin.getSymbol({
12966
+ }
12967
+ function responseValidatorResolver$1(ctx) {
12968
+ const { schema } = ctx.symbols;
12969
+ return $(schema).attr(identifiers.parseAsync).call("data").await().return();
12970
+ }
12971
+ function runRequestResolver$1(ctx) {
12972
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
12973
+ const candidates = [typeof validator === "function" ? validator : validator?.request, requestValidatorResolver$1];
12974
+ for (const candidate of candidates) {
12975
+ const statements = candidate?.(ctx);
12976
+ if (statements === null) return;
12977
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12978
+ }
12979
+ }
12980
+ function runResponseResolver$1(ctx) {
12981
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
12982
+ const candidates = [typeof validator === "function" ? validator : validator?.response, responseValidatorResolver$1];
12983
+ for (const candidate of candidates) {
12984
+ const statements = candidate?.(ctx);
12985
+ if (statements === null) return;
12986
+ if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12987
+ }
12988
+ }
12989
+ function createRequestSchemaContext$1(ctx) {
12990
+ const { plugin } = ctx;
12991
+ const z = plugin.external("zod.z");
12992
+ return {
12993
+ ...ctx,
12994
+ $,
12995
+ chain: { current: $(z) },
12996
+ nodes: {
12997
+ composite: compositeNode$1,
12998
+ empty: emptyNode$1,
12999
+ optional: optionalNode$1
13000
+ },
13001
+ symbols: {
13002
+ schema: $(""),
13003
+ z
13004
+ }
13005
+ };
13006
+ }
13007
+ function createRequestSchemaV3(ctx) {
13008
+ const { operation, plugin } = ctx;
13009
+ const baseCtx = createRequestSchemaContext$1(ctx);
13010
+ const schema = baseCtx.nodes.composite(baseCtx);
13011
+ if (!schema) return;
13012
+ if (!plugin.config.requests.shouldExtract({ operation })) return schema;
13013
+ return exportAst({
13014
+ final: { expression: schema },
13015
+ meta: {
13016
+ resource: "operation",
13017
+ resourceId: operation.id,
13018
+ role: "data"
13019
+ },
13020
+ naming: plugin.config.requests,
13021
+ namingAnchor: operation.id,
13022
+ path: [],
13023
+ plugin,
13024
+ schema: {}
13025
+ });
13026
+ }
13027
+ function createRequestValidatorV3(ctx) {
13028
+ const symbolOrSchema = createRequestSchemaV3(ctx);
13029
+ if (!symbolOrSchema) return;
13030
+ const baseCtx = createRequestSchemaContext$1(ctx);
13031
+ return runRequestResolver$1({
13032
+ ...baseCtx,
13033
+ symbols: {
13034
+ ...baseCtx.symbols,
13035
+ schema: symbolOrSchema
13036
+ }
13037
+ });
13038
+ }
13039
+ function createResponseValidatorV3({ operation, plugin }) {
13040
+ const symbol = plugin.querySymbol({
12359
13041
  category: "schema",
12360
13042
  resource: "operation",
12361
13043
  resourceId: operation.id,
12362
- role: "data",
13044
+ role: "responses",
12363
13045
  tool: "zod"
12364
13046
  });
12365
13047
  if (!symbol) return;
12366
13048
  const z = plugin.external("zod.z");
12367
- const ctx = {
13049
+ return runResponseResolver$1({
12368
13050
  $,
12369
13051
  chain: { current: $(z) },
12370
13052
  operation,
@@ -12373,80 +13055,134 @@ const createRequestValidatorV3 = ({ operation, plugin }) => {
12373
13055
  schema: symbol,
12374
13056
  z
12375
13057
  }
12376
- };
12377
- const validator = plugin.config["~resolvers"]?.validator;
12378
- const candidates = [typeof validator === "function" ? validator : validator?.request, validatorResolver$1];
13058
+ });
13059
+ }
13060
+
13061
+ //#endregion
13062
+ //#region src/plugins/zod/v4/api.ts
13063
+ function emptyNode(ctx) {
13064
+ const { z } = ctx.symbols;
13065
+ if (ctx.layer.whenEmpty === "omit") throw new Error(`Cannot create empty schema for layer "${ctx.layer.as}" with whenEmpty: 'omit'`);
13066
+ if (ctx.layer.whenEmpty === "strict") return $(z).attr(identifiers.never).call();
13067
+ return $(z).attr(identifiers.object).call($.object());
13068
+ }
13069
+ function optionalNode(ctx) {
13070
+ if (!ctx.layer.optional) return ctx.schema;
13071
+ return $(ctx.schema).attr(identifiers.optional).call();
13072
+ }
13073
+ function compositeNode(ctx) {
13074
+ const { z } = ctx.symbols;
13075
+ const obj = $.object();
13076
+ const defaultValues = getDefaultRequestValidatorLayers(ctx.operation);
13077
+ for (const key of requestValidatorLayers) {
13078
+ const layer = resolveValidatorLayer(ctx.layers, key, defaultValues);
13079
+ const layerSchema = ctx.plugin.querySymbol({
13080
+ category: "schema",
13081
+ resource: "operation",
13082
+ resourceId: ctx.operation.id,
13083
+ role: `request-${key}`,
13084
+ tool: "zod"
13085
+ });
13086
+ if (layerSchema) {
13087
+ obj.prop(layer.as, ctx.nodes.optional({
13088
+ ...ctx,
13089
+ layer,
13090
+ schema: $(layerSchema)
13091
+ }));
13092
+ continue;
13093
+ }
13094
+ if (layer.whenEmpty === "omit") continue;
13095
+ const empty = ctx.nodes.empty({
13096
+ ...ctx,
13097
+ layer
13098
+ });
13099
+ obj.prop(layer.as, ctx.nodes.optional({
13100
+ ...ctx,
13101
+ layer,
13102
+ schema: empty
13103
+ }));
13104
+ }
13105
+ if (obj.isEmpty) return;
13106
+ return $(z).attr(identifiers.object).call(obj);
13107
+ }
13108
+ function requestValidatorResolver(ctx) {
13109
+ const { schema } = ctx.symbols;
13110
+ return $(schema).attr(identifiers.parseAsync).call("data").await().return();
13111
+ }
13112
+ function responseValidatorResolver(ctx) {
13113
+ const { schema } = ctx.symbols;
13114
+ return $(schema).attr(identifiers.parseAsync).call("data").await().return();
13115
+ }
13116
+ function runRequestResolver(ctx) {
13117
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
13118
+ const candidates = [typeof validator === "function" ? validator : validator?.request, requestValidatorResolver];
12379
13119
  for (const candidate of candidates) {
12380
13120
  const statements = candidate?.(ctx);
12381
13121
  if (statements === null) return;
12382
13122
  if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12383
13123
  }
12384
- };
12385
- const createResponseValidatorV3 = ({ operation, plugin }) => {
12386
- const symbol = plugin.getSymbol({
12387
- category: "schema",
12388
- resource: "operation",
12389
- resourceId: operation.id,
12390
- role: "responses",
12391
- tool: "zod"
12392
- });
12393
- if (!symbol) return;
12394
- const z = plugin.external("zod.z");
12395
- const ctx = {
12396
- $,
12397
- chain: { current: $(z) },
12398
- operation,
12399
- plugin,
12400
- symbols: {
12401
- schema: symbol,
12402
- z
12403
- }
12404
- };
12405
- const validator = plugin.config["~resolvers"]?.validator;
12406
- const candidates = [typeof validator === "function" ? validator : validator?.response, validatorResolver$1];
13124
+ }
13125
+ function runResponseResolver(ctx) {
13126
+ const validator = ctx.plugin.config["~resolvers"]?.validator;
13127
+ const candidates = [typeof validator === "function" ? validator : validator?.response, responseValidatorResolver];
12407
13128
  for (const candidate of candidates) {
12408
13129
  const statements = candidate?.(ctx);
12409
13130
  if (statements === null) return;
12410
13131
  if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12411
13132
  }
12412
- };
12413
-
12414
- //#endregion
12415
- //#region src/plugins/zod/v4/api.ts
12416
- const validatorResolver = (ctx) => {
12417
- const { schema } = ctx.symbols;
12418
- return $(schema).attr(identifiers.parseAsync).call("data").await().return();
12419
- };
12420
- const createRequestValidatorV4 = ({ operation, plugin }) => {
12421
- const symbol = plugin.getSymbol({
12422
- category: "schema",
12423
- resource: "operation",
12424
- resourceId: operation.id,
12425
- role: "data",
12426
- tool: "zod"
12427
- });
12428
- if (!symbol) return;
13133
+ }
13134
+ function createRequestSchemaContext(ctx) {
13135
+ const { plugin } = ctx;
12429
13136
  const z = plugin.external("zod.z");
12430
- const ctx = {
13137
+ return {
13138
+ ...ctx,
12431
13139
  $,
12432
13140
  chain: { current: $(z) },
12433
- operation,
12434
- plugin,
13141
+ nodes: {
13142
+ composite: compositeNode,
13143
+ empty: emptyNode,
13144
+ optional: optionalNode
13145
+ },
12435
13146
  symbols: {
12436
- schema: symbol,
13147
+ schema: $(""),
12437
13148
  z
12438
13149
  }
12439
13150
  };
12440
- const validator = plugin.config["~resolvers"]?.validator;
12441
- const candidates = [typeof validator === "function" ? validator : validator?.request, validatorResolver];
12442
- for (const candidate of candidates) {
12443
- const statements = candidate?.(ctx);
12444
- if (statements === null) return;
12445
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12446
- }
12447
- };
12448
- const createResponseValidatorV4 = ({ operation, plugin }) => {
12449
- const symbol = plugin.getSymbol({
13151
+ }
13152
+ function createRequestSchemaV4(ctx) {
13153
+ const { operation, plugin } = ctx;
13154
+ const baseCtx = createRequestSchemaContext(ctx);
13155
+ const schema = baseCtx.nodes.composite(baseCtx);
13156
+ if (!schema) return;
13157
+ if (!plugin.config.requests.shouldExtract({ operation })) return schema;
13158
+ return exportAst({
13159
+ final: { expression: schema },
13160
+ meta: {
13161
+ resource: "operation",
13162
+ resourceId: operation.id,
13163
+ role: "data"
13164
+ },
13165
+ naming: plugin.config.requests,
13166
+ namingAnchor: operation.id,
13167
+ path: [],
13168
+ plugin,
13169
+ schema: {}
13170
+ });
13171
+ }
13172
+ function createRequestValidatorV4(ctx) {
13173
+ const symbolOrSchema = createRequestSchemaV4(ctx);
13174
+ if (!symbolOrSchema) return;
13175
+ const baseCtx = createRequestSchemaContext(ctx);
13176
+ return runRequestResolver({
13177
+ ...baseCtx,
13178
+ symbols: {
13179
+ ...baseCtx.symbols,
13180
+ schema: symbolOrSchema
13181
+ }
13182
+ });
13183
+ }
13184
+ function createResponseValidatorV4({ operation, plugin }) {
13185
+ const symbol = plugin.querySymbol({
12450
13186
  category: "schema",
12451
13187
  resource: "operation",
12452
13188
  resourceId: operation.id,
@@ -12455,7 +13191,7 @@ const createResponseValidatorV4 = ({ operation, plugin }) => {
12455
13191
  });
12456
13192
  if (!symbol) return;
12457
13193
  const z = plugin.external("zod.z");
12458
- const ctx = {
13194
+ return runResponseResolver({
12459
13195
  $,
12460
13196
  chain: { current: $(z) },
12461
13197
  operation,
@@ -12464,33 +13200,36 @@ const createResponseValidatorV4 = ({ operation, plugin }) => {
12464
13200
  schema: symbol,
12465
13201
  z
12466
13202
  }
12467
- };
12468
- const validator = plugin.config["~resolvers"]?.validator;
12469
- const candidates = [typeof validator === "function" ? validator : validator?.response, validatorResolver];
12470
- for (const candidate of candidates) {
12471
- const statements = candidate?.(ctx);
12472
- if (statements === null) return;
12473
- if (statements !== void 0) return $.func().async().param("data").do(...statements instanceof Array ? statements : [statements]);
12474
- }
12475
- };
13203
+ });
13204
+ }
12476
13205
 
12477
13206
  //#endregion
12478
13207
  //#region src/plugins/zod/api.ts
12479
13208
  var Api = class {
12480
- createRequestValidator(args) {
12481
- const { plugin } = args;
13209
+ createRequestSchema(ctx) {
13210
+ const { plugin } = ctx;
13211
+ if (!plugin.config.requests.enabled) return;
12482
13212
  switch (plugin.config.compatibilityVersion) {
12483
- case 3: return createRequestValidatorV3(args);
12484
- case "mini": return createRequestValidatorMini(args);
12485
- default: return createRequestValidatorV4(args);
13213
+ case 3: return createRequestSchemaV3(ctx);
13214
+ case "mini": return createRequestSchemaMini(ctx);
13215
+ default: return createRequestSchemaV4(ctx);
12486
13216
  }
12487
13217
  }
12488
- createResponseValidator(args) {
12489
- const { plugin } = args;
13218
+ createRequestValidator(ctx) {
13219
+ const { plugin } = ctx;
13220
+ if (!plugin.config.requests.enabled) return;
13221
+ switch (plugin.config.compatibilityVersion) {
13222
+ case 3: return createRequestValidatorV3(ctx);
13223
+ case "mini": return createRequestValidatorMini(ctx);
13224
+ default: return createRequestValidatorV4(ctx);
13225
+ }
13226
+ }
13227
+ createResponseValidator(ctx) {
13228
+ const { plugin } = ctx;
12490
13229
  switch (plugin.config.compatibilityVersion) {
12491
- case 3: return createResponseValidatorV3(args);
12492
- case "mini": return createResponseValidatorMini(args);
12493
- default: return createResponseValidatorV4(args);
13230
+ case 3: return createResponseValidatorV3(ctx);
13231
+ case "mini": return createResponseValidatorMini(ctx);
13232
+ default: return createResponseValidatorV4(ctx);
12494
13233
  }
12495
13234
  }
12496
13235
  };
@@ -12515,69 +13254,61 @@ function getZodModule({ plugin }) {
12515
13254
  }
12516
13255
  }
12517
13256
 
12518
- //#endregion
12519
- //#region src/plugins/zod/shared/operation-schema.ts
12520
- function buildOperationSchema(operation) {
12521
- const requiredProperties = /* @__PURE__ */ new Set();
12522
- const schema = {
12523
- properties: {
12524
- body: { type: "never" },
12525
- path: { type: "never" },
12526
- query: { type: "never" }
12527
- },
12528
- type: "object"
12529
- };
12530
- if (operation.parameters) for (const location of [
12531
- "header",
12532
- "path",
12533
- "query"
12534
- ]) {
12535
- const params = operation.parameters[location];
12536
- if (!params) continue;
12537
- const properties = {};
12538
- const required = [];
12539
- const propKey = location === "header" ? "headers" : location;
12540
- for (const key in params) {
12541
- const parameter = params[key];
12542
- properties[parameter.name] = parameter.schema;
12543
- if (parameter.required) {
12544
- required.push(parameter.name);
12545
- requiredProperties.add(propKey);
12546
- }
12547
- }
12548
- if (Object.keys(properties).length) schema.properties[propKey] = {
12549
- properties,
12550
- required,
12551
- type: "object"
12552
- };
12553
- }
12554
- if (operation.body) {
12555
- schema.properties.body = operation.body.schema;
12556
- if (operation.body.required) requiredProperties.add("body");
12557
- }
12558
- schema.required = [...requiredProperties];
12559
- return {
12560
- required: schema.required,
12561
- schema
12562
- };
12563
- }
12564
-
12565
13257
  //#endregion
12566
13258
  //#region src/plugins/zod/shared/operation.ts
12567
13259
  function irOperationToAst({ operation, path, plugin, processor, tags }) {
12568
13260
  if (plugin.config.requests.enabled) {
12569
13261
  const { schema } = buildOperationSchema(operation);
12570
- processor.process({
13262
+ if (schema.properties?.body && schema.properties.body.type !== "never") processor.process({
12571
13263
  meta: {
12572
13264
  resource: "operation",
12573
13265
  resourceId: operation.id,
12574
- role: "data"
13266
+ role: "request-body"
12575
13267
  },
12576
- naming: plugin.config.requests,
13268
+ naming: plugin.config.requests.body,
12577
13269
  namingAnchor: operation.id,
12578
- path,
13270
+ path: [...path, "body"],
12579
13271
  plugin,
12580
- schema,
13272
+ schema: schema.properties.body,
13273
+ tags
13274
+ });
13275
+ if (schema.properties?.headers && schema.properties.headers.type === "object") processor.process({
13276
+ meta: {
13277
+ resource: "operation",
13278
+ resourceId: operation.id,
13279
+ role: "request-headers"
13280
+ },
13281
+ naming: plugin.config.requests.headers,
13282
+ namingAnchor: operation.id,
13283
+ path: [...path, "headers"],
13284
+ plugin,
13285
+ schema: schema.properties.headers,
13286
+ tags
13287
+ });
13288
+ if (schema.properties?.path && schema.properties.path.type === "object") processor.process({
13289
+ meta: {
13290
+ resource: "operation",
13291
+ resourceId: operation.id,
13292
+ role: "request-path"
13293
+ },
13294
+ naming: plugin.config.requests.path,
13295
+ namingAnchor: operation.id,
13296
+ path: [...path, "path"],
13297
+ plugin,
13298
+ schema: schema.properties.path,
13299
+ tags
13300
+ });
13301
+ if (schema.properties?.query && schema.properties.query.type === "object") processor.process({
13302
+ meta: {
13303
+ resource: "operation",
13304
+ resourceId: operation.id,
13305
+ role: "request-query"
13306
+ },
13307
+ naming: plugin.config.requests.query,
13308
+ namingAnchor: operation.id,
13309
+ path: [...path, "query"],
13310
+ plugin,
13311
+ schema: schema.properties.query,
12581
13312
  tags
12582
13313
  });
12583
13314
  }
@@ -12622,46 +13353,6 @@ function irWebhookToAst({ operation, path, plugin, processor, tags }) {
12622
13353
  }
12623
13354
  }
12624
13355
 
12625
- //#endregion
12626
- //#region src/plugins/zod/shared/export.ts
12627
- function exportAst({ final, meta, naming, namingAnchor, path, plugin, schema, tags }) {
12628
- const z = plugin.external("zod.z");
12629
- const name = pathToName(path, { anchor: namingAnchor });
12630
- const symbol = plugin.registerSymbol(buildSymbolIn({
12631
- meta: {
12632
- category: "schema",
12633
- path,
12634
- tags,
12635
- tool: "zod",
12636
- ...meta
12637
- },
12638
- name,
12639
- naming,
12640
- plugin,
12641
- schema
12642
- }));
12643
- const typeInferSymbol = naming.types.infer.enabled ? plugin.registerSymbol(buildSymbolIn({
12644
- meta: {
12645
- category: "type",
12646
- path,
12647
- tags,
12648
- tool: "zod",
12649
- variant: "infer",
12650
- ...meta
12651
- },
12652
- name,
12653
- naming: naming.types.infer,
12654
- plugin,
12655
- schema
12656
- })) : void 0;
12657
- const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(z).attr(final.typeName))).assign(final.expression);
12658
- plugin.node(statement);
12659
- if (typeInferSymbol) {
12660
- const inferType = $.type.alias(typeInferSymbol).export().type($.type(z).attr(identifiers.infer).generic($(symbol).typeofType()));
12661
- plugin.node(inferType);
12662
- }
12663
- }
12664
-
12665
13356
  //#endregion
12666
13357
  //#region src/plugins/zod/shared/meta.ts
12667
13358
  /**
@@ -12900,7 +13591,7 @@ function baseNode$32(ctx) {
12900
13591
  const { symbols } = ctx;
12901
13592
  const { z } = symbols;
12902
13593
  const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
12903
- if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
13594
+ if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
12904
13595
  if (literalMembers.length === 1) return literalMembers[0];
12905
13596
  return $(z).attr(identifiers.union).call($.array(...literalMembers));
12906
13597
  }
@@ -13030,7 +13721,7 @@ function numberResolver$2(ctx) {
13030
13721
  if (minNode) checks.push(minNode);
13031
13722
  const maxNode = ctx.nodes.max(ctx);
13032
13723
  if (maxNode) checks.push(maxNode);
13033
- if (checks.length > 0) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
13724
+ if (checks.length) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
13034
13725
  return ctx.chain.current;
13035
13726
  }
13036
13727
  function numberToNode$2({ plugin, schema }) {
@@ -13061,7 +13752,7 @@ function numberToNode$2({ plugin, schema }) {
13061
13752
  //#region src/plugins/zod/mini/toAst/object.ts
13062
13753
  function additionalPropertiesNode$2(ctx) {
13063
13754
  const { _childResults, applyModifiers, schema, walk, walkerCtx } = ctx;
13064
- if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
13755
+ if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
13065
13756
  const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
13066
13757
  _childResults.push(additionalResult);
13067
13758
  return applyModifiers(additionalResult, {}).expression;
@@ -13193,7 +13884,7 @@ function stringResolver$2(ctx) {
13193
13884
  }
13194
13885
  const patternNode = ctx.nodes.pattern(ctx);
13195
13886
  if (patternNode) checks.push(patternNode);
13196
- if (checks.length > 0) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
13887
+ if (checks.length) ctx.chain.current = ctx.chain.current.attr(identifiers.check).call(...checks);
13197
13888
  return ctx.chain.current;
13198
13889
  }
13199
13890
  function stringToNode$2({ plugin, schema }) {
@@ -13224,7 +13915,7 @@ function baseNode$26(ctx) {
13224
13915
  const { applyModifiers, childResults, symbols } = ctx;
13225
13916
  const { z } = symbols;
13226
13917
  const tupleFn = $(z).attr(identifiers.tuple);
13227
- if (childResults.length === 0) return tupleFn.call($.array());
13918
+ if (!childResults.length) return tupleFn.call($.array());
13228
13919
  const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
13229
13920
  return tupleFn.call($.array(...tupleElements));
13230
13921
  }
@@ -13328,7 +14019,7 @@ function voidToAst$2({ plugin, schema }) {
13328
14019
 
13329
14020
  //#endregion
13330
14021
  //#region src/plugins/zod/mini/walker.ts
13331
- function createVisitor$2(config) {
14022
+ function createVisitor$2(config = {}) {
13332
14023
  const { schemaExtractor } = config;
13333
14024
  return {
13334
14025
  applyModifiers(result, ctx, options = {}) {
@@ -13407,6 +14098,10 @@ function createVisitor$2(config) {
13407
14098
  });
13408
14099
  if (extracted !== schema) return walk(extracted, ctx);
13409
14100
  }
14101
+ if (schema.symbolRef) return {
14102
+ expression: $(schema.symbolRef),
14103
+ meta: defaultMeta(schema)
14104
+ };
13410
14105
  },
13411
14106
  intersection(items, schemas, parentSchema, ctx) {
13412
14107
  const z = ctx.plugin.external("zod.z");
@@ -13576,7 +14271,7 @@ function createVisitor$2(config) {
13576
14271
  if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
13577
14272
  });
13578
14273
  let expression;
13579
- if (nonNullItems.length === 0) expression = $(z).attr(identifiers.null).call();
14274
+ if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
13580
14275
  else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
13581
14276
  else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
13582
14277
  return {
@@ -13624,10 +14319,10 @@ function createVisitor$2(config) {
13624
14319
  //#region src/plugins/zod/mini/processor.ts
13625
14320
  function createProcessor$2(plugin) {
13626
14321
  const processor = createSchemaProcessor();
13627
- const hooks = [plugin.config["~hooks"]?.schemas, plugin.context.config.parser.hooks.schemas];
14322
+ const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
13628
14323
  function extractor(ctx) {
13629
14324
  if (processor.hasEmitted(ctx.path)) return ctx.schema;
13630
- for (const hook of hooks) if (hook?.shouldExtract?.(ctx)) {
14325
+ for (const hook of extractorHooks) if (typeof hook === "boolean" ? hook : hook?.(ctx) ?? false) {
13631
14326
  process({
13632
14327
  namingAnchor: processor.context.anchor,
13633
14328
  tags: processor.context.tags,
@@ -13673,10 +14368,7 @@ const handlerMini = ({ plugin }) => {
13673
14368
  plugin.symbol("z", {
13674
14369
  external: getZodModule({ plugin }),
13675
14370
  importKind: "namespace",
13676
- meta: {
13677
- category: "external",
13678
- resource: "zod.z"
13679
- }
14371
+ meta: { resource: "zod.z" }
13680
14372
  });
13681
14373
  const processor = createProcessor$2(plugin);
13682
14374
  plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
@@ -13937,7 +14629,7 @@ function baseNode$20(ctx) {
13937
14629
  const { symbols } = ctx;
13938
14630
  const { z } = symbols;
13939
14631
  const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
13940
- if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
14632
+ if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
13941
14633
  else if (literalMembers.length === 1) return literalMembers[0];
13942
14634
  else return $(z).attr(identifiers.union).call($.array(...literalMembers));
13943
14635
  }
@@ -14089,7 +14781,7 @@ function numberToNode$1({ plugin, schema }) {
14089
14781
  //#region src/plugins/zod/v3/toAst/object.ts
14090
14782
  function additionalPropertiesNode$1(ctx) {
14091
14783
  const { applyModifiers, schema, walk, walkerCtx } = ctx;
14092
- if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
14784
+ if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
14093
14785
  const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
14094
14786
  ctx._childResults.push(additionalResult);
14095
14787
  return applyModifiers(additionalResult, {}).expression;
@@ -14244,7 +14936,7 @@ function baseNode$14(ctx) {
14244
14936
  const { applyModifiers, childResults, symbols } = ctx;
14245
14937
  const { z } = symbols;
14246
14938
  const tupleFn = $(z).attr(identifiers.tuple);
14247
- if (childResults.length === 0) return tupleFn.call($.array());
14939
+ if (!childResults.length) return tupleFn.call($.array());
14248
14940
  const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
14249
14941
  return tupleFn.call($.array(...tupleElements));
14250
14942
  }
@@ -14348,7 +15040,7 @@ function voidToAst$1({ plugin, schema }) {
14348
15040
 
14349
15041
  //#endregion
14350
15042
  //#region src/plugins/zod/v3/walker.ts
14351
- function createVisitor$1(config) {
15043
+ function createVisitor$1(config = {}) {
14352
15044
  const { schemaExtractor } = config;
14353
15045
  return {
14354
15046
  applyModifiers(result, ctx, options = {}) {
@@ -14429,6 +15121,10 @@ function createVisitor$1(config) {
14429
15121
  });
14430
15122
  if (extracted !== schema) return walk(extracted, ctx);
14431
15123
  }
15124
+ if (schema.symbolRef) return {
15125
+ expression: $(schema.symbolRef),
15126
+ meta: defaultMeta(schema)
15127
+ };
14432
15128
  },
14433
15129
  intersection(items, schemas, parentSchema, ctx) {
14434
15130
  const z = ctx.plugin.external("zod.z");
@@ -14594,7 +15290,7 @@ function createVisitor$1(config) {
14594
15290
  if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
14595
15291
  });
14596
15292
  let expression;
14597
- if (nonNullItems.length === 0) expression = $(z).attr(identifiers.null).call();
15293
+ if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
14598
15294
  else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
14599
15295
  else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
14600
15296
  return {
@@ -14642,10 +15338,10 @@ function createVisitor$1(config) {
14642
15338
  //#region src/plugins/zod/v3/processor.ts
14643
15339
  function createProcessor$1(plugin) {
14644
15340
  const processor = createSchemaProcessor();
14645
- const hooks = [plugin.config["~hooks"]?.schemas, plugin.context.config.parser.hooks.schemas];
15341
+ const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
14646
15342
  function extractor(ctx) {
14647
15343
  if (processor.hasEmitted(ctx.path)) return ctx.schema;
14648
- for (const hook of hooks) if (hook?.shouldExtract?.(ctx)) {
15344
+ for (const hook of extractorHooks) if (typeof hook === "boolean" ? hook : hook?.(ctx) ?? false) {
14649
15345
  process({
14650
15346
  namingAnchor: processor.context.anchor,
14651
15347
  tags: processor.context.tags,
@@ -14690,10 +15386,7 @@ function createProcessor$1(plugin) {
14690
15386
  const handlerV3 = ({ plugin }) => {
14691
15387
  plugin.symbol("z", {
14692
15388
  external: getZodModule({ plugin }),
14693
- meta: {
14694
- category: "external",
14695
- resource: "zod.z"
14696
- }
15389
+ meta: { resource: "zod.z" }
14697
15390
  });
14698
15391
  const processor = createProcessor$1(plugin);
14699
15392
  plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
@@ -14954,7 +15647,7 @@ function baseNode$8(ctx) {
14954
15647
  const { symbols } = ctx;
14955
15648
  const { z } = symbols;
14956
15649
  const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
14957
- if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
15650
+ if (allStrings && enumMembers.length) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
14958
15651
  if (literalMembers.length === 1) return literalMembers[0];
14959
15652
  return $(z).attr(identifiers.union).call($.array(...literalMembers));
14960
15653
  }
@@ -15111,7 +15804,7 @@ function numberToNode({ plugin, schema }) {
15111
15804
  //#region src/plugins/zod/v4/toAst/object.ts
15112
15805
  function additionalPropertiesNode(ctx) {
15113
15806
  const { _childResults, applyModifiers, schema, walk, walkerCtx } = ctx;
15114
- if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
15807
+ if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length) return;
15115
15808
  const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
15116
15809
  _childResults.push(additionalResult);
15117
15810
  return applyModifiers(additionalResult, {}).expression;
@@ -15268,7 +15961,7 @@ function baseNode$2(ctx) {
15268
15961
  const { applyModifiers, childResults, symbols } = ctx;
15269
15962
  const { z } = symbols;
15270
15963
  const tupleFn = $(z).attr(identifiers.tuple);
15271
- if (childResults.length === 0) return tupleFn.call($.array());
15964
+ if (!childResults.length) return tupleFn.call($.array());
15272
15965
  const tupleElements = childResults.map((result) => applyModifiers(result, { optional: false }).expression);
15273
15966
  return tupleFn.call($.array(...tupleElements));
15274
15967
  }
@@ -15372,7 +16065,7 @@ function voidToAst({ plugin, schema }) {
15372
16065
 
15373
16066
  //#endregion
15374
16067
  //#region src/plugins/zod/v4/walker.ts
15375
- function createVisitor(config) {
16068
+ function createVisitor(config = {}) {
15376
16069
  const { schemaExtractor } = config;
15377
16070
  return {
15378
16071
  applyModifiers(result, ctx, options = {}) {
@@ -15450,6 +16143,10 @@ function createVisitor(config) {
15450
16143
  });
15451
16144
  if (extracted !== schema) return walk(extracted, ctx);
15452
16145
  }
16146
+ if (schema.symbolRef) return {
16147
+ expression: $(schema.symbolRef),
16148
+ meta: defaultMeta(schema)
16149
+ };
15453
16150
  },
15454
16151
  intersection(items, schemas, parentSchema, ctx) {
15455
16152
  const z = ctx.plugin.external("zod.z");
@@ -15624,7 +16321,7 @@ function createVisitor(config) {
15624
16321
  if (schema.type !== "null" && schema.const !== null) nonNullItems.push(item);
15625
16322
  });
15626
16323
  let expression;
15627
- if (nonNullItems.length === 0) expression = $(z).attr(identifiers.null).call();
16324
+ if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
15628
16325
  else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
15629
16326
  else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
15630
16327
  return {
@@ -15672,10 +16369,10 @@ function createVisitor(config) {
15672
16369
  //#region src/plugins/zod/v4/processor.ts
15673
16370
  function createProcessor(plugin) {
15674
16371
  const processor = createSchemaProcessor();
15675
- const hooks = [plugin.config["~hooks"]?.schemas, plugin.context.config.parser.hooks.schemas];
16372
+ const extractorHooks = [plugin.config["~hooks"]?.schemas?.shouldExtract, plugin.context.config.parser.hooks.schemas?.shouldExtract];
15676
16373
  function extractor(ctx) {
15677
16374
  if (processor.hasEmitted(ctx.path)) return ctx.schema;
15678
- for (const hook of hooks) if (hook?.shouldExtract?.(ctx)) {
16375
+ for (const hook of extractorHooks) if (typeof hook === "boolean" ? hook : hook?.(ctx) ?? false) {
15679
16376
  process({
15680
16377
  namingAnchor: processor.context.anchor,
15681
16378
  tags: processor.context.tags,
@@ -15721,10 +16418,7 @@ const handlerV4 = ({ plugin }) => {
15721
16418
  plugin.symbol("z", {
15722
16419
  external: getZodModule({ plugin }),
15723
16420
  importKind: "namespace",
15724
- meta: {
15725
- category: "external",
15726
- resource: "zod.z"
15727
- }
16421
+ meta: { resource: "zod.z" }
15728
16422
  });
15729
16423
  const processor = createProcessor(plugin);
15730
16424
  plugin.forEach("operation", "parameter", "requestBody", "schema", "webhook", (event) => {
@@ -15896,9 +16590,58 @@ const defaultConfig = {
15896
16590
  });
15897
16591
  plugin.config.requests = context.valueToObject({
15898
16592
  defaultValue: {
16593
+ body: {
16594
+ case: plugin.config.case ?? "camelCase",
16595
+ enabled: true,
16596
+ name: "z{{name}}Body",
16597
+ types: {
16598
+ ...plugin.config.types,
16599
+ infer: {
16600
+ ...plugin.config.types.infer,
16601
+ name: "{{name}}BodyZodType"
16602
+ }
16603
+ }
16604
+ },
15899
16605
  case: plugin.config.case ?? "camelCase",
15900
16606
  enabled: true,
16607
+ headers: {
16608
+ case: plugin.config.case ?? "camelCase",
16609
+ enabled: true,
16610
+ name: "z{{name}}Headers",
16611
+ types: {
16612
+ ...plugin.config.types,
16613
+ infer: {
16614
+ ...plugin.config.types.infer,
16615
+ name: "{{name}}HeadersZodType"
16616
+ }
16617
+ }
16618
+ },
15901
16619
  name: "z{{name}}Data",
16620
+ path: {
16621
+ case: plugin.config.case ?? "camelCase",
16622
+ enabled: true,
16623
+ name: "z{{name}}Path",
16624
+ types: {
16625
+ ...plugin.config.types,
16626
+ infer: {
16627
+ ...plugin.config.types.infer,
16628
+ name: "{{name}}PathZodType"
16629
+ }
16630
+ }
16631
+ },
16632
+ query: {
16633
+ case: plugin.config.case ?? "camelCase",
16634
+ enabled: true,
16635
+ name: "z{{name}}Query",
16636
+ types: {
16637
+ ...plugin.config.types,
16638
+ infer: {
16639
+ ...plugin.config.types.infer,
16640
+ name: "{{name}}QueryZodType"
16641
+ }
16642
+ }
16643
+ },
16644
+ shouldExtract: () => false,
15902
16645
  types: {
15903
16646
  ...plugin.config.types,
15904
16647
  infer: {
@@ -15911,6 +16654,107 @@ const defaultConfig = {
15911
16654
  ...mappers,
15912
16655
  object: (fields, defaultValue) => ({
15913
16656
  ...fields,
16657
+ body: context.valueToObject({
16658
+ defaultValue: defaultValue.body,
16659
+ mappers: {
16660
+ ...mappers,
16661
+ object: (fields, defaultValue) => ({
16662
+ ...fields,
16663
+ types: context.valueToObject({
16664
+ defaultValue: defaultValue.types,
16665
+ mappers: { object: (fields, defaultValue) => ({
16666
+ ...fields,
16667
+ infer: context.valueToObject({
16668
+ defaultValue: {
16669
+ ...defaultValue.infer,
16670
+ enabled: fields.infer !== void 0 ? Boolean(fields.infer) : defaultValue.infer.enabled
16671
+ },
16672
+ mappers,
16673
+ value: fields.infer
16674
+ })
16675
+ }) },
16676
+ value: fields.types
16677
+ })
16678
+ })
16679
+ },
16680
+ value: fields.body
16681
+ }),
16682
+ headers: context.valueToObject({
16683
+ defaultValue: defaultValue.headers,
16684
+ mappers: {
16685
+ ...mappers,
16686
+ object: (fields, defaultValue) => ({
16687
+ ...fields,
16688
+ types: context.valueToObject({
16689
+ defaultValue: defaultValue.types,
16690
+ mappers: { object: (fields, defaultValue) => ({
16691
+ ...fields,
16692
+ infer: context.valueToObject({
16693
+ defaultValue: {
16694
+ ...defaultValue.infer,
16695
+ enabled: fields.infer !== void 0 ? Boolean(fields.infer) : defaultValue.infer.enabled
16696
+ },
16697
+ mappers,
16698
+ value: fields.infer
16699
+ })
16700
+ }) },
16701
+ value: fields.types
16702
+ })
16703
+ })
16704
+ },
16705
+ value: fields.headers
16706
+ }),
16707
+ path: context.valueToObject({
16708
+ defaultValue: defaultValue.path,
16709
+ mappers: {
16710
+ ...mappers,
16711
+ object: (fields, defaultValue) => ({
16712
+ ...fields,
16713
+ types: context.valueToObject({
16714
+ defaultValue: defaultValue.types,
16715
+ mappers: { object: (fields, defaultValue) => ({
16716
+ ...fields,
16717
+ infer: context.valueToObject({
16718
+ defaultValue: {
16719
+ ...defaultValue.infer,
16720
+ enabled: fields.infer !== void 0 ? Boolean(fields.infer) : defaultValue.infer.enabled
16721
+ },
16722
+ mappers,
16723
+ value: fields.infer
16724
+ })
16725
+ }) },
16726
+ value: fields.types
16727
+ })
16728
+ })
16729
+ },
16730
+ value: fields.path
16731
+ }),
16732
+ query: context.valueToObject({
16733
+ defaultValue: defaultValue.query,
16734
+ mappers: {
16735
+ ...mappers,
16736
+ object: (fields, defaultValue) => ({
16737
+ ...fields,
16738
+ types: context.valueToObject({
16739
+ defaultValue: defaultValue.types,
16740
+ mappers: { object: (fields, defaultValue) => ({
16741
+ ...fields,
16742
+ infer: context.valueToObject({
16743
+ defaultValue: {
16744
+ ...defaultValue.infer,
16745
+ enabled: fields.infer !== void 0 ? Boolean(fields.infer) : defaultValue.infer.enabled
16746
+ },
16747
+ mappers,
16748
+ value: fields.infer
16749
+ })
16750
+ }) },
16751
+ value: fields.types
16752
+ })
16753
+ })
16754
+ },
16755
+ value: fields.query
16756
+ }),
16757
+ shouldExtract: fields.shouldExtract !== void 0 ? typeof fields.shouldExtract === "function" ? fields.shouldExtract : () => Boolean(fields.shouldExtract) : defaultValue.shouldExtract,
15914
16758
  types: context.valueToObject({
15915
16759
  defaultValue: defaultValue.types,
15916
16760
  mappers: { object: (fields, defaultValue) => ({
@@ -16221,4 +17065,4 @@ async function resolveJobs({ logger, userConfigs }) {
16221
17065
 
16222
17066
  //#endregion
16223
17067
  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-B4xCXgH4.mjs.map
17068
+ //# sourceMappingURL=init-C3GzFcQR.mjs.map