@budibase/server 2.7.28 → 2.7.30

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.30",
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.30",
50
+ "@budibase/client": "2.7.30",
51
+ "@budibase/pro": "2.7.30",
52
+ "@budibase/shared-core": "2.7.30",
53
+ "@budibase/string-templates": "2.7.30",
54
+ "@budibase/types": "2.7.30",
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": "e0eaa71a9ad08d6c43363521d45bd48afe9c2009"
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
@@ -36,11 +36,14 @@ export function checkDatasourceTypes(schema: Integration, config: any) {
36
36
  async function enrichDatasourceWithValues(datasource: Datasource) {
37
37
  const cloned = cloneDeep(datasource)
38
38
  const env = await getEnvironmentVariables()
39
+ //Do not process entities, as we do not want to process formulas
40
+ const { entities, ...clonedWithoutEntities } = cloned
39
41
  const processed = processObjectSync(
40
- cloned,
42
+ clonedWithoutEntities,
41
43
  { env },
42
44
  { onlyFound: true }
43
45
  ) as Datasource
46
+ processed.entities = entities
44
47
  const definition = await getDefinition(processed.source)
45
48
  processed.config = checkDatasourceTypes(definition!, processed.config)
46
49
  return {