@tetrascience-npm/tetrascience-react-ui 0.4.0-beta.10.1 → 0.4.0-beta.12.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.
Files changed (61) hide show
  1. package/README.md +4 -4
  2. package/dist/athena.d.ts +167 -0
  3. package/dist/databricks.d.ts +129 -0
  4. package/dist/exceptions-DN25pCDi.cjs +2 -0
  5. package/dist/exceptions-DN25pCDi.cjs.map +1 -0
  6. package/dist/exceptions-jCQ6h5C8.js +33 -0
  7. package/dist/exceptions-jCQ6h5C8.js.map +1 -0
  8. package/dist/index.cjs +2021 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.css +1 -1
  11. package/dist/index.d.ts +2165 -2020
  12. package/dist/index.js +9461 -2
  13. package/dist/index.js.map +1 -0
  14. package/dist/logo.png +0 -0
  15. package/dist/providers/athena.cjs +2 -0
  16. package/dist/providers/athena.cjs.map +1 -0
  17. package/dist/providers/athena.d.ts +7 -77
  18. package/dist/providers/athena.js +160 -0
  19. package/dist/providers/athena.js.map +1 -0
  20. package/dist/providers/databricks.cjs +2 -0
  21. package/dist/providers/databricks.cjs.map +1 -0
  22. package/dist/providers/databricks.d.ts +7 -41
  23. package/dist/providers/databricks.js +85 -0
  24. package/dist/providers/databricks.js.map +1 -0
  25. package/dist/providers/snowflake.cjs +2 -0
  26. package/dist/providers/snowflake.cjs.map +1 -0
  27. package/dist/providers/snowflake.d.ts +7 -38
  28. package/dist/providers/snowflake.js +122 -0
  29. package/dist/providers/snowflake.js.map +1 -0
  30. package/dist/server.cjs +2 -0
  31. package/dist/server.cjs.map +1 -0
  32. package/dist/server.d.ts +537 -522
  33. package/dist/server.js +266 -0
  34. package/dist/server.js.map +1 -0
  35. package/dist/{providers/types-Ck4uFaGp.d.ts → snowflake.d.ts} +125 -82
  36. package/dist/vite.svg +1 -0
  37. package/package.json +32 -52
  38. package/dist/cjs/index.js +0 -2001
  39. package/dist/cjs/index.js.map +0 -1
  40. package/dist/cjs/providers/athena.js +0 -2
  41. package/dist/cjs/providers/athena.js.map +0 -1
  42. package/dist/cjs/providers/databricks.js +0 -2
  43. package/dist/cjs/providers/databricks.js.map +0 -1
  44. package/dist/cjs/providers/exceptions-CYktpdqW.js +0 -2
  45. package/dist/cjs/providers/exceptions-CYktpdqW.js.map +0 -1
  46. package/dist/cjs/providers/snowflake.js +0 -2
  47. package/dist/cjs/providers/snowflake.js.map +0 -1
  48. package/dist/cjs/server.js +0 -2
  49. package/dist/cjs/server.js.map +0 -1
  50. package/dist/esm/index.js +0 -2001
  51. package/dist/esm/index.js.map +0 -1
  52. package/dist/esm/providers/athena.js +0 -2
  53. package/dist/esm/providers/athena.js.map +0 -1
  54. package/dist/esm/providers/databricks.js +0 -2
  55. package/dist/esm/providers/databricks.js.map +0 -1
  56. package/dist/esm/providers/exceptions-C3uFWZB2.js +0 -2
  57. package/dist/esm/providers/exceptions-C3uFWZB2.js.map +0 -1
  58. package/dist/esm/providers/snowflake.js +0 -2
  59. package/dist/esm/providers/snowflake.js.map +0 -1
  60. package/dist/esm/server.js +0 -2
  61. package/dist/esm/server.js.map +0 -1
package/README.md CHANGED
@@ -293,7 +293,7 @@ import type { ButtonProps, BarGraphProps, BarDataSeries } from '@tetrascience-np
293
293
 
294
294
  ## Examples
295
295
 
296
- The repository includes example applications in the `examples/` directory:
296
+ This repository uses component driven development with storybook.js. To see the examples run the following.
297
297
 
298
298
  ```bash
299
299
  # Clone the repository
@@ -303,11 +303,11 @@ cd ts-lib-ui-kit
303
303
  # Install dependencies
304
304
  yarn
305
305
 
306
- # Run the themed example app
307
- yarn workspace vite-themed-app dev
306
+ # Run the storybook
307
+ yarn dev
308
308
  ```
