@budibase/server 0.9.174 → 0.9.176-alpha.2
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.7469e1e4.css → index.75ed4773.css} +1 -1
- package/builder/assets/{index.ba2741f9.js → index.d3780441.js} +34 -34
- package/builder/index.html +2 -2
- package/coverage/clover.xml +383 -207
- package/coverage/coverage-final.json +8 -6
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +120 -24
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/hosting.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +19 -19
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query.js.html +9 -3
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +14 -14
- package/coverage/lcov-report/api/controllers/row/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +11 -32
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +908 -0
- package/coverage/lcov-report/api/controllers/table/index.html +59 -29
- package/coverage/lcov-report/api/controllers/table/index.js.html +52 -376
- package/coverage/lcov-report/api/controllers/table/internal.js.html +494 -0
- package/coverage/lcov-report/api/controllers/table/utils.js.html +70 -10
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/hosting.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/thread.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/automations/utils.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +25 -4
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/client.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +38 -38
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +652 -332
- package/dist/api/controllers/datasource.js +41 -14
- package/dist/api/controllers/query.js +3 -1
- package/dist/api/controllers/row/ExternalRequest.js +12 -10
- package/dist/api/controllers/row/utils.js +3 -11
- package/dist/api/controllers/table/external.js +222 -0
- package/dist/api/controllers/table/index.js +28 -121
- package/dist/api/controllers/table/internal.js +138 -0
- package/dist/api/controllers/table/utils.js +17 -0
- package/dist/constants/index.js +6 -0
- package/dist/definitions/datasource.js +3 -0
- package/dist/integrations/base/datasourcePlus.js +2 -0
- package/dist/integrations/base/sql.js +16 -11
- package/dist/integrations/base/sqlTable.js +141 -0
- package/dist/integrations/base/utils.js +30 -0
- package/dist/integrations/mysql.js +13 -7
- package/dist/integrations/postgres.js +18 -8
- package/dist/integrations/utils.js +21 -6
- package/dist/package.json +4 -4
- package/dist/tests/utilities/TestConfiguration.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/api/controllers/datasource.js +46 -14
- package/src/api/controllers/query.js +3 -1
- package/src/api/controllers/row/ExternalRequest.ts +12 -10
- package/src/api/controllers/row/utils.js +3 -10
- package/src/api/controllers/table/external.js +276 -0
- package/src/api/controllers/table/index.js +27 -135
- package/src/api/controllers/table/internal.js +138 -0
- package/src/api/controllers/table/utils.js +20 -0
- package/src/api/routes/tests/datasource.spec.js +2 -2
- package/src/api/routes/tests/query.spec.js +0 -1
- package/src/constants/index.js +7 -0
- package/src/definitions/common.ts +7 -1
- package/src/definitions/datasource.ts +5 -0
- package/src/integrations/base/datasourcePlus.ts +8 -0
- package/src/integrations/base/sql.ts +15 -16
- package/src/integrations/base/sqlTable.ts +167 -0
- package/src/integrations/base/utils.ts +19 -0
- package/src/integrations/mysql.ts +15 -9
- package/src/integrations/postgres.ts +19 -9
- package/src/integrations/utils.ts +22 -6
- package/src/tests/utilities/TestConfiguration.js +2 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { QueryJson } from "../../definitions/datasource"
|
|
2
|
+
import { Datasource } from "../../definitions/common"
|
|
3
|
+
|
|
4
|
+
module DatasourceUtils {
|
|
5
|
+
const { integrations } = require("../index")
|
|
6
|
+
|
|
7
|
+
export async function makeExternalQuery(datasource: Datasource, json: QueryJson) {
|
|
8
|
+
const Integration = integrations[datasource.source]
|
|
9
|
+
// query is the opinionated function
|
|
10
|
+
if (Integration.prototype.query) {
|
|
11
|
+
const integration = new Integration(datasource.config)
|
|
12
|
+
return integration.query(json)
|
|
13
|
+
} else {
|
|
14
|
+
throw "Datasource does not support query."
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports.makeExternalQuery = makeExternalQuery
|
|
19
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "../definitions/datasource"
|
|
9
9
|
import { Table, TableSchema } from "../definitions/common"
|
|
10
10
|
import { getSqlQuery } from "./utils"
|
|
11
|
+
import { DatasourcePlus } from "./base/datasourcePlus"
|
|
11
12
|
|
|
12
13
|
module MySQLModule {
|
|
13
14
|
const mysql = require("mysql2")
|
|
@@ -15,7 +16,7 @@ module MySQLModule {
|
|
|
15
16
|
const {
|
|
16
17
|
buildExternalTableId,
|
|
17
18
|
convertType,
|
|
18
|
-
|
|
19
|
+
finaliseExternalTables,
|
|
19
20
|
} = require("./utils")
|
|
20
21
|
const { FieldTypes } = require("../constants")
|
|
21
22
|
|
|
@@ -131,9 +132,11 @@ module MySQLModule {
|
|
|
131
132
|
})
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
class MySQLIntegration extends Sql {
|
|
135
|
+
class MySQLIntegration extends Sql implements DatasourcePlus {
|
|
135
136
|
private config: MySQLConfig
|
|
136
137
|
private readonly client: any
|
|
138
|
+
public tables: Record<string, Table> = {}
|
|
139
|
+
public schemaErrors: Record<string, string> = {}
|
|
137
140
|
|
|
138
141
|
constructor(config: MySQLConfig) {
|
|
139
142
|
super("mysql")
|
|
@@ -185,10 +188,6 @@ module MySQLModule {
|
|
|
185
188
|
constraints,
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
|
-
// for now just default to first column
|
|
189
|
-
if (primaryKeys.length === 0) {
|
|
190
|
-
primaryKeys.push(descResp[0].Field)
|
|
191
|
-
}
|
|
192
191
|
if (!tables[tableName]) {
|
|
193
192
|
tables[tableName] = {
|
|
194
193
|
_id: buildExternalTableId(datasourceId, tableName),
|
|
@@ -197,12 +196,12 @@ module MySQLModule {
|
|
|
197
196
|
schema,
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
|
-
|
|
201
|
-
copyExistingPropsOver(tableName, tables, entities)
|
|
202
199
|
}
|
|
203
200
|
|
|
204
201
|
this.client.end()
|
|
205
|
-
|
|
202
|
+
const final = finaliseExternalTables(tables, entities)
|
|
203
|
+
this.tables = final.tables
|
|
204
|
+
this.schemaErrors = final.errors
|
|
206
205
|
}
|
|
207
206
|
|
|
208
207
|
async create(query: SqlQuery | string) {
|
|
@@ -263,6 +262,13 @@ module MySQLModule {
|
|
|
263
262
|
const operation = this._operation(json)
|
|
264
263
|
this.client.connect()
|
|
265
264
|
const input = this._query(json, { disableReturning: true })
|
|
265
|
+
if (Array.isArray(input)) {
|
|
266
|
+
const responses = []
|
|
267
|
+
for (let query of input) {
|
|
268
|
+
responses.push(await internalQuery(this.client, query, false))
|
|
269
|
+
}
|
|
270
|
+
return responses
|
|
271
|
+
}
|
|
266
272
|
let row
|
|
267
273
|
// need to manage returning, a feature mySQL can't do
|
|
268
274
|
if (operation === operation.DELETE) {
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "../definitions/datasource"
|
|
8
8
|
import { Table } from "../definitions/common"
|
|
9
9
|
import { getSqlQuery } from "./utils"
|
|
10
|
+
import { DatasourcePlus } from "./base/datasourcePlus"
|
|
10
11
|
|
|
11
12
|
module PostgresModule {
|
|
12
13
|
const { Pool } = require("pg")
|
|
@@ -15,7 +16,7 @@ module PostgresModule {
|
|
|
15
16
|
const {
|
|
16
17
|
buildExternalTableId,
|
|
17
18
|
convertType,
|
|
18
|
-
|
|
19
|
+
finaliseExternalTables,
|
|
19
20
|
} = require("./utils")
|
|
20
21
|
const { escapeDangerousCharacters } = require("../utilities")
|
|
21
22
|
|
|
@@ -132,10 +133,12 @@ module PostgresModule {
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
class PostgresIntegration extends Sql {
|
|
136
|
+
class PostgresIntegration extends Sql implements DatasourcePlus {
|
|
136
137
|
static pool: any
|
|
137
138
|
private readonly client: any
|
|
138
139
|
private readonly config: PostgresConfig
|
|
140
|
+
public tables: Record<string, Table> = {}
|
|
141
|
+
public schemaErrors: Record<string, string> = {}
|
|
139
142
|
|
|
140
143
|
COLUMNS_SQL =
|
|
141
144
|
"select * from information_schema.columns where not table_schema = 'information_schema' and not table_schema = 'pg_catalog'"
|
|
@@ -207,7 +210,7 @@ module PostgresModule {
|
|
|
207
210
|
if (!tables[tableName] || !tables[tableName].schema) {
|
|
208
211
|
tables[tableName] = {
|
|
209
212
|
_id: buildExternalTableId(datasourceId, tableName),
|
|
210
|
-
primary: tableKeys[tableName] || [
|
|
213
|
+
primary: tableKeys[tableName] || [],
|
|
211
214
|
name: tableName,
|
|
212
215
|
schema: {},
|
|
213
216
|
}
|
|
@@ -232,10 +235,9 @@ module PostgresModule {
|
|
|
232
235
|
}
|
|
233
236
|
}
|
|
234
237
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.tables = tables
|
|
238
|
+
const final = finaliseExternalTables(tables, entities)
|
|
239
|
+
this.tables = final.tables
|
|
240
|
+
this.schemaErrors = final.errors
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
async create(query: SqlQuery | string) {
|
|
@@ -261,8 +263,16 @@ module PostgresModule {
|
|
|
261
263
|
async query(json: QueryJson) {
|
|
262
264
|
const operation = this._operation(json).toLowerCase()
|
|
263
265
|
const input = this._query(json)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
+
if (Array.isArray(input)) {
|
|
267
|
+
const responses = []
|
|
268
|
+
for (let query of input) {
|
|
269
|
+
responses.push(await internalQuery(this.client, query))
|
|
270
|
+
}
|
|
271
|
+
return responses
|
|
272
|
+
} else {
|
|
273
|
+
const response = await internalQuery(this.client, input)
|
|
274
|
+
return response.rows.length ? response.rows : [{ [operation]: true }]
|
|
275
|
+
}
|
|
266
276
|
}
|
|
267
277
|
}
|
|
268
278
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SqlQuery } from "../definitions/datasource"
|
|
2
|
-
import { Datasource } from "../definitions/common"
|
|
2
|
+
import { Datasource, Table } from "../definitions/common"
|
|
3
3
|
import { SourceNames } from "../definitions/datasource"
|
|
4
4
|
const { DocumentTypes, SEPARATOR } = require("../db/utils")
|
|
5
|
-
const { FieldTypes } = require("../constants")
|
|
5
|
+
const { FieldTypes, BuildSchemaErrors } = require("../constants")
|
|
6
6
|
|
|
7
7
|
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`
|
|
8
8
|
const ROW_ID_REGEX = /^\[.*]$/g
|
|
@@ -102,14 +102,14 @@ export function isIsoDateString(str: string) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// add the existing relationships from the entities if they exist, to prevent them from being overridden
|
|
105
|
-
|
|
105
|
+
function copyExistingPropsOver(
|
|
106
106
|
tableName: string,
|
|
107
|
-
|
|
107
|
+
table: Table,
|
|
108
108
|
entities: { [key: string]: any }
|
|
109
109
|
) {
|
|
110
110
|
if (entities && entities[tableName]) {
|
|
111
111
|
if (entities[tableName].primaryDisplay) {
|
|
112
|
-
|
|
112
|
+
table.primaryDisplay = entities[tableName].primaryDisplay
|
|
113
113
|
}
|
|
114
114
|
const existingTableSchema = entities[tableName].schema
|
|
115
115
|
for (let key in existingTableSchema) {
|
|
@@ -117,8 +117,24 @@ export function copyExistingPropsOver(
|
|
|
117
117
|
continue
|
|
118
118
|
}
|
|
119
119
|
if (existingTableSchema[key].type === "link") {
|
|
120
|
-
|
|
120
|
+
table.schema[key] = existingTableSchema[key]
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
return table
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function finaliseExternalTables(tables: { [key: string]: any }, entities: { [key: string]: any }) {
|
|
128
|
+
const finalTables: { [key: string]: any } = {}
|
|
129
|
+
const errors: { [key: string]: string } = {}
|
|
130
|
+
for (let [name, table] of Object.entries(tables)) {
|
|
131
|
+
// make sure every table has a key
|
|
132
|
+
if (table.primary == null || table.primary.length === 0) {
|
|
133
|
+
errors[name] = BuildSchemaErrors.NO_KEY
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
// make sure all previous props have been added back
|
|
137
|
+
finalTables[name] = copyExistingPropsOver(name, table, entities)
|
|
138
|
+
}
|
|
139
|
+
return { tables: finalTables, errors }
|
|
124
140
|
}
|
|
@@ -311,7 +311,8 @@ class TestConfiguration {
|
|
|
311
311
|
|
|
312
312
|
async createDatasource(config = null) {
|
|
313
313
|
config = config || basicDatasource()
|
|
314
|
-
|
|
314
|
+
const response = await this._req(config, null, controllers.datasource.save)
|
|
315
|
+
this.datasource = response.datasource
|
|
315
316
|
return this.datasource
|
|
316
317
|
}
|
|
317
318
|
|