@querypanel/node-sdk 1.0.56 → 1.0.58
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 +15 -2
- package/dist/index.cjs +917 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +534 -9
- package/dist/index.d.ts +534 -9
- package/dist/index.js +915 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -37,7 +37,7 @@ interface IntrospectOptions {
|
|
|
37
37
|
tables?: string[];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
type DatabaseDialect = "clickhouse" | "postgres" | "mysql";
|
|
40
|
+
type DatabaseDialect = "bigquery" | "clickhouse" | "postgres" | "mysql";
|
|
41
41
|
interface DatabaseExecutionResult {
|
|
42
42
|
fields: string[];
|
|
43
43
|
rows: Array<Record<string, unknown>>;
|
|
@@ -74,6 +74,70 @@ interface DatabaseAdapter {
|
|
|
74
74
|
close?(): Promise<void>;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Request passed to BigQueryClientFn.
|
|
79
|
+
* dryRun: when true, the client should run the query as a dry run (validation only, no execution).
|
|
80
|
+
*/
|
|
81
|
+
interface BigQueryQueryRequest {
|
|
82
|
+
query: string;
|
|
83
|
+
params?: Record<string, string | number | boolean | string[] | number[]>;
|
|
84
|
+
/** When true, validate the query without executing (e.g. BigQuery dry run). */
|
|
85
|
+
dryRun?: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface BigQueryQueryResult {
|
|
88
|
+
rows: Array<Record<string, unknown>>;
|
|
89
|
+
fields: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Client function for the BigQuery adapter.
|
|
93
|
+
* Implement using @google-cloud/bigquery: createQueryJob with dryRun for validation, getQueryResults for execute.
|
|
94
|
+
*/
|
|
95
|
+
type BigQueryClientFn = (request: BigQueryQueryRequest) => Promise<BigQueryQueryResult>;
|
|
96
|
+
interface BigQueryAdapterOptions {
|
|
97
|
+
/** GCP project ID. Used for INFORMATION_SCHEMA queries. */
|
|
98
|
+
projectId: string;
|
|
99
|
+
/** Optional project that owns the dataset. Defaults to projectId. */
|
|
100
|
+
datasetProjectId?: string;
|
|
101
|
+
/** Default dataset (schema) name. Used for introspection and unqualified table names. */
|
|
102
|
+
dataset: string;
|
|
103
|
+
/** Optional location for the dataset (e.g. "US", "EU"). */
|
|
104
|
+
location?: string;
|
|
105
|
+
/** Logical database name used in introspection metadata. */
|
|
106
|
+
database?: string;
|
|
107
|
+
/** Optional database kind label. Defaults to "bigquery". */
|
|
108
|
+
kind?: SchemaIntrospection["db"]["kind"];
|
|
109
|
+
/**
|
|
110
|
+
* Optional allow-list of table names (dataset.table or bare table name).
|
|
111
|
+
* When specified, introspection and queries are restricted to these tables only.
|
|
112
|
+
*/
|
|
113
|
+
allowedTables?: string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* BigQuery adapter following the same pattern as PostgresAdapter and ClickHouseAdapter.
|
|
117
|
+
* - execute: runs the query via the client function.
|
|
118
|
+
* - validate: uses dry run (no EXPLAIN in BigQuery) to validate SQL without executing.
|
|
119
|
+
* - introspect: uses INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS.
|
|
120
|
+
*/
|
|
121
|
+
declare class BigQueryAdapter implements DatabaseAdapter {
|
|
122
|
+
private readonly clientFn;
|
|
123
|
+
private readonly projectId;
|
|
124
|
+
private readonly datasetProjectId;
|
|
125
|
+
private readonly defaultDataset;
|
|
126
|
+
private readonly databaseName;
|
|
127
|
+
private readonly kind;
|
|
128
|
+
private readonly allowedTables?;
|
|
129
|
+
constructor(clientFn: BigQueryClientFn, options: BigQueryAdapterOptions);
|
|
130
|
+
execute(sql: string, params?: Record<string, string | number | boolean | string[] | number[]>): Promise<DatabaseExecutionResult>;
|
|
131
|
+
validate(sql: string, params?: Record<string, string | number | boolean | string[] | number[]>): Promise<void>;
|
|
132
|
+
getDialect(): "bigquery";
|
|
133
|
+
/**
|
|
134
|
+
* Introspect using BigQuery INFORMATION_SCHEMA (TABLES and COLUMNS).
|
|
135
|
+
* Restricts to the default dataset (or allowedTables) and returns tables/columns only.
|
|
136
|
+
*/
|
|
137
|
+
introspect(options?: IntrospectOptions): Promise<SchemaIntrospection>;
|
|
138
|
+
private validateQueryTables;
|
|
139
|
+
}
|
|
140
|
+
|
|
77
141
|
interface ClickHouseAdapterOptions {
|
|
78
142
|
/** Optional logical database name used in introspection metadata. */
|
|
79
143
|
database?: string;
|
|
@@ -156,8 +220,11 @@ declare class PostgresAdapter implements DatabaseAdapter {
|
|
|
156
220
|
execute(sql: string, params?: Record<string, string | number | boolean | string[] | number[]>): Promise<DatabaseExecutionResult>;
|
|
157
221
|
private validateQueryTables;
|
|
158
222
|
/**
|
|
159
|
-
* Convert
|
|
160
|
-
* PostgreSQL expects $1, $2, $3 in SQL and an array of values [val1, val2, val3]
|
|
223
|
+
* Convert params to positional array for PostgreSQL.
|
|
224
|
+
* PostgreSQL expects $1, $2, $3 in SQL and an array of values [val1, val2, val3].
|
|
225
|
+
* When the record has numeric keys ("1", "2", "3") — e.g. from mapGeneratedParams —
|
|
226
|
+
* use only those in order so placeholder order matches SQL. Otherwise fall back to
|
|
227
|
+
* named keys in alphabetical order for backward compatibility.
|
|
161
228
|
*/
|
|
162
229
|
private convertNamedToPositionalParams;
|
|
163
230
|
validate(sql: string, params?: Record<string, string | number | boolean | string[] | number[]>): Promise<void>;
|
|
@@ -169,6 +236,46 @@ declare class PostgresAdapter implements DatabaseAdapter {
|
|
|
169
236
|
introspect(options?: IntrospectOptions): Promise<SchemaIntrospection>;
|
|
170
237
|
}
|
|
171
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Interface for the API layer used by route modules.
|
|
241
|
+
* Implemented by ApiClient (HTTP to querypanel-sdk) and CallbackApiClient (in-process callbacks).
|
|
242
|
+
* Allows the SDK to be used inside your own API without HTTP recursion by providing a callback-based implementation.
|
|
243
|
+
*/
|
|
244
|
+
interface IQueryPanelApi {
|
|
245
|
+
getDefaultTenantId(): string | undefined;
|
|
246
|
+
get<T>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
247
|
+
post<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
248
|
+
postWithHeaders<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<{
|
|
249
|
+
data: T;
|
|
250
|
+
headers: Headers;
|
|
251
|
+
}>;
|
|
252
|
+
put<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
253
|
+
patch<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
254
|
+
delete<T = void>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Options passed to the request handler when using the callback-based API.
|
|
258
|
+
* Use this when you run the SDK inside your own API and want to handle "API" calls in-process (e.g. call querypanel-sdk services directly) to avoid recursion.
|
|
259
|
+
*/
|
|
260
|
+
interface RequestHandlerOptions {
|
|
261
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
262
|
+
path: string;
|
|
263
|
+
body?: unknown;
|
|
264
|
+
tenantId: string;
|
|
265
|
+
userId?: string;
|
|
266
|
+
scopes?: string[];
|
|
267
|
+
signal?: AbortSignal;
|
|
268
|
+
sessionId?: string;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Result from the request handler. Return `headers` for POST requests to paths like `/query` or `/v2/query` when the SDK needs to read response headers (e.g. x-querypanel-session-id).
|
|
272
|
+
*/
|
|
273
|
+
interface RequestHandlerResult {
|
|
274
|
+
data: unknown;
|
|
275
|
+
headers?: Headers;
|
|
276
|
+
}
|
|
277
|
+
type RequestHandler = (opts: RequestHandlerOptions) => Promise<RequestHandlerResult>;
|
|
278
|
+
|
|
172
279
|
/**
|
|
173
280
|
* Error codes for the query pipeline
|
|
174
281
|
* These match the server-side error codes returned in API responses
|
|
@@ -315,6 +422,78 @@ interface ActiveChartListOptions extends ChartListOptions {
|
|
|
315
422
|
withData?: boolean;
|
|
316
423
|
}
|
|
317
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Dashboard interface matching querypanel-sdk schema
|
|
427
|
+
*/
|
|
428
|
+
interface SdkDashboard {
|
|
429
|
+
id: string;
|
|
430
|
+
organization_id: string;
|
|
431
|
+
name: string;
|
|
432
|
+
description: string | null;
|
|
433
|
+
status: "draft" | "deployed";
|
|
434
|
+
content_json: string | null;
|
|
435
|
+
widget_config: Record<string, unknown> | null;
|
|
436
|
+
editor_type: "blocknote" | "custom";
|
|
437
|
+
is_customer_fork: boolean;
|
|
438
|
+
forked_from_dashboard_id: string | null;
|
|
439
|
+
tenant_id: string | null;
|
|
440
|
+
datasource_id: string | null;
|
|
441
|
+
version: number;
|
|
442
|
+
deployed_at: string | null;
|
|
443
|
+
created_at: string;
|
|
444
|
+
updated_at: string;
|
|
445
|
+
created_by: string | null;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Dashboard creation input
|
|
449
|
+
*/
|
|
450
|
+
interface DashboardCreateInput {
|
|
451
|
+
name: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
content_json?: string;
|
|
454
|
+
widget_config?: Record<string, unknown>;
|
|
455
|
+
editor_type?: "blocknote" | "custom";
|
|
456
|
+
datasource_id?: string;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Dashboard update input
|
|
460
|
+
*/
|
|
461
|
+
interface DashboardUpdateInput {
|
|
462
|
+
name?: string;
|
|
463
|
+
description?: string;
|
|
464
|
+
content_json?: string;
|
|
465
|
+
widget_config?: Record<string, unknown>;
|
|
466
|
+
editor_type?: "blocknote" | "custom";
|
|
467
|
+
datasource_id?: string | null;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Dashboard list options
|
|
471
|
+
*/
|
|
472
|
+
interface DashboardListOptions {
|
|
473
|
+
tenantId?: string;
|
|
474
|
+
userId?: string;
|
|
475
|
+
scopes?: string[];
|
|
476
|
+
pagination?: PaginationQuery$1;
|
|
477
|
+
status?: "draft" | "deployed";
|
|
478
|
+
sortBy?: "name" | "created_at" | "updated_at" | "deployed_at";
|
|
479
|
+
sortDir?: "asc" | "desc";
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Fork dashboard input
|
|
483
|
+
*/
|
|
484
|
+
interface DashboardForkInput {
|
|
485
|
+
tenant_id: string;
|
|
486
|
+
name?: string;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Fork update input
|
|
490
|
+
*/
|
|
491
|
+
interface DashboardForkUpdateInput {
|
|
492
|
+
tenant_id: string;
|
|
493
|
+
content_json?: string;
|
|
494
|
+
widget_config?: Record<string, unknown>;
|
|
495
|
+
}
|
|
496
|
+
|
|
318
497
|
interface IngestResponse {
|
|
319
498
|
success: boolean;
|
|
320
499
|
message: string;
|
|
@@ -525,6 +704,10 @@ interface AskOptions {
|
|
|
525
704
|
* - "v2": Improved pipeline with intent planning, hybrid retrieval, schema linking, and SQL reflection
|
|
526
705
|
*/
|
|
527
706
|
pipeline?: "v1" | "v2";
|
|
707
|
+
/**
|
|
708
|
+
* Optional OpenAI model id for v2 SQL generation. Omit to use server default.
|
|
709
|
+
*/
|
|
710
|
+
model?: string;
|
|
528
711
|
}
|
|
529
712
|
/**
|
|
530
713
|
* Intent analysis result from the v2 pipeline.
|
|
@@ -871,19 +1054,87 @@ interface VizSpecResponse {
|
|
|
871
1054
|
notes: string | null;
|
|
872
1055
|
}
|
|
873
1056
|
|
|
1057
|
+
/**
|
|
1058
|
+
* API client that delegates every request to a callback instead of HTTP.
|
|
1059
|
+
* Use this when running the SDK inside your own API so that "API" calls are handled in-process (e.g. by calling querypanel-sdk services directly) and do not cause recursion.
|
|
1060
|
+
*/
|
|
1061
|
+
declare class CallbackApiClient implements IQueryPanelApi {
|
|
1062
|
+
private readonly requestHandler;
|
|
1063
|
+
private readonly defaultTenantId?;
|
|
1064
|
+
constructor(requestHandler: RequestHandler, options?: {
|
|
1065
|
+
defaultTenantId?: string;
|
|
1066
|
+
});
|
|
1067
|
+
getDefaultTenantId(): string | undefined;
|
|
1068
|
+
private request;
|
|
1069
|
+
get<T>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
1070
|
+
post<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
1071
|
+
postWithHeaders<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<{
|
|
1072
|
+
data: T;
|
|
1073
|
+
headers: Headers;
|
|
1074
|
+
}>;
|
|
1075
|
+
put<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
1076
|
+
patch<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
1077
|
+
delete<T = void>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/** Options when constructing the SDK with HTTP (default) or with a custom API implementation. */
|
|
1081
|
+
interface QueryPanelSdkAPIOptions {
|
|
1082
|
+
defaultTenantId?: string;
|
|
1083
|
+
additionalHeaders?: Record<string, string>;
|
|
1084
|
+
fetch?: typeof fetch;
|
|
1085
|
+
/**
|
|
1086
|
+
* Use a custom API implementation (e.g. CallbackApiClient) instead of HTTP.
|
|
1087
|
+
* When set, baseUrl and privateKey are ignored and no requests are sent to querypanel-sdk;
|
|
1088
|
+
* use this when calling the SDK from within your own API to avoid recursion.
|
|
1089
|
+
*/
|
|
1090
|
+
api?: IQueryPanelApi;
|
|
1091
|
+
}
|
|
874
1092
|
/**
|
|
875
1093
|
* Main SDK class - Thin orchestrator
|
|
876
|
-
* Delegates to deep modules (ApiClient, QueryEngine, route modules)
|
|
1094
|
+
* Delegates to deep modules (ApiClient or custom API, QueryEngine, route modules)
|
|
877
1095
|
* Following Ousterhout's principle: "Simple interface hiding complexity"
|
|
878
1096
|
*/
|
|
879
1097
|
declare class QueryPanelSdkAPI {
|
|
880
1098
|
private readonly client;
|
|
881
1099
|
private readonly queryEngine;
|
|
882
|
-
|
|
1100
|
+
/**
|
|
1101
|
+
* @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
|
|
1102
|
+
*/
|
|
1103
|
+
constructor(baseUrl: string, privateKey: string, workspaceId: string, options?: QueryPanelSdkAPIOptions);
|
|
1104
|
+
/**
|
|
1105
|
+
* Create an SDK instance that uses a request callback instead of HTTP.
|
|
1106
|
+
* Use this when calling the SDK from within your own API so that "API" calls
|
|
1107
|
+
* are handled in-process (e.g. by invoking querypanel-sdk services directly)
|
|
1108
|
+
* and do not cause recursion.
|
|
1109
|
+
*
|
|
1110
|
+
* @param workspaceId - Workspace identifier (sent as `organizationId` in JWTs and API auth)
|
|
1111
|
+
* @param requestHandler - Callback invoked for each logical API request (method, path, body, tenantId, etc.)
|
|
1112
|
+
* @param options - Optional defaultTenantId
|
|
1113
|
+
* @returns QueryPanelSdkAPI instance; attach databases and call ask(), syncSchema(), etc. as usual
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* ```ts
|
|
1117
|
+
* const qp = QueryPanelSdkAPI.withCallbacks(
|
|
1118
|
+
* process.env.QUERYPANEL_WORKSPACE_ID!,
|
|
1119
|
+
* async (opts) => {
|
|
1120
|
+
* // Call your in-process services (e.g. querypanel-sdk logic) instead of HTTP
|
|
1121
|
+
* if (opts.path === '/query' || opts.path === '/v2/query') {
|
|
1122
|
+
* const result = await yourSqlGenerator.generate(opts.body, opts.tenantId);
|
|
1123
|
+
* return { data: result, headers: new Headers({ 'x-querypanel-session-id': result.sessionId }) };
|
|
1124
|
+
* }
|
|
1125
|
+
* if (opts.path === '/chart') return { data: await yourChartService.generate(opts.body) };
|
|
1126
|
+
* // ... other paths
|
|
1127
|
+
* return { data: await yourProxy(opts) };
|
|
1128
|
+
* },
|
|
1129
|
+
* { defaultTenantId: process.env.DEFAULT_TENANT_ID }
|
|
1130
|
+
* );
|
|
1131
|
+
* qp.attachPostgres('db', createClient, { tenantFieldName: 'tenant_id' });
|
|
1132
|
+
* const result = await qp.ask('Top 10 orders', { tenantId: 't1', database: 'db' });
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
static withCallbacks(workspaceId: string, requestHandler: RequestHandler, options?: {
|
|
883
1136
|
defaultTenantId?: string;
|
|
884
|
-
|
|
885
|
-
fetch?: typeof fetch;
|
|
886
|
-
});
|
|
1137
|
+
}): QueryPanelSdkAPI;
|
|
887
1138
|
attachClickhouse(name: string, clientFn: ClickHouseClientFn, options?: ClickHouseAdapterOptions & {
|
|
888
1139
|
description?: string;
|
|
889
1140
|
tags?: string[];
|
|
@@ -898,6 +1149,13 @@ declare class QueryPanelSdkAPI {
|
|
|
898
1149
|
tenantFieldType?: string;
|
|
899
1150
|
enforceTenantIsolation?: boolean;
|
|
900
1151
|
}): void;
|
|
1152
|
+
attachBigQuery(name: string, clientFn: BigQueryClientFn, options: BigQueryAdapterOptions & {
|
|
1153
|
+
description?: string;
|
|
1154
|
+
tags?: string[];
|
|
1155
|
+
tenantFieldName?: string;
|
|
1156
|
+
tenantFieldType?: string;
|
|
1157
|
+
enforceTenantIsolation?: boolean;
|
|
1158
|
+
}): void;
|
|
901
1159
|
attachDatabase(name: string, adapter: DatabaseAdapter): void;
|
|
902
1160
|
introspect(databaseName: string, tables?: string[]): Promise<SchemaIntrospection>;
|
|
903
1161
|
/**
|
|
@@ -957,6 +1215,31 @@ declare class QueryPanelSdkAPI {
|
|
|
957
1215
|
* ```
|
|
958
1216
|
*/
|
|
959
1217
|
ask(question: string, options: AskOptions, signal?: AbortSignal): Promise<AskResponse>;
|
|
1218
|
+
/**
|
|
1219
|
+
* Creates a JWT for the given tenant (and optional userId, scopes).
|
|
1220
|
+
* Use this when you need to pass a token to the embed (e.g. frontend or demo).
|
|
1221
|
+
* Only available when using the HTTP client (ApiClient); not available when using withCallbacks.
|
|
1222
|
+
*/
|
|
1223
|
+
createJwt(options: {
|
|
1224
|
+
tenantId: string;
|
|
1225
|
+
userId?: string;
|
|
1226
|
+
scopes?: string[];
|
|
1227
|
+
}): Promise<string>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Runs SQL against an attached database with tenant isolation applied.
|
|
1230
|
+
* Used by embed run-sql (e.g. dashboard chart execution). Requires a database
|
|
1231
|
+
* to be attached (e.g. via attachPostgres) and options.tenantId.
|
|
1232
|
+
*/
|
|
1233
|
+
runSqlForDashboard(input: {
|
|
1234
|
+
sql: string;
|
|
1235
|
+
params?: Record<string, unknown>;
|
|
1236
|
+
database?: string;
|
|
1237
|
+
}, options: {
|
|
1238
|
+
tenantId: string;
|
|
1239
|
+
}): Promise<{
|
|
1240
|
+
rows: unknown[];
|
|
1241
|
+
fields: string[];
|
|
1242
|
+
}>;
|
|
960
1243
|
/**
|
|
961
1244
|
* Generates a VizSpec visualization specification from query results.
|
|
962
1245
|
*
|
|
@@ -1338,6 +1621,248 @@ declare class QueryPanelSdkAPI {
|
|
|
1338
1621
|
userId?: string;
|
|
1339
1622
|
scopes?: string[];
|
|
1340
1623
|
}, signal?: AbortSignal): Promise<void>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Creates a new dashboard with BlockNote content.
|
|
1626
|
+
*
|
|
1627
|
+
* @param body - Dashboard configuration including name and BlockNote content
|
|
1628
|
+
* @param options - Tenant, user, and scope options
|
|
1629
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1630
|
+
* @returns Created dashboard
|
|
1631
|
+
*
|
|
1632
|
+
* @example
|
|
1633
|
+
* ```typescript
|
|
1634
|
+
* const dashboard = await qp.createDashboard({
|
|
1635
|
+
* name: "Sales Dashboard",
|
|
1636
|
+
* description: "Monthly sales metrics",
|
|
1637
|
+
* content_json: blockNoteContent,
|
|
1638
|
+
* editor_type: "blocknote",
|
|
1639
|
+
* }, { tenantId: "tenant_123" });
|
|
1640
|
+
* ```
|
|
1641
|
+
*/
|
|
1642
|
+
createDashboard(body: DashboardCreateInput, options?: {
|
|
1643
|
+
tenantId?: string;
|
|
1644
|
+
userId?: string;
|
|
1645
|
+
scopes?: string[];
|
|
1646
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Lists dashboards with pagination and filtering.
|
|
1649
|
+
*
|
|
1650
|
+
* @param options - Filtering and pagination options
|
|
1651
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1652
|
+
* @returns Paginated list of dashboards
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* ```typescript
|
|
1656
|
+
* const dashboards = await qp.listDashboards({
|
|
1657
|
+
* tenantId: "tenant_123",
|
|
1658
|
+
* status: "deployed",
|
|
1659
|
+
* pagination: { page: 1, limit: 10 },
|
|
1660
|
+
* });
|
|
1661
|
+
* ```
|
|
1662
|
+
*/
|
|
1663
|
+
listDashboards(options?: DashboardListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkDashboard>>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Gets a dashboard by ID.
|
|
1666
|
+
*
|
|
1667
|
+
* @param id - Dashboard ID
|
|
1668
|
+
* @param options - Tenant, user, and scope options
|
|
1669
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1670
|
+
* @returns Dashboard details
|
|
1671
|
+
*
|
|
1672
|
+
* @example
|
|
1673
|
+
* ```typescript
|
|
1674
|
+
* const dashboard = await qp.getDashboard("dash_123", {
|
|
1675
|
+
* tenantId: "tenant_123",
|
|
1676
|
+
* });
|
|
1677
|
+
* ```
|
|
1678
|
+
*/
|
|
1679
|
+
getDashboard(id: string, options?: {
|
|
1680
|
+
tenantId?: string;
|
|
1681
|
+
userId?: string;
|
|
1682
|
+
scopes?: string[];
|
|
1683
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Gets a dashboard for a specific tenant.
|
|
1686
|
+
* Returns customer fork if exists, otherwise returns the original dashboard.
|
|
1687
|
+
*
|
|
1688
|
+
* @param id - Dashboard ID
|
|
1689
|
+
* @param tenantId - Tenant ID to check for fork
|
|
1690
|
+
* @param options - Additional auth options
|
|
1691
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1692
|
+
* @returns Dashboard (fork if exists, original otherwise)
|
|
1693
|
+
*
|
|
1694
|
+
* @example
|
|
1695
|
+
* ```typescript
|
|
1696
|
+
* const dashboard = await qp.getDashboardForTenant(
|
|
1697
|
+
* "dash_123",
|
|
1698
|
+
* "tenant_456",
|
|
1699
|
+
* );
|
|
1700
|
+
* ```
|
|
1701
|
+
*/
|
|
1702
|
+
getDashboardForTenant(id: string, tenantId: string, options?: {
|
|
1703
|
+
userId?: string;
|
|
1704
|
+
scopes?: string[];
|
|
1705
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Updates a dashboard.
|
|
1708
|
+
*
|
|
1709
|
+
* @param id - Dashboard ID to update
|
|
1710
|
+
* @param body - Fields to update
|
|
1711
|
+
* @param options - Tenant, user, and scope options
|
|
1712
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1713
|
+
* @returns Updated dashboard
|
|
1714
|
+
*
|
|
1715
|
+
* @example
|
|
1716
|
+
* ```typescript
|
|
1717
|
+
* const updated = await qp.updateDashboard("dash_123", {
|
|
1718
|
+
* name: "Updated Dashboard",
|
|
1719
|
+
* content_json: newBlockNoteContent,
|
|
1720
|
+
* }, { tenantId: "tenant_123" });
|
|
1721
|
+
* ```
|
|
1722
|
+
*/
|
|
1723
|
+
updateDashboard(id: string, body: DashboardUpdateInput, options?: {
|
|
1724
|
+
tenantId?: string;
|
|
1725
|
+
userId?: string;
|
|
1726
|
+
scopes?: string[];
|
|
1727
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1728
|
+
/**
|
|
1729
|
+
* Updates dashboard status (deploy/undeploy).
|
|
1730
|
+
*
|
|
1731
|
+
* @param id - Dashboard ID
|
|
1732
|
+
* @param status - New status
|
|
1733
|
+
* @param options - Tenant, user, and scope options
|
|
1734
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1735
|
+
* @returns Updated dashboard
|
|
1736
|
+
*
|
|
1737
|
+
* @example
|
|
1738
|
+
* ```typescript
|
|
1739
|
+
* const deployed = await qp.updateDashboardStatus(
|
|
1740
|
+
* "dash_123",
|
|
1741
|
+
* "deployed",
|
|
1742
|
+
* { tenantId: "tenant_123" },
|
|
1743
|
+
* );
|
|
1744
|
+
* ```
|
|
1745
|
+
*/
|
|
1746
|
+
updateDashboardStatus(id: string, status: "draft" | "deployed", options?: {
|
|
1747
|
+
tenantId?: string;
|
|
1748
|
+
userId?: string;
|
|
1749
|
+
scopes?: string[];
|
|
1750
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1751
|
+
/**
|
|
1752
|
+
* Deletes a dashboard.
|
|
1753
|
+
*
|
|
1754
|
+
* @param id - Dashboard ID to delete
|
|
1755
|
+
* @param options - Tenant, user, and scope options
|
|
1756
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1757
|
+
*
|
|
1758
|
+
* @example
|
|
1759
|
+
* ```typescript
|
|
1760
|
+
* await qp.deleteDashboard("dash_123", { tenantId: "tenant_123" });
|
|
1761
|
+
* ```
|
|
1762
|
+
*/
|
|
1763
|
+
deleteDashboard(id: string, options?: {
|
|
1764
|
+
tenantId?: string;
|
|
1765
|
+
userId?: string;
|
|
1766
|
+
scopes?: string[];
|
|
1767
|
+
}, signal?: AbortSignal): Promise<void>;
|
|
1768
|
+
/**
|
|
1769
|
+
* Forks a dashboard for customer customization (copy-on-write).
|
|
1770
|
+
*
|
|
1771
|
+
* Creates a full copy of the dashboard that the customer can edit independently.
|
|
1772
|
+
* The original dashboard remains unchanged.
|
|
1773
|
+
*
|
|
1774
|
+
* @param id - Dashboard ID to fork
|
|
1775
|
+
* @param input - Fork configuration with tenant_id
|
|
1776
|
+
* @param options - Additional auth options
|
|
1777
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1778
|
+
* @returns Forked dashboard
|
|
1779
|
+
*
|
|
1780
|
+
* @example
|
|
1781
|
+
* ```typescript
|
|
1782
|
+
* const fork = await qp.forkDashboard("dash_123", {
|
|
1783
|
+
* tenant_id: "tenant_456",
|
|
1784
|
+
* name: "Customer's Custom Dashboard",
|
|
1785
|
+
* });
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
forkDashboard(id: string, input: DashboardForkInput, options?: {
|
|
1789
|
+
userId?: string;
|
|
1790
|
+
scopes?: string[];
|
|
1791
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1792
|
+
/**
|
|
1793
|
+
* Updates a customer fork.
|
|
1794
|
+
*
|
|
1795
|
+
* @param forkId - Fork ID to update
|
|
1796
|
+
* @param input - Update data including tenant_id
|
|
1797
|
+
* @param options - Additional auth options
|
|
1798
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1799
|
+
* @returns Updated fork
|
|
1800
|
+
*
|
|
1801
|
+
* @example
|
|
1802
|
+
* ```typescript
|
|
1803
|
+
* const updated = await qp.updateFork("fork_123", {
|
|
1804
|
+
* tenant_id: "tenant_456",
|
|
1805
|
+
* content_json: newBlockNoteContent,
|
|
1806
|
+
* });
|
|
1807
|
+
* ```
|
|
1808
|
+
*/
|
|
1809
|
+
updateFork(forkId: string, input: DashboardForkUpdateInput, options?: {
|
|
1810
|
+
userId?: string;
|
|
1811
|
+
scopes?: string[];
|
|
1812
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Rollbacks a fork to the original dashboard.
|
|
1815
|
+
* This deletes the fork and the customer will see the original again.
|
|
1816
|
+
*
|
|
1817
|
+
* @param forkId - Fork ID to rollback
|
|
1818
|
+
* @param tenantId - Tenant ID
|
|
1819
|
+
* @param options - Additional auth options
|
|
1820
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1821
|
+
* @returns Original dashboard
|
|
1822
|
+
*
|
|
1823
|
+
* @example
|
|
1824
|
+
* ```typescript
|
|
1825
|
+
* const original = await qp.rollbackFork("fork_123", "tenant_456");
|
|
1826
|
+
* ```
|
|
1827
|
+
*/
|
|
1828
|
+
rollbackFork(forkId: string, tenantId: string, options?: {
|
|
1829
|
+
userId?: string;
|
|
1830
|
+
scopes?: string[];
|
|
1831
|
+
}, signal?: AbortSignal): Promise<SdkDashboard>;
|
|
1832
|
+
/**
|
|
1833
|
+
* Deletes a customer fork.
|
|
1834
|
+
*
|
|
1835
|
+
* @param forkId - Fork ID to delete
|
|
1836
|
+
* @param tenantId - Tenant ID
|
|
1837
|
+
* @param options - Additional auth options
|
|
1838
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1839
|
+
*
|
|
1840
|
+
* @example
|
|
1841
|
+
* ```typescript
|
|
1842
|
+
* await qp.deleteFork("fork_123", "tenant_456");
|
|
1843
|
+
* ```
|
|
1844
|
+
*/
|
|
1845
|
+
deleteFork(forkId: string, tenantId: string, options?: {
|
|
1846
|
+
userId?: string;
|
|
1847
|
+
scopes?: string[];
|
|
1848
|
+
}, signal?: AbortSignal): Promise<void>;
|
|
1849
|
+
/**
|
|
1850
|
+
* Lists all customer forks for a tenant.
|
|
1851
|
+
*
|
|
1852
|
+
* @param tenantId - Tenant ID
|
|
1853
|
+
* @param options - Additional auth options
|
|
1854
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
1855
|
+
* @returns Array of forks
|
|
1856
|
+
*
|
|
1857
|
+
* @example
|
|
1858
|
+
* ```typescript
|
|
1859
|
+
* const forks = await qp.listForksForTenant("tenant_456");
|
|
1860
|
+
* ```
|
|
1861
|
+
*/
|
|
1862
|
+
listForksForTenant(tenantId: string, options?: {
|
|
1863
|
+
userId?: string;
|
|
1864
|
+
scopes?: string[];
|
|
1865
|
+
}, signal?: AbortSignal): Promise<SdkDashboard[]>;
|
|
1341
1866
|
}
|
|
1342
1867
|
|
|
1343
|
-
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 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, 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 };
|
|
1868
|
+
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 };
|