@budibase/server 2.7.28 → 2.7.29

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.7.28",
4
+ "version": "2.7.29",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -46,12 +46,12 @@
46
46
  "license": "GPL-3.0",
47
47
  "dependencies": {
48
48
  "@apidevtools/swagger-parser": "10.0.3",
49
- "@budibase/backend-core": "2.7.28",
50
- "@budibase/client": "2.7.28",
51
- "@budibase/pro": "2.7.28",
52
- "@budibase/shared-core": "2.7.28",
53
- "@budibase/string-templates": "2.7.28",
54
- "@budibase/types": "2.7.28",
49
+ "@budibase/backend-core": "2.7.29",
50
+ "@budibase/client": "2.7.29",
51
+ "@budibase/pro": "2.7.29",
52
+ "@budibase/shared-core": "2.7.29",
53
+ "@budibase/string-templates": "2.7.29",
54
+ "@budibase/types": "2.7.29",
55
55
  "@bull-board/api": "3.7.0",
56
56
  "@bull-board/koa": "3.9.4",
57
57
  "@elastic/elasticsearch": "7.10.0",
@@ -195,5 +195,5 @@
195
195
  }
196
196
  }
197
197
  },
198
- "gitHead": "8595dfa6c3679ca2706a79f36bd1e18a5fa3ddf5"
198
+ "gitHead": "c5c8d7c084b443fe41828c0299daaaf38a518f63"
199
199
  }
@@ -3,10 +3,10 @@ import * as userController from "../user"
3
3
  import { FieldTypes } from "../../../constants"
4
4
  import { context } from "@budibase/backend-core"
5
5
  import { makeExternalQuery } from "../../../integrations/base/query"
6
- import { Row, Table } from "@budibase/types"
6
+ import { FieldType, Row, Table, UserCtx } from "@budibase/types"
7
7
  import { Format } from "../view/exporters"
8
- import { UserCtx } from "@budibase/types"
9
8
  import sdk from "../../../sdk"
9
+
10
10
  const validateJs = require("validate.js")
11
11
  const { cloneDeep } = require("lodash/fp")
12
12
 
@@ -20,6 +20,13 @@ validateJs.extend(validateJs.validators.datetime, {
20
20
  },
21
21
  })
22
22
 
23
+ function isForeignKey(key: string, table: Table) {
24
+ const relationships = Object.values(table.schema).filter(
25
+ column => column.type === FieldType.LINK
26
+ )
27
+ return relationships.some(relationship => relationship.foreignKey === key)
28
+ }
29
+
23
30
  export async function getDatasourceAndQuery(json: any) {
24
31
  const datasourceId = json.endpoint.datasourceId
25
32
  const datasource = await sdk.datasources.get(datasourceId)
@@ -65,6 +72,10 @@ export async function validate({
65
72
  const column = fetchedTable.schema[fieldName]
66
73
  const constraints = cloneDeep(column.constraints)
67
74
  const type = column.type
75
+ // foreign keys are likely to be enriched
76
+ if (isForeignKey(fieldName, fetchedTable)) {
77
+ continue
78
+ }
68
79
  // formulas shouldn't validated, data will be deleted anyway
69
80
  if (type === FieldTypes.FORMULA || column.autocolumn) {
70
81
  continue