309
309
 
310
- Visit <http://localhost:5173> to see the example app with custom theming.
310
+ Visit <http://localhost:6006>.
311
311
 
312
312
  ## Documentation
313
313
 
@@ -0,0 +1,167 @@
1
+ import { AthenaClient as AthenaClient_2 } from '@aws-sdk/client-athena';
2
+ import { awsSdkClientAthena } from '@aws-sdk/client-athena';
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
+ declare type AthenaClient = AthenaClient_2;
20
+
21
+ /**
22
+ * Athena data provider
23
+ */
24
+ export 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
+ declare type AthenaSDK = awsSdkClientAthena;
70
+
71
+ /**
72
+ * Get the TDP Athena provider
73
+ *
74
+ * Creates an Athena provider using TDP environment configuration
75
+ *
76
+ * @returns Promise resolving to Athena data provider
77
+ * @throws {InvalidProviderConfigurationError} If @aws-sdk/client-athena is not installed
78
+ * @throws {Error} If ATHENA_S3_OUTPUT_LOCATION is not set when using the 'primary' workgroup
79
+ */
80
+ export declare function getTdpAthenaProvider(): Promise<AthenaProvider>;
81
+
82
+ /**
83
+ * Raised when the provider configuration is invalid
84
+ */
85
+ export declare class InvalidProviderConfigurationError extends ProviderError {
86
+ constructor(message: string);
87
+ }
88
+
89
+ /**
90
+ * Raised when a table is missing in the database
91
+ */
92
+ export declare class MissingTableError extends ProviderError {
93
+ constructor(message: string);
94
+ }
95
+
96
+ /**
97
+ * Data App Provider Types
98
+ *
99
+ * TypeScript equivalents of the Python ProviderConfiguration Pydantic models
100
+ * from ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider_typing.py
101
+ */
102
+ /**
103
+ * Configuration model for data providers.
104
+ *
105
+ * This interface represents the configuration needed to connect to various
106
+ * database providers (Snowflake, Databricks, Athena, Benchling, etc.)
107
+ * attached to a data app.
108
+ */
109
+ export declare interface ProviderConfiguration {
110
+ /** Human-readable name of the provider */
111
+ name: string;
112
+ /** Provider type (snowflake, databricks, benchling, custom, etc.) */
113
+ type: string;
114
+ /** Optional URL to the provider's icon */
115
+ iconUrl?: string;
116
+ /** Dictionary containing connection details and credentials */
117
+ fields: Record<string, string | undefined>;
118
+ }
119
+
120
+ /**
121
+ * Raised when connecting to a provider fails
122
+ */
123
+ export declare class ProviderConnectionError extends ProviderError {
124
+ constructor(message: string);
125
+ }
126
+
127
+ /**
128
+ * Provider Exceptions
129
+ *
130
+ * TypeScript equivalents of the Python exceptions from
131
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py
132
+ */
133
+ /**
134
+ * Base class for provider errors
135
+ */
136
+ export declare class ProviderError extends Error {
137
+ constructor(message: string);
138
+ }
139
+
140
+ /**
141
+ * Raised when a query fails
142
+ */
143
+ export declare class QueryError extends ProviderError {
144
+ constructor(message: string);
145
+ }
146
+
147
+ /**
148
+ * Standardized query result from data providers.
149
+ *
150
+ * This interface provides a consistent shape for query results across
151
+ * all provider types (Snowflake, Databricks, Athena), with optional
152
+ * metadata for API responses.
153
+ */
154
+ export declare interface QueryResult {
155
+ /** Array of row objects returned by the query */
156
+ data: Array<Record<string, unknown>>;
157
+ /** Number of rows returned */
158
+ rowCount: number;
159
+ /** Name of the provider that executed the query */
160
+ provider?: string;
161
+ /** Whether this is mock/demo data */
162
+ mock?: boolean;
163
+ /** Optional message (e.g., for errors or warnings) */
164
+ message?: string;
165
+ }
166
+
167
+ export { }
@@ -0,0 +1,129 @@
1
+ import { DBSQLClient as DBSQLClient_2 } from '@databricks/sql';
2
+ import { default as default_2 } from '@databricks/sql/dist/contracts/IDBSQLSession';
3
+
4
+ /**
5
+ * Build a Databricks data provider from the configuration
6
+ *
7
+ * @param config - Provider configuration
8
+ * @returns Promise resolving to Databricks data provider
9
+ * @throws {InvalidProviderConfigurationError} If @databricks/sql is not installed or config is invalid
10
+ */
11
+ export declare function buildDatabricksProvider(config: ProviderConfiguration): Promise<DatabricksProvider>;
12
+
13
+ /**
14
+ * Databricks data provider
15
+ */
16
+ export declare class DatabricksProvider {
17
+ private client;
18
+ private session;
19
+ /**
20
+ * Initialize the Databricks data provider
21
+ *
22
+ * @param client - Databricks SQL client
23
+ * @param session - Databricks SQL session
24
+ */
25
+ constructor(client: DBSQLClient, session: IDBSQLSession);
26
+ /**
27
+ * Query the Databricks database
28
+ *
29
+ * @param sqlQuery - SQL query to execute
30
+ * @param _params - Parameters to pass to the query (currently not used)
31
+ * @returns Promise resolving to array of row objects
32
+ */
33
+ query(sqlQuery: string, _params?: Record<string, unknown>): Promise<Array<Record<string, unknown>>>;
34
+ /**
35
+ * Close the Databricks connection
36
+ */
37
+ close(): Promise<void>;
38
+ }
39
+
40
+ declare type DBSQLClient = DBSQLClient_2;
41
+
42
+ declare type IDBSQLSession = default_2;
43
+
44
+ /**
45
+ * Raised when the provider configuration is invalid
46
+ */
47
+ export declare class InvalidProviderConfigurationError extends ProviderError {
48
+ constructor(message: string);
49
+ }
50
+
51
+ /**
52
+ * Raised when a table is missing in the database
53
+ */
54
+ export declare class MissingTableError extends ProviderError {
55
+ constructor(message: string);
56
+ }
57
+
58
+ /**
59
+ * Data App Provider Types
60
+ *
61
+ * TypeScript equivalents of the Python ProviderConfiguration Pydantic models
62
+ * from ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/provider_typing.py
63
+ */
64
+ /**
65
+ * Configuration model for data providers.
66
+ *
67
+ * This interface represents the configuration needed to connect to various
68
+ * database providers (Snowflake, Databricks, Athena, Benchling, etc.)
69
+ * attached to a data app.
70
+ */
71
+ export declare interface ProviderConfiguration {
72
+ /** Human-readable name of the provider */
73
+ name: string;
74
+ /** Provider type (snowflake, databricks, benchling, custom, etc.) */
75
+ type: string;
76
+ /** Optional URL to the provider's icon */
77
+ iconUrl?: string;
78
+ /** Dictionary containing connection details and credentials */
79
+ fields: Record<string, string | undefined>;
80
+ }
81
+
82
+ /**
83
+ * Raised when connecting to a provider fails
84
+ */
85
+ export declare class ProviderConnectionError extends ProviderError {
86
+ constructor(message: string);
87
+ }
88
+
89
+ /**
90
+ * Provider Exceptions
91
+ *
92
+ * TypeScript equivalents of the Python exceptions from
93
+ * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py
94
+ */
95
+ /**
96
+ * Base class for provider errors
97
+ */
98
+ export declare class ProviderError extends Error {
99
+ constructor(message: string);
100
+ }
101
+
102
+ /**
103
+ * Raised when a query fails
104
+ */
105
+ export declare class QueryError extends ProviderError {
106
+ constructor(message: string);
107
+ }
108
+
109
+ /**
110
+ * Standardized query result from data providers.
111
+ *
112
+ * This interface provides a consistent shape for query results across
113
+ * all provider types (Snowflake, Databricks, Athena), with optional
114
+ * metadata for API responses.
115
+ */
116
+ export declare interface QueryResult {
117
+ /** Array of row objects returned by the query */
118
+ data: Array<Record<string, unknown>>;
119
+ /** Number of rows returned */
120
+ rowCount: number;
121
+ /** Name of the provider that executed the query */
122
+ provider?: string;
123
+ /** Whether this is mock/demo data */
124
+ mock?: boolean;
125
+ /** Optional message (e.g., for errors or warnings) */
126
+ message?: string;
127
+ }
128
+
129
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";class o extends Error{constructor(r){super(r),this.name="ProviderError"}}class s extends o{constructor(r){super(r),this.name="MissingTableError"}}class n extends o{constructor(r){super(r),this.name="QueryError"}}class i extends o{constructor(r){super(r),this.name="ProviderConnectionError"}}class t extends o{constructor(r){super(r),this.name="InvalidProviderConfigurationError"}}exports.InvalidProviderConfigurationError=t;exports.MissingTableError=s;exports.ProviderConnectionError=i;exports.ProviderError=o;exports.QueryError=n;
2
+ //# sourceMappingURL=exceptions-DN25pCDi.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions-DN25pCDi.cjs","sources":["../src/server/providers/exceptions.ts"],"sourcesContent":["/**\n * Provider Exceptions\n *\n * TypeScript equivalents of the Python exceptions from\n * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py\n */\n\n/**\n * Base class for provider errors\n */\nexport class ProviderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ProviderError\";\n }\n}\n\n/**\n * Raised when a table is missing in the database\n */\nexport class MissingTableError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"MissingTableError\";\n }\n}\n\n/**\n * Raised when a query fails\n */\nexport class QueryError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"QueryError\";\n }\n}\n\n/**\n * Raised when connecting to a provider fails\n */\nexport class ProviderConnectionError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"ProviderConnectionError\";\n }\n}\n\n/**\n * Raised when the provider configuration is invalid\n */\nexport class InvalidProviderConfigurationError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidProviderConfigurationError\";\n }\n}\n\n"],"names":["ProviderError","message","MissingTableError","QueryError","ProviderConnectionError","InvalidProviderConfigurationError"],"mappings":"aAUO,MAAMA,UAAsB,KAAM,CACvC,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,eACd,CACF,CAKO,MAAMC,UAA0BF,CAAc,CACnD,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,mBACd,CACF,CAKO,MAAME,UAAmBH,CAAc,CAC5C,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,YACd,CACF,CAKO,MAAMG,UAAgCJ,CAAc,CACzD,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,yBACd,CACF,CAKO,MAAMI,UAA0CL,CAAc,CACnE,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,mCACd,CACF"}
@@ -0,0 +1,33 @@
1
+ class o extends Error {
2
+ constructor(r) {
3
+ super(r), this.name = "ProviderError";
4
+ }
5
+ }
6
+ class e extends o {
7
+ constructor(r) {
8
+ super(r), this.name = "MissingTableError";
9
+ }
10
+ }
11
+ class n extends o {
12
+ constructor(r) {
13
+ super(r), this.name = "QueryError";
14
+ }
15
+ }
16
+ class t extends o {
17
+ constructor(r) {
18
+ super(r), this.name = "ProviderConnectionError";
19
+ }
20
+ }
21
+ class i extends o {
22
+ constructor(r) {
23
+ super(r), this.name = "InvalidProviderConfigurationError";
24
+ }
25
+ }
26
+ export {
27
+ i as I,
28
+ e as M,
29
+ t as P,
30
+ n as Q,
31
+ o as a
32
+ };
33
+ //# sourceMappingURL=exceptions-jCQ6h5C8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions-jCQ6h5C8.js","sources":["../src/server/providers/exceptions.ts"],"sourcesContent":["/**\n * Provider Exceptions\n *\n * TypeScript equivalents of the Python exceptions from\n * ts-lib-ui-kit-streamlit/tetrascience/data_app_providers/exceptions.py\n */\n\n/**\n * Base class for provider errors\n */\nexport class ProviderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ProviderError\";\n }\n}\n\n/**\n * Raised when a table is missing in the database\n */\nexport class MissingTableError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"MissingTableError\";\n }\n}\n\n/**\n * Raised when a query fails\n */\nexport class QueryError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"QueryError\";\n }\n}\n\n/**\n * Raised when connecting to a provider fails\n */\nexport class ProviderConnectionError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"ProviderConnectionError\";\n }\n}\n\n/**\n * Raised when the provider configuration is invalid\n */\nexport class InvalidProviderConfigurationError extends ProviderError {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidProviderConfigurationError\";\n }\n}\n\n"],"names":["ProviderError","message","MissingTableError","QueryError","ProviderConnectionError","InvalidProviderConfigurationError"],"mappings":"AAUO,MAAMA,UAAsB,MAAM;AAAA,EACvC,YAAYC,GAAiB;AAC3B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACd;AACF;AAKO,MAAMC,UAA0BF,EAAc;AAAA,EACnD,YAAYC,GAAiB;AAC3B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACd;AACF;AAKO,MAAME,UAAmBH,EAAc;AAAA,EAC5C,YAAYC,GAAiB;AAC3B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACd;AACF;AAKO,MAAMG,UAAgCJ,EAAc;AAAA,EACzD,YAAYC,GAAiB;AAC3B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACd;AACF;AAKO,MAAMI,UAA0CL,EAAc;AAAA,EACnE,YAAYC,GAAiB;AAC3B,UAAMA,CAAO,GACb,KAAK,OAAO;AAAA,EACd;AACF;"}