@querypanel/node-sdk 1.2.4 → 1.2.6

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
@@ -395,6 +395,12 @@ interface ChartListOptions {
395
395
  updatedTo?: string;
396
396
  includeData?: boolean;
397
397
  }
398
+ /** Options for bulk chart fetch (`GET /charts/bulk`) — no pagination. */
399
+ type ChartListAllOptions = Omit<ChartListOptions, "pagination">;
400
+ interface ChartBulkGetResponse {
401
+ data: SdkChart[];
402
+ missingIds: string[];
403
+ }
398
404
 
399
405
  interface SdkActiveChart {
400
406
  id: string;
@@ -1412,6 +1418,14 @@ declare class QueryPanelSdkAPI {
1412
1418
  * ```
1413
1419
  */
1414
1420
  listCharts(options?: ChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkChart>>;
1421
+ /**
1422
+ * Lists saved charts via `GET /charts/all` (same query, filters, and pagination as {@link listCharts}).
1423
+ */
1424
+ listAllCharts(options?: ChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkChart>>;
1425
+ /**
1426
+ * Bulk gets saved charts by chart IDs (`GET /charts/bulk` with `ids` query params).
1427
+ */
1428
+ getChartsByIds(ids: string[], options?: ChartListAllOptions, signal?: AbortSignal): Promise<ChartBulkGetResponse>;
1415
1429
  /**
1416
1430
  * Lists query sessions with pagination and filtering.
1417
1431
  *
@@ -1910,4 +1924,4 @@ declare class QueryPanelSdkAPI {
1910
1924
  }, signal?: AbortSignal): Promise<SdkDashboard[]>;
1911
1925
  }
1912
1926
 
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 };
1927
+ 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 ChartBulkGetResponse, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListAllOptions, 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
@@ -395,6 +395,12 @@ interface ChartListOptions {
395
395
  updatedTo?: string;
396
396
  includeData?: boolean;
397
397
  }
398
+ /** Options for bulk chart fetch (`GET /charts/bulk`) — no pagination. */
399
+ type ChartListAllOptions = Omit<ChartListOptions, "pagination">;
400
+ interface ChartBulkGetResponse {
401
+ data: SdkChart[];
402
+ missingIds: string[];
403
+ }
398
404
 
399
405
  interface SdkActiveChart {
400
406
  id: string;
@@ -1412,6 +1418,14 @@ declare class QueryPanelSdkAPI {
1412
1418
  * ```
1413
1419
  */
1414
1420
  listCharts(options?: ChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkChart>>;
1421
+ /**
1422
+ * Lists saved charts via `GET /charts/all` (same query, filters, and pagination as {@link listCharts}).
1423
+ */
1424
+ listAllCharts(options?: ChartListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkChart>>;
1425
+ /**
1426
+ * Bulk gets saved charts by chart IDs (`GET /charts/bulk` with `ids` query params).
1427
+ */
1428
+ getChartsByIds(ids: string[], options?: ChartListAllOptions, signal?: AbortSignal): Promise<ChartBulkGetResponse>;
1415
1429
  /**
1416
1430
  * Lists query sessions with pagination and filtering.
1417
1431
  *
@@ -1910,4 +1924,4 @@ declare class QueryPanelSdkAPI {
1910
1924
  }, signal?: AbortSignal): Promise<SdkDashboard[]>;
1911
1925
  }
1912
1926
 
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 };
1927
+ 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 ChartBulkGetResponse, type ChartCreateInput, type ChartEncoding, type ChartEnvelope, type ChartListAllOptions, 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
@@ -1261,6 +1261,61 @@ async function listCharts(client, queryEngine, options, signal) {
1261
1261
  }
1262
1262
  return response;
1263
1263
  }
1264
+ async function listAllCharts(client, queryEngine, options, signal) {
1265
+ const tenantId = resolveTenantId(client, options?.tenantId);
1266
+ const params = new URLSearchParams();
1267
+ if (options?.pagination?.page)
1268
+ params.set("page", `${options.pagination.page}`);
1269
+ if (options?.pagination?.limit)
1270
+ params.set("limit", `${options.pagination.limit}`);
1271
+ if (options?.sortBy) params.set("sort_by", options.sortBy);
1272
+ if (options?.sortDir) params.set("sort_dir", options.sortDir);
1273
+ if (options?.title) params.set("title", options.title);
1274
+ if (options?.userFilter) params.set("user_id", options.userFilter);
1275
+ if (options?.createdFrom) params.set("created_from", options.createdFrom);
1276
+ if (options?.createdTo) params.set("created_to", options.createdTo);
1277
+ if (options?.updatedFrom) params.set("updated_from", options.updatedFrom);
1278
+ if (options?.updatedTo) params.set("updated_to", options.updatedTo);
1279
+ const response = await client.get(
1280
+ `/charts/all${params.toString() ? `?${params.toString()}` : ""}`,
1281
+ tenantId,
1282
+ options?.userId,
1283
+ options?.scopes,
1284
+ signal
1285
+ );
1286
+ if (options?.includeData) {
1287
+ response.data = await Promise.all(
1288
+ response.data.map(async (chart) => {
1289
+ const rows = await executeChartQuery(queryEngine, chart, tenantId);
1290
+ return hydrateChartWithData(chart, rows);
1291
+ })
1292
+ );
1293
+ }
1294
+ return response;
1295
+ }
1296
+ async function getChartsByIds(client, queryEngine, ids, options, signal) {
1297
+ const tenantId = resolveTenantId(client, options?.tenantId);
1298
+ const params = new URLSearchParams();
1299
+ for (const id of ids) {
1300
+ params.append("ids", id);
1301
+ }
1302
+ const response = await client.get(
1303
+ `/charts/bulk${params.toString() ? `?${params.toString()}` : ""}`,
1304
+ tenantId,
1305
+ options?.userId,
1306
+ options?.scopes,
1307
+ signal
1308
+ );
1309
+ if (options?.includeData) {
1310
+ response.data = await Promise.all(
1311
+ response.data.map(async (chart) => {
1312
+ const rows = await executeChartQuery(queryEngine, chart, tenantId);
1313
+ return hydrateChartWithData(chart, rows);
1314
+ })
1315
+ );
1316
+ }
1317
+ return response;
1318
+ }
1264
1319
  async function getChart(client, queryEngine, id, options, signal) {
1265
1320
  const tenantId = resolveTenantId(client, options?.tenantId);
1266
1321
  const chart = await client.get(
@@ -2728,6 +2783,29 @@ var QueryPanelSdkAPI = class _QueryPanelSdkAPI {
2728
2783
  signal
2729
2784
  );
2730
2785
  }
2786
+ /**
2787
+ * Lists saved charts via `GET /charts/all` (same query, filters, and pagination as {@link listCharts}).
2788
+ */
2789
+ async listAllCharts(options, signal) {
2790
+ return await listAllCharts(
2791
+ this.client,
2792
+ this.queryEngine,
2793
+ options,
2794
+ signal
2795
+ );
2796
+ }
2797
+ /**
2798
+ * Bulk gets saved charts by chart IDs (`GET /charts/bulk` with `ids` query params).
2799
+ */
2800
+ async getChartsByIds(ids, options, signal) {
2801
+ return await getChartsByIds(
2802
+ this.client,
2803
+ this.queryEngine,
2804
+ ids,
2805
+ options,
2806
+ signal
2807
+ );
2808
+ }
2731
2809
  // Session history CRUD operations
2732
2810
  /**
2733
2811
  * Lists query sessions with pagination and filtering.