Update interfaces.ts

This commit is contained in:
Nate Kelley 2025-03-25 11:23:19 -06:00
parent 1bf3d42e5b
commit cd39acaf41
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 95 additions and 65 deletions

View File

@ -1,4 +1,4 @@
import type { BusterDataset } from '../datasets'; import * as v from 'valibot';
export enum DataSourceStatus { export enum DataSourceStatus {
ACTIVE = 'active', ACTIVE = 'active',
@ -57,76 +57,106 @@ export enum DataSourceEnvironment {
development = 'development' development = 'development'
} }
export interface PostgresCredentials { export const PostgresCredentialsSchema = v.object({
name: string; name: v.string(),
type: 'postgres' | 'supabase'; type: v.union([v.literal('postgres'), v.literal('supabase')]),
host: string; host: v.string(),
port: number; port: v.pipe(
username: string; v.number(),
password: string; v.minValue(1, 'Port must be greater than 0'),
default_database: string; //postgres v.maxValue(65535, 'Port must be less than or equal to 65535')
default_schema: string; //public ),
} username: v.string(),
password: v.string(),
default_database: v.string(), // postgres
default_schema: v.string() // public
});
export interface MySQLCredentials { export type PostgresCredentials = v.InferOutput<typeof PostgresCredentialsSchema>;
name: string;
type: 'mysql' | 'mariadb';
host: string;
port: number;
username: string;
}
export interface BigQueryCredentials { export const MySQLCredentialsSchema = v.object({
name: string; name: v.string(),
type: 'bigquery'; type: v.union([v.literal('mysql'), v.literal('mariadb')]),
service_role_key: string; host: v.string(),
default_project_id: string; port: v.pipe(
default_dataset_id: string; v.number(),
} v.minValue(1, 'Port must be greater than 0'),
v.maxValue(65535, 'Port must be less than or equal to 65535')
),
username: v.string()
});
export interface RedshiftCredentials { export type MySQLCredentials = v.InferOutput<typeof MySQLCredentialsSchema>;
name: string;
type: 'redshift';
host: string;
port: number;
username: string;
password: string;
default_database: string;
default_schema: string;
}
export interface SnowflakeCredentials { export const BigQueryCredentialsSchema = v.object({
name: string; name: v.string(),
type: 'snowflake'; type: v.literal('bigquery'),
account_id: string; service_role_key: v.string('Service role key is required'),
warehouse_id: string; default_project_id: v.string('Project ID is required'),
username: string; default_dataset_id: v.string('Dataset ID is required')
password: string; });
role: string | null;
default_database: string;
default_schema: string;
}
export interface DatabricksCredentials { export type BigQueryCredentials = v.InferOutput<typeof BigQueryCredentialsSchema>;
name: string;
type: 'databricks';
host: string;
api_key: string;
warehouse_id: string;
default_catalog: string;
default_schema: string;
}
export interface SQLServerCredentials { export const RedshiftCredentialsSchema = v.object({
name: string; name: v.string(),
type: 'sqlserver'; type: v.literal('redshift'),
host: string; host: v.string(),
port: number; port: v.pipe(
username: string; v.number(),
password: string; v.minValue(1, 'Port must be greater than 0'),
default_database: string; v.maxValue(65535, 'Port must be less than or equal to 65535')
default_schema: string; ),
} username: v.string(),
password: v.string(),
default_database: v.string(),
default_schema: v.string()
});
export type RedshiftCredentials = v.InferOutput<typeof RedshiftCredentialsSchema>;
export const SnowflakeCredentialsSchema = v.object({
name: v.string(),
type: v.literal('snowflake'),
account_id: v.string('Account ID is required'),
warehouse_id: v.string('Warehouse ID is required'),
username: v.string(),
password: v.string(),
role: v.nullable(v.string()),
default_database: v.string(),
default_schema: v.string()
});
export type SnowflakeCredentials = v.InferOutput<typeof SnowflakeCredentialsSchema>;
export const DatabricksCredentialsSchema = v.object({
name: v.string(),
type: v.literal('databricks'),
host: v.string(),
api_key: v.string('API key is required'),
warehouse_id: v.string('Warehouse ID is required'),
default_catalog: v.string(),
default_schema: v.string()
});
export type DatabricksCredentials = v.InferOutput<typeof DatabricksCredentialsSchema>;
export const SQLServerCredentialsSchema = v.object({
name: v.string(),
type: v.literal('sqlserver'),
host: v.string(),
port: v.pipe(
v.number(),
v.minValue(1, 'Port must be greater than 0'),
v.maxValue(65535, 'Port must be less than or equal to 65535')
),
username: v.string(),
password: v.string(),
default_database: v.string(),
default_schema: v.string()
});
export type SQLServerCredentials = v.InferOutput<typeof SQLServerCredentialsSchema>;
export interface DataSource { export interface DataSource {
created_at: '2024-07-18T21:19:49.721159Z'; created_at: '2024-07-18T21:19:49.721159Z';