@querypanel/node-sdk 1.2.3 → 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.cjs +83 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +83 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
@@ -1594,6 +1598,14 @@ declare class QueryPanelSdkAPI {
|
|
|
1594
1598
|
* ```
|
|
1595
1599
|
*/
|
|
1596
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>;
|
|
1597
1609
|
/**
|
|
1598
1610
|
* Retrieves a single active chart by ID.
|
|
1599
1611
|
*
|
|
@@ -1898,4 +1910,4 @@ declare class QueryPanelSdkAPI {
|
|
|
1898
1910
|
}, signal?: AbortSignal): Promise<SdkDashboard[]>;
|
|
1899
1911
|
}
|
|
1900
1912
|
|
|
1901
|
-
export { ALL_VIZ_CHART_TYPES, 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
|
|
@@ -1594,6 +1598,14 @@ declare class QueryPanelSdkAPI {
|
|
|
1594
1598
|
* ```
|
|
1595
1599
|
*/
|
|
1596
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>;
|
|
1597
1609
|
/**
|
|
1598
1610
|
* Retrieves a single active chart by ID.
|
|
1599
1611
|
*
|
|
@@ -1898,4 +1910,4 @@ declare class QueryPanelSdkAPI {
|
|
|
1898
1910
|
}, signal?: AbortSignal): Promise<SdkDashboard[]>;
|
|
1899
1911
|
}
|
|
1900
1912
|
|
|
1901
|
-
export { ALL_VIZ_CHART_TYPES, 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
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
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("
|
|
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(
|
|
@@ -2301,9 +2334,6 @@ var ALL_VIZ_CHART_TYPES = [
|
|
|
2301
2334
|
|
|
2302
2335
|
// src/index.ts
|
|
2303
2336
|
var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
|
|
2304
|
-
client;
|
|
2305
|
-
queryEngine;
|
|
2306
|
-
supportedChartTypes;
|
|
2307
2337
|
/**
|
|
2308
2338
|
* @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
|
|
2309
2339
|
*/
|
|
@@ -2913,6 +2943,29 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
|
|
|
2913
2943
|
signal
|
|
2914
2944
|
);
|
|
2915
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
|
+
}
|
|
2916
2969
|
/**
|
|
2917
2970
|
* Retrieves a single active chart by ID.
|
|
2918
2971
|
*
|