@querypanel/node-sdk 1.0.48 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1471,6 +1471,9 @@ function buildModifiedQuestion(originalQuestion, modifications) {
1471
1471
  }
1472
1472
  function buildVizHints(modifications) {
1473
1473
  const hints = {};
1474
+ if (modifications.kind) {
1475
+ hints.kind = modifications.kind;
1476
+ }
1474
1477
  if (modifications.chartType) {
1475
1478
  hints.chartType = modifications.chartType;
1476
1479
  }
@@ -1491,6 +1494,13 @@ function buildVizHints(modifications) {
1491
1494
  }
1492
1495
  return hints;
1493
1496
  }
1497
+ function stripVizSpecOnlyHints(hints) {
1498
+ if (!("kind" in hints)) {
1499
+ return hints;
1500
+ }
1501
+ const { kind: _kind, ...rest } = hints;
1502
+ return rest;
1503
+ }
1494
1504
  function resolveTenantId5(client, tenantId) {
1495
1505
  const resolved = tenantId ?? client.getDefaultTenantId();
1496
1506
  if (!resolved) {
@@ -1574,6 +1584,7 @@ async function modifyChart(client, queryEngine, input, options, signal) {
1574
1584
  };
1575
1585
  if (rows.length > 0) {
1576
1586
  const vizHints = hasVizMods ? buildVizHints(input.vizModifications) : {};
1587
+ const vizHintsForChart = chartType === "vizspec" ? vizHints : stripVizSpecOnlyHints(vizHints);
1577
1588
  if (chartType === "vizspec") {
1578
1589
  const vizspecResponse = await client.post(
1579
1590
  "/vizspec",
@@ -1586,7 +1597,7 @@ async function modifyChart(client, queryEngine, input, options, signal) {
1586
1597
  max_retries: options?.chartMaxRetries ?? 3,
1587
1598
  query_id: queryId,
1588
1599
  // Include viz hints for the chart generator
1589
- ...hasVizMods ? { encoding_hints: vizHints } : {}
1600
+ ...hasVizMods ? { encoding_hints: vizHintsForChart } : {}
1590
1601
  },
1591
1602
  tenantId,
1592
1603
  options?.userId,
@@ -1611,7 +1622,7 @@ async function modifyChart(client, queryEngine, input, options, signal) {
1611
1622
  max_retries: options?.chartMaxRetries ?? 3,
1612
1623
  query_id: queryId,
1613
1624
  // Include viz hints for the chart generator
1614
- ...hasVizMods ? { encoding_hints: vizHints } : {}
1625
+ ...hasVizMods ? { encoding_hints: vizHintsForChart } : {}
1615
1626
  },
1616
1627
  tenantId,
1617
1628
  options?.userId,
@@ -1731,7 +1742,8 @@ async function generateVizSpec(client, input, options, signal) {
1731
1742
  fields: input.fields,
1732
1743
  rows: input.rows,
1733
1744
  max_retries: options?.maxRetries ?? input.max_retries ?? 3,
1734
- query_id: input.query_id
1745
+ query_id: input.query_id,
1746
+ encoding_hints: input.encoding_hints
1735
1747
  },
1736
1748
  tenantId,
1737
1749
  options?.userId,