@querypanel/node-sdk 1.0.49 → 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.d.cts CHANGED
@@ -369,7 +369,7 @@ interface VizSpecBase {
369
369
  };
370
370
  }
371
371
  type VizSpecKind = VizSpecBase["kind"];
372
- type ChartType = 'line' | 'bar' | 'area' | 'scatter' | 'pie';
372
+ type ChartType = 'line' | 'bar' | 'column' | 'area' | 'scatter' | 'pie';
373
373
  type StackingMode = 'none' | 'stacked' | 'percent';
374
374
  interface ChartEncoding {
375
375
  chartType: ChartType;
@@ -416,6 +416,50 @@ interface MetricSpec extends VizSpecBase {
416
416
  encoding: MetricEncoding;
417
417
  }
418
418
  type VizSpec = ChartSpec | TableSpec | MetricSpec;
419
+ /**
420
+ * Encoding hints for vizspec modifications.
421
+ * These hints guide the LLM to generate specific visualization configurations.
422
+ */
423
+ interface EncodingHints {
424
+ /** Preferred vizspec kind (chart, table, metric) */
425
+ kind?: 'chart' | 'table' | 'metric';
426
+ /** Preferred chart type (bar, line, area, scatter, pie) */
427
+ chartType?: ChartType;
428
+ /** X axis field configuration */
429
+ xAxis?: AxisField;
430
+ /** Y axis field configuration (single or multiple) */
431
+ yAxis?: AxisField | AxisField[];
432
+ /** Series/color field for multi-series charts */
433
+ series?: FieldRef;
434
+ /** Stacking mode for multi-series */
435
+ stacking?: StackingMode;
436
+ /** Maximum rows to display */
437
+ limit?: number;
438
+ }
439
+ /**
440
+ * Input for vizspec generator service
441
+ */
442
+ interface VizSpecGeneratorInput {
443
+ question: string;
444
+ sql: string;
445
+ rationale?: string;
446
+ fields: string[];
447
+ rows: Array<Record<string, unknown>>;
448
+ maxRetries?: number;
449
+ queryId?: string;
450
+ /**
451
+ * Optional encoding hints for visualization modification.
452
+ * When provided, these guide the LLM to generate specific visualization configurations.
453
+ */
454
+ encodingHints?: EncodingHints;
455
+ }
456
+ /**
457
+ * Output from vizspec generator service
458
+ */
459
+ interface VizSpecResult {
460
+ spec: VizSpec;
461
+ notes: string | null;
462
+ }
419
463
 
420
464
  /**
421
465
  * Context document returned by the query pipeline.
@@ -753,6 +797,11 @@ interface VizSpecGenerateInput {
753
797
  rows: Array<Record<string, unknown>>;
754
798
  max_retries?: number;
755
799
  query_id?: string;
800
+ /**
801
+ * Optional encoding hints for visualization modification.
802
+ * When provided, these guide the LLM to generate specific visualization configurations.
803
+ */
804
+ encoding_hints?: EncodingHints;
756
805
  }
757
806
  interface VizSpecGenerateOptions {
758
807
  tenantId?: string;
@@ -1234,4 +1283,4 @@ declare class QueryPanelSdkAPI {
1234
1283
  }, signal?: AbortSignal): Promise<void>;
1235
1284
  }
1236
1285
 
1237
- export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, 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 DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type FieldRef, type FieldRefInput, type FieldType, type IngestResponse, 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, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, QueryPipelineError, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecResponse, anonymizeResults };
1286
+ export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, 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 DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IngestResponse, 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, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, QueryPipelineError, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, 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
@@ -369,7 +369,7 @@ interface VizSpecBase {
369
369
  };
370
370
  }
371
371
  type VizSpecKind = VizSpecBase["kind"];
372
- type ChartType = 'line' | 'bar' | 'area' | 'scatter' | 'pie';
372
+ type ChartType = 'line' | 'bar' | 'column' | 'area' | 'scatter' | 'pie';
373
373
  type StackingMode = 'none' | 'stacked' | 'percent';
