@querypanel/node-sdk 1.0.54 → 1.0.56
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/README.md +9 -1
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -191,8 +191,8 @@ type QueryErrorCode = (typeof QueryErrorCode)[keyof typeof QueryErrorCode];
|
|
|
191
191
|
*/
|
|
192
192
|
declare class QueryPipelineError extends Error {
|
|
193
193
|
readonly code: QueryErrorCode;
|
|
194
|
-
readonly details?: Record<string, unknown
|
|
195
|
-
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown>);
|
|
194
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
195
|
+
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown> | undefined);
|
|
196
196
|
/**
|
|
197
197
|
* Check if this is a moderation error
|
|
198
198
|
*/
|
|
@@ -741,6 +741,8 @@ interface ChartModifyOptions {
|
|
|
741
741
|
* QueryPanel session ID for context-aware follow-ups.
|
|
742
742
|
* Pass the querypanelSessionId from a previous ask() response
|
|
743
743
|
* to preserve conversation history when modifying charts.
|
|
744
|
+
* If omitted, modifyChart starts a new QueryPanel session and sends
|
|
745
|
+
* the original question with modification hints.
|
|
744
746
|
*/
|
|
745
747
|
querypanelSessionId?: string;
|
|
746
748
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -191,8 +191,8 @@ type QueryErrorCode = (typeof QueryErrorCode)[keyof typeof QueryErrorCode];
|
|
|
191
191
|
*/
|
|
192
192
|
declare class QueryPipelineError extends Error {
|
|
193
193
|
readonly code: QueryErrorCode;
|
|
194
|
-
readonly details?: Record<string, unknown
|
|
195
|
-
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown>);
|
|
194
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
195
|
+
constructor(message: string, code: QueryErrorCode, details?: Record<string, unknown> | undefined);
|
|
196
196
|
/**
|
|
197
197
|
* Check if this is a moderation error
|
|
198
198
|
*/
|
|
@@ -741,6 +741,8 @@ interface ChartModifyOptions {
|
|
|
741
741
|
* QueryPanel session ID for context-aware follow-ups.
|
|
742
742
|
* Pass the querypanelSessionId from a previous ask() response
|
|
743
743
|
* to preserve conversation history when modifying charts.
|
|
744
|
+
* If omitted, modifyChart starts a new QueryPanel session and sends
|
|
745
|
+
* the original question with modification hints.
|
|
744
746
|
*/
|
|
745
747
|
querypanelSessionId?: string;
|
|
746
748
|
}
|
package/dist/index.js
CHANGED
|
@@ -1414,7 +1414,7 @@ function anonymizeResults(rows) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
|
|
1416
1416
|
// src/routes/modify.ts
|
|
1417
|
-
function buildModifiedQuestion(originalQuestion, modifications, pipeline) {
|
|
1417
|
+
function buildModifiedQuestion(originalQuestion, modifications, pipeline, hasSessionContext = false) {
|
|
1418
1418
|
const hints = [];
|
|
1419
1419
|
if (modifications.timeGranularity) {
|
|
1420
1420
|
hints.push(`group results by ${modifications.timeGranularity}`);
|
|
@@ -1449,6 +1449,9 @@ function buildModifiedQuestion(originalQuestion, modifications, pipeline) {
|
|
|
1449
1449
|
if (hints.length === 0) {
|
|
1450
1450
|
return originalQuestion;
|
|
1451
1451
|
}
|
|
1452
|
+
if (pipeline === "v2" && hasSessionContext) {
|
|
1453
|
+
return hints.join(", ");
|
|
1454
|
+
}
|
|
1452
1455
|
return `${originalQuestion} (${hints.join(", ")})`;
|
|
1453
1456
|
}
|
|
1454
1457
|
var START_PARAM_KEY_REGEX = /(^|_)(start|from)(_|$)/i;
|
|
@@ -1557,6 +1560,7 @@ async function modifyChart(client, queryEngine, input, options, signal) {
|
|
|
1557
1560
|
const tenantId = resolveTenantId5(client, options?.tenantId);
|
|
1558
1561
|
const sessionId = crypto4.randomUUID();
|
|
1559
1562
|
const querypanelSessionId = options?.querypanelSessionId ?? sessionId;
|
|
1563
|
+
const hasQuerypanelSessionContext = !!options?.querypanelSessionId;
|
|
1560
1564
|
const chartType = options?.chartType ?? "vega-lite";
|
|
1561
1565
|
const hasSqlMods = !!input.sqlModifications;
|
|
1562
1566
|
const hasVizMods = !!input.vizModifications;
|
|
@@ -1593,7 +1597,8 @@ async function modifyChart(client, queryEngine, input, options, signal) {
|
|
|
1593
1597
|
const modifiedQuestion = buildModifiedQuestion(
|
|
1594
1598
|
input.question,
|
|
1595
1599
|
input.sqlModifications,
|
|
1596
|
-
options?.pipeline
|
|
1600
|
+
options?.pipeline,
|
|
1601
|
+
hasQuerypanelSessionContext
|
|
1597
1602
|
);
|
|
1598
1603
|
if (options?.pipeline === "v2") {
|
|
1599
1604
|
finalQuestion = modifiedQuestion;
|