dbgate-types 5.3.3 → 5.4.0

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.
@@ -15,5 +15,12 @@ export interface AlterProcessor {
15
15
  recreateTable(oldTable: TableInfo, newTable: TableInfo);
16
16
  createSqlObject(obj: SqlObjectInfo);
17
17
  dropSqlObject(obj: SqlObjectInfo);
18
- fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[], insertOnly: string[]);
18
+ fillPreloadedRows(
19
+ table: NamedObjectInfo,
20
+ oldRows: any[],
21
+ newRows: any[],
22
+ key: string[],
23
+ insertOnly: string[],
24
+ autoIncrementColumn: string
25
+ );
19
26
  }
package/dbinfo.d.ts CHANGED
@@ -94,7 +94,19 @@ export interface TableInfo extends DatabaseObjectInfo {
94
94
  __isDynamicStructure?: boolean;
95
95
  }
96
96
 
97
- export interface CollectionInfo extends DatabaseObjectInfo {}
97
+ export interface CollectionInfo extends DatabaseObjectInfo {
98
+ // all known columns with definition (only used in Cassandra)
99
+ knownColumns?: ColumnInfo[];
100
+
101
+ // unique combination of columns (should be contatenation of partitionKey and clusterKey)
102
+ uniqueKey?: ColumnReference[];
103
+
104
+ // partition key columns
105
+ partitionKey?: ColumnReference[]
106
+
107
+ // unique key inside partition
108
+ clusterKey?: ColumnReference[];
109
+ }
98
110
 