374
374
  interface ChartEncoding {
375
375
  chartType: ChartType;
@@ -416,6 +416,50 @@ interface MetricSpec extends VizSpecBase {
416
416
  encoding: MetricEncoding;
417
417
  }
418
418
  type VizSpec = ChartSpec | TableSpec | MetricSpec;
419
+ /**
420
+ * Encoding hints for vizspec modifications.
421
+ * These hints guide the LLM to generate specific visualization configurations.
422
+ */
423
+ interface EncodingHints {
424
+ /** Preferred vizspec kind (chart, table, metric) */
425
+ kind?: 'chart' | 'table' | 'metric';
426
+ /** Preferred chart type (bar, line, area, scatter, pie) */
427
+ chartType?: ChartType;
428
+ /** X axis field configuration */
429
+ xAxis?: AxisField;
430
+ /** Y axis field configuration (single or multiple) */
431
+ yAxis?: AxisField | AxisField[];
432
+ /** Series/color field for multi-series charts */
433
+ series?: FieldRef;
434
+ /** Stacking mode for multi-series */
435
+ stacking?: StackingMode;
436
+ /** Maximum rows to display */
437
+ limit?: number;
438
+ }
439
+ /**
440
+ * Input for vizspec generator service
441
+ */
442
+ interface VizSpecGeneratorInput {
443
+ question: string;
444
+ sql: string;
445
+ rationale?: string;
446
+ fields: string[];
447
+ rows: Array<Record<string, unknown>>;
448
+ maxRetries?: number;
449
+ queryId?: string;
450
+ /**
451
+ * Optional encoding hints for visualization modification.
452
+ * When provided, these guide the LLM to generate specific visualization configurations.
453
+ */
454
+ encodingHints?: EncodingHints;
455
+ }
456
+ /**
457
+ * Output from vizspec generator service
458
+ */
459
+ interface VizSpecResult {
460
+ spec: VizSpec;
461
+ notes: string | null;
462
+ }
419
463
 
420
464
  /**
421
465
  * Context document returned by the query pipeline.
@@ -753,6 +797,11 @@ interface VizSpecGenerateInput {
753
797
  rows: Array<Record<string, unknown>>;
754
798
  max_retries?: number;
755
799
  query_id?: string;
800
+ /**
801
+ * Optional encoding hints for visualization modification.
802
+ * When provided, these guide the LLM to generate specific visualization configurations.
803
+ */
804
+ encoding_hints?: EncodingHints;
756
805
  }
757
806
  interface VizSpecGenerateOptions {
758
807
  tenantId?: string;
@@ -1234,4 +1283,4 @@ declare class QueryPanelSdkAPI {
1234
1283
  }, signal?: AbortSignal): Promise<void>;
1235
1284
  }
1236
1285
 
1237
- export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, 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 DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type FieldRef, type FieldRefInput, type FieldType, type IngestResponse, 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, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, QueryPipelineError, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, type SdkSession, type SdkSessionTurn, type SessionGetOptions, type SessionListOptions, type SessionUpdateInput, type SqlModifications, type StackingMode, type TableColumn, type TableEncoding, type TableSpec, type TimeUnit, type VizModifications, type VizSpec, type VizSpecGenerateInput, type VizSpecGenerateOptions, type VizSpecResponse, anonymizeResults };
1286
+ export { type ActiveChartCreateInput, type ActiveChartListOptions, type ActiveChartUpdateInput, type AggregateOp, type AskOptions, type AskResponse, type AxisField, type AxisFieldInput, 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 DatabaseAdapter, type DatabaseDialect, type DateRangeInput, type EncodingHints, type FieldRef, type FieldRefInput, type FieldType, type IngestResponse, 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, PostgresAdapter, type PostgresAdapterOptions, type PostgresClientFn, QueryErrorCode, QueryErrorCode as QueryErrorCodeType, QueryPanelSdkAPI, QueryPipelineError, type SchemaIntrospection, type SchemaSyncOptions, type SdkActiveChart, type SdkChart, 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
@@ -1701,7 +1701,8 @@ async function generateVizSpec(client, input, options, signal) {
1701
1701
  fields: input.fields,
1702
1702
  rows: input.rows,
1703
1703
  max_retries: options?.maxRetries ?? input.max_retries ?? 3,
1704
- query_id: input.query_id
1704
+ query_id: input.query_id,
1705
+ encoding_hints: input.encoding_hints
1705
1706
  },
1706
1707
  tenantId,
1707
1708
  options?.userId,