dbgate-types 5.4.5-alpha.5 → 5.5.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.
package/dbinfo.d.ts CHANGED
@@ -126,6 +126,7 @@ export interface TriggerInfo extends SqlObjectInfo {}
126
126
  export interface SchemaInfo {
127
127
  objectId?: string;
128
128
  schemaName: string;
129
+ isDefault?: boolean;
129
130
  }
130
131
 
131
132
  export interface DatabaseInfoObjects {
@@ -139,7 +140,5 @@ export interface DatabaseInfoObjects {
139
140
  }
140
141
 
141
142
  export interface DatabaseInfo extends DatabaseInfoObjects {
142
- schemas?: SchemaInfo[];
143
143
  engine?: string;
144
- defaultSchema?: string;
145
144
  }
package/dialect.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface SqlDialect {
17
17
 
18
18
  dropColumnDependencies?: string[];
19
19
  changeColumnDependencies?: string[];
20
+ renameColumnDependencies?: string[];
20
21
 
21
22
  dropIndexContainsTableSpec?: boolean;
22
23
 
@@ -49,7 +50,13 @@ export interface SqlDialect {
49
50
  predefinedDataTypes: string[];
50
51
 
51
52
  // create sql-tree expression
52
- createColumnViewExpression(columnName: string, dataType: string, source: { alias: string }, alias?: string): any;
53
+ createColumnViewExpression(
54
+ columnName: string,
55
+ dataType: string,
56
+ source: { alias: string },
57
+ alias?: string,
58
+ purpose: 'view' | 'filter' = 'view'
59
+ ): any;
53
60
 
54
61
  getTableFormOptions(intent: 'newTableForm' | 'editTableForm' | 'sqlCreateTable' | 'sqlAlterTable'): {
55
62
  name: string;
package/engines.d.ts CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  FunctionInfo,
12
12
  TriggerInfo,
13
13
  CollectionInfo,
14
+ SchemaInfo,
14
15
  } from './dbinfo';
15
16
  import { FilterBehaviour } from './filter-type';
16
17
 
@@ -24,10 +25,12 @@ export interface StreamOptions {
24
25
 
25
26
  export interface RunScriptOptions {
26
27
  useTransaction: boolean;
28
+ queryOptions?: QueryOptions;
27
29
  }
28
30
 
29
31
  export interface QueryOptions {
30
32
  discardResult?: boolean;
33
+ importSqlDump?: boolean;
31
34
  }
32
35
 
33
36
  export interface WriteTableOptions {
@@ -129,6 +132,15 @@ export interface FilterBehaviourProvider {
129
132
  getFilterBehaviour(dataType: string, standardFilterBehaviours: { [id: string]: FilterBehaviour }): FilterBehaviour;
130
133
  }
131
134
 
135
+ export interface DatabaseHandle {
136
+ client: any;
137
+ database?: string;
138
+ feedback?: (message: any) => void;
139
+ getDatabase?: () => any;
140
+ connectionType?: string;
141
+ treeKeySeparator?: string;
142
+ }
143
+
132
144
  export interface EngineDriver extends FilterBehaviourProvider {
133
145
  engine: string;
134
146
  title: string;
@@ -170,52 +182,52 @@ export interface EngineDriver extends FilterBehaviourProvider {
170
182
  defaultSocketPath?: string;
171
183
  authTypeLabel?: string;
172
184
  importExportArgs?: any[];
173
- connect({ server, port, user, password, database }): Promise<any>;
174
- close(pool): Promise<any>;
175
- query(pool: any, sql: string, options?: QueryOptions): Promise<QueryResult>;
176
- stream(pool: any, sql: string, options: StreamOptions);
177
- readQuery(pool: any, sql: string, structure?: TableInfo): Promise<stream.Readable>;
178
- readJsonQuery(pool: any, query: any, structure?: TableInfo): Promise<stream.Readable>;
179
- writeTable(pool: any, name: NamedObjectInfo, options: WriteTableOptions): Promise<stream.Writable>;
185
+ connect({ server, port, user, password, database }): Promise<DatabaseHandle>;
186
+ close(dbhan: DatabaseHandle): Promise<any>;
187
+ query(dbhan: DatabaseHandle, sql: string, options?: QueryOptions): Promise<QueryResult>;
188
+ stream(dbhan: DatabaseHandle, sql: string, options: StreamOptions);
189
+ readQuery(dbhan: DatabaseHandle, sql: string, structure?: TableInfo): Promise<stream.Readable>;
190
+ readJsonQuery(dbhan: DatabaseHandle, query: any, structure?: TableInfo): Promise<stream.Readable>;
191
+ writeTable(dbhan: DatabaseHandle, name: NamedObjectInfo, options: WriteTableOptions): Promise<stream.Writable>;
180
192
  analyseSingleObject(
181
- pool: any,
193
+ dbhan: DatabaseHandle,
182
194
  name: NamedObjectInfo,
183
195
  objectTypeField: keyof DatabaseInfo
184
196
  ): Promise<TableInfo | ViewInfo | ProcedureInfo | FunctionInfo | TriggerInfo>;
185
- analyseSingleTable(pool: any, name: NamedObjectInfo): Promise<TableInfo>;
186
- getVersion(pool: any): Promise<{ version: string }>;
187
- listDatabases(pool: any): Promise<
197
+ analyseSingleTable(dbhan: DatabaseHandle, name: NamedObjectInfo): Promise<TableInfo>;
198
+ getVersion(dbhan: DatabaseHandle): Promise<{ version: string }>;
199
+ listDatabases(dbhan: DatabaseHandle): Promise<
188
200
  {
189
201
  name: string;
190
202
  }[]
191
203
  >;
192
- loadKeys(pool, root: string, filter?: string): Promise;
193
- exportKeys(pool, options: {}): Promise;
194
- loadKeyInfo(pool, key): Promise;
195
- loadKeyTableRange(pool, key, cursor, count): Promise;
196
- loadFieldValues(pool: any, name: NamedObjectInfo, field: string, search: string): Promise;
197
- analyseFull(pool: any, serverVersion): Promise<DatabaseInfo>;
198
- analyseIncremental(pool: any, structure: DatabaseInfo, serverVersion): Promise<DatabaseInfo>;
204
+ loadKeys(dbhan: DatabaseHandle, root: string, filter?: string): Promise;
205
+ exportKeys(dbhan: DatabaseHandle, options: {}): Promise;
206
+ loadKeyInfo(dbhan: DatabaseHandle, key): Promise;
207
+ loadKeyTableRange(dbhan: DatabaseHandle, key, cursor, count): Promise;
208
+ loadFieldValues(dbhan: DatabaseHandle, name: NamedObjectInfo, field: string, search: string): Promise;
209
+ analyseFull(dbhan: DatabaseHandle, serverVersion): Promise<DatabaseInfo>;
210
+ analyseIncremental(dbhan: DatabaseHandle, structure: DatabaseInfo, serverVersion): Promise<DatabaseInfo>;
199
211
  dialect: SqlDialect;
200
212
  dialectByVersion(version): SqlDialect;
201
213
  createDumper(options = null): SqlDumper;
202
- createBackupDumper(pool: any, options): Promise<SqlBackupDumper>;
214
+ createBackupDumper(dbhan: DatabaseHandle, options): Promise<SqlBackupDumper>;
203
215
  getAuthTypes(): EngineAuthType[];
204
- readCollection(pool: any, options: ReadCollectionOptions): Promise<any>;
205
- updateCollection(pool: any, changeSet: any): Promise<any>;
216
+ readCollection(dbhan: DatabaseHandle, options: ReadCollectionOptions): Promise<any>;
217
+ updateCollection(dbhan: DatabaseHandle, changeSet: any): Promise<any>;
206
218
  getCollectionUpdateScript(changeSet: any, collectionInfo: CollectionInfo): string;
207
- createDatabase(pool: any, name: string): Promise;
208
- dropDatabase(pool: any, name: string): Promise;
219
+ createDatabase(dbhan: DatabaseHandle, name: string): Promise;
220
+ dropDatabase(dbhan: DatabaseHandle, name: string): Promise;
209
221
  getQuerySplitterOptions(usage: 'stream' | 'script' | 'editor'): any;
210
- script(pool: any, sql: string, options?: RunScriptOptions): Promise;
211
- operation(pool: any, operation: {}, options?: RunScriptOptions): Promise;
222
+ script(dbhan: DatabaseHandle, sql: string, options?: RunScriptOptions): Promise;
223
+ operation(dbhan: DatabaseHandle, operation: {}, options?: RunScriptOptions): Promise;
212
224
  getNewObjectTemplates(): NewObjectTemplate[];
213
- // direct call of pool method, only some methods could be supported, on only some drivers
214
- callMethod(pool, method, args);
215
- serverSummary(pool): Promise<ServerSummary>;
216
- summaryCommand(pool, command, row): Promise<void>;
217
- startProfiler(pool, options): Promise<any>;
218
- stopProfiler(pool, profiler): Promise<void>;
225
+ // direct call of dbhan.client method, only some methods could be supported, on only some drivers
226
+ callMethod(dbhan: DatabaseHandle, method, args);
227
+ serverSummary(dbhan: DatabaseHandle): Promise<ServerSummary>;
228
+ summaryCommand(dbhan: DatabaseHandle, command, row): Promise<void>;
229
+ startProfiler(dbhan: DatabaseHandle, options): Promise<any>;
230
+ stopProfiler(dbhan: DatabaseHandle, profiler): Promise<void>;
219
231
  getRedirectAuthUrl(connection, options): Promise<{ url: string; sid: string }>;
220
232
  getAuthTokenFromCode(connection, options): Promise<string>;
221
233
  getAccessTokenFromAuth(connection, req): Promise<string | null>;
@@ -228,6 +240,9 @@ export interface EngineDriver extends FilterBehaviourProvider {
228
240
  dbinfo: DatabaseInfo,
229
241
  defaultCreator: (changeSet: any, dbinfo: DatabaseInfo) => any
230
242
  ): any[];
243
+ // adapts table info from different source (import, other database) to be suitable for this database
244
+ adaptTableInfo(table: TableInfo): TableInfo;
245
+ listSchemas(dbhan: DatabaseHandle): SchemaInfo[];
231
246
 
232
247
  analyserClass?: any;
233
248
  dumperClass?: any;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.4.5-alpha.5",
2
+ "version": "5.5.1",
3
3
  "name": "dbgate-types",
4
4
  "homepage": "https://dbgate.org/",
5
5
  "repository": {