@querypanel/node-sdk 1.2.2 → 1.2.4

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.d.cts CHANGED
@@ -421,6 +421,10 @@ interface ActiveChartUpdateInput {
421
421
  interface ActiveChartListOptions extends ChartListOptions {
422
422
  withData?: boolean;
423
423
  }
424
+ interface ActiveChartBulkGetResponse {
425
+ data: SdkActiveChart[];
426
+ missingIds: string[];
427
+ }
424
428
 
425
429
  /**
426
430
  * Dashboard interface matching querypanel-sdk schema
@@ -554,6 +558,8 @@ interface VizSpecBase {
554
558
  }
555
559
  type VizSpecKind = VizSpecBase["kind"];
556
560
  type ChartType = 'line' | 'bar' | 'column' | 'area' | 'scatter' | 'pie';
561
+ /** Full VizSpec chart catalog; use when building a custom `supportedChartTypes` list. */
562
+ declare const ALL_VIZ_CHART_TYPES: readonly ChartType[];
557
563
  type StackingMode = 'none' | 'stacked' | 'percent';
558
564
  interface ChartEncoding {
559
565
  chartType: ChartType;
@@ -720,6 +726,11 @@ interface AskOptions {
720
726
  * Only sent when `pipeline: "v2"`.
721
727
  */
722
728
  systemPrompt?: string;
729
+ /**
730
+ * Restrict VizSpec `chartType` values when `chartType` is `"vizspec"`.
731
+ * Sent to `POST /vizspec` as `supported_chart_types`. Omitted allows all standard types.
732
+ */
733
+ supportedChartTypes?: ChartType[];
723
734
  }
724
735
  /**
725
736
  * Intent analysis result from the v2 pipeline.
@@ -940,6 +951,10 @@ interface ChartModifyOptions {
940
951
  * the original question with modification hints.
941
952
  */
942
953
  querypanelSessionId?: string;
954
+ /**
955
+ * Restrict VizSpec chart types for this call (merged with SDK default from constructor when omitted).
956
+ */
957
+ supportedChartTypes?: ChartType[];
943
958
  }
944
959
  /**
945
960
  * Response from modifyChart(), extending AskResponse with modification metadata.
@@ -1054,6 +1069,8 @@ interface VizSpecGenerateInput {
1054
1069
  * When provided, these guide the LLM to generate specific visualization configurations.
1055
1070
  */
1056
1071
  encoding_hints?: EncodingHints;
1072
+ /** When set, VizSpec kind "chart" may only use these chart types (API: supported_chart_types). */
1073
+ supported_chart_types?: ChartType[];
1057
1074
  }
