@budibase/server 2.6.16-alpha.3 → 2.6.16-alpha.5
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/builder/assets/{index.40a27943.js → index.b9eeb2a8.js} +216 -216
- package/builder/index.html +1 -1
- package/dist/api/controllers/datasource.js +70 -39
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/routes/datasource.js +1 -0
- package/dist/db/dynamoClient.js +1 -1
- package/dist/integrations/airtable.js +28 -2
- package/dist/integrations/arangodb.js +19 -3
- package/dist/integrations/couchdb.js +16 -1
- package/dist/integrations/dynamodb.js +16 -0
- package/dist/integrations/elasticsearch.js +15 -0
- package/dist/integrations/firebase.js +15 -0
- package/dist/integrations/googlesheets.js +16 -0
- package/dist/integrations/index.js +5 -2
- package/dist/integrations/microsoftSqlServer.js +16 -0
- package/dist/integrations/mongodb.js +16 -0
- package/dist/integrations/mysql.js +21 -5
- package/dist/integrations/oracle.js +29 -0
- package/dist/integrations/postgres.js +26 -7
- package/dist/integrations/redis.js +20 -1
- package/dist/integrations/s3.js +23 -4
- package/dist/integrations/snowflake.js +15 -0
- package/dist/migrations/functions/backfill/app/queries.js +1 -2
- package/dist/sdk/app/datasources/datasources.js +10 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/api/controllers/datasource.ts +88 -49
- package/src/api/controllers/integration.ts +3 -3
- package/src/api/routes/datasource.ts +5 -0
- package/src/db/dynamoClient.ts +1 -1
- package/src/integration-test/postgres.spec.ts +0 -1
- package/src/integrations/airtable.ts +31 -4
- package/src/integrations/arangodb.ts +18 -2
- package/src/integrations/couchdb.ts +18 -4
- package/src/integrations/dynamodb.ts +34 -5
- package/src/integrations/elasticsearch.ts +16 -1
- package/src/integrations/firebase.ts +15 -0
- package/src/integrations/googlesheets.ts +16 -0
- package/src/integrations/index.ts +12 -7
- package/src/integrations/microsoftSqlServer.ts +16 -0
- package/src/integrations/mongodb.ts +16 -0
- package/src/integrations/mysql.ts +27 -16
- package/src/integrations/oracle.ts +28 -6
- package/src/integrations/postgres.ts +21 -3
- package/src/integrations/redis.ts +26 -3
- package/src/integrations/s3.ts +19 -3
- package/src/integrations/snowflake.ts +20 -1
- package/src/migrations/functions/backfill/app/queries.ts +1 -1
- package/src/sdk/app/datasources/datasources.ts +7 -1
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
QueryType,
|
|
9
9
|
SqlQuery,
|
|
10
10
|
DatasourcePlus,
|
|
11
|
+
DatasourceFeature,
|
|
12
|
+
ConnectionInfo,
|
|
11
13
|
} from "@budibase/types"
|
|
12
14
|
import {
|
|
13
15
|
getSqlQuery,
|
|
@@ -39,6 +41,7 @@ const SCHEMA: Integration = {
|
|
|
39
41
|
"Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
|
40
42
|
friendlyName: "MS SQL Server",
|
|
41
43
|
type: "Relational",
|
|
44
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
42
45
|
datasource: {
|
|
43
46
|
user: {
|
|
44
47
|
type: DatasourceFieldType.STRING,
|
|
@@ -121,6 +124,19 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
|
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|
|
127
|
+
async testConnection() {
|
|
128
|
+
const response: ConnectionInfo = {
|
|
129
|
+
connected: false,
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
await this.connect()
|
|
133
|
+
response.connected = true
|
|
134
|
+
} catch (e: any) {
|
|
135
|
+
response.error = e.message as string
|
|
136
|
+
}
|
|
137
|
+
return response
|
|
138
|
+
}
|
|
139
|
+
|
|
124
140
|
getBindingIdentifier(): string {
|
|
125
141
|
return `@p${this.index++}`
|
|
126
142
|
}
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
DatasourceFieldType,
|
|
4
4
|
QueryType,
|
|
5
5
|
IntegrationBase,
|
|
6
|
+
DatasourceFeature,
|
|
7
|
+
ConnectionInfo,
|
|
6
8
|
} from "@budibase/types"
|
|
7
9
|
import {
|
|
8
10
|
MongoClient,
|
|
@@ -38,6 +40,7 @@ const getSchema = () => {
|
|
|
38
40
|
type: "Non-relational",
|
|
39
41
|
description:
|
|
40
42
|
"MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
|
43
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
41
44
|
datasource: {
|
|
42
45
|
connectionString: {
|
|
43
46
|
type: DatasourceFieldType.STRING,
|
|
@@ -358,6 +361,19 @@ class MongoIntegration implements IntegrationBase {
|
|
|
358
361
|
this.client = new MongoClient(config.connectionString, options)
|
|
359
362
|
}
|
|
360
363
|
|
|
364
|
+
async testConnection() {
|
|
365
|
+
const response: ConnectionInfo = {
|
|
366
|
+
connected: false,
|
|
367
|
+
}
|
|
368
|
+
try {
|
|
369
|
+
await this.connect()
|
|
370
|
+
response.connected = true
|
|
371
|
+
} catch (e: any) {
|
|
372
|
+
response.error = e.message as string
|
|
373
|
+
}
|
|
374
|
+
return response
|
|
375
|
+
}
|
|
376
|
+
|
|
361
377
|
async connect() {
|
|
362
378
|
return this.client.connect()
|
|
363
379
|
}
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
Table,
|
|
8
8
|
TableSchema,
|
|
9
9
|
DatasourcePlus,
|
|
10
|
+
DatasourceFeature,
|
|
11
|
+
ConnectionInfo,
|
|
10
12
|
} from "@budibase/types"
|
|
11
13
|
import {
|
|
12
14
|
getSqlQuery,
|
|
@@ -20,18 +22,11 @@ import { NUMBER_REGEX } from "../utilities"
|
|
|
20
22
|
import Sql from "./base/sql"
|
|
21
23
|
import { MySQLColumn } from "./base/types"
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
import mysql from "mysql2/promise"
|
|
24
26
|
|
|
25
|
-
interface MySQLConfig {
|
|
26
|
-
host: string
|
|
27
|
-
port: number
|
|
28
|
-
user: string
|
|
29
|
-
password: string
|
|
27
|
+
interface MySQLConfig extends mysql.ConnectionOptions {
|
|
30
28
|
database: string
|
|
31
|
-
ssl?: { [key: string]: any }
|
|
32
29
|
rejectUnauthorized: boolean
|
|
33
|
-
typeCast: Function
|
|
34
|
-
multipleStatements: boolean
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
const SCHEMA: Integration = {
|
|
@@ -41,6 +36,7 @@ const SCHEMA: Integration = {
|
|
|
41
36
|
type: "Relational",
|
|
42
37
|
description:
|
|
43
38
|
"MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
|
39
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
44
40
|
datasource: {
|
|
45
41
|
host: {
|
|
46
42
|
type: DatasourceFieldType.STRING,
|
|
@@ -92,8 +88,6 @@ const SCHEMA: Integration = {
|
|
|
92
88
|
},
|
|
93
89
|
}
|
|
94
90
|
|
|
95
|
-
const TimezoneAwareDateTypes = ["timestamp"]
|
|
96
|
-
|
|
97
91
|
function bindingTypeCoerce(bindings: any[]) {
|
|
98
92
|
for (let i = 0; i < bindings.length; i++) {
|
|
99
93
|
const binding = bindings[i]
|
|
@@ -120,7 +114,7 @@ function bindingTypeCoerce(bindings: any[]) {
|
|
|
120
114
|
|
|
121
115
|
class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
122
116
|
private config: MySQLConfig
|
|
123
|
-
private client
|
|
117
|
+
private client?: mysql.Connection
|
|
124
118
|
public tables: Record<string, Table> = {}
|
|
125
119
|
public schemaErrors: Record<string, string> = {}
|
|
126
120
|
|
|
@@ -134,7 +128,8 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
|
134
128
|
if (
|
|
135
129
|
config.rejectUnauthorized != null &&
|
|
136
130
|
!config.rejectUnauthorized &&
|
|
137
|
-
config.ssl
|
|
131
|
+
config.ssl &&
|
|
132
|
+
typeof config.ssl !== "string"
|
|
138
133
|
) {
|
|
139
134
|
config.ssl.rejectUnauthorized = config.rejectUnauthorized
|
|
140
135
|
}
|
|
@@ -160,6 +155,22 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
|
160
155
|
}
|
|
161
156
|
}
|
|
162
157
|
|
|
158
|
+
async testConnection() {
|
|
159
|
+
const response: ConnectionInfo = {
|
|
160
|
+
connected: false,
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const [result] = await this.internalQuery(
|
|
164
|
+
{ sql: "SELECT 1+1 AS checkRes" },
|
|
165
|
+
{ connect: true }
|
|
166
|
+
)
|
|
167
|
+
response.connected = result?.checkRes == 2
|
|
168
|
+
} catch (e: any) {
|
|
169
|
+
response.error = e.message as string
|
|
170
|
+
}
|
|
171
|
+
return response
|
|
172
|
+
}
|
|
173
|
+
|
|
163
174
|
getBindingIdentifier(): string {
|
|
164
175
|
return "?"
|
|
165
176
|
}
|
|
@@ -173,7 +184,7 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
|
173
184
|
}
|
|
174
185
|
|
|
175
186
|
async disconnect() {
|
|
176
|
-
await this.client
|
|
187
|
+
await this.client!.end()
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
async internalQuery(
|
|
@@ -192,10 +203,10 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
|
192
203
|
? baseBindings
|
|
193
204
|
: bindingTypeCoerce(baseBindings)
|
|
194
205
|
// Node MySQL is callback based, so we must wrap our call in a promise
|
|
195
|
-
const response = await this.client
|
|
206
|
+
const response = await this.client!.query(query.sql, bindings)
|
|
196
207
|
return response[0]
|
|
197
208
|
} finally {
|
|
198
|
-
if (opts?.connect) {
|
|
209
|
+
if (opts?.connect && this.client) {
|
|
199
210
|
await this.disconnect()
|
|
200
211
|
}
|
|
201
212
|
}
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
SqlQuery,
|
|
8
8
|
Table,
|
|
9
9
|
DatasourcePlus,
|
|
10
|
+
DatasourceFeature,
|
|
11
|
+
ConnectionInfo,
|
|
10
12
|
} from "@budibase/types"
|
|
11
13
|
import {
|
|
12
14
|
buildExternalTableId,
|
|
@@ -24,12 +26,7 @@ import {
|
|
|
24
26
|
ExecuteOptions,
|
|
25
27
|
Result,
|
|
26
28
|
} from "oracledb"
|
|
27
|
-
import {
|
|
28
|
-
OracleTable,
|
|
29
|
-
OracleColumn,
|
|
30
|
-
OracleColumnsResponse,
|
|
31
|
-
OracleConstraint,
|
|
32
|
-
} from "./base/types"
|
|
29
|
+
import { OracleTable, OracleColumn, OracleColumnsResponse } from "./base/types"
|
|
33
30
|
let oracledb: any
|
|
34
31
|
try {
|
|
35
32
|
oracledb = require("oracledb")
|
|
@@ -53,6 +50,7 @@ const SCHEMA: Integration = {
|
|
|
53
50
|
type: "Relational",
|
|
54
51
|
description:
|
|
55
52
|
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
|
53
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
56
54
|
datasource: {
|
|
57
55
|
host: {
|
|
58
56
|
type: DatasourceFieldType.STRING,
|
|
@@ -325,6 +323,30 @@ class OracleIntegration extends Sql implements DatasourcePlus {
|
|
|
325
323
|
this.schemaErrors = final.errors
|
|
326
324
|
}
|
|
327
325
|
|
|
326
|
+
async testConnection() {
|
|
327
|
+
const response: ConnectionInfo = {
|
|
328
|
+
connected: false,
|
|
329
|
+
}
|
|
330
|
+
let connection
|
|
331
|
+
try {
|
|
332
|
+
connection = await this.getConnection()
|
|
333
|
+
response.connected = true
|
|
334
|
+
} catch (err: any) {
|
|
335
|
+
response.connected = false
|
|
336
|
+
response.error = err.message
|
|
337
|
+
} finally {
|
|
338
|
+
if (connection) {
|
|
339
|
+
try {
|
|
340
|
+
await connection.close()
|
|
341
|
+
} catch (err: any) {
|
|
342
|
+
response.connected = false
|
|
343
|
+
response.error = err.message
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return response
|
|
348
|
+
}
|
|
349
|
+
|
|
328
350
|
private async internalQuery<T>(query: SqlQuery): Promise<Result<T>> {
|
|
329
351
|
let connection
|
|
330
352
|
try {
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
SqlQuery,
|
|
7
7
|
Table,
|
|
8
8
|
DatasourcePlus,
|
|
9
|
+
DatasourceFeature,
|
|
10
|
+
ConnectionInfo,
|
|
9
11
|
} from "@budibase/types"
|
|
10
12
|
import {
|
|
11
13
|
getSqlQuery,
|
|
@@ -18,7 +20,7 @@ import Sql from "./base/sql"
|
|
|
18
20
|
import { PostgresColumn } from "./base/types"
|
|
19
21
|
import { escapeDangerousCharacters } from "../utilities"
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
import { Client, types } from "pg"
|
|
22
24
|
|
|
23
25
|
// Return "date" and "timestamp" types as plain strings.
|
|
24
26
|
// This lets us reference the original stored timezone.
|
|
@@ -50,6 +52,7 @@ const SCHEMA: Integration = {
|
|
|
50
52
|
type: "Relational",
|
|
51
53
|
description:
|
|
52
54
|
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
|
55
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
53
56
|
datasource: {
|
|
54
57
|
host: {
|
|
55
58
|
type: DatasourceFieldType.STRING,
|
|
@@ -114,7 +117,7 @@ const SCHEMA: Integration = {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
class PostgresIntegration extends Sql implements DatasourcePlus {
|
|
117
|
-
private readonly client:
|
|
120
|
+
private readonly client: Client
|
|
118
121
|
private readonly config: PostgresConfig
|
|
119
122
|
private index: number = 1
|
|
120
123
|
private open: boolean
|
|
@@ -150,6 +153,21 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
|
|
150
153
|
this.open = false
|
|
151
154
|
}
|
|
152
155
|
|
|
156
|
+
async testConnection() {
|
|
157
|
+
const response: ConnectionInfo = {
|
|
158
|
+
connected: false,
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
await this.openConnection()
|
|
162
|
+
response.connected = true
|
|
163
|
+
} catch (e: any) {
|
|
164
|
+
response.error = e.message as string
|
|
165
|
+
} finally {
|
|
166
|
+
await this.closeConnection()
|
|
167
|
+
}
|
|
168
|
+
return response
|
|
169
|
+
}
|
|
170
|
+
|
|
153
171
|
getBindingIdentifier(): string {
|
|
154
172
|
return `$${this.index++}`
|
|
155
173
|
}
|
|
@@ -163,7 +181,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
|
|
163
181
|
if (!this.config.schema) {
|
|
164
182
|
this.config.schema = "public"
|
|
165
183
|
}
|
|
166
|
-
this.client.query(`SET search_path TO ${this.config.schema}`)
|
|
184
|
+
await this.client.query(`SET search_path TO ${this.config.schema}`)
|
|
167
185
|
this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'`
|
|
168
186
|
this.open = true
|
|
169
187
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ConnectionInfo,
|
|
3
|
+
DatasourceFeature,
|
|
4
|
+
DatasourceFieldType,
|
|
5
|
+
Integration,
|
|
6
|
+
QueryType,
|
|
7
|
+
} from "@budibase/types"
|
|
2
8
|
import Redis from "ioredis"
|
|
3
9
|
|
|
4
10
|
interface RedisConfig {
|
|
@@ -11,9 +17,11 @@ interface RedisConfig {
|
|
|
11
17
|
|
|
12
18
|
const SCHEMA: Integration = {
|
|
13
19
|
docs: "https://redis.io/docs/",
|
|
14
|
-
description:
|
|
20
|
+
description:
|
|
21
|
+
"Redis is a caching tool, providing powerful key-value store capabilities.",
|
|
15
22
|
friendlyName: "Redis",
|
|
16
23
|
type: "Non-relational",
|
|
24
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
17
25
|
datasource: {
|
|
18
26
|
host: {
|
|
19
27
|
type: "string",
|
|
@@ -86,7 +94,7 @@ const SCHEMA: Integration = {
|
|
|
86
94
|
|
|
87
95
|
class RedisIntegration {
|
|
88
96
|
private readonly config: RedisConfig
|
|
89
|
-
private client
|
|
97
|
+
private client
|
|
90
98
|
|
|
91
99
|
constructor(config: RedisConfig) {
|
|
92
100
|
this.config = config
|
|
@@ -99,6 +107,21 @@ class RedisIntegration {
|
|
|
99
107
|
})
|
|
100
108
|
}
|
|
101
109
|
|
|
110
|
+
async testConnection() {
|
|
111
|
+
const response: ConnectionInfo = {
|
|
112
|
+
connected: false,
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
await this.client.ping()
|
|
116
|
+
response.connected = true
|
|
117
|
+
} catch (e: any) {
|
|
118
|
+
response.error = e.message as string
|
|
119
|
+
} finally {
|
|
120
|
+
await this.disconnect()
|
|
121
|
+
}
|
|
122
|
+
return response
|
|
123
|
+
}
|
|
124
|
+
|
|
102
125
|
async disconnect() {
|
|
103
126
|
return this.client.quit()
|
|
104
127
|
}
|
package/src/integrations/s3.ts
CHANGED
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
QueryType,
|
|
4
4
|
IntegrationBase,
|
|
5
5
|
DatasourceFieldType,
|
|
6
|
+
DatasourceFeature,
|
|
7
|
+
ConnectionInfo,
|
|
6
8
|
} from "@budibase/types"
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
import AWS from "aws-sdk"
|
|
11
|
+
import csv from "csvtojson"
|
|
10
12
|
|
|
11
13
|
interface S3Config {
|
|
12
14
|
region: string
|
|
@@ -22,6 +24,7 @@ const SCHEMA: Integration = {
|
|
|
22
24
|
"Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
23
25
|
friendlyName: "Amazon S3",
|
|
24
26
|
type: "Object store",
|
|
27
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
25
28
|
datasource: {
|
|
26
29
|
region: {
|
|
27
30
|
type: "string",
|
|
@@ -152,7 +155,7 @@ const SCHEMA: Integration = {
|
|
|
152
155
|
|
|
153
156
|
class S3Integration implements IntegrationBase {
|
|
154
157
|
private readonly config: S3Config
|
|
155
|
-
private client
|
|
158
|
+
private client
|
|
156
159
|
|
|
157
160
|
constructor(config: S3Config) {
|
|
158
161
|
this.config = config
|
|
@@ -165,6 +168,19 @@ class S3Integration implements IntegrationBase {
|
|
|
165
168
|
this.client = new AWS.S3(this.config)
|
|
166
169
|
}
|
|
167
170
|
|
|
171
|
+
async testConnection() {
|
|
172
|
+
const response: ConnectionInfo = {
|
|
173
|
+
connected: false,
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
await this.client.listBuckets().promise()
|
|
177
|
+
response.connected = true
|
|
178
|
+
} catch (e: any) {
|
|
179
|
+
response.error = e.message as string
|
|
180
|
+
}
|
|
181
|
+
return response
|
|
182
|
+
}
|
|
183
|
+
|
|
168
184
|
async create(query: {
|
|
169
185
|
bucket: string
|
|
170
186
|
location: string
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ConnectionInfo,
|
|
3
|
+
DatasourceFeature,
|
|
4
|
+
Integration,
|
|
5
|
+
QueryType,
|
|
6
|
+
SqlQuery,
|
|
7
|
+
} from "@budibase/types"
|
|
2
8
|
import { Snowflake } from "snowflake-promise"
|
|
3
9
|
|
|
4
10
|
interface SnowflakeConfig {
|
|
@@ -16,6 +22,7 @@ const SCHEMA: Integration = {
|
|
|
16
22
|
"Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
|
17
23
|
friendlyName: "Snowflake",
|
|
18
24
|
type: "Relational",
|
|
25
|
+
features: [DatasourceFeature.CONNECTION_CHECKING],
|
|
19
26
|
datasource: {
|
|
20
27
|
account: {
|
|
21
28
|
type: "string",
|
|
@@ -65,6 +72,18 @@ class SnowflakeIntegration {
|
|
|
65
72
|
this.client = new Snowflake(config)
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
async testConnection(): Promise<ConnectionInfo> {
|
|
76
|
+
try {
|
|
77
|
+
await this.client.connect()
|
|
78
|
+
return { connected: true }
|
|
79
|
+
} catch (e: any) {
|
|
80
|
+
return {
|
|
81
|
+
connected: false,
|
|
82
|
+
error: e.message as string,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
68
87
|
async internalQuery(query: SqlQuery) {
|
|
69
88
|
await this.client.connect()
|
|
70
89
|
try {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { cloneDeep } from "lodash/fp"
|
|
14
14
|
import { getEnvironmentVariables } from "../../utils"
|
|
15
15
|
import { getDefinitions, getDefinition } from "../../../integrations"
|
|
16
|
+
import _ from "lodash"
|
|
16
17
|
|
|
17
18
|
const ENV_VAR_PREFIX = "env."
|
|
18
19
|
|
|
@@ -41,7 +42,7 @@ async function enrichDatasourceWithValues(datasource: Datasource) {
|
|
|
41
42
|
{ onlyFound: true }
|
|
42
43
|
) as Datasource
|
|
43
44
|
const definition = await getDefinition(processed.source)
|
|
44
|
-
processed.config = checkDatasourceTypes(definition
|
|
45
|
+
processed.config = checkDatasourceTypes(definition!, processed.config)
|
|
45
46
|
return {
|
|
46
47
|
datasource: processed,
|
|
47
48
|
envVars: env as Record<string, string>,
|
|
@@ -147,6 +148,11 @@ export function mergeConfigs(update: Datasource, old: Datasource) {
|
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
}
|
|
151
|
+
|
|
152
|
+
if (old.config?.auth) {
|
|
153
|
+
update.config = _.merge(old.config, update.config)
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
// update back to actual passwords for everything else
|
|
151
157
|
for (let [key, value] of Object.entries(update.config)) {
|
|
152
158
|
if (value !== PASSWORD_REPLACEMENT) {
|