-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
57 lines (48 loc) · 1.24 KB
/
types.ts
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
import type { mssqlTypes } from '@cityssm/mssql-multi-pool'
interface SourceQueryConfiguration {
sourceType: 'sql'
sourceSql: string
sourceParameters?: Record<string, unknown>
}
interface SourceTableConfiguration {
sourceType: 'table'
sourceTableName: string
}
export type SourceConfiguration = (
| SourceQueryConfiguration
| SourceTableConfiguration
) & {
sourceDatabase: mssqlTypes.config
}
export interface DestinationConfiguration {
destinationTableName: string
destinationDatabase: mssqlTypes.config
}
export interface DestinationViewConfiguration {
destinationViewName: string
destinationDatabase: mssqlTypes.config
dropOldTables?: boolean
}
interface ReplicateResultSuccess {
success: true
destinationRows: number
destinationTableName: string
}
export type ErrorStep =
| 'source:connect'
| 'source:request'
| 'source:query'
| 'destination:buildSql'
| 'destination:connect'
| 'destination:createTable'
| 'destination:insert'
| 'destination:createView'
| 'destination:alterView'
| 'destination:dropTable'
interface ReplicateResultError {
success: false
destinationRows: number
errorStep: ErrorStep
errorMessage: string
}
export type ReplicateResult = ReplicateResultSuccess | ReplicateResultError