1058
1075
  interface VizSpecGenerateOptions {
1059
1076
  tenantId?: string;
@@ -1100,6 +1117,12 @@ interface QueryPanelSdkAPIOptions {
1100
1117
  * use this when calling the SDK from within your own API to avoid recursion.
1101
1118
  */
1102
1119
  api?: IQueryPanelApi;
1120
+ /**
1121
+ * Restrict VizSpec chart kinds (when using `chartType: "vizspec"`).
1122
+ * Omitted means all types: line, bar, column, area, scatter, pie.
1123
+ * Per-request `supportedChartTypes` on `ask` / `modifyChart` overrides this default.
1124
+ */
1125
+ supportedChartTypes?: ChartType[];
1103
1126
  }
1104
1127
  /**
1105
1128
  * Main SDK class - Thin orchestrator
@@ -1109,6 +1132,7 @@ interface QueryPanelSdkAPIOptions {
1109
1132
  declare class QueryPanelSdkAPI {
1110
1133
  private readonly client;
1111
1134
  private readonly queryEngine;
1135
+ private readonly supportedChartTypes?;
1112
1136
  /**
1113
1137
  * @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
1114
1138
  */
@@ -1146,6 +1170,7 @@ declare class QueryPanelSdkAPI {
1146
1170
  */
1147
1171
  static withCallbacks(workspaceId: string, requestHandler: RequestHandler, options?: {
1148
1172
  defaultTenantId?: string;
1173
+ supportedChartTypes?: ChartType[];
1149
1174
  }): QueryPanelSdkAPI;
1150
1175
  attachClickhouse(name: string, clientFn: ClickHouseClientFn, options?: ClickHouseAdapterOptions & {
1151
1176
  description?: string;
@@ -1573,6 +1598,14 @@ declare class QueryPanelSdkAPI {
1573
1598
  * ```
1574
1599
  */
1575
1600
  listActiveCharts(options?: ActiveChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkActiveChart>>;
1601
+ /**
1602
+ * Lists all active charts without pagination.
1603
+ */
1604
+ listAllActiveCharts(options?: ActiveChartListOptions, signal?: AbortSignal): Promise<SdkActiveChart[]>;
1605
+ /**
1606
+ * Bulk gets active charts by IDs.
1607
+ */
1608
+ getActiveChartsByIds(ids: string[], options?: ActiveChartListOptions, signal?: AbortSignal): Promise<ActiveChartBulkGetResponse>;
1576
1609
  /**
1577
1610
  * Retrieves a single active chart by ID.
1578
1611
  *
@@ -1877,4 +1910,4 @@ declare class QueryPanelSdkAPI {
1877
1910
  }, signal?: AbortSignal): Promise<SdkDashboard[]>;
1878
1911
  }
1879
1912
 
1880
- export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, BigQueryAdapter, type BigQueryAdapterOptions, type BigQueryClientFn, type BigQueryQueryRequest, type BigQueryQueryResult, CallbackApiClient, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListOptions, type ChartModifyInput, type ChartModifyOptions, type ChartModifyResponse, type ChartSpec, type ChartType, type ChartUpdateInput, ClickHouseAdapter, type ClickHouseAdapterOptions, type ClickHouseClientFn, type ContextDocument, type DashboardCreateInput, type DashboardForkInput, type DashboardForkUpdateInput, type DashboardListOptions, type DashboardUpdateInput, type DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IQueryPanelApi, type IngestResponse, type IntentResult, type MetricEncoding, type MetricField, type MetricSpec, type PaginatedResponse$1 as PaginatedResponse, type PaginationInfo$1 as PaginationInfo, type PaginationQuery$1 as PaginationQuery, type ParamRecord, type ParamValue, type PipelineTrace, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, type QueryPanelSdkAPIOptions, QueryPipelineError, type RequestHandler, type RequestHandlerOptions, type RequestHandlerResult, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkDashboard, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type ValueFormat, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecGeneratorInput, type VizSpecKind, type VizSpecResponse, type VizSpecResult, anonymizeResults };
1913
+ export { ALL_VIZ_CHART_TYPES, type ActiveChartBulkGetResponse, type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, BigQueryAdapter, type BigQueryAdapterOptions, type BigQueryClientFn, type BigQueryQueryRequest, type BigQueryQueryResult, CallbackApiClient, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListOptions, type ChartModifyInput, type ChartModifyOptions, type ChartModifyResponse, type ChartSpec, type ChartType, type ChartUpdateInput, ClickHouseAdapter, type ClickHouseAdapterOptions, type ClickHouseClientFn, type ContextDocument, type DashboardCreateInput, type DashboardForkInput, type DashboardForkUpdateInput, type DashboardListOptions, type DashboardUpdateInput, type DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IQueryPanelApi, type IngestResponse, type IntentResult, type MetricEncoding, type MetricField, type MetricSpec, type PaginatedResponse$1 as PaginatedResponse, type PaginationInfo$1 as PaginationInfo, type PaginationQuery$1 as PaginationQuery, type ParamRecord, type ParamValue, type PipelineTrace, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, type QueryPanelSdkAPIOptions, QueryPipelineError, type RequestHandler, type RequestHandlerOptions, type RequestHandlerResult, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkDashboard, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type ValueFormat, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecGeneratorInput, type VizSpecKind, type VizSpecResponse, type VizSpecResult, anonymizeResults };
package/dist/index.d.ts CHANGED
@@ -421,6 +421,10 @@ interface ActiveChartUpdateInput {
421
421
  interface ActiveChartListOptions extends ChartListOptions {
422
422
  withData?: boolean;
423
423
  }
424
+ interface ActiveChartBulkGetResponse {
425
+ data: SdkActiveChart[];
426
+ missingIds: string[];
427
+ }
424
428
 
425
429
  /**
426
430
  * Dashboard interface matching querypanel-sdk schema
@@ -554,6 +558,8 @@ interface VizSpecBase {
554
558
  }
555
559
  type VizSpecKind = VizSpecBase["kind"];
556
560
  type ChartType = 'line' | 'bar' | 'column' | 'area' | 'scatter' | 'pie';
561
+ /** Full VizSpec chart catalog; use when building a custom `supportedChartTypes` list. */
562
+ declare const ALL_VIZ_CHART_TYPES: readonly ChartType[];
557
563
  type StackingMode = 'none' | 'stacked' | 'percent';
558
564
  interface ChartEncoding {
559
565
  chartType: ChartType;
@@ -720,6 +726,11 @@ interface AskOptions {
720
726
  * Only sent when `pipeline: "v2"`.
721
727
  */
722
728
  systemPrompt?: string;
729
+ /**
730
+ * Restrict VizSpec `chartType` values when `chartType` is `"vizspec"`.
731
+ * Sent to `POST /vizspec` as `supported_chart_types`. Omitted allows all standard types.
732
+ */
733
+ supportedChartTypes?: ChartType[];
723
734
  }
724
735
  /**
725
736
  * Intent analysis result from the v2 pipeline.
@@ -940,6 +951,10 @@ interface ChartModifyOptions {
940
951
  * the original question with modification hints.
941
952
  */
942
953
  querypanelSessionId?: string;
954
+ /**
955
+ * Restrict VizSpec chart types for this call (merged with SDK default from constructor when omitted).
956
+ */
957
+ supportedChartTypes?: ChartType[];
943
958
  }
944
959
  /**
945
960
  * Response from modifyChart(), extending AskResponse with modification metadata.
@@ -1054,6 +1069,8 @@ interface VizSpecGenerateInput {
1054
1069
  * When provided, these guide the LLM to generate specific visualization configurations.
1055
1070
  */
1056
1071
  encoding_hints?: EncodingHints;
1072
+ /** When set, VizSpec kind "chart" may only use these chart types (API: supported_chart_types). */
1073
+ supported_chart_types?: ChartType[];
1057
1074
  }
1058
1075
  interface VizSpecGenerateOptions {
1059
1076
  tenantId?: string;
@@ -1100,6 +1117,12 @@ interface QueryPanelSdkAPIOptions {
1100
1117
  * use this when calling the SDK from within your own API to avoid recursion.
1101
1118
  */
1102
1119
  api?: IQueryPanelApi;
1120
+ /**
1121
+ * Restrict VizSpec chart kinds (when using `chartType: "vizspec"`).
1122
+ * Omitted means all types: line, bar, column, area, scatter, pie.
1123
+ * Per-request `supportedChartTypes` on `ask` / `modifyChart` overrides this default.
1124
+ */
1125
+ supportedChartTypes?: ChartType[];
1103
1126
  }
1104
1127
  /**
1105
1128
  * Main SDK class - Thin orchestrator
@@ -1109,6 +1132,7 @@ interface QueryPanelSdkAPIOptions {
1109
1132
  declare class QueryPanelSdkAPI {
1110
1133
  private readonly client;
1111
1134
  private readonly queryEngine;
1135
+ private readonly supportedChartTypes?;
1112
1136
  /**
1113
1137
  * @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
1114
1138
  */
@@ -1146,6 +1170,7 @@ declare class QueryPanelSdkAPI {
1146
1170
  */
1147
1171
  static withCallbacks(workspaceId: string, requestHandler: RequestHandler, options?: {
1148
1172
  defaultTenantId?: string;
1173
+ supportedChartTypes?: ChartType[];
1149
1174
  }): QueryPanelSdkAPI;
1150
1175
  attachClickhouse(name: string, clientFn: ClickHouseClientFn, options?: ClickHouseAdapterOptions & {
1151
1176
  description?: string;
@@ -1573,6 +1598,14 @@ declare class QueryPanelSdkAPI {
1573
1598
  * ```
1574
1599
  */
1575
1600
  listActiveCharts(options?: ActiveChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkActiveChart>>;
1601
+ /**
1602
+ * Lists all active charts without pagination.
1603
+ */
1604
+ listAllActiveCharts(options?: ActiveChartListOptions, signal?: AbortSignal): Promise<SdkActiveChart[]>;
1605
+ /**
1606
+ * Bulk gets active charts by IDs.
1607
+ */
1608
+ getActiveChartsByIds(ids: string[], options?: ActiveChartListOptions, signal?: AbortSignal): Promise<ActiveChartBulkGetResponse>;
1576
1609
  /**
1577
1610
  * Retrieves a single active chart by ID.
1578
1611
  *
@@ -1877,4 +1910,4 @@ declare class QueryPanelSdkAPI {
1877
1910
  }, signal?: AbortSignal): Promise<SdkDashboard[]>;
1878
1911
  }
1879
1912
 
1880
- export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, BigQueryAdapter, type BigQueryAdapterOptions, type BigQueryClientFn, type BigQueryQueryRequest, type BigQueryQueryResult, CallbackApiClient, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListOptions, type ChartModifyInput, type ChartModifyOptions, type ChartModifyResponse, type ChartSpec, type ChartType, type ChartUpdateInput, ClickHouseAdapter, type ClickHouseAdapterOptions, type ClickHouseClientFn, type ContextDocument, type DashboardCreateInput, type DashboardForkInput, type DashboardForkUpdateInput, type DashboardListOptions, type DashboardUpdateInput, type DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IQueryPanelApi, type IngestResponse, type IntentResult, type MetricEncoding, type MetricField, type MetricSpec, type PaginatedResponse$1 as PaginatedResponse, type PaginationInfo$1 as PaginationInfo, type PaginationQuery$1 as PaginationQuery, type ParamRecord, type ParamValue, type PipelineTrace, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, type QueryPanelSdkAPIOptions, QueryPipelineError, type RequestHandler, type RequestHandlerOptions, type RequestHandlerResult, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkDashboard, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type ValueFormat, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecGeneratorInput, type VizSpecKind, type VizSpecResponse, type VizSpecResult, anonymizeResults };
1913
+ export { ALL_VIZ_CHART_TYPES, type ActiveChartBulkGetResponse, type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, BigQueryAdapter, type BigQueryAdapterOptions, type BigQueryClientFn, type BigQueryQueryRequest, type BigQueryQueryResult, CallbackApiClient, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListOptions, type ChartModifyInput, type ChartModifyOptions, type ChartModifyResponse, type ChartSpec, type ChartType, type ChartUpdateInput, ClickHouseAdapter, type ClickHouseAdapterOptions, type ClickHouseClientFn, type ContextDocument, type DashboardCreateInput, type DashboardForkInput, type DashboardForkUpdateInput, type DashboardListOptions, type DashboardUpdateInput, type DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IQueryPanelApi, type IngestResponse, type IntentResult, type MetricEncoding, type MetricField, type MetricSpec, type PaginatedResponse$1 as PaginatedResponse, type PaginationInfo$1 as PaginationInfo, type PaginationQuery$1 as PaginationQuery, type ParamRecord, type ParamValue, type PipelineTrace, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, type QueryPanelSdkAPIOptions, QueryPipelineError, type RequestHandler, type RequestHandlerOptions, type RequestHandlerResult, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkDashboard, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type ValueFormat, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecGeneratorInput, type VizSpecKind, type VizSpecResponse, type VizSpecResult, anonymizeResults };
package/dist/index.js CHANGED
@@ -14,12 +14,6 @@ var BigQueryAdapter = class {
14
14
  );
15
15
  }
16
16
  }
17
- projectId;
18
- datasetProjectId;
19
- defaultDataset;
20
- databaseName;
21
- kind;
22
- allowedTables;
23
17
  async execute(sql, params) {
24
18
  if (this.allowedTables) {
25
19
  this.validateQueryTables(sql);
@@ -250,10 +244,6 @@ var ClickHouseAdapter = class {
250
244
  this.allowedTables = normalizeTableFilter2(options.allowedTables);
251
245
  }
252
246
  }
253
- databaseName;
254
- defaultFormat;
255
- kind;
256
- allowedTables;
257
247
  async execute(sql, params) {
258
248
  if (this.allowedTables) {
259
249
  this.validateQueryTables(sql);
@@ -466,10 +456,6 @@ var PostgresAdapter = class {
466
456
  );
467
457
  }
468
458
  }
469
- databaseName;
470
- defaultSchema;
471
- kind;
472
- allowedTables;
473
459
  async execute(sql, params) {
474
460
  if (this.allowedTables) {
475
461
  this.validateQueryTables(sql);
@@ -710,14 +696,8 @@ function sanitize2(value) {
710
696
  // src/core/client.ts
711
697
  import crypto from "crypto";
712
698
  var ApiClient = class {
713
- baseUrl;
714
- privateKey;
715
- organizationId;
716
- defaultTenantId;
717
- additionalHeaders;
718
- fetchImpl;
719
- cryptoKey = null;
720
699
  constructor(baseUrl, privateKey, organizationId, options) {
700
+ this.cryptoKey = null;
721
701
  if (!baseUrl) {
722
702
  throw new Error("Base URL is required");
723
703
  }
@@ -963,8 +943,6 @@ var ApiClient = class {
963
943
 
964
944
  // src/core/callback-client.ts
965
945
  var CallbackApiClient = class {
966
- requestHandler;
967
- defaultTenantId;
968
946
  constructor(requestHandler, options) {
969
947
  this.requestHandler = requestHandler;
970
948
  this.defaultTenantId = options?.defaultTenantId;
@@ -1068,9 +1046,10 @@ var CallbackApiClient = class {
1068
1046
 
1069
1047
  // src/core/query-engine.ts
1070
1048
  var QueryEngine = class {
1071
- databases = /* @__PURE__ */ new Map();
1072
- databaseMetadata = /* @__PURE__ */ new Map();
1073
- defaultDatabase;
1049
+ constructor() {
1050
+ this.databases = /* @__PURE__ */ new Map();
1051
+ this.databaseMetadata = /* @__PURE__ */ new Map();
1052
+ }
1074
1053
  attachDatabase(name, adapter, metadata) {
1075
1054
  this.databases.set(name, adapter);
1076
1055
  this.databaseMetadata.set(name, metadata);
@@ -1390,7 +1369,7 @@ async function listActiveCharts(client, queryEngine, options, signal) {
1390
1369
  params.set("limit", `${options.pagination.limit}`);
1391
1370
  if (options?.sortBy) params.set("sort_by", options.sortBy);
1392
1371
  if (options?.sortDir) params.set("sort_dir", options.sortDir);
1393
- if (options?.title) params.set("name", options.title);
1372
+ if (options?.title) params.set("title", options.title);
1394
1373
  if (options?.userFilter) params.set("user_id", options.userFilter);
1395
1374
  if (options?.createdFrom) params.set("created_from", options.createdFrom);
1396
1375
  if (options?.createdTo) params.set("created_to", options.createdTo);
@@ -1419,6 +1398,60 @@ async function listActiveCharts(client, queryEngine, options, signal) {
1419
1398
  }
1420
1399
  return response;
1421
1400
  }
1401
+ async function listAllActiveCharts(client, queryEngine, options, signal) {
1402
+ const tenantId = resolveTenantId2(client, options?.tenantId);
1403
+ const response = await client.get(
1404
+ "/active-charts/all",
1405
+ tenantId,
1406
+ options?.userId,
1407
+ options?.scopes,
1408
+ signal
1409
+ );
1410
+ if (options?.withData) {
1411
+ response.data = await Promise.all(
1412
+ response.data.map(async (active) => ({
1413
+ ...active,
1414
+ chart: active.chart ? await getChart(
1415
+ client,
1416
+ queryEngine,
1417
+ active.chart_id,
1418
+ options,
1419
+ signal
1420
+ ) : null
1421
+ }))
1422
+ );
1423
+ }
1424
+ return response.data;
1425
+ }
1426
+ async function getActiveChartsByIds(client, queryEngine, ids, options, signal) {
1427
+ const tenantId = resolveTenantId2(client, options?.tenantId);
1428
+ const params = new URLSearchParams();
1429
+ for (const id of ids) {
1430
+ params.append("ids", id);
1431
+ }
1432
+ const response = await client.get(
1433
+ `/active-charts/bulk${params.toString() ? `?${params.toString()}` : ""}`,
1434
+ tenantId,
1435
+ options?.userId,
1436
+ options?.scopes,
1437
+ signal
1438
+ );
1439
+ if (options?.withData) {
1440
+ response.data = await Promise.all(
1441
+ response.data.map(async (active) => ({
1442
+ ...active,
1443
+ chart: active.chart ? await getChart(
1444
+ client,
1445
+ queryEngine,
1446
+ active.chart_id,
1447
+ options,
1448
+ signal
1449
+ ) : null
1450
+ }))
1451
+ );
1452
+ }
1453
+ return response;
1454
+ }
1422
1455
  async function getActiveChart(client, queryEngine, id, options, signal) {
1423
1456
  const tenantId = resolveTenantId2(client, options?.tenantId);
1424
1457
  const active = await client.get(
@@ -1776,7 +1809,10 @@ async function ask(client, queryEngine, question, options, signal) {
1776
1809
  fields: execution.fields,
1777
1810
  rows: anonymizeResults(rows),
1778
1811
  max_retries: options.chartMaxRetries ?? 3,
1779
- query_id: queryResponse.data.queryId
1812
+ query_id: queryResponse.data.queryId,
1813
+ ...options.supportedChartTypes?.length ? {
1814
+ supported_chart_types: options.supportedChartTypes
1815
+ } : {}
1780
1816
  },
1781
1817
  tenantId,
1782
1818
  options.userId,
@@ -2117,7 +2153,8 @@ async function modifyChart(client, queryEngine, input, options, signal) {
2117
2153
  max_retries: options?.chartMaxRetries ?? 3,
2118
2154
  query_id: queryId,
2119
2155
  // Include viz hints for the chart generator
2120
- ...hasVizMods ? { encoding_hints: vizHintsForChart } : {}
2156
+ ...hasVizMods ? { encoding_hints: vizHintsForChart } : {},
2157
+ ...options?.supportedChartTypes?.length ? { supported_chart_types: options.supportedChartTypes } : {}
2121
2158
  },
2122
2159
  tenantId,
2123
2160
  options?.userId,
@@ -2264,7 +2301,8 @@ async function generateVizSpec(client, input, options, signal) {
2264
2301
  rows: input.rows,
2265
2302
  max_retries: options?.maxRetries ?? input.max_retries ?? 3,
2266
2303
  query_id: input.query_id,
2267
- encoding_hints: input.encoding_hints
2304
+ encoding_hints: input.encoding_hints,
2305
+ ...input.supported_chart_types?.length ? { supported_chart_types: input.supported_chart_types } : {}
2268
2306
  },
2269
2307
  tenantId,
2270
2308
  options?.userId,
@@ -2284,10 +2322,18 @@ function resolveTenantId8(client, tenantId) {
2284
2322
  return resolved;
2285
2323
  }
2286
2324
 
2325
+ // src/types/vizspec.ts
2326
+ var ALL_VIZ_CHART_TYPES = [
2327
+ "line",
2328
+ "bar",
2329
+ "column",
2330
+ "area",
2331
+ "scatter",
2332
+ "pie"
2333
+ ];
2334
+
2287
2335
  // src/index.ts
2288
2336
  var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2289
- client;
2290
- queryEngine;
2291
2337
  /**
2292
2338
  * @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
2293
2339
  */
@@ -2305,6 +2351,7 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2305
2351
  });
2306
2352
  }
2307
2353
  this.queryEngine = new QueryEngine();
2354
+ this.supportedChartTypes = options?.supportedChartTypes;
2308
2355
  }
2309
2356
  /**
2310
2357
  * Create an SDK instance that uses a request callback instead of HTTP.
@@ -2341,7 +2388,10 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2341
2388
  const api = new CallbackApiClient(requestHandler, {
2342
2389
  defaultTenantId: options?.defaultTenantId
2343
2390
  });
2344
- return new _QueryPanelSdkAPI("", "", workspaceId, { api });
2391
+ return new _QueryPanelSdkAPI("", "", workspaceId, {
2392
+ api,
2393
+ supportedChartTypes: options?.supportedChartTypes
2394
+ });
2345
2395
  }
2346
2396
  // Database attachment methods
2347
2397
  attachClickhouse(name, clientFn, options) {
@@ -2465,7 +2515,10 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2465
2515
  this.client,
2466
2516
  this.queryEngine,
2467
2517
  question,
2468
- options,
2518
+ {
2519
+ ...options,
2520
+ supportedChartTypes: options.supportedChartTypes ?? this.supportedChartTypes
2521
+ },
2469
2522
  signal
2470
2523
  );
2471
2524
  }
@@ -2537,7 +2590,10 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2537
2590
  async generateVizSpec(input, options, signal) {
2538
2591
  return await generateVizSpec(
2539
2592
  this.client,
2540
- input,
2593
+ {
2594
+ ...input,
2595
+ supported_chart_types: input.supported_chart_types ?? this.supportedChartTypes
2596
+ },
2541
2597
  options,
2542
2598
  signal
2543
2599
  );
@@ -2605,7 +2661,10 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2605
2661
  this.client,
2606
2662
  this.queryEngine,
2607
2663
  input,
2608
- options,
2664
+ options ? {
2665
+ ...options,
2666
+ supportedChartTypes: options.supportedChartTypes ?? this.supportedChartTypes
2667
+ } : this.supportedChartTypes ? { supportedChartTypes: this.supportedChartTypes } : void 0,
2609
2668
  signal
2610
2669
  );
2611
2670
  }
@@ -2884,6 +2943,29 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2884
2943
  signal
2885
2944
  );
2886
2945
  }
2946
+ /**
2947
+ * Lists all active charts without pagination.
2948
+ */
2949
+ async listAllActiveCharts(options, signal) {
2950
+ return await listAllActiveCharts(
2951
+ this.client,
2952
+ this.queryEngine,
2953
+ options,
2954
+ signal
2955
+ );
2956
+ }
2957
+ /**
2958
+ * Bulk gets active charts by IDs.
2959
+ */
2960
+ async getActiveChartsByIds(ids, options, signal) {
2961
+ return await getActiveChartsByIds(
2962
+ this.client,
2963
+ this.queryEngine,
2964
+ ids,
2965
+ options,
2966
+ signal
2967
+ );
2968
+ }
2887
2969
  /**
2888
2970
  * Retrieves a single active chart by ID.
2889
2971
  *
@@ -3243,6 +3325,7 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
3243
3325
  }
3244
3326
  };
3245
3327
  export {
3328
+ ALL_VIZ_CHART_TYPES,
3246
3329
  BigQueryAdapter,
3247
3330
  CallbackApiClient,
3248
3331
  ClickHouseAdapter,