Merge remote-tracking branch 'origin/develop' into feature/required-field-focus

This commit is contained in:
Dean 2022-05-28 18:31:48 +01:00
commit b06235efc0
13 changed files with 87 additions and 66 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "src/index.js", "main": "src/index.js",
"author": "Budibase", "author": "Budibase",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1", "@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "^1.0.188-alpha.0", "@budibase/string-templates": "^1.0.188-alpha.2",
"@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2", "@spectrum-css/avatar": "^3.0.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -69,10 +69,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.188-alpha.0", "@budibase/bbui": "^1.0.188-alpha.2",
"@budibase/client": "^1.0.188-alpha.0", "@budibase/client": "^1.0.188-alpha.2",
"@budibase/frontend-core": "^1.0.188-alpha.0", "@budibase/frontend-core": "^1.0.188-alpha.2",
"@budibase/string-templates": "^1.0.188-alpha.0", "@budibase/string-templates": "^1.0.188-alpha.2",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.188-alpha.0", "@budibase/bbui": "^1.0.188-alpha.2",
"@budibase/frontend-core": "^1.0.188-alpha.0", "@budibase/frontend-core": "^1.0.188-alpha.2",
"@budibase/string-templates": "^1.0.188-alpha.0", "@budibase/string-templates": "^1.0.188-alpha.2",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View File

@ -1,5 +1,4 @@
import { API } from "api" import { API } from "api"
import { JSONUtils } from "@budibase/frontend-core"
import TableFetch from "@budibase/frontend-core/src/fetch/TableFetch.js" import TableFetch from "@budibase/frontend-core/src/fetch/TableFetch.js"
import ViewFetch from "@budibase/frontend-core/src/fetch/ViewFetch.js" import ViewFetch from "@budibase/frontend-core/src/fetch/ViewFetch.js"
import QueryFetch from "@budibase/frontend-core/src/fetch/QueryFetch.js" import QueryFetch from "@budibase/frontend-core/src/fetch/QueryFetch.js"
@ -40,44 +39,41 @@ export const fetchDatasourceSchema = async (
return null return null
} }
// Check for any JSON fields so we can add any top level properties // Enrich schema with relationships if required
let jsonAdditions = {} if (definition?.sql && options?.enrichRelationships) {
Object.keys(schema).forEach(fieldKey => { const relationshipAdditions = await getRelationshipSchemaAdditions(schema)
schema = {
...schema,
...relationshipAdditions,
}
}
// Ensure schema is in the correct structure
return instance.enrichSchema(schema)
}
/**
* Fetches the schema of relationship fields for a SQL table schema
* @param schema the schema to enrich
*/
export const getRelationshipSchemaAdditions = async schema => {
if (!schema) {
return null
}
let relationshipAdditions = {}
for (let fieldKey of Object.keys(schema)) {
const fieldSchema = schema[fieldKey] const fieldSchema = schema[fieldKey]
if (fieldSchema?.type === "json") { if (fieldSchema?.type === "link") {
const jsonSchema = JSONUtils.convertJSONSchemaToTableSchema(fieldSchema, { const linkSchema = await fetchDatasourceSchema({
squashObjects: true, type: "table",
tableId: fieldSchema?.tableId,
}) })
Object.keys(jsonSchema).forEach(jsonKey => { Object.keys(linkSchema || {}).forEach(linkKey => {
jsonAdditions[`${fieldKey}.${jsonKey}`] = { relationshipAdditions[`${fieldKey}.${linkKey}`] = {
type: jsonSchema[jsonKey].type, type: linkSchema[linkKey].type,
nestedJSON: true,
} }
}) })
} }
})
schema = { ...schema, ...jsonAdditions }
// Check for any relationship fields if required
if (options?.enrichRelationships && definition.sql) {
let relationshipAdditions = {}
for (let fieldKey of Object.keys(schema)) {
const fieldSchema = schema[fieldKey]
if (fieldSchema?.type === "link") {
const linkSchema = await fetchDatasourceSchema({
type: "table",
tableId: fieldSchema?.tableId,
})
Object.keys(linkSchema || {}).forEach(linkKey => {
relationshipAdditions[`${fieldKey}.${linkKey}`] = {
type: linkSchema[linkKey].type,
}
})
}
}
schema = { ...schema, ...relationshipAdditions }
} }
return relationshipAdditions
// Ensure schema structure is correct
return instance.enrichSchema(schema)
} }