99
111
  export interface ViewInfo extends SqlObjectInfo {
100
112
  columns: ColumnInfo[];
package/dialect.d.ts CHANGED
@@ -34,6 +34,7 @@ export interface SqlDialect {
34
34
  dropCheck?: boolean;
35
35
 
36
36
  dropReferencesWhenDropTable?: boolean;
37
+ requireFromDual?: boolean;
37
38
 
38
39
  predefinedDataTypes: string[];
39
40
 
package/engines.d.ts CHANGED
@@ -2,7 +2,17 @@ import stream from 'stream';
2
2
  import { QueryResult } from './query';
3
3
  import { SqlDialect } from './dialect';
4
4
  import { SqlDumper } from './dumper';
5
- import { DatabaseInfo, NamedObjectInfo, TableInfo, ViewInfo, ProcedureInfo, FunctionInfo, TriggerInfo } from './dbinfo';
5
+ import {
6
+ DatabaseInfo,
7
+ NamedObjectInfo,
8
+ TableInfo,
9
+ ViewInfo,
10
+ ProcedureInfo,
11
+ FunctionInfo,
12
+ TriggerInfo,
13
+ CollectionInfo,
14
+ } from './dbinfo';
15
+ import { FilterBehaviour } from './filter-type';
6
16
 
7
17
  export interface StreamOptions {
8
18
  recordset: (columns) => void;
@@ -40,6 +50,9 @@ export interface ReadCollectionOptions {
40
50
  countDocuments?: boolean;
41
51
  skip?: number;
42
52
  limit?: number;
53
+ condition?: any;
54
+ aggregate?: CollectionAggregateDefinition;
55
+ sort?: CollectionSortDefinition;
43
56
  }
44
57
 
45
58
  export interface NewObjectTemplate {
@@ -71,7 +84,52 @@ export interface ServerSummary {
71
84
  databases: ServerSummaryDatabase[];
72
85
  }
73
86
 
74
- export interface EngineDriver {
87
+ export type CollectionAggregateFunction = 'count' | 'sum' | 'avg' | 'min' | 'max';
88
+ export interface CollectionAggregateDefinition {
89
+ condition: any; // SQL tree condition
90
+ groupByColumns: string[];
91
+ aggregateColumns: {
92
+ alias: string;
93
+ aggregateFunction: CollectionAggregateFunction;
94
+ columnArgument?: string;
95
+ }[];
96
+ }
97
+
98
+ export interface CollectionSortDefinitionItem {
99
+ columnName: string;
100
+ direction: 'ASC' | 'DESC';
101
+ }
102
+
103
+ export type CollectionSortDefinition = CollectionSortDefinitionItem[];
104
+
105
+ export interface DataEditorTypesBehaviour {
106
+ parseSqlNull?: boolean;
107
+ parseJsonNull?: boolean;
108
+ parseJsonBoolean?: boolean;
109
+ parseNumber?: boolean;
110
+ parseJsonArray?: boolean;
111
+ parseJsonObject?: boolean;
112
+ parseHexAsBuffer?: boolean;
113
+ parseObjectIdAsDollar?: boolean;
114
+ parseDateAsDollar?: boolean;
115
+
116
+ explicitDataType?: boolean;
117
+ supportNumberType?: boolean;
118
+ supportStringType?: boolean;
119
+ supportBooleanType?: boolean;
120
+ supportDateType?: boolean;
121
+ supportNullType?: boolean;
122
+ supportJsonType?: boolean;
123
+ supportObjectIdType?: boolean;
124
+
125
+ supportFieldRemoval?: boolean;
126
+ }
127
+
128
+ export interface FilterBehaviourProvider {
129
+ getFilterBehaviour(dataType: string, standardFilterBehaviours: { [id: string]: FilterBehaviour }): FilterBehaviour;
130
+ }
131
+
132
+ export interface EngineDriver extends FilterBehaviourProvider {
75
133
  engine: string;
76
134
  title: string;
77
135
  defaultPort?: number;
@@ -79,6 +137,7 @@ export interface EngineDriver {
79
137
  editorMode?: string;
80
138
  readOnlySessions: boolean;
81
139
  supportedKeyTypes: SupportedDbKeyType[];
140
+ dataEditorTypesBehaviour: DataEditorTypesBehaviour;
82
141
  supportsDatabaseUrl?: boolean;
83
142
  supportsDatabaseDump?: boolean;
84
143
  supportsServerSummary?: boolean;
@@ -89,8 +148,20 @@ export interface EngineDriver {
89
148
  profilerChartAggregateFunction?: string;
90
149
  profilerChartMeasures?: { label: string; field: string }[];
91
150
  isElectronOnly?: boolean;
151
+
152
+ collectionSingularLabel?: string;
153
+ collectionPluralLabel?: string;
154
+ collectionNameLabel?: string;
155
+ newCollectionFormParams?: any[];
156
+
92
157
  supportedCreateDatabase?: boolean;
93
- showConnectionField?: (field: string, values: any) => boolean;
158
+ showConnectionField?: (
159
+ field: string,
160
+ values: any,
161
+ {
162
+ config: {},
163
+ }
164
+ ) => boolean;
94
165
  showConnectionTab?: (tab: 'ssl' | 'sshTunnel', values: any) => boolean;
95
166
  beforeConnectionSave?: (values: any) => any;
96
167
  databaseUrlPlaceholder?: string;
@@ -131,11 +202,12 @@ export interface EngineDriver {
131
202
  getAuthTypes(): EngineAuthType[];
132
203
  readCollection(pool: any, options: ReadCollectionOptions): Promise<any>;
133
204
  updateCollection(pool: any, changeSet: any): Promise<any>;
134
- getCollectionUpdateScript(changeSet: any): string;
205
+ getCollectionUpdateScript(changeSet: any, collectionInfo: CollectionInfo): string;
135
206
  createDatabase(pool: any, name: string): Promise;
136
207
  dropDatabase(pool: any, name: string): Promise;
137
208
  getQuerySplitterOptions(usage: 'stream' | 'script' | 'editor'): any;
138
209
  script(pool: any, sql: string, options?: RunScriptOptions): Promise;
210
+ operation(pool: any, operation: {}, options?: RunScriptOptions): Promise;
139
211
  getNewObjectTemplates(): NewObjectTemplate[];
140
212
  // direct call of pool method, only some methods could be supported, on only some drivers
141
213
  callMethod(pool, method, args);
@@ -143,6 +215,13 @@ export interface EngineDriver {
143
215
  summaryCommand(pool, command, row): Promise<void>;
144
216
  startProfiler(pool, options): Promise<any>;
145
217
  stopProfiler(pool, profiler): Promise<void>;
218
+ getRedirectAuthUrl(connection, options): Promise<{ url: string; sid: string }>;
219
+ getAuthTokenFromCode(connection, options): Promise<string>;
220
+ getAccessTokenFromAuth(connection, req): Promise<string | null>;
221
+ getCollectionExportQueryScript(collection: string, condition: any, sort?: CollectionSortDefinition): string;
222
+ getCollectionExportQueryJson(collection: string, condition: any, sort?: CollectionSortDefinition): {};
223
+ getScriptTemplates(objectTypeField: keyof DatabaseInfo): { label: string; scriptTemplate: string }[];
224
+ getScriptTemplateContent(scriptTemplate: string, props: any): Promise<string>;
146
225
 
147
226
  analyserClass?: any;
148
227
  dumperClass?: any;
@@ -0,0 +1,19 @@
1
+ export interface FilterBehaviour {
2
+ supportEquals?: boolean;
3
+ supportStringInclusion?: boolean;
4
+ supportEmpty?: boolean;
5
+ supportNumberLikeComparison?: boolean;
6
+ supportDatetimeComparison?: boolean;
7
+ supportDatetimeSymbols?: boolean;
8
+ supportNullTesting?: boolean;
9
+ supportExistsTesting?: boolean;
10
+ supportBooleanValues?: boolean;
11
+ supportSqlCondition?: boolean;
12
+ supportArrayTesting?: boolean;
13
+
14
+ allowStringToken?: boolean;
15
+ allowNumberToken?: boolean;
16
+ allowHexString?: boolean;
17
+ allowNumberDualTesting?: boolean;
18
+ allowObjectIdTesting?: boolean;
19
+ }
package/index.d.ts CHANGED
@@ -47,3 +47,4 @@ export * from './dbtypes';
47
47
  export * from './extensions';
48
48
  export * from './alter-processor';
49
49
  export * from './appdefs';
50
+ export * from './filter-type';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.3.3",
2
+ "version": "5.4.0",
3
3
  "name": "dbgate-types",
4
4
  "homepage": "https://dbgate.org/",
5
5
  "repository": {