@querypanel/node-sdk 1.0.56 → 1.2.0

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
@@ -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 named params to positional array for PostgreSQL
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;
@@ -871,19 +1050,87 @@ interface VizSpecResponse {
871
1050
  notes: string | null;
872
1051
  }
873
1052
 
1053
+ /**
1054
+ * API client that delegates every request to a callback instead of HTTP.
1055
+ * 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.
1056
+ */
1057
+ declare class CallbackApiClient implements IQueryPanelApi {
1058
+ private readonly requestHandler;
1059
+ private readonly defaultTenantId?;
1060
+ constructor(requestHandler: RequestHandler, options?: {
1061
+ defaultTenantId?: string;
1062
+ });
1063
+ getDefaultTenantId(): string | undefined;
1064
+ private request;
1065
+ get<T>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
1066
+ post<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
1067
+ postWithHeaders<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<{
1068
+ data: T;
1069
+ headers: Headers;
1070
+ }>;
1071
+ put<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
1072
+ patch<T>(path: string, body: unknown, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
1073
+ delete<T = void>(path: string, tenantId: string, userId?: string, scopes?: string[], signal?: AbortSignal, sessionId?: string): Promise<T>;
1074
+ }
1075
+
1076
+ /** Options when constructing the SDK with HTTP (default) or with a custom API implementation. */
1077
+ interface QueryPanelSdkAPIOptions {
1078
+ defaultTenantId?: string;
1079
+ additionalHeaders?: Record<string, string>;
1080
+ fetch?: typeof fetch;
1081
+ /**
1082
+ * Use a custom API implementation (e.g. CallbackApiClient) instead of HTTP.
1083
+ * When set, baseUrl and privateKey are ignored and no requests are sent to querypanel-sdk;
1084
+ * use this when calling the SDK from within your own API to avoid recursion.
1085
+ */
1086
+ api?: IQueryPanelApi;
1087
+ }
874
1088
  /**
875
1089
  * Main SDK class - Thin orchestrator
876
- * Delegates to deep modules (ApiClient, QueryEngine, route modules)
1090
+ * Delegates to deep modules (ApiClient or custom API, QueryEngine, route modules)
877
1091
  * Following Ousterhout's principle: "Simple interface hiding complexity"
878
1092
  */
879
1093
  declare class QueryPanelSdkAPI {
880
1094
  private readonly client;
881
1095
  private readonly queryEngine;
882
- constructor(baseUrl: string, privateKey: string, organizationId: string, options?: {
1096
+ /**
1097
+ * @param workspaceId - Workspace UUID (same value as your org in the dashboard). Passed to the API as JWT claim `organizationId`.
1098
+ */
1099
+ constructor(baseUrl: string, privateKey: string, workspaceId: string, options?: QueryPanelSdkAPIOptions);
1100
+ /**
1101
+ * Create an SDK instance that uses a request callback instead of HTTP.
1102
+ * Use this when calling the SDK from within your own API so that "API" calls
1103
+ * are handled in-process (e.g. by invoking querypanel-sdk services directly)
1104
+ * and do not cause recursion.
1105
+ *
1106
+ * @param workspaceId - Workspace identifier (sent as `organizationId` in JWTs and API auth)
1107
+ * @param requestHandler - Callback invoked for each logical API request (method, path, body, tenantId, etc.)
1108
+ * @param options - Optional defaultTenantId
1109
+ * @returns QueryPanelSdkAPI instance; attach databases and call ask(), syncSchema(), etc. as usual
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * const qp = QueryPanelSdkAPI.withCallbacks(
1114
+ * process.env.QUERYPANEL_WORKSPACE_ID!,
1115
+ * async (opts) => {
1116
+ * // Call your in-process services (e.g. querypanel-sdk logic) instead of HTTP
1117
+ * if (opts.path === '/query' || opts.path === '/v2/query') {
1118
+ * const result = await yourSqlGenerator.generate(opts.body, opts.tenantId);
1119
+ * return { data: result, headers: new Headers({ 'x-querypanel-session-id': result.sessionId }) };
1120
+ * }
1121
+ * if (opts.path === '/chart') return { data: await yourChartService.generate(opts.body) };
1122
+ * // ... other paths
1123
+ * return { data: await yourProxy(opts) };
1124
+ * },
1125
+ * { defaultTenantId: process.env.DEFAULT_TENANT_ID }
1126
+ * );
1127
+ * qp.attachPostgres('db', createClient, { tenantFieldName: 'tenant_id' });
1128
+ * const result = await qp.ask('Top 10 orders', { tenantId: 't1', database: 'db' });
1129
+ * ```
1130
+ */
1131
+ static withCallbacks(workspaceId: string, requestHandler: RequestHandler, options?: {
883
1132
  defaultTenantId?: string;
884
- additionalHeaders?: Record<string, string>;
885
- fetch?: typeof fetch;
886
- });
1133
+ }): QueryPanelSdkAPI;
887
1134
  attachClickhouse(name: string, clientFn: ClickHouseClientFn, options?: ClickHouseAdapterOptions & {
888
1135
  description?: string;
889
1136
  tags?: string[];
@@ -898,6 +1145,13 @@ declare class QueryPanelSdkAPI {
898
1145
  tenantFieldType?: string;
899
1146
  enforceTenantIsolation?: boolean;
900
1147
  }): void;
1148
+ attachBigQuery(name: string, clientFn: BigQueryClientFn, options: BigQueryAdapterOptions & {
1149
+ description?: string;
1150
+ tags?: string[];
1151
+ tenantFieldName?: string;
1152
+ tenantFieldType?: string;
1153
+ enforceTenantIsolation?: boolean;
1154
+ }): void;
901
1155
  attachDatabase(name: string, adapter: DatabaseAdapter): void;
902
1156
  introspect(databaseName: string, tables?: string[]): Promise<SchemaIntrospection>;
903
1157
  /**
@@ -957,6 +1211,31 @@ declare class QueryPanelSdkAPI {
957
1211
  * ```
958
1212
  */
959
1213
  ask(question: string, options: AskOptions, signal?: AbortSignal): Promise<AskResponse>;
1214
+ /**
1215
+ * Creates a JWT for the given tenant (and optional userId, scopes).
1216
+ * Use this when you need to pass a token to the embed (e.g. frontend or demo).
1217
+ * Only available when using the HTTP client (ApiClient); not available when using withCallbacks.
1218
+ */
1219
+ createJwt(options: {
1220
+ tenantId: string;
1221
+ userId?: string;
1222
+ scopes?: string[];
1223
+ }): Promise<string>;
1224
+ /**
1225
+ * Runs SQL against an attached database with tenant isolation applied.
1226
+ * Used by embed run-sql (e.g. dashboard chart execution). Requires a database
1227
+ * to be attached (e.g. via attachPostgres) and options.tenantId.
1228
+ */
1229
+ runSqlForDashboard(input: {
1230
+ sql: string;
1231
+ params?: Record<string, unknown>;
1232
+ database?: string;
1233
+ }, options: {
1234
+ tenantId: string;
1235
+ }): Promise<{
1236
+ rows: unknown[];
1237
+ fields: string[];
1238
+ }>;
960
1239
  /**
961
1240
  * Generates a VizSpec visualization specification from query results.
962
1241
  *
@@ -1338,6 +1617,248 @@ declare class QueryPanelSdkAPI {
1338
1617
  userId?: string;
1339
1618
  scopes?: string[];
1340
1619
  }, signal?: AbortSignal): Promise<void>;
1620
+ /**
1621
+ * Creates a new dashboard with BlockNote content.
1622
+ *
1623
+ * @param body - Dashboard configuration including name and BlockNote content
1624
+ * @param options - Tenant, user, and scope options
1625
+ * @param signal - Optional AbortSignal for cancellation
1626
+ * @returns Created dashboard
1627
+ *
1628
+ * @example
1629
+ * ```typescript
1630
+ * const dashboard = await qp.createDashboard({
1631
+ * name: "Sales Dashboard",
1632
+ * description: "Monthly sales metrics",
1633
+ * content_json: blockNoteContent,
1634
+ * editor_type: "blocknote",
1635
+ * }, { tenantId: "tenant_123" });
1636
+ * ```
1637
+ */
1638
+ createDashboard(body: DashboardCreateInput, options?: {
1639
+ tenantId?: string;
1640
+ userId?: string;
1641
+ scopes?: string[];
1642
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1643
+ /**
1644
+ * Lists dashboards with pagination and filtering.
1645
+ *
1646
+ * @param options - Filtering and pagination options
1647
+ * @param signal - Optional AbortSignal for cancellation
1648
+ * @returns Paginated list of dashboards
1649
+ *
1650
+ * @example
1651
+ * ```typescript
1652
+ * const dashboards = await qp.listDashboards({
1653
+ * tenantId: "tenant_123",
1654
+ * status: "deployed",
1655
+ * pagination: { page: 1, limit: 10 },
1656
+ * });
1657
+ * ```
1658
+ */
1659
+ listDashboards(options?: DashboardListOptions, signal?: AbortSignal): Promise<PaginatedResponse$1<SdkDashboard>>;
1660
+ /**
1661
+ * Gets a dashboard by ID.
1662
+ *
1663
+ * @param id - Dashboard ID
1664
+ * @param options - Tenant, user, and scope options
1665
+ * @param signal - Optional AbortSignal for cancellation
1666
+ * @returns Dashboard details
1667
+ *
1668
+ * @example
1669
+ * ```typescript
1670
+ * const dashboard = await qp.getDashboard("dash_123", {
1671
+ * tenantId: "tenant_123",
1672
+ * });
1673
+ * ```
1674
+ */
1675
+ getDashboard(id: string, options?: {
1676
+ tenantId?: string;
1677
+ userId?: string;
1678
+ scopes?: string[];
1679
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1680
+ /**
1681
+ * Gets a dashboard for a specific tenant.
1682
+ * Returns customer fork if exists, otherwise returns the original dashboard.
1683
+ *
1684
+ * @param id - Dashboard ID
1685
+ * @param tenantId - Tenant ID to check for fork
1686
+ * @param options - Additional auth options
1687
+ * @param signal - Optional AbortSignal for cancellation
1688
+ * @returns Dashboard (fork if exists, original otherwise)
1689
+ *
1690
+ * @example
1691
+ * ```typescript
1692
+ * const dashboard = await qp.getDashboardForTenant(
1693
+ * "dash_123",
1694
+ * "tenant_456",
1695
+ * );
1696
+ * ```
1697
+ */
1698
+ getDashboardForTenant(id: string, tenantId: string, options?: {
1699
+ userId?: string;
1700
+ scopes?: string[];
1701
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1702
+ /**
1703
+ * Updates a dashboard.
1704
+ *
1705
+ * @param id - Dashboard ID to update
1706
+ * @param body - Fields to update
1707
+ * @param options - Tenant, user, and scope options
1708
+ * @param signal - Optional AbortSignal for cancellation
1709
+ * @returns Updated dashboard
1710
+ *
1711
+ * @example
1712
+ * ```typescript
1713
+ * const updated = await qp.updateDashboard("dash_123", {
1714
+ * name: "Updated Dashboard",
1715
+ * content_json: newBlockNoteContent,
1716
+ * }, { tenantId: "tenant_123" });
1717
+ * ```
1718
+ */
1719
+ updateDashboard(id: string, body: DashboardUpdateInput, options?: {
1720
+ tenantId?: string;
1721
+ userId?: string;
1722
+ scopes?: string[];
1723
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1724
+ /**
1725
+ * Updates dashboard status (deploy/undeploy).
1726
+ *
1727
+ * @param id - Dashboard ID
1728
+ * @param status - New status
1729
+ * @param options - Tenant, user, and scope options
1730
+ * @param signal - Optional AbortSignal for cancellation
1731
+ * @returns Updated dashboard
1732
+ *
1733
+ * @example
1734
+ * ```typescript
1735
+ * const deployed = await qp.updateDashboardStatus(
1736
+ * "dash_123",
1737
+ * "deployed",
1738
+ * { tenantId: "tenant_123" },
1739
+ * );
1740
+ * ```
1741
+ */
1742
+ updateDashboardStatus(id: string, status: "draft" | "deployed", options?: {
1743
+ tenantId?: string;
1744
+ userId?: string;
1745
+ scopes?: string[];
1746
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1747
+ /**
1748
+ * Deletes a dashboard.
1749
+ *
1750
+ * @param id - Dashboard ID to delete
1751
+ * @param options - Tenant, user, and scope options
1752
+ * @param signal - Optional AbortSignal for cancellation
1753
+ *
1754
+ * @example
1755
+ * ```typescript
1756
+ * await qp.deleteDashboard("dash_123", { tenantId: "tenant_123" });
1757
+ * ```
1758
+ */
1759
+ deleteDashboard(id: string, options?: {
1760
+ tenantId?: string;
1761
+ userId?: string;
1762
+ scopes?: string[];
1763
+ }, signal?: AbortSignal): Promise<void>;
1764
+ /**
1765
+ * Forks a dashboard for customer customization (copy-on-write).
1766
+ *
1767
+ * Creates a full copy of the dashboard that the customer can edit independently.
1768
+ * The original dashboard remains unchanged.
1769
+ *
1770
+ * @param id - Dashboard ID to fork
1771
+ * @param input - Fork configuration with tenant_id
1772
+ * @param options - Additional auth options
1773
+ * @param signal - Optional AbortSignal for cancellation
1774
+ * @returns Forked dashboard
1775
+ *
1776
+ * @example
1777
+ * ```typescript
1778
+ * const fork = await qp.forkDashboard("dash_123", {
1779
+ * tenant_id: "tenant_456",
1780
+ * name: "Customer's Custom Dashboard",
1781
+ * });
1782
+ * ```
1783
+ */
1784
+ forkDashboard(id: string, input: DashboardForkInput, options?: {
1785
+ userId?: string;
1786
+ scopes?: string[];
1787
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1788
+ /**
1789
+ * Updates a customer fork.
1790
+ *
1791
+ * @param forkId - Fork ID to update
1792
+ * @param input - Update data including tenant_id
1793
+ * @param options - Additional auth options
1794
+ * @param signal - Optional AbortSignal for cancellation
1795
+ * @returns Updated fork
1796
+ *
1797
+ * @example
1798
+ * ```typescript
1799
+ * const updated = await qp.updateFork("fork_123", {
1800
+ * tenant_id: "tenant_456",
1801
+ * content_json: newBlockNoteContent,
1802
+ * });
1803
+ * ```
1804
+ */
1805
+ updateFork(forkId: string, input: DashboardForkUpdateInput, options?: {
1806
+ userId?: string;
1807
+ scopes?: string[];
1808
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1809
+ /**
1810
+ * Rollbacks a fork to the original dashboard.
1811
+ * This deletes the fork and the customer will see the original again.
1812
+ *
1813
+ * @param forkId - Fork ID to rollback
1814
+ * @param tenantId - Tenant ID
1815
+ * @param options - Additional auth options
1816
+ * @param signal - Optional AbortSignal for cancellation
1817
+ * @returns Original dashboard
1818
+ *
1819
+ * @example
1820
+ * ```typescript
1821
+ * const original = await qp.rollbackFork("fork_123", "tenant_456");
1822
+ * ```
1823
+ */
1824
+ rollbackFork(forkId: string, tenantId: string, options?: {
1825
+ userId?: string;
1826
+ scopes?: string[];
1827
+ }, signal?: AbortSignal): Promise<SdkDashboard>;
1828
+ /**
1829
+ * Deletes a customer fork.
1830
+ *
1831
+ * @param forkId - Fork ID to delete
1832
+ * @param tenantId - Tenant ID
1833
+ * @param options - Additional auth options
1834
+ * @param signal - Optional AbortSignal for cancellation
1835
+ *
1836
+ * @example
1837
+ * ```typescript
1838
+ * await qp.deleteFork("fork_123", "tenant_456");
1839
+ * ```
1840
+ */
1841
+ deleteFork(forkId: string, tenantId: string, options?: {
1842
+ userId?: string;
1843
+ scopes?: string[];
1844
+ }, signal?: AbortSignal): Promise<void>;
1845
+ /**
1846
+ * Lists all customer forks for a tenant.
1847
+ *
1848
+ * @param tenantId - Tenant ID
1849
+ * @param options - Additional auth options
1850
+ * @param signal - Optional AbortSignal for cancellation
1851
+ * @returns Array of forks
1852
+ *
1853
+ * @example
1854
+ * ```typescript
1855
+ * const forks = await qp.listForksForTenant("tenant_456");
1856
+ * ```
1857
+ */
1858
+ listForksForTenant(tenantId: string, options?: {
1859
+ userId?: string;
1860
+ scopes?: string[];
1861
+ }, signal?: AbortSignal): Promise<SdkDashboard[]>;
1341
1862
  }
1342
1863
 
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 };
1864
+ 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 };