@tetrascience-npm/tetrascience-react-ui 0.3.0 → 0.4.0-beta.10.1

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.
@@ -0,0 +1,79 @@
1
+ import * as _aws_sdk_client_athena from '@aws-sdk/client-athena';
2
+ export { I as InvalidProviderConfigurationError, M as MissingTableError, P as ProviderConfiguration, a as ProviderConnectionError, b as ProviderError, Q as QueryError, c as QueryResult } from './types-Ck4uFaGp.js';
3
+
4
+ /**
5
+ * Athena Data Provider
6
+ *
7
+ * TypeScript equivalent of AthenaProvider from
8
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider.py
9
+ *
10
+ * @remarks
11
+ * This provider requires the `@aws-sdk/client-athena` package to be installed.
12
+ * It is an optional peer dependency - install it only if you need Athena support:
13
+ * ```bash
14
+ * npm install @aws-sdk/client-athena
15
+ * # or
16
+ * yarn add @aws-sdk/client-athena
17
+ * ```
18
+ */
19
+ type AthenaClient = _aws_sdk_client_athena.AthenaClient;
20
+ type AthenaSDK = typeof _aws_sdk_client_athena;
21
+ /**
22
+ * Athena data provider
23
+ */
24
+ declare class AthenaProvider {
25
+ private client;
26
+ private sdk;
27
+ private workgroup;
28
+ private database;
29
+ private outputLocation?;
30
+ /**
31
+ * Initialize the Athena data provider
32
+ *
33
+ * @param client - AWS Athena client
34
+ * @param sdk - AWS Athena SDK module (for accessing command classes)
35
+ * @param workgroup - Athena workgroup to use
36
+ * @param database - Default database/schema
37
+ * @param outputLocation - Optional S3 output location
38
+ */
39
+ constructor(client: AthenaClient, sdk: AthenaSDK, workgroup: string, database: string, outputLocation?: string);
40
+ /**
41
+ * Query the Athena database
42
+ *
43
+ * @param sqlQuery - SQL query to execute
44
+ * @param _params - Parameters to pass to the query (currently not used - Athena doesn't support parameterized queries)
45
+ * @returns Promise resolving to array of row objects
46
+ *
47
+ * @remarks
48
+ * **Security Note:** AWS Athena does not support parameterized queries.
49
+ * Unlike traditional databases, there is no native way to use bind parameters
50
+ * with Athena. Callers are responsible for properly sanitizing any user input
51
+ * before constructing the SQL query string. This is a known limitation of the
52
+ * Athena service, not a design flaw in this implementation.
53
+ */
54
+ query(sqlQuery: string, _params?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
55
+ /**
56
+ * Wait for query to complete
57
+ */
58
+ private waitForQueryCompletion;
59
+ /**
60
+ * Fetch all results from a completed query
61
+ */
62
+ private fetchAllResults;
63
+ /**
64
+ * Close the Athena client (no-op for AWS SDK clients)
65
+ */
66
+ close(): Promise<void>;
67
+ }
68
+ /**
69
+ * Get the TDP Athena provider
70
+ *
71
+ * Creates an Athena provider using TDP environment configuration
72
+ *
73
+ * @returns Promise resolving to Athena data provider
74
+ * @throws {InvalidProviderConfigurationError} If @aws-sdk/client-athena is not installed
75
+ * @throws {Error} If ATHENA_S3_OUTPUT_LOCATION is not set when using the 'primary' workgroup
76
+ */
77
+ declare function getTdpAthenaProvider(): Promise<AthenaProvider>;
78
+
79
+ export { AthenaProvider, getTdpAthenaProvider };
@@ -0,0 +1,43 @@
1
+ import * as _databricks_sql_dist_contracts_IDBSQLSession from '@databricks/sql/dist/contracts/IDBSQLSession';
2
+ import * as _databricks_sql from '@databricks/sql';
3
+ import { P as ProviderConfiguration } from './types-Ck4uFaGp.js';
4
+ export { I as InvalidProviderConfigurationError, M as MissingTableError, a as ProviderConnectionError, b as ProviderError, Q as QueryError, c as QueryResult } from './types-Ck4uFaGp.js';
5
+
6
+ type DBSQLClient = _databricks_sql.DBSQLClient;
7
+ type IDBSQLSession = _databricks_sql_dist_contracts_IDBSQLSession.default;
8
+ /**
9
+ * Databricks data provider
10
+ */
11
+ declare class DatabricksProvider {
12
+ private client;
13
+ private session;
14
+ /**
15
+ * Initialize the Databricks data provider
16
+ *
17
+ * @param client - Databricks SQL client
18
+ * @param session - Databricks SQL session
19
+ */
20
+ constructor(client: DBSQLClient, session: IDBSQLSession);
21
+ /**
22
+ * Query the Databricks database
23
+ *
24
+ * @param sqlQuery - SQL query to execute
25
+ * @param _params - Parameters to pass to the query (currently not used)
26
+ * @returns Promise resolving to array of row objects
27
+ */
28
+ query(sqlQuery: string, _params?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
29
+ /**
30
+ * Close the Databricks connection
31
+ */
32
+ close(): Promise<void>;
33
+ }
34
+ /**
35
+ * Build a Databricks data provider from the configuration
36
+ *
37
+ * @param config - Provider configuration
38
+ * @returns Promise resolving to Databricks data provider
39
+ * @throws {InvalidProviderConfigurationError} If @databricks/sql is not installed or config is invalid
40
+ */
41
+ declare function buildDatabricksProvider(config: ProviderConfiguration): Promise<DatabricksProvider>;
42
+
43
+ export { DatabricksProvider, ProviderConfiguration, buildDatabricksProvider };
@@ -0,0 +1,40 @@
1
+ import * as snowflake_sdk from 'snowflake-sdk';
2
+ import { P as ProviderConfiguration } from './types-Ck4uFaGp.js';
3
+ export { I as InvalidProviderConfigurationError, M as MissingTableError, a as ProviderConnectionError, b as ProviderError, Q as QueryError, c as QueryResult } from './types-Ck4uFaGp.js';
4
+
5
+ type SnowflakeConnection = snowflake_sdk.Connection;
6
+ /**
7
+ * Snowflake data provider
8
+ */
9
+ declare class SnowflakeProvider {
10
+ private connection;
11
+ /**
12
+ * Initialize the Snowflake data provider
13
+ *
14
+ * @param connection - Snowflake connection
15
+ */
16
+ constructor(connection: SnowflakeConnection);
17
+ /**
18
+ * Query the Snowflake database
19
+ *
20
+ * @param sqlText - SQL query to execute
21
+ * @param params - Parameters to pass to the query. For positional binds, use an array.
22
+ * For named binds, use an object with keys matching the bind variable names.
23
+ * @returns Promise resolving to array of row objects
24
+ */
25
+ query(sqlText: string, params?: Record<string, unknown> | unknown[]): Promise<Array<Record<string, unknown>>>;
26
+ /**
27
+ * Close the Snowflake connection
28
+ */
29
+ close(): Promise<void>;
30
+ }
31
+ /**
32
+ * Build a Snowflake data provider from the configuration
33
+ *
34
+ * @param config - Provider configuration
35
+ * @returns Promise resolving to Snowflake data provider
36
+ * @throws {InvalidProviderConfigurationError} If snowflake-sdk is not installed or config is invalid
37
+ */
38
+ declare function buildSnowflakeProvider(config: ProviderConfiguration): Promise<SnowflakeProvider>;
39
+
40
+ export { ProviderConfiguration, SnowflakeProvider, buildSnowflakeProvider };
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Provider Exceptions
3
+ *
4
+ * TypeScript equivalents of the Python exceptions from
5
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py
6
+ */
7
+ /**
8
+ * Base class for provider errors
9
+ */
10
+ declare class ProviderError extends Error {
11
+ constructor(message: string);
12
+ }
13
+ /**
14
+ * Raised when a table is missing in the database
15
+ */
16
+ declare class MissingTableError extends ProviderError {
17
+ constructor(message: string);
18
+ }
19
+ /**
20
+ * Raised when a query fails
21
+ */
22
+ declare class QueryError extends ProviderError {
23
+ constructor(message: string);
24
+ }
25
+ /**
26
+ * Raised when connecting to a provider fails
27
+ */
28
+ declare class ProviderConnectionError extends ProviderError {
29
+ constructor(message: string);
30
+ }
31
+ /**
32
+ * Raised when the provider configuration is invalid
33
+ */
34
+ declare class InvalidProviderConfigurationError extends ProviderError {
35
+ constructor(message: string);
36
+ }
37
+
38
+ /**
39
+ * Data App Provider Types
40
+ *
41
+ * TypeScript equivalents of the Python ProviderConfiguration Pydantic models
42
+ * from ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider_typing.py
43
+ */
44
+ /**
45
+ * Configuration model for data providers.
46
+ *
47
+ * This interface represents the configuration needed to connect to various
48
+ * database providers (Snowflake, Databricks, Athena, Benchling, etc.)
49
+ * attached to a data app.
50
+ */
51
+ interface ProviderConfiguration {
52
+ /** Human-readable name of the provider */
53
+ name: string;
54
+ /** Provider type (snowflake, databricks, benchling, custom, etc.) */
55
+ type: string;
56
+ /** Optional URL to the provider's icon */
57
+ iconUrl?: string;
58
+ /** Dictionary containing connection details and credentials */
59
+ fields: Record<string, string | undefined>;
60
+ }
61
+ /**
62
+ * Standardized query result from data providers.
63
+ *
64
+ * This interface provides a consistent shape for query results across
65
+ * all provider types (Snowflake, Databricks, Athena), with optional
66
+ * metadata for API responses.
67
+ */
68
+ interface QueryResult {
69
+ /** Array of row objects returned by the query */
70
+ data: Array<Record<string, unknown>>;
71
+ /** Number of rows returned */
72
+ rowCount: number;
73
+ /** Name of the provider that executed the query */
74
+ provider?: string;
75
+ /** Whether this is mock/demo data */
76
+ mock?: boolean;
77
+ /** Optional message (e.g., for errors or warnings) */
78
+ message?: string;
79
+ }
80
+
81
+ export { InvalidProviderConfigurationError as I, MissingTableError as M, QueryError as Q, ProviderConnectionError as a, ProviderError as b };
82
+ export type { ProviderConfiguration as P, QueryResult as c };
package/dist/server.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ import { TDPClient } from '@tetrascience-npm/ts-connectors-sdk';
2
+ import * as snowflake_sdk from 'snowflake-sdk';
3
+ import * as _databricks_sql_dist_contracts_IDBSQLSession from '@databricks/sql/dist/contracts/IDBSQLSession';
4
+ import * as _databricks_sql from '@databricks/sql';
5
+ import * as _aws_sdk_client_athena from '@aws-sdk/client-athena';
6
+
1
7
  /**
2
8
  * JWT Token Manager for TetraScience Data Apps
3
9
  *
@@ -90,5 +96,430 @@ declare class JwtTokenManager {
90
96
  */
91
97
  declare const jwtManager: JwtTokenManager;
92
98
 
93
- export { JwtTokenManager, jwtManager };
94
- export type { CookieDict, ExpressRequestLike, JwtTokenManagerConfig };
99
+ /**
100
+ * Provider Exceptions
101
+ *
102
+ * TypeScript equivalents of the Python exceptions from
103
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py
104
+ */
105
+ /**
106
+ * Base class for provider errors
107
+ */
108
+ declare class ProviderError extends Error {
109
+ constructor(message: string);
110
+ }
111
+ /**
112
+ * Raised when a table is missing in the database
113
+ */
114
+ declare class MissingTableError extends ProviderError {
115
+ constructor(message: string);
116
+ }
117
+ /**
118
+ * Raised when a query fails
119
+ */
120
+ declare class QueryError extends ProviderError {
121
+ constructor(message: string);
122
+ }
123
+ /**
124
+ * Raised when connecting to a provider fails
125
+ */
126
+ declare class ProviderConnectionError extends ProviderError {
127
+ constructor(message: string);
128
+ }
129
+ /**
130
+ * Raised when the provider configuration is invalid
131
+ */
132
+ declare class InvalidProviderConfigurationError extends ProviderError {
133
+ constructor(message: string);
134
+ }
135
+
136
+ /**
137
+ * Data App Provider Types
138
+ *
139
+ * TypeScript equivalents of the Python ProviderConfiguration Pydantic models
140
+ * from ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider_typing.py
141
+ */
142
+ /**
143
+ * Configuration model for data providers.
144
+ *
145
+ * This interface represents the configuration needed to connect to various
146
+ * database providers (Snowflake, Databricks, Athena, Benchling, etc.)
147
+ * attached to a data app.
148
+ */
149
+ interface ProviderConfiguration {
150
+ /** Human-readable name of the provider */
151
+ name: string;
152
+ /** Provider type (snowflake, databricks, benchling, custom, etc.) */
153
+ type: string;
154
+ /** Optional URL to the provider's icon */
155
+ iconUrl?: string;
156
+ /** Dictionary containing connection details and credentials */
157
+ fields: Record<string, string | undefined>;
158
+ }
159
+ /**
160
+ * Minimal provider information as returned by the /dataapps/apps/{appId} endpoint
161
+ */
162
+ interface MinimalProvider {
163
+ id: string;
164
+ orgSlug: string;
165
+ name: string;
166
+ type: string;
167
+ iconUrl: string;
168
+ createdAt: string;
169
+ updatedAt?: string;
170
+ createdBy: string;
171
+ updatedBy?: string;
172
+ }
173
+ /**
174
+ * Provider secret information from the provider API response
175
+ */
176
+ interface ProviderSecret {
177
+ name: string;
178
+ value?: string;
179
+ type: string;
180
+ required: boolean;
181
+ arn: string;
182
+ envName: string;
183
+ }
184
+ /**
185
+ * Full provider API response including secrets
186
+ */
187
+ interface ProviderApiResponse {
188
+ id: string;
189
+ orgSlug: string;
190
+ name: string;
191
+ type: string;
192
+ iconUrl: string;
193
+ createdAt: string;
194
+ updatedAt?: string;
195
+ createdBy: string;
196
+ updatedBy?: string;
197
+ dataAppCount: string;
198
+ secrets: ProviderSecret[];
199
+ }
200
+ /**
201
+ * Container data app response from /dataapps/apps/container/{connectorId}
202
+ */
203
+ interface ContainerDataApp {
204
+ id: string;
205
+ orgSlug: string;
206
+ connectorId: string;
207
+ serviceNamespace: string;
208
+ serviceDiscoveryName: string;
209
+ createdAt: string;
210
+ updatedAt?: string;
211
+ createdBy: string;
212
+ updatedBy?: string;
213
+ port: string;
214
+ config: Record<string, unknown>;
215
+ providers: MinimalProvider[];
216
+ }
217
+ /**
218
+ * Organization API response
219
+ */
220
+ interface OrganizationApiResponse {
221
+ id: string;
222
+ orgSlug: string;
223
+ name: string;
224
+ emailDomain: string;
225
+ authType: string;
226
+ features: Record<string, unknown>;
227
+ tenantId: string;
228
+ createdAt: string;
229
+ createdBy: string;
230
+ modifiedAt?: string;
231
+ modifiedBy?: string;
232
+ subdomain: string;
233
+ ssoEnabledOnTenant: boolean;
234
+ }
235
+ /**
236
+ * Options for getProviderConfigurations function
237
+ */
238
+ interface GetProviderConfigurationsOptions {
239
+ /** Override provider configurations JSON (for local development) */
240
+ providerConfigOverride?: string;
241
+ /** Connector ID (defaults to CONNECTOR_ID env var) */
242
+ connectorId?: string;
243
+ }
244
+ /**
245
+ * Display-friendly provider information for UI components.
246
+ *
247
+ * A simplified subset of ProviderConfiguration containing only the
248
+ * fields needed for displaying provider information in the UI,
249
+ * including the names of available connection fields without their
250
+ * secret values.
251
+ */
252
+ interface ProviderInfo {
253
+ /** Human-readable name of the provider */
254
+ name: string;
255
+ /** Provider type (snowflake, databricks, athena, etc.) */
256
+ type: string;
257
+ /** Optional URL to the provider's icon */
258
+ iconUrl?: string | null;
259
+ /** Names of available connection fields (without secret values) */
260
+ availableFields: string[];
261
+ }
262
+ /**
263
+ * Standardized query result from data providers.
264
+ *
265
+ * This interface provides a consistent shape for query results across
266
+ * all provider types (Snowflake, Databricks, Athena), with optional
267
+ * metadata for API responses.
268
+ */
269
+ interface QueryResult {
270
+ /** Array of row objects returned by the query */
271
+ data: Array<Record<string, unknown>>;
272
+ /** Number of rows returned */
273
+ rowCount: number;
274
+ /** Name of the provider that executed the query */
275
+ provider?: string;
276
+ /** Whether this is mock/demo data */
277
+ mock?: boolean;
278
+ /** Optional message (e.g., for errors or warnings) */
279
+ message?: string;
280
+ }
281
+
282
+ /**
283
+ * Get Provider Configurations
284
+ *
285
+ * TypeScript equivalent of get_provider_configurations from
286
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider.py
287
+ *
288
+ * Retrieves data app provider configurations either from environment variable
289
+ * override or by fetching from the TDP API.
290
+ */
291
+
292
+ /**
293
+ * Get the provider configurations.
294
+ *
295
+ * There are two ways to get the provider configurations:
296
+ * 1. If the environment variable `DATA_APP_PROVIDER_CONFIG` is set or
297
+ * providerConfigOverride is provided, the provider configurations are read from it.
298
+ * 2. If the environment variable `CONNECTOR_ID` is set or connectorId is provided,
299
+ * the provider configurations are fetched from TDP. The secrets are read from
300
+ * environment variables.
301
+ * 3. If neither of the above is set, an empty array is returned.
302
+ *
303
+ * Option 1 is used for local development to specify the provider configurations directly.
304
+ * Option 2 is used in production to fetch the provider configurations from TDP.
305
+ *
306
+ * @param client - Initialized TDPClient instance (call client.init() first)
307
+ * @param options - Optional configuration overrides
308
+ * @returns Array of provider configurations
309
+ * @throws {InvalidProviderConfigurationError} If provider config JSON is invalid
310
+ * @throws {Error} If TDPClient is not initialized
311
+ *
312
+ * @example
313
+ * ```typescript
314
+ * import { TDPClient } from '@tetrascience-npm/ts-connectors-sdk';
315
+ * import { getProviderConfigurations } from '@tetrascience-npm/tetrascience-react-ui/server';
316
+ *
317
+ * // Initialize TDPClient with user's JWT token
318
+ * // Other fields (tdpEndpoint, connectorId, orgSlug) are read from environment variables
319
+ * const client = new TDPClient({
320
+ * authToken: userJwtToken, // from jwtManager.getTokenFromExpressRequest(req)
321
+ * artifactType: "data-app",
322
+ * });
323
+ * await client.init();
324
+ *
325
+ * const providers = await getProviderConfigurations(client);
326
+ *
327
+ * for (const provider of providers) {
328
+ * console.log(`Provider: ${provider.name} (${provider.type})`);
329
+ * }
330
+ * ```
331
+ */
332
+ declare function getProviderConfigurations(client: TDPClient, options?: GetProviderConfigurationsOptions): Promise<ProviderConfiguration[]>;
333
+
334
+ type SnowflakeConnection = snowflake_sdk.Connection;
335
+ /**
336
+ * Snowflake data provider
337
+ */
338
+ declare class SnowflakeProvider {
339
+ private connection;
340
+ /**
341
+ * Initialize the Snowflake data provider
342
+ *
343
+ * @param connection - Snowflake connection
344
+ */
345
+ constructor(connection: SnowflakeConnection);
346
+ /**
347
+ * Query the Snowflake database
348
+ *
349
+ * @param sqlText - SQL query to execute
350
+ * @param params - Parameters to pass to the query. For positional binds, use an array.
351
+ * For named binds, use an object with keys matching the bind variable names.
352
+ * @returns Promise resolving to array of row objects
353
+ */
354
+ query(sqlText: string, params?: Record<string, unknown> | unknown[]): Promise<Array<Record<string, unknown>>>;
355
+ /**
356
+ * Close the Snowflake connection
357
+ */
358
+ close(): Promise<void>;
359
+ }
360
+ /**
361
+ * Build a Snowflake data provider from the configuration
362
+ *
363
+ * @param config - Provider configuration
364
+ * @returns Promise resolving to Snowflake data provider
365
+ * @throws {InvalidProviderConfigurationError} If snowflake-sdk is not installed or config is invalid
366
+ */
367
+ declare function buildSnowflakeProvider(config: ProviderConfiguration): Promise<SnowflakeProvider>;
368
+
369
+ type DBSQLClient = _databricks_sql.DBSQLClient;
370
+ type IDBSQLSession = _databricks_sql_dist_contracts_IDBSQLSession.default;
371
+ /**
372
+ * Databricks data provider
373
+ */
374
+ declare class DatabricksProvider {
375
+ private client;
376
+ private session;
377
+ /**
378
+ * Initialize the Databricks data provider
379
+ *
380
+ * @param client - Databricks SQL client
381
+ * @param session - Databricks SQL session
382
+ */
383
+ constructor(client: DBSQLClient, session: IDBSQLSession);
384
+ /**
385
+ * Query the Databricks database
386
+ *
387
+ * @param sqlQuery - SQL query to execute
388
+ * @param _params - Parameters to pass to the query (currently not used)
389
+ * @returns Promise resolving to array of row objects
390
+ */
391
+ query(sqlQuery: string, _params?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
392
+ /**
393
+ * Close the Databricks connection
394
+ */
395
+ close(): Promise<void>;
396
+ }
397
+ /**
398
+ * Build a Databricks data provider from the configuration
399
+ *
400
+ * @param config - Provider configuration
401
+ * @returns Promise resolving to Databricks data provider
402
+ * @throws {InvalidProviderConfigurationError} If @databricks/sql is not installed or config is invalid
403
+ */
404
+ declare function buildDatabricksProvider(config: ProviderConfiguration): Promise<DatabricksProvider>;
405
+
406
+ /**
407
+ * Athena Data Provider
408
+ *
409
+ * TypeScript equivalent of AthenaProvider from
410
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider.py
411
+ *
412
+ * @remarks
413
+ * This provider requires the `@aws-sdk/client-athena` package to be installed.
414
+ * It is an optional peer dependency - install it only if you need Athena support:
415
+ * ```bash
416
+ * npm install @aws-sdk/client-athena
417
+ * # or
418
+ * yarn add @aws-sdk/client-athena
419
+ * ```
420
+ */
421
+ type AthenaClient = _aws_sdk_client_athena.AthenaClient;
422
+ type AthenaSDK = typeof _aws_sdk_client_athena;
423
+ /**
424
+ * Athena data provider
425
+ */
426
+ declare class AthenaProvider {
427
+ private client;
428
+ private sdk;
429
+ private workgroup;
430
+ private database;
431
+ private outputLocation?;
432
+ /**
433
+ * Initialize the Athena data provider
434
+ *
435
+ * @param client - AWS Athena client
436
+ * @param sdk - AWS Athena SDK module (for accessing command classes)
437
+ * @param workgroup - Athena workgroup to use
438
+ * @param database - Default database/schema
439
+ * @param outputLocation - Optional S3 output location
440
+ */
441
+ constructor(client: AthenaClient, sdk: AthenaSDK, workgroup: string, database: string, outputLocation?: string);
442
+ /**
443
+ * Query the Athena database
444
+ *
445
+ * @param sqlQuery - SQL query to execute
446
+ * @param _params - Parameters to pass to the query (currently not used - Athena doesn't support parameterized queries)
447
+ * @returns Promise resolving to array of row objects
448
+ *
449
+ * @remarks
450
+ * **Security Note:** AWS Athena does not support parameterized queries.
451
+ * Unlike traditional databases, there is no native way to use bind parameters
452
+ * with Athena. Callers are responsible for properly sanitizing any user input
453
+ * before constructing the SQL query string. This is a known limitation of the
454
+ * Athena service, not a design flaw in this implementation.
455
+ */
456
+ query(sqlQuery: string, _params?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
457
+ /**
458
+ * Wait for query to complete
459
+ */
460
+ private waitForQueryCompletion;
461
+ /**
462
+ * Fetch all results from a completed query
463
+ */
464
+ private fetchAllResults;
465
+ /**
466
+ * Close the Athena client (no-op for AWS SDK clients)
467
+ */
468
+ close(): Promise<void>;
469
+ }
470
+ /**
471
+ * Get the TDP Athena provider
472
+ *
473
+ * Creates an Athena provider using TDP environment configuration
474
+ *
475
+ * @returns Promise resolving to Athena data provider
476
+ * @throws {InvalidProviderConfigurationError} If @aws-sdk/client-athena is not installed
477
+ * @throws {Error} If ATHENA_S3_OUTPUT_LOCATION is not set when using the 'primary' workgroup
478
+ */
479
+ declare function getTdpAthenaProvider(): Promise<AthenaProvider>;
480
+
481
+ /**
482
+ * Build Provider Factory
483
+ *
484
+ * TypeScript equivalent of build_provider from
485
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider.py
486
+ */
487
+
488
+ /**
489
+ * Union type of all supported data providers
490
+ */
491
+ type DataProvider = SnowflakeProvider | DatabricksProvider | AthenaProvider;
492
+ /**
493
+ * Build a data provider from the configuration
494
+ *
495
+ * The return type is a union of specific provider types. More provider types
496
+ * may be added in the future.
497
+ *
498
+ * @param config - Provider configuration
499
+ * @returns Promise resolving to the appropriate data provider
500
+ * @throws {InvalidProviderConfigurationError} If the provider type is not supported
501
+ *
502
+ * @example
503
+ * ```typescript
504
+ * import { TDPClient } from '@tetrascience-npm/ts-connectors-sdk';
505
+ * import { buildProvider, getProviderConfigurations } from '@tetrascience-npm/tetrascience-react-ui/server';
506
+ *
507
+ * // Other fields (tdpEndpoint, connectorId, orgSlug) are read from environment variables
508
+ * const client = new TDPClient({
509
+ * authToken: userJwt,
510
+ * artifactType: "data-app",
511
+ * });
512
+ * await client.init();
513
+ * const configs = await getProviderConfigurations(client);
514
+ *
515
+ * const snowflakeConfig = configs.find(c => c.type === 'snowflake');
516
+ * if (snowflakeConfig) {
517
+ * const provider = await buildProvider(snowflakeConfig);
518
+ * const results = await provider.query('SELECT * FROM my_table');
519
+ * }
520
+ * ```
521
+ */
522
+ declare function buildProvider(config: ProviderConfiguration): Promise<DataProvider>;
523
+
524
+ export { AthenaProvider, DatabricksProvider, InvalidProviderConfigurationError, JwtTokenManager, MissingTableError, ProviderConnectionError, ProviderError, QueryError, SnowflakeProvider, buildDatabricksProvider, buildProvider, buildSnowflakeProvider, getProviderConfigurations, getTdpAthenaProvider, jwtManager };
525
+ export type { ContainerDataApp, CookieDict, DataProvider, ExpressRequestLike, GetProviderConfigurationsOptions, JwtTokenManagerConfig, MinimalProvider, OrganizationApiResponse, ProviderApiResponse, ProviderConfiguration, ProviderInfo, ProviderSecret, QueryResult };