@ahoo-wang/wow-generator 9.7.0 → 9.9.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.
@@ -289,17 +289,13 @@ function I(e) {
289
289
  function Ye(e, t) {
290
290
  let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = !1, o = (e) => {
291
291
  if (!(!e || i.has(e) || a)) {
292
- if (i.add(e), w(e)) {
293
- o(t && k(e, t));
294
- return;
292
+ if (i.add(e), w(e)) o(t && k(e, t));
293
+ else if (e.nullable || Array.isArray(e.type)) a = !0;
294
+ else {
295
+ for (let t of e.required ?? []) r.add(t);
296
+ for (let t of Object.keys(e.properties ?? {})) n.includes(t) || n.push(t);
297
+ e.allOf?.forEach(o);
295
298
  }
296
- if (e.nullable || Array.isArray(e.type)) {
297
- a = !0;
298
- return;
299
- }
300
- for (let t of e.required ?? []) r.add(t);
301
- for (let t of Object.keys(e.properties ?? {})) n.includes(t) || n.push(t);
302
- e.allOf?.forEach(o);
303
299
  }
304
300
  };
305
301
  return o(e), a ? [] : n.filter((e) => !r.has(e));
@@ -841,11 +837,8 @@ var Zt = class {
841
837
  }
842
838
  let a = i.filter((t) => e.has(t));
843
839
  if (!(a.length < i.length)) {
844
- if (!n.operation.operationId) {
845
- this.warnings.push(`Skipping ${r}: it has no operationId, and the operationId names its method.`);
846
- continue;
847
- }
848
- for (let e of a) t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
840
+ if (!n.operation.operationId) this.warnings.push(`Skipping ${r}: it has no operationId, and the operationId names its method.`);
841
+ else for (let e of a) t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
849
842
  }
850
843
  }
851
844
  return t;
@@ -1115,13 +1108,7 @@ function Cn(e, t) {
1115
1108
  }
1116
1109
  function wn(e, t, n) {
1117
1110
  let r = t[n];
1118
- if (r) {
1119
- if (typeof r != "object") {
1120
- e.push(`- ${n}: \`${r}\``);
1121
- return;
1122
- }
1123
- Tn(e, n, r);
1124
- }
1111
+ r && (typeof r == "object" ? Tn(e, n, r) : e.push(`- ${n}: \`${r}\``));
1125
1112
  }
1126
1113
  function Tn(e, t, n) {
1127
1114
  e.push(`- ${t}: `), e.push("```json"), e.push(JSON.stringify(n, null, 2)), e.push("```");
@@ -1492,17 +1479,13 @@ function er(e, t, n = [], r = [], i) {
1492
1479
  });
1493
1480
  }
1494
1481
  function tr(e, t) {
1495
- if (e.implements = [...[e.implements ?? []].flat(), "ApiMetadataCapable"], e.ctors ??= [], t === void 0) {
1496
- e.ctors.push({ parameters: [{
1497
- name: "apiMetadata",
1498
- type: "ApiMetadata",
1499
- hasQuestionToken: !0,
1500
- scope: a.Public,
1501
- isReadonly: !0
1502
- }] });
1503
- return;
1504
- }
1505
- e.properties = [...e.properties ?? [], {
1482
+ e.implements = [...[e.implements ?? []].flat(), "ApiMetadataCapable"], e.ctors ??= [], t === void 0 ? e.ctors.push({ parameters: [{
1483
+ name: "apiMetadata",
1484
+ type: "ApiMetadata",
1485
+ hasQuestionToken: !0,
1486
+ scope: a.Public,
1487
+ isReadonly: !0
1488
+ }] }) : (e.properties = [...e.properties ?? [], {
1506
1489
  name: "apiMetadata",
1507
1490
  type: "ApiMetadata",
1508
1491
  isReadonly: !0
@@ -1514,7 +1497,7 @@ function tr(e, t) {
1514
1497
  }],
1515
1498
  statements: `this.apiMetadata = { ${t}, ...apiMetadata };`,
1516
1499
  docs: ["@param apiMetadata - Merged over the defaults, so passing only a `fetcher` keeps the base path."]
1517
- });
1500
+ }));
1518
1501
  }
1519
1502
  function nr(e) {
1520
1503
  return e === "delete" ? "del" : e;
@@ -1695,12 +1678,12 @@ function fr(e, t, n, r) {
1695
1678
  let i = n.body.name, a = n.optionalFields.map(S).join(" | ");
1696
1679
  a !== "" && (i = `PartialBy<${i},${a}>`);
1697
1680
  let s = `CommandBody<${i}>`;
1698
- return n.typeName === void 0 ? s : r.has(n.typeName) ? n.typeName : (r.add(n.typeName), e.add({
1681
+ return n.typeName === void 0 ? s : (r.has(n.typeName) || (r.add(n.typeName), e.add({
1699
1682
  kind: o.TypeAlias,
1700
1683
  name: n.typeName,
1701
1684
  type: s,
1702
1685
  isExported: !0
1703
- }), n.typeName);
1686
+ })), n.typeName);
1704
1687
  }
1705
1688
  function pr(e, t) {
1706
1689
  return [
@@ -1743,16 +1726,12 @@ function mr(e) {
1743
1726
  }
1744
1727
  function hr(e, t) {
1745
1728
  let n = t.modules.module(e.file);
1746
- if (e.emptyMessageBody) {
1747
- xn(n.add({
1748
- kind: o.TypeAlias,
1749
- name: e.info.name,
1750
- type: "globalThis.Record<string, never>",
1751
- isExported: !0
1752
- }), e.docSchema, e.key, t.schemaDocs === "full");
1753
- return;
1754
- }
1755
- new _r(e, n, t).write();
1729
+ e.emptyMessageBody ? xn(n.add({
1730
+ kind: o.TypeAlias,
1731
+ name: e.info.name,
1732
+ type: "globalThis.Record<string, never>",
1733
+ isExported: !0
1734
+ }), e.docSchema, e.key, t.schemaDocs === "full") : new _r(e, n, t).write();
1756
1735
  }
1757
1736
  function gr(e) {
1758
1737
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
@@ -1996,15 +1975,11 @@ function Tr(e) {
1996
1975
  //#region src/finalize/typeOnlyImports.ts
1997
1976
  function Er(e) {
1998
1977
  let t = e;
1999
- for (let e = t.getParent(); e; t = e, e = e.getParent()) {
2000
- if (n.isQualifiedName(e)) {
2001
- if (e.getLeft() !== t) return !1;
2002
- continue;
2003
- }
2004
- if (n.isPropertyAccessExpression(e)) {
2005
- if (e.getExpression() !== t) return !1;
2006
- continue;
2007
- }
1978
+ for (let e = t.getParent(); e; t = e, e = e.getParent()) if (n.isQualifiedName(e)) {
1979
+ if (e.getLeft() !== t) return !1;
1980
+ } else if (n.isPropertyAccessExpression(e)) {
1981
+ if (e.getExpression() !== t) return !1;
1982
+ } else {
2008
1983
  if (n.isExpressionWithTypeArguments(e)) {
2009
1984
  let t = e.getParent(), r = t?.getParent();
2010
1985
  return !(n.isHeritageClause(t) && t.getToken() === s.ExtendsKeyword && (n.isClassDeclaration(r) || n.isClassExpression(r)));
@@ -2018,11 +1993,8 @@ function Dr(e) {
2018
1993
  if (t.length === 0) return [];
2019
1994
  let r = new Set(t.flatMap((e) => e.getNamedImports().map((e) => (e.getAliasNode() ?? e.getNameNode()).getText()))), i = /* @__PURE__ */ new Set();
2020
1995
  return e.forEachDescendant((e, t) => {
2021
- if (n.isImportDeclaration(e)) {
2022
- t.skip();
2023
- return;
2024
- }
2025
- if (n.isIdentifier(e) && r.has(e.getText()) && !Er(e)) {
1996
+ if (n.isImportDeclaration(e)) t.skip();
1997
+ else if (n.isIdentifier(e) && r.has(e.getText()) && !Er(e)) {
2026
1998
  let t = e.getSymbol();
2027
1999
  t && i.add(t.compilerSymbol);
2028
2000
  }
@@ -2597,4 +2569,4 @@ function mi(e) {
2597
2569
  //#endregion
2598
2570
  export { ie as a, h as c, re as i, fi as n, g as o, Fr as r, _ as s, pi as t };
2599
2571
 
2600
- //# sourceMappingURL=codeGenerator-DCYj0aYK.js.map
2572
+ //# sourceMappingURL=codeGenerator-CsWf0pZy.js.map