@tetrascience-npm/tetrascience-react-ui 0.2.0 → 0.3.0-beta.1.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 };