adorn-api 1.0.22 → 1.0.23

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.
@@ -93,6 +93,8 @@ export declare class Spinner {
93
93
  private current;
94
94
  private total;
95
95
  private customStatus?;
96
+ private frameIndex;
97
+ private lastLineLength;
96
98
  constructor(message?: string);
97
99
  /**
98
100
  * Start the spinner.
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/cli/progress.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,WAAW,CAAa;gBAEpB,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;IAMhE;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAYhD;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO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GED
@@ -323,7 +323,7 @@ function unwrapPromiseTypeNode(typeNode) {
323
323
  }
324
324
 
325
325
  // src/compiler/schema/openapi.ts
326
- var import_typescript11 = __toESM(require("typescript"), 1);
326
+ var import_typescript12 = __toESM(require("typescript"), 1);
327
327
 
328
328
  // src/compiler/schema/typeToJsonSchema.ts
329
329
  var import_typescript7 = __toESM(require("typescript"), 1);
@@ -1629,7 +1629,221 @@ function resolveAndCollectObjectProps(schema, components) {
1629
1629
  }
1630
1630
 
1631
1631
  // src/compiler/schema/queryBuilderAnalyzer.ts
1632
+ var import_typescript10 = __toESM(require("typescript"), 1);
1633
+
1634
+ // src/compiler/schema/serviceCallAnalyzer.ts
1632
1635
  var import_typescript9 = __toESM(require("typescript"), 1);
1636
+ var ServiceCallAnalyzer = class {
1637
+ checker;
1638
+ program;
1639
+ cache = /* @__PURE__ */ new Map();
1640
+ analyzedMethods = /* @__PURE__ */ new Set();
1641
+ constructor(checker, program) {
1642
+ this.checker = checker;
1643
+ this.program = program;
1644
+ }
1645
+ /**
1646
+ * Analyzes a controller method for query builder patterns, following service calls
1647
+ */
1648
+ analyzeControllerMethod(methodDeclaration, options = {}) {
1649
+ const cacheKey = this.getMethodCacheKey(methodDeclaration);
1650
+ if (this.cache.has(cacheKey)) {
1651
+ return this.cache.get(cacheKey) ?? null;
1652
+ }
1653
+ const maxDepth = options.maxDepth ?? 3;
1654
+ const schema = this.analyzeMethodWithServiceCalls(methodDeclaration, 0, maxDepth, options);
1655
+ this.cache.set(cacheKey, schema);
1656
+ return schema;
1657
+ }
1658
+ /**
1659
+ * Recursively analyzes method with service call traversal
1660
+ */
1661
+ analyzeMethodWithServiceCalls(methodDeclaration, currentDepth, maxDepth, options) {
1662
+ if (currentDepth >= maxDepth) {
1663
+ return null;
1664
+ }
1665
+ const methodKey = this.getMethodCacheKey(methodDeclaration);
1666
+ if (this.analyzedMethods.has(methodKey)) {
1667
+ return null;
1668
+ }
1669
+ this.analyzedMethods.add(methodKey);
1670
+ const directSchema = analyzeQueryBuilderForSchema(methodDeclaration, this.checker);
1671
+ if (directSchema) {
1672
+ return directSchema;
1673
+ }
1674
+ const serviceCalls = this.findServiceCalls(methodDeclaration);
1675
+ for (const serviceCall of serviceCalls) {
1676
+ const serviceSchema = this.analyzeServiceMethod(serviceCall, currentDepth, maxDepth, options);
1677
+ if (serviceSchema) {
1678
+ return serviceSchema;
1679
+ }
1680
+ }
1681
+ return null;
1682
+ }
1683
+ /**
1684
+ * Analyzes a service method for query builder patterns
1685
+ */
1686
+ analyzeServiceMethod(serviceCall, currentDepth, maxDepth, options) {
1687
+ const directSchema = analyzeQueryBuilderForSchema(serviceCall.methodDeclaration, this.checker);
1688
+ if (directSchema) {
1689
+ return directSchema;
1690
+ }
1691
+ if (options.analyzeHelpers) {
1692
+ return this.analyzeMethodWithServiceCalls(
1693
+ serviceCall.methodDeclaration,
1694
+ currentDepth + 1,
1695
+ maxDepth,
1696
+ options
1697
+ );
1698
+ }
1699
+ return null;
1700
+ }
1701
+ /**
1702
+ * Finds service calls in a method body
1703
+ */
1704
+ findServiceCalls(methodDeclaration) {
1705
+ const serviceCalls = [];
1706
+ const body = methodDeclaration.body;
1707
+ if (!body) {
1708
+ return serviceCalls;
1709
+ }
1710
+ const visitor = (node) => {
1711
+ if (import_typescript9.default.isCallExpression(node)) {
1712
+ const serviceCall = this.resolveServiceCall(node);
1713
+ if (serviceCall) {
1714
+ serviceCalls.push(serviceCall);
1715
+ }
1716
+ }
1717
+ import_typescript9.default.forEachChild(node, visitor);
1718
+ };
1719
+ import_typescript9.default.forEachChild(body, visitor);
1720
+ return serviceCalls;
1721
+ }
1722
+ /**
1723
+ * Resolves a call expression to a service method
1724
+ */
1725
+ resolveServiceCall(callExpression) {
1726
+ if (import_typescript9.default.isPropertyAccessExpression(callExpression.expression)) {
1727
+ const propAccess = callExpression.expression;
1728
+ const methodName = propAccess.name.text;
1729
+ const objectType = this.checker.getTypeAtLocation(propAccess.expression);
1730
+ const objectSymbol = objectType.getSymbol();
1731
+ if (objectSymbol) {
1732
+ const classDeclaration = this.findClassDeclaration(objectSymbol);
1733
+ if (classDeclaration) {
1734
+ const methodDeclaration = this.findMethodDeclaration(classDeclaration, methodName);
1735
+ if (methodDeclaration) {
1736
+ return {
1737
+ serviceName: classDeclaration.name?.text || "Unknown",
1738
+ methodName,
1739
+ filePath: classDeclaration.getSourceFile().fileName,
1740
+ classDeclaration,
1741
+ methodDeclaration
1742
+ };
1743
+ }
1744
+ }
1745
+ }
1746
+ }
1747
+ if (import_typescript9.default.isPropertyAccessExpression(callExpression.expression)) {
1748
+ const propAccess = callExpression.expression;
1749
+ const methodName = propAccess.name.text;
1750
+ if (import_typescript9.default.isIdentifier(propAccess.expression)) {
1751
+ const className = propAccess.expression.text;
1752
+ const classSymbol = this.checker.getSymbolAtLocation(propAccess.expression);
1753
+ if (classSymbol) {
1754
+ const classDeclaration = this.findClassDeclaration(classSymbol);
1755
+ if (classDeclaration && classDeclaration.name?.text === className) {
1756
+ const methodDeclaration = this.findMethodDeclaration(classDeclaration, methodName);
1757
+ if (methodDeclaration) {
1758
+ return {
1759
+ serviceName: className,
1760
+ methodName,
1761
+ filePath: classDeclaration.getSourceFile().fileName,
1762
+ classDeclaration,
1763
+ methodDeclaration
1764
+ };
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1770
+ return null;
1771
+ }
1772
+ /**
1773
+ * Finds class declaration from a symbol
1774
+ */
1775
+ findClassDeclaration(symbol) {
1776
+ const declarations = symbol.getDeclarations();
1777
+ if (!declarations) return null;
1778
+ for (const declaration of declarations) {
1779
+ if (import_typescript9.default.isClassDeclaration(declaration)) {
1780
+ return declaration;
1781
+ }
1782
+ }
1783
+ return null;
1784
+ }
1785
+ /**
1786
+ * Finds method declaration in a class
1787
+ */
1788
+ findMethodDeclaration(classDeclaration, methodName) {
1789
+ for (const member of classDeclaration.members) {
1790
+ if (import_typescript9.default.isMethodDeclaration(member) && member.name) {
1791
+ if (import_typescript9.default.isIdentifier(member.name) && member.name.text === methodName) {
1792
+ return member;
1793
+ }
1794
+ }
1795
+ }
1796
+ return null;
1797
+ }
1798
+ /**
1799
+ * Generates cache key for a method
1800
+ */
1801
+ getMethodCacheKey(methodDeclaration) {
1802
+ const sourceFile = methodDeclaration.getSourceFile();
1803
+ const className = this.getClassName(methodDeclaration);
1804
+ const methodName = methodDeclaration.name?.getText() || "unknown";
1805
+ const line = sourceFile.getLineAndCharacterOfPosition(methodDeclaration.getStart()).line;
1806
+ return `${sourceFile.fileName}:${className}:${methodName}:${line}`;
1807
+ }
1808
+ /**
1809
+ * Gets class name from method declaration
1810
+ */
1811
+ getClassName(methodDeclaration) {
1812
+ let node = methodDeclaration;
1813
+ while (node) {
1814
+ if (import_typescript9.default.isClassDeclaration(node)) {
1815
+ return node.name?.text || "Unknown";
1816
+ }
1817
+ node = node.parent;
1818
+ }
1819
+ return "Unknown";
1820
+ }
1821
+ /**
1822
+ * Clears the analysis cache
1823
+ */
1824
+ clearCache() {
1825
+ this.cache.clear();
1826
+ this.analyzedMethods.clear();
1827
+ }
1828
+ /**
1829
+ * Gets cache statistics
1830
+ */
1831
+ getCacheStats() {
1832
+ return {
1833
+ cached: this.cache.size,
1834
+ analyzed: this.analyzedMethods.size
1835
+ };
1836
+ }
1837
+ };
1838
+ function analyzeControllerWithServiceCalls(methodDeclaration, checker, program, options = {}) {
1839
+ if (!program) {
1840
+ return null;
1841
+ }
1842
+ const analyzer = new ServiceCallAnalyzer(checker, program);
1843
+ return analyzer.analyzeControllerMethod(methodDeclaration, options);
1844
+ }
1845
+
1846
+ // src/compiler/schema/queryBuilderAnalyzer.ts
1633
1847
  function analyzeQueryBuilderForSchema(methodDeclaration, checker, options = {}) {
1634
1848
  const body = methodDeclaration.body;
1635
1849
  if (!body) {
@@ -1649,8 +1863,18 @@ function analyzeQueryBuilderForSchema(methodDeclaration, checker, options = {})
1649
1863
  }
1650
1864
  return parseQueryBuilderChain(callChain, checker, options);
1651
1865
  }
1652
- function analyzeQueryBuilderWithDetails(methodDeclaration, checker, options = {}, operationInfo) {
1653
- const schema = analyzeQueryBuilderForSchema(methodDeclaration, checker, options);
1866
+ function analyzeQueryBuilderWithServiceCalls(methodDeclaration, checker, program, options = {}, operationInfo) {
1867
+ let schema = analyzeQueryBuilderForSchema(methodDeclaration, checker, options);
1868
+ if (!schema && program) {
1869
+ try {
1870
+ schema = analyzeControllerWithServiceCalls(methodDeclaration, checker, program, {
1871
+ maxDepth: options.maxDepth,
1872
+ analyzeHelpers: options.analyzeHelpers
1873
+ });
1874
+ } catch (error) {
1875
+ console.warn("Service call analysis failed:", error);
1876
+ }
1877
+ }
1654
1878
  return {
1655
1879
  detected: schema !== null,
1656
1880
  schema,
@@ -1665,12 +1889,12 @@ function analyzeWithVariableTracking(body, checker, options) {
1665
1889
  let isPaged = false;
1666
1890
  let hasReturn = false;
1667
1891
  for (const statement of body.statements) {
1668
- if (import_typescript9.default.isReturnStatement(statement)) {
1892
+ if (import_typescript10.default.isReturnStatement(statement)) {
1669
1893
  hasReturn = true;
1670
1894
  const returnExpr = statement.expression;
1671
- if (returnExpr && import_typescript9.default.isCallExpression(returnExpr)) {
1895
+ if (returnExpr && import_typescript10.default.isCallExpression(returnExpr)) {
1672
1896
  const callExpr = returnExpr;
1673
- if (import_typescript9.default.isIdentifier(callExpr.expression) && queryBuilderVar) {
1897
+ if (import_typescript10.default.isIdentifier(callExpr.expression) && queryBuilderVar) {
1674
1898
  const varName = callExpr.expression.text;
1675
1899
  if (varName === queryBuilderVar) {
1676
1900
  const methodName = callExpr.expression.text;
@@ -1679,9 +1903,9 @@ function analyzeWithVariableTracking(body, checker, options) {
1679
1903
  }
1680
1904
  }
1681
1905
  }
1682
- if (import_typescript9.default.isPropertyAccessExpression(callExpr.expression) && queryBuilderVar) {
1906
+ if (import_typescript10.default.isPropertyAccessExpression(callExpr.expression) && queryBuilderVar) {
1683
1907
  const propAccess = callExpr.expression;
1684
- if (import_typescript9.default.isIdentifier(propAccess.expression) && propAccess.expression.text === queryBuilderVar) {
1908
+ if (import_typescript10.default.isIdentifier(propAccess.expression) && propAccess.expression.text === queryBuilderVar) {
1685
1909
  const methodName = propAccess.name.text;
1686
1910
  if (methodName === "executePaged") {
1687
1911
  isPaged = true;
@@ -1691,13 +1915,13 @@ function analyzeWithVariableTracking(body, checker, options) {
1691
1915
  }
1692
1916
  continue;
1693
1917
  }
1694
- if (!import_typescript9.default.isExpressionStatement(statement)) {
1695
- if (import_typescript9.default.isVariableStatement(statement)) {
1918
+ if (!import_typescript10.default.isExpressionStatement(statement)) {
1919
+ if (import_typescript10.default.isVariableStatement(statement)) {
1696
1920
  for (const declaration of statement.declarationList.declarations) {
1697
- if (!import_typescript9.default.isIdentifier(declaration.name)) continue;
1921
+ if (!import_typescript10.default.isIdentifier(declaration.name)) continue;
1698
1922
  const varName = declaration.name.text;
1699
1923
  const initializer = declaration.initializer;
1700
- if (!initializer || !import_typescript9.default.isCallExpression(initializer)) continue;
1924
+ if (!initializer || !import_typescript10.default.isCallExpression(initializer)) continue;
1701
1925
  const opInfo = extractChainedOperation(initializer);
1702
1926
  if (opInfo && (opInfo.operation === "selectFromEntity" || opInfo.operation === "selectFrom")) {
1703
1927
  queryBuilderVar = varName;
@@ -1710,13 +1934,13 @@ function analyzeWithVariableTracking(body, checker, options) {
1710
1934
  continue;
1711
1935
  }
1712
1936
  const expr = statement.expression;
1713
- if (import_typescript9.default.isBinaryExpression(expr) && expr.operatorToken.kind === import_typescript9.default.SyntaxKind.EqualsToken) {
1714
- if (!import_typescript9.default.isIdentifier(expr.left)) {
1937
+ if (import_typescript10.default.isBinaryExpression(expr) && expr.operatorToken.kind === import_typescript10.default.SyntaxKind.EqualsToken) {
1938
+ if (!import_typescript10.default.isIdentifier(expr.left)) {
1715
1939
  continue;
1716
1940
  }
1717
1941
  const varName = expr.left.text;
1718
1942
  const rightSide = expr.right;
1719
- if (import_typescript9.default.isCallExpression(rightSide)) {
1943
+ if (import_typescript10.default.isCallExpression(rightSide)) {
1720
1944
  const opInfo = extractChainedOperation(rightSide);
1721
1945
  if (opInfo) {
1722
1946
  if (opInfo.operation === "selectFromEntity" || opInfo.operation === "selectFrom") {
@@ -1754,14 +1978,14 @@ function analyzeWithVariableTracking(body, checker, options) {
1754
1978
  };
1755
1979
  }
1756
1980
  function extractChainedOperation(callExpr) {
1757
- if (import_typescript9.default.isIdentifier(callExpr.expression)) {
1981
+ if (import_typescript10.default.isIdentifier(callExpr.expression)) {
1758
1982
  const methodName2 = callExpr.expression.text;
1759
1983
  if (methodName2 === "selectFromEntity" || methodName2 === "selectFrom") {
1760
1984
  const entityArg = callExpr.arguments[0];
1761
1985
  let entityName = null;
1762
- if (import_typescript9.default.isIdentifier(entityArg)) {
1986
+ if (import_typescript10.default.isIdentifier(entityArg)) {
1763
1987
  entityName = entityArg.text;
1764
- } else if (import_typescript9.default.isPropertyAccessExpression(entityArg)) {
1988
+ } else if (import_typescript10.default.isPropertyAccessExpression(entityArg)) {
1765
1989
  entityName = entityArg.name.text;
1766
1990
  }
1767
1991
  return {
@@ -1772,7 +1996,7 @@ function extractChainedOperation(callExpr) {
1772
1996
  };
1773
1997
  }
1774
1998
  }
1775
- if (!import_typescript9.default.isPropertyAccessExpression(callExpr.expression)) {
1999
+ if (!import_typescript10.default.isPropertyAccessExpression(callExpr.expression)) {
1776
2000
  return null;
1777
2001
  }
1778
2002
  const propAccess = callExpr.expression;
@@ -1780,7 +2004,7 @@ function extractChainedOperation(callExpr) {
1780
2004
  if (methodName === "select") {
1781
2005
  const fields = [];
1782
2006
  for (const arg of callExpr.arguments) {
1783
- if (import_typescript9.default.isStringLiteral(arg)) {
2007
+ if (import_typescript10.default.isStringLiteral(arg)) {
1784
2008
  fields.push(arg.text);
1785
2009
  }
1786
2010
  }
@@ -1802,19 +2026,19 @@ function extractChainedOperation(callExpr) {
1802
2026
  return null;
1803
2027
  }
1804
2028
  function parseIncludeObjectLiteral(arg) {
1805
- if (!import_typescript9.default.isObjectLiteralExpression(arg)) {
2029
+ if (!import_typescript10.default.isObjectLiteralExpression(arg)) {
1806
2030
  return null;
1807
2031
  }
1808
2032
  const includes = {};
1809
2033
  for (const prop of arg.properties) {
1810
- if (!import_typescript9.default.isPropertyAssignment(prop) || !import_typescript9.default.isIdentifier(prop.name)) {
2034
+ if (!import_typescript10.default.isPropertyAssignment(prop) || !import_typescript10.default.isIdentifier(prop.name)) {
1811
2035
  continue;
1812
2036
  }
1813
2037
  const relationName = prop.name.text;
1814
2038
  const value = prop.initializer;
1815
- if (value.kind === import_typescript9.default.SyntaxKind.TrueKeyword) {
2039
+ if (value.kind === import_typescript10.default.SyntaxKind.TrueKeyword) {
1816
2040
  includes[relationName] = true;
1817
- } else if (import_typescript9.default.isObjectLiteralExpression(value)) {
2041
+ } else if (import_typescript10.default.isObjectLiteralExpression(value)) {
1818
2042
  const nestedSchema = parseNestedInclude(value, 0);
1819
2043
  if (nestedSchema) {
1820
2044
  includes[relationName] = nestedSchema;
@@ -1827,18 +2051,18 @@ function parseNestedInclude(obj, depth) {
1827
2051
  const selectedFields = [];
1828
2052
  const includes = {};
1829
2053
  for (const prop of obj.properties) {
1830
- if (!import_typescript9.default.isPropertyAssignment(prop) || !import_typescript9.default.isIdentifier(prop.name)) {
2054
+ if (!import_typescript10.default.isPropertyAssignment(prop) || !import_typescript10.default.isIdentifier(prop.name)) {
1831
2055
  continue;
1832
2056
  }
1833
2057
  const propName = prop.name.text;
1834
2058
  const value = prop.initializer;
1835
- if (propName === "select" && import_typescript9.default.isArrayLiteralExpression(value)) {
2059
+ if (propName === "select" && import_typescript10.default.isArrayLiteralExpression(value)) {
1836
2060
  for (const element of value.elements) {
1837
- if (import_typescript9.default.isStringLiteral(element)) {
2061
+ if (import_typescript10.default.isStringLiteral(element)) {
1838
2062
  selectedFields.push(element.text);
1839
2063
  }
1840
2064
  }
1841
- } else if (propName === "include" && import_typescript9.default.isObjectLiteralExpression(value)) {
2065
+ } else if (propName === "include" && import_typescript10.default.isObjectLiteralExpression(value)) {
1842
2066
  const nestedIncludes = parseIncludeObjectLiteral(value);
1843
2067
  if (nestedIncludes) {
1844
2068
  for (const [relName, relSchema] of Object.entries(nestedIncludes)) {
@@ -1855,10 +2079,10 @@ function parseNestedInclude(obj, depth) {
1855
2079
  };
1856
2080
  }
1857
2081
  function getMethodName(expression) {
1858
- if (import_typescript9.default.isIdentifier(expression)) {
2082
+ if (import_typescript10.default.isIdentifier(expression)) {
1859
2083
  return expression.text;
1860
2084
  }
1861
- if (import_typescript9.default.isPropertyAccessExpression(expression)) {
2085
+ if (import_typescript10.default.isPropertyAccessExpression(expression)) {
1862
2086
  return expression.name.text;
1863
2087
  }
1864
2088
  return null;
@@ -1866,7 +2090,7 @@ function getMethodName(expression) {
1866
2090
  function findReturnStatement(body) {
1867
2091
  let returnStatement = null;
1868
2092
  for (const statement of body.statements) {
1869
- if (import_typescript9.default.isReturnStatement(statement)) {
2093
+ if (import_typescript10.default.isReturnStatement(statement)) {
1870
2094
  if (returnStatement !== null) {
1871
2095
  return null;
1872
2096
  }
@@ -1879,20 +2103,20 @@ function analyzeReturnExpression(expression) {
1879
2103
  if (!expression) {
1880
2104
  return null;
1881
2105
  }
1882
- if (import_typescript9.default.isCallExpression(expression)) {
2106
+ if (import_typescript10.default.isCallExpression(expression)) {
1883
2107
  return buildCallChain(expression, null);
1884
2108
  }
1885
2109
  return null;
1886
2110
  }
1887
2111
  function buildCallChain(node, parent) {
1888
- if (import_typescript9.default.isCallExpression(node)) {
2112
+ if (import_typescript10.default.isCallExpression(node)) {
1889
2113
  const callNode = {
1890
2114
  expression: node.expression,
1891
2115
  methodName: getMethodName(node.expression),
1892
2116
  arguments: node.arguments,
1893
2117
  parent
1894
2118
  };
1895
- if (import_typescript9.default.isPropertyAccessExpression(node.expression)) {
2119
+ if (import_typescript10.default.isPropertyAccessExpression(node.expression)) {
1896
2120
  return buildCallChain(node.expression.expression, callNode);
1897
2121
  }
1898
2122
  return callNode;
@@ -1919,7 +2143,7 @@ function parseQueryBuilderChain(chain, checker, options) {
1919
2143
  const methodName = currentNode.methodName;
1920
2144
  if (methodName === "select") {
1921
2145
  for (const arg of currentNode.arguments) {
1922
- if (import_typescript9.default.isStringLiteral(arg)) {
2146
+ if (import_typescript10.default.isStringLiteral(arg)) {
1923
2147
  selectedFields.add(arg.text);
1924
2148
  }
1925
2149
  }
@@ -1954,10 +2178,10 @@ function extractEntityName(callNode, checker) {
1954
2178
  return null;
1955
2179
  }
1956
2180
  const entityArg = callNode.arguments[0];
1957
- if (import_typescript9.default.isIdentifier(entityArg)) {
2181
+ if (import_typescript10.default.isIdentifier(entityArg)) {
1958
2182
  return entityArg.text;
1959
2183
  }
1960
- if (import_typescript9.default.isPropertyAccessExpression(entityArg)) {
2184
+ if (import_typescript10.default.isPropertyAccessExpression(entityArg)) {
1961
2185
  return entityArg.name.text;
1962
2186
  }
1963
2187
  return null;
@@ -1966,16 +2190,16 @@ function parseIncludeArgument(arg, includes, checker, options, depth) {
1966
2190
  if (!arg) {
1967
2191
  return;
1968
2192
  }
1969
- if (import_typescript9.default.isObjectLiteralExpression(arg)) {
2193
+ if (import_typescript10.default.isObjectLiteralExpression(arg)) {
1970
2194
  for (const prop of arg.properties) {
1971
- if (!import_typescript9.default.isPropertyAssignment(prop) || !import_typescript9.default.isIdentifier(prop.name)) {
2195
+ if (!import_typescript10.default.isPropertyAssignment(prop) || !import_typescript10.default.isIdentifier(prop.name)) {
1972
2196
  continue;
1973
2197
  }
1974
2198
  const relationName = prop.name.text;
1975
2199
  const value = prop.initializer;
1976
- if (value.kind === import_typescript9.default.SyntaxKind.TrueKeyword) {
2200
+ if (value.kind === import_typescript10.default.SyntaxKind.TrueKeyword) {
1977
2201
  includes[relationName] = true;
1978
- } else if (import_typescript9.default.isObjectLiteralExpression(value)) {
2202
+ } else if (import_typescript10.default.isObjectLiteralExpression(value)) {
1979
2203
  const maxDepth = options.maxDepth ?? 5;
1980
2204
  if (depth < maxDepth) {
1981
2205
  const nestedSchema = parseNestedInclude(value, depth + 1);
@@ -1989,7 +2213,7 @@ function parseIncludeArgument(arg, includes, checker, options, depth) {
1989
2213
  }
1990
2214
 
1991
2215
  // src/compiler/schema/queryBuilderSchemaBuilder.ts
1992
- var import_typescript10 = require("typescript");
2216
+ var import_typescript11 = require("typescript");
1993
2217
  function wrapInPaginatedResult(schema) {
1994
2218
  return {
1995
2219
  type: "object",
@@ -2035,9 +2259,11 @@ function generateOpenAPI(controllers, checker, options = {}) {
2035
2259
  paths[fullPath] = {};
2036
2260
  }
2037
2261
  const method = operation.httpMethod.toLowerCase();
2038
- const analysisResult = analyzeQueryBuilderWithDetails(
2262
+ const analysisResult = analyzeQueryBuilderWithServiceCalls(
2039
2263
  operation.methodDeclaration,
2040
2264
  checker,
2265
+ null,
2266
+ // TODO: Pass program when available
2041
2267
  {},
2042
2268
  {
2043
2269
  methodName: operation.operationId,
@@ -2340,12 +2566,12 @@ function mergeBodySchemaAnnotations(bodyParam, ctx, schema) {
2340
2566
  const declarations = typeSymbol.getDeclarations();
2341
2567
  if (!declarations || declarations.length === 0) return schema;
2342
2568
  const classDecl = declarations[0];
2343
- if (!import_typescript11.default.isClassDeclaration(classDecl)) return schema;
2569
+ if (!import_typescript12.default.isClassDeclaration(classDecl)) return schema;
2344
2570
  const result = { ...schema };
2345
2571
  const props = { ...result.properties };
2346
2572
  for (const member of classDecl.members) {
2347
- if (!import_typescript11.default.isPropertyDeclaration(member) || !member.name) continue;
2348
- const propName = import_typescript11.default.isIdentifier(member.name) ? member.name.text : null;
2573
+ if (!import_typescript12.default.isPropertyDeclaration(member) || !member.name) continue;
2574
+ const propName = import_typescript12.default.isIdentifier(member.name) ? member.name.text : null;
2349
2575
  if (!propName) continue;
2350
2576
  if (!props[propName]) continue;
2351
2577
  const frags = extractPropertySchemaFragments(ctx.checker, member);
@@ -2358,7 +2584,7 @@ function mergeBodySchemaAnnotations(bodyParam, ctx, schema) {
2358
2584
  }
2359
2585
 
2360
2586
  // src/compiler/manifest/emit.ts
2361
- var import_typescript12 = __toESM(require("typescript"), 1);
2587
+ var import_typescript13 = __toESM(require("typescript"), 1);
2362
2588
  function generateManifest(controllers, checker, version, validationMode = "ajv-runtime") {
2363
2589
  const components = /* @__PURE__ */ new Map();
2364
2590
  const ctx = {
@@ -2380,7 +2606,7 @@ function generateManifest(controllers, checker, version, validationMode = "ajv-r
2380
2606
  generator: {
2381
2607
  name: "adorn-api",
2382
2608
  version,
2383
- typescript: import_typescript12.default.version
2609
+ typescript: import_typescript13.default.version
2384
2610
  },
2385
2611
  schemas: {
2386
2612
  kind: "openapi-3.1",
@@ -2866,7 +3092,7 @@ async function isStale(params) {
2866
3092
  // src/compiler/cache/writeCache.ts
2867
3093
  var import_node_fs4 = __toESM(require("fs"), 1);
2868
3094
  var import_node_path4 = __toESM(require("path"), 1);
2869
- var import_typescript13 = __toESM(require("typescript"), 1);
3095
+ var import_typescript14 = __toESM(require("typescript"), 1);
2870
3096
  function statMtimeMs2(p) {
2871
3097
  return import_node_fs4.default.statSync(p).mtimeMs;
2872
3098
  }
@@ -2899,7 +3125,7 @@ function writeCache(params) {
2899
3125
  generator: {
2900
3126
  name: "adorn-api",
2901
3127
  version: params.adornVersion,
2902
- typescript: import_typescript13.default.version
3128
+ typescript: import_typescript14.default.version
2903
3129
  },
2904
3130
  project: {
2905
3131
  tsconfigPath: params.tsconfigAbs,
@@ -3061,6 +3287,8 @@ var Spinner = class {
3061
3287
  current = 0;
3062
3288
  total = 0;
3063
3289
  customStatus;
3290
+ frameIndex = 0;
3291
+ lastLineLength = 0;
3064
3292
  constructor(message = "") {
3065
3293
  this.message = message;
3066
3294
  }
@@ -3068,9 +3296,8 @@ var Spinner = class {
3068
3296
  * Start the spinner.
3069
3297
  */
3070
3298
  start() {
3071
- let frameIndex = 0;
3072
3299
  this.interval = setInterval(() => {
3073
- const frame = this.frames[frameIndex];
3300
+ const frame = this.frames[this.frameIndex];
3074
3301
  let output;
3075
3302
  if (this.customStatus) {
3076
3303
  output = `\r${frame} ${this.customStatus}`;
@@ -3079,11 +3306,12 @@ var Spinner = class {
3079
3306
  } else {
3080
3307
  output = `\r${frame} ${this.message}`;
3081
3308
  }
3309
+ this.lastLineLength = output.length - 1;
3082
3310
  import_node_process.default.stdout.write(output);
3083
3311
  if (import_node_process.default.stdout.writable) {
3084
3312
  import_node_process.default.stdout.write("");
3085
3313
  }
3086
- frameIndex = (frameIndex + 1) % this.frames.length;
3314
+ this.frameIndex = (this.frameIndex + 1) % this.frames.length;
3087
3315
  }, 80);
3088
3316
  }
3089
3317
  /**
@@ -3098,8 +3326,12 @@ var Spinner = class {
3098
3326
  */
3099
3327
  setStatus(status) {
3100
3328
  this.customStatus = status;
3101
- const frame = this.frames[this.current];
3102
- import_node_process.default.stdout.write(`\r${frame} ${status}`);
3329
+ const frame = this.frames[this.frameIndex];
3330
+ const output = `\r${frame} ${status}`;
3331
+ const clearLength = Math.max(this.lastLineLength, output.length - 1);
3332
+ import_node_process.default.stdout.write("\r" + " ".repeat(clearLength) + "\r");
3333
+ this.lastLineLength = output.length - 1;
3334
+ import_node_process.default.stdout.write(output);
3103
3335
  if (import_node_process.default.stdout.writable) {
3104
3336
  import_node_process.default.stdout.write("");
3105
3337
  }
@@ -3118,7 +3350,7 @@ var Spinner = class {
3118
3350
  clearInterval(this.interval);
3119
3351
  this.interval = void 0;
3120
3352
  }
3121
- import_node_process.default.stdout.write("\r" + " ".repeat(60) + "\r");
3353
+ import_node_process.default.stdout.write("\r" + " ".repeat(this.lastLineLength) + "\r");
3122
3354
  if (completedMessage) {
3123
3355
  import_node_process.default.stdout.write(completedMessage + "\n");
3124
3356
  }
@@ -3652,7 +3884,7 @@ function getEdgesByRelation(graph, relation) {
3652
3884
  }
3653
3885
 
3654
3886
  // src/compiler/graph/builder.ts
3655
- var import_typescript14 = __toESM(require("typescript"), 1);
3887
+ var import_typescript15 = __toESM(require("typescript"), 1);
3656
3888
 
3657
3889
  // src/compiler/graph/schemaGraph.ts
3658
3890
  var SchemaGraph = class {
@@ -3904,7 +4136,7 @@ var SchemaGraph = class {
3904
4136
  };
3905
4137
 
3906
4138
  // src/cli.ts
3907
- var import_typescript15 = __toESM(require("typescript"), 1);
4139
+ var import_typescript16 = __toESM(require("typescript"), 1);
3908
4140
  var import_node_process2 = __toESM(require("process"), 1);
3909
4141
  var import_meta2 = {};
3910
4142
  var ADORN_VERSION = (() => {
@@ -3983,7 +4215,7 @@ function sanitizeForJson(obj) {
3983
4215
  return result;
3984
4216
  }
3985
4217
  function buildControllerGraph(controllers) {
3986
- const graph = createGraph(import_typescript15.default.version);
4218
+ const graph = createGraph(import_typescript16.default.version);
3987
4219
  const nodeMap = /* @__PURE__ */ new Map();
3988
4220
  for (const ctrl of controllers) {
3989
4221
  const nodeId = `Controller:${ctrl.className}`;
@@ -4095,7 +4327,7 @@ async function buildCommand(args) {
4095
4327
  outDir: outputDir,
4096
4328
  project: projectPath,
4097
4329
  adornVersion: ADORN_VERSION,
4098
- typescriptVersion: import_typescript15.default.version
4330
+ typescriptVersion: import_typescript16.default.version
4099
4331
  });
4100
4332
  if (!stale.stale) {
4101
4333
  progress.completePhase("staleness-check");