View File

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.188-alpha.0", "@budibase/bbui": "^1.0.188-alpha.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View File

@ -6,6 +6,7 @@ import {
runLuceneQuery, runLuceneQuery,
luceneSort, luceneSort,
} from "../utils/lucene" } from "../utils/lucene"
import { convertJSONSchemaToTableSchema } from "../utils/json"
/** /**
* Parent class which handles the implementation of fetching data from an * Parent class which handles the implementation of fetching data from an
@ -248,7 +249,8 @@ export default class DataFetch {
} }
/** /**
* Enriches the schema and ensures that entries are objects with names * Enriches a datasource schema with nested fields and ensures the structure
* is correct.
* @param schema the datasource schema * @param schema the datasource schema
* @return {object} the enriched datasource schema * @return {object} the enriched datasource schema
*/ */
@ -256,6 +258,26 @@ export default class DataFetch {
if (schema == null) { if (schema == null) {
return null return null
} }
// Check for any JSON fields so we can add any top level properties
let jsonAdditions = {}
Object.keys(schema).forEach(fieldKey => {
const fieldSchema = schema[fieldKey]
if (fieldSchema?.type === "json") {
const jsonSchema = convertJSONSchemaToTableSchema(fieldSchema, {
squashObjects: true,
})
Object.keys(jsonSchema).forEach(jsonKey => {
jsonAdditions[`${fieldKey}.${jsonKey}`] = {
type: jsonSchema[jsonKey].type,
nestedJSON: true,
}
})
}
})
schema = { ...schema, ...jsonAdditions }
// Ensure schema is in the correct structure
let enrichedSchema = {} let enrichedSchema = {}
Object.entries(schema).forEach(([fieldName, fieldSchema]) => { Object.entries(schema).forEach(([fieldName, fieldSchema]) => {
if (typeof fieldSchema === "string") { if (typeof fieldSchema === "string") {
@ -270,6 +292,7 @@ export default class DataFetch {
} }
} }
}) })
return enrichedSchema return enrichedSchema
} }

View File

@ -1,7 +1,5 @@
FROM node:14-slim FROM node:14-slim
RUN apt-get update
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh" LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh"
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh" LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh"
LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh" LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh"
@ -16,8 +14,12 @@ ENV BUDIBASE_ENVIRONMENT=PRODUCTION
# copy files and install dependencies # copy files and install dependencies
COPY . ./ COPY . ./
# handle node-gyp # handle node-gyp
RUN apk add --no-cache --virtual .gyp python3 make g++ \ RUN apt-get update \
&& yarn && apk del .gyp && apt-get install -y --no-install-recommends g++ make python \
&& yarn \
&& yarn cache clean \
&& apt-get remove -y --purge --auto-remove g++ make python \
&& rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp
RUN yarn global add pm2 RUN yarn global add pm2
RUN yarn build RUN yarn build

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -70,10 +70,10 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "^10.0.3", "@apidevtools/swagger-parser": "^10.0.3",
"@budibase/backend-core": "^1.0.188-alpha.0", "@budibase/backend-core": "^1.0.188-alpha.2",
"@budibase/client": "^1.0.188-alpha.0", "@budibase/client": "^1.0.188-alpha.2",
"@budibase/pro": "1.0.188-alpha.0", "@budibase/pro": "1.0.188-alpha.2",
"@budibase/string-templates": "^1.0.188-alpha.0", "@budibase/string-templates": "^1.0.188-alpha.2",
"@bull-board/api": "^3.7.0", "@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0", "@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.0.188-alpha.0", "version": "1.0.188-alpha.2",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -32,9 +32,9 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "^1.0.188-alpha.0", "@budibase/backend-core": "^1.0.188-alpha.2",
"@budibase/pro": "1.0.188-alpha.0", "@budibase/pro": "1.0.188-alpha.2",
"@budibase/string-templates": "^1.0.188-alpha.0", "@budibase/string-templates": "^1.0.188-alpha.2",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "^0.3.0", "@techpass/passport-openidconnect": "^0.3.0",