-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
157 lines (148 loc) · 4.1 KB
/
Copy pathtypes.ts
File metadata and controls
157 lines (148 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**
* Represents the database driver types supported by DBCode
*/
export type Driver =
| 'postgres'
| 'mssql'
| 'azure'
| 'cockroach'
| 'yugabyte'
| 'timescale'
| 'mysql'
| 'mariadb'
| 'mongodb'
| 'sqlite'
| 'libsql'
| 'd1'
| 'redshift'
| 'oracle'
| 'duckdb'
| 'cassandra'
| 'snowflake'
| 'motherduck'
| 'db2'
| 'bigquery'
| 'redis'
| 'starrocks'
| 'singlestore'
| 'doris'
| 'excel'
| 'csv'
| 'greenplum'
| 'clickhouse'
| 'dataverse'
| 'risingwave'
| 'trino'
| 'athena'
| 'databricks'
| 'elasticsearch'
| 'questdb'
| 'azuresynapse';
/**
* Password save options for database connections
*/
export type SavePasswordOption =
| 'no'
| 'yes'
| 'session'
| 'encrypted'
| 'secretStorage'
| 'na'
| 'cmd';
/**
* Connection role types for environment categorization
*/
export type ConnectionRole =
| 'production'
| 'testing'
| 'development'
| '';
/**
* Connection configuration for database connections
*/
export interface ConnectionConfig {
/** Unique identifier for the connection */
connectionId: string;
/** Tunnel ID if connecting through a tunnel */
tunnelId?: string;
/** The type of connection, either host-based or socket-based */
connectionType: 'host' | 'socket';
/** Database host/server address (required for host connections) */
host?: string;
/** Database port number (required for host connections) */
port?: number;
/** Socket path for socket-based connections */
socket?: string;
/** Database driver type */
driver: Driver;
/** Display name for the connection */
name: string;
/** Username for database authentication */
username?: string;
/** Password for database authentication */
password?: string;
/** Color identifier for UI display */
color?: string;
/** Database name to connect to */
database?: string;
/** How the password should be saved and managed */
savePassword?: SavePasswordOption;
/** Connection timeout in milliseconds */
connectionTimeout?: number;
/** Request timeout in milliseconds */
requestTimeout?: number;
/** Group name for organizing connections */
group?: string;
/** Whether to use SSL/TLS encryption */
ssl?: boolean;
/** Whether to trust self-signed or unauthorized SSL certificates */
sslTrustCertificate?: boolean;
/** Path to the SSL Certificate Authority (CA) certificate file */
sslCACert?: string;
/** Path to the SSL client certificate file */
sslClientCert?: string;
/** Path to the SSL client private key file */
sslClientKey?: string;
/** Driver-specific configuration options */
driverOptions?: { [key: string]: string | number | boolean };
/** Filters to apply to the connection for data display */
filters?: { [key: string]: string[] };
/** Whether the connection should be read-only */
readOnly?: boolean;
/** Environment role of the connection for categorization */
role?: ConnectionRole;
}
/**
* Result of connection operations
*/
export interface ConnectionOperationResult {
/** Whether the operation was successful */
success: boolean;
/** Error message if operation failed */
error?: string;
/** IDs of the connections involved in the operation */
connectionIds?: string[];
}
/**
* DBCode API interface for managing database connections
*/
export interface DBCodeAPI {
/**
* Add one or more database connections
* @param connections Array of connection configurations to add
* @returns Promise resolving to operation result
*/
addConnections(connections: ConnectionConfig[]): Promise<ConnectionOperationResult>;
/**
* Remove one or more database connections
* @param connectionIds Array of connection IDs to remove
* @returns Promise resolving to operation result
*/
removeConnections(connectionIds: string[]): Promise<ConnectionOperationResult>;
/**
* Reveal the DBCode explorer tree view and optionally select/expand a connection
* @param connectionId Optional connection ID to find, select and expand in the explorer
* @returns Promise resolving to operation result
*/
revealConnection(connectionId?: string): Promise<ConnectionOperationResult>;
}