@deepagents/text2sql 7.42.4 → 7.43.1

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.
@@ -1615,6 +1615,18 @@ var indexHintRow = z5.object({
1615
1615
  is_partitioning_column: z5.string().nullable(),
1616
1616
  clustering_ordinal_position: int64.nullable()
1617
1617
  });
1618
+ var IndexHintsWarning = class extends Error {
1619
+ code = "DEEPAGENTS_TEXT2SQL_BIGQUERY_INDEX_HINTS_FAILED";
1620
+ detail;
1621
+ constructor(failure, dataset) {
1622
+ super(
1623
+ `Reading the partitioning and clustering columns of a dataset failed, and indexing goes on without its index hints: ${Error.isError(failure) ? failure.message : String(failure)}`,
1624
+ { cause: failure }
1625
+ );
1626
+ this.name = "IndexHintsWarning";
1627
+ this.detail = `dataset: ${dataset}`;
1628
+ }
1629
+ };
1618
1630
  var BigQueryIndexesGrounding = class extends IndexesGrounding {
1619
1631
  #adapter;
1620
1632
  constructor(adapter, config = {}) {
@@ -1645,7 +1657,8 @@ var BigQueryIndexesGrounding = class extends IndexesGrounding {
1645
1657
  }
1646
1658
  try {
1647
1659
  await this.#batchIndexes(dataset, tables2);
1648
- } catch {
1660
+ } catch (error) {
1661
+ process.emitWarning(new IndexHintsWarning(error, dataset));
1649
1662
  }
1650
1663
  }
1651
1664
  }
@@ -1759,6 +1772,18 @@ var textValueRow = z6.object({ value: z6.string() });
1759
1772
  var numericValue = z6.union([z6.number(), z6.bigint(), z6.string()]);
1760
1773
 
1761
1774
  // packages/text2sql/src/lib/adapters/bigquery/row-count.bigquery.grounding.ts
1775
+ var RowCountSourceWarning = class extends Error {
1776
+ code = "DEEPAGENTS_TEXT2SQL_BIGQUERY_ROW_COUNT_SOURCE_FAILED";
1777
+ detail;
1778
+ constructor(failure, source, next, dataset) {
1779
+ super(
1780
+ `Reading row counts from ${source} failed, and ${next}: ${Error.isError(failure) ? failure.message : String(failure)}`,
1781
+ { cause: failure }
1782
+ );
1783
+ this.name = "RowCountSourceWarning";
1784
+ this.detail = `dataset: ${dataset}`;
1785
+ }
1786
+ };
1762
1787
  var tableStorageRow = z7.object({
1763
1788
  table_name: z7.string().nullable(),
1764
1789
  total_rows: numericValue.nullable()
@@ -1813,11 +1838,27 @@ var BigQueryRowCountGrounding = class extends RowCountGrounding {
1813
1838
  const inList = tableNames.map((n) => `'${this.#adapter.escapeString(n)}'`).join(", ");
1814
1839
  try {
1815
1840
  return await this.#fromTableStorage(dataset, inList);
1816
- } catch {
1841
+ } catch (error) {
1842
+ process.emitWarning(
1843
+ new RowCountSourceWarning(
1844
+ error,
1845
+ "INFORMATION_SCHEMA.TABLE_STORAGE",
1846
+ "the grounding reads __TABLES__ instead",
1847
+ dataset
1848
+ )
1849
+ );
1817
1850
  }
1818
1851
  try {
1819
1852
  return await this.#fromLegacyTables(dataset, inList);
1820
- } catch {
1853
+ } catch (error) {
1854
+ process.emitWarning(
1855
+ new RowCountSourceWarning(
1856
+ error,
1857
+ "__TABLES__",
1858
+ "the dataset has no row counts",
1859
+ dataset
1860
+ )
1861
+ );
1821
1862
  }
1822
1863
  return /* @__PURE__ */ new Map();
1823
1864
  }