Merge branch 'develop' into budi-7352-query-parameter-fields-dont-save-in-external-data-connector
This commit is contained in:
commit
a853e32ede
|
@ -154,7 +154,7 @@ jobs:
|
||||||
node-version: 14.x
|
node-version: 14.x
|
||||||
cache: "yarn"
|
cache: "yarn"
|
||||||
- run: yarn
|
- run: yarn
|
||||||
- run: yarn build
|
- run: yarn build --projects=@budibase/server,@budibase/worker,@budibase/client
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
cd qa-core
|
cd qa-core
|
||||||
|
|
|
@ -101,8 +101,6 @@ packages/builder/cypress.env.json
|
||||||
packages/builder/cypress/reports
|
packages/builder/cypress/reports
|
||||||
stats.html
|
stats.html
|
||||||
|
|
||||||
# TypeScript cache
|
|
||||||
*.tsbuildinfo
|
|
||||||
|
|
||||||
# plugins
|
# plugins
|
||||||
budibase-component
|
budibase-component
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.8.29-alpha.12",
|
"version": "2.8.29-alpha.15",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
11
nx.json
11
nx.json
|
@ -8,14 +8,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"targetDefaults": {
|
"targetDefaults": {}
|
||||||
"dev:builder": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": ["@budibase/string-templates"],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@
|
||||||
"kill-builder": "kill-port 3000",
|
"kill-builder": "kill-port 3000",
|
||||||
"kill-server": "kill-port 4001 4002",
|
"kill-server": "kill-port 4001 4002",
|
||||||
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
||||||
"dev": "yarn run kill-all && lerna run --stream --parallel dev:builder",
|
"dev": "yarn run kill-all && lerna run --stream dev:builder",
|
||||||
"dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker",
|
"dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker",
|
||||||
"dev:server": "yarn run kill-server && lerna run --stream --parallel dev:builder --scope @budibase/worker --scope @budibase/server",
|
"dev:server": "yarn run kill-server && lerna run --stream dev:builder --scope @budibase/worker --scope @budibase/server",
|
||||||
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
|
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
|
||||||
"dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
|
"dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
|
||||||
"test": "lerna run --stream test --stream",
|
"test": "lerna run --stream test --stream",
|
||||||
|
|
|
@ -9,6 +9,7 @@ const baseConfig: Config.InitialProjectOptions = {
|
||||||
},
|
},
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
"@budibase/types": "<rootDir>/../types/src",
|
"@budibase/types": "<rootDir>/../types/src",
|
||||||
|
"@budibase/shared-core": ["<rootDir>/../shared-core/src"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,20 +88,5 @@
|
||||||
"ts-node": "10.8.1",
|
"ts-node": "10.8.1",
|
||||||
"tsconfig-paths": "4.0.0",
|
"tsconfig-paths": "4.0.0",
|
||||||
"typescript": "4.7.3"
|
"typescript": "4.7.3"
|
||||||
},
|
}
|
||||||
"nx": {
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": [
|
|
||||||
"@budibase/types"
|
|
||||||
],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@budibase/types": ["../types/src"]
|
"@budibase/types": ["../types/src"],
|
||||||
|
"@budibase/shared-core": ["../shared-core/src"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
|
|
|
@ -98,13 +98,13 @@
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
"@budibase/string-templates",
|
"@budibase/string-templates",
|
||||||
"@budibase/shared-core"
|
"@budibase/shared-core",
|
||||||
|
"@budibase/types"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,9 @@
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
|
"@budibase/shared-core",
|
||||||
"@budibase/string-templates",
|
"@budibase/string-templates",
|
||||||
"@budibase/shared-core"
|
"@budibase/types"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
}
|
}
|
||||||
|
@ -144,8 +145,8 @@
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
"@budibase/string-templates",
|
|
||||||
"@budibase/shared-core",
|
"@budibase/shared-core",
|
||||||
|
"@budibase/string-templates",
|
||||||
"@budibase/types"
|
"@budibase/types"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
|
@ -157,13 +158,13 @@
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
"@budibase/shared-core",
|
"@budibase/shared-core",
|
||||||
"@budibase/string-templates"
|
"@budibase/string-templates",
|
||||||
|
"@budibase/types"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"gitHead": "115189f72a850bfb52b65ec61d932531bf327072"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,8 @@
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
"@budibase/backend-core"
|
"@budibase/backend-core",
|
||||||
|
"@budibase/string-templates"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"require": ["tsconfig-paths/register"],
|
"require": ["tsconfig-paths/register"],
|
||||||
"swc": true
|
"swc": true
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../types" }, { "path": "../backend-core" }],
|
|
||||||
"include": ["src/**/*", "package.json"],
|
"include": ["src/**/*", "package.json"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,14 +70,26 @@
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
{
|
{
|
||||||
"projects": [
|
"projects": [
|
||||||
|
"@budibase/shared-core",
|
||||||
"@budibase/string-templates",
|
"@budibase/string-templates",
|
||||||
"@budibase/shared-core"
|
"@budibase/types"
|
||||||
|
],
|
||||||
|
"target": "build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dev:builder": {
|
||||||
|
"dependsOn": [
|
||||||
|
{
|
||||||
|
"projects": [
|
||||||
|
"@budibase/shared-core",
|
||||||
|
"@budibase/string-templates",
|
||||||
|
"@budibase/types"
|
||||||
],
|
],
|
||||||
"target": "build"
|
"target": "build"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,11 @@ const devPaths = production
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
find: "@budibase/shared-core",
|
find: "@budibase/shared-core",
|
||||||
replacement: path.resolve("../shared-core/dist/mjs/src/index"),
|
replacement: path.resolve("../shared-core/dist/index"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "@budibase/types",
|
find: "@budibase/types",
|
||||||
replacement: path.resolve("../types/dist/mjs/index"),
|
replacement: path.resolve("../types/dist/index"),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
$: parentId = $component?.id
|
$: parentId = $component?.id
|
||||||
$: inBuilder = $builderStore.inBuilder
|
$: inBuilder = $builderStore.inBuilder
|
||||||
$: instance = {
|
$: instance = {
|
||||||
_component: `@budibase/standard-components/${type}`,
|
_component: getComponent(type),
|
||||||
_id: id,
|
_id: id,
|
||||||
_instanceName: name || type[0].toUpperCase() + type.slice(1),
|
_instanceName: getInstanceName(name, type),
|
||||||
_styles: {
|
_styles: {
|
||||||
...styles,
|
...styles,
|
||||||
normal: styles?.normal || {},
|
normal: styles?.normal || {},
|
||||||
|
@ -45,6 +45,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getComponent = type => {
|
||||||
|
if (!type) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (type.startsWith("plugin/")) {
|
||||||
|
return type
|
||||||
|
} else {
|
||||||
|
return `@budibase/standard-components/${type}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getInstanceName = (name, type) => {
|
||||||
|
if (name) {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
if (!type) {
|
||||||
|
return "New component"
|
||||||
|
}
|
||||||
|
if (type.startsWith("plugin/")) {
|
||||||
|
type = type.split("plugin/")[1]
|
||||||
|
}
|
||||||
|
return type[0].toUpperCase() + type.slice(1)
|
||||||
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (inBuilder) {
|
if (inBuilder) {
|
||||||
block.unregisterComponent(id, parentId)
|
block.unregisterComponent(id, parentId)
|
||||||
|
|
|
@ -18,6 +18,8 @@ import { styleable } from "utils/styleable"
|
||||||
import { linkable } from "utils/linkable"
|
import { linkable } from "utils/linkable"
|
||||||
import { getAction } from "utils/getAction"
|
import { getAction } from "utils/getAction"
|
||||||
import Provider from "components/context/Provider.svelte"
|
import Provider from "components/context/Provider.svelte"
|
||||||
|
import Block from "components/Block.svelte"
|
||||||
|
import BlockComponent from "components/BlockComponent.svelte"
|
||||||
import { ActionTypes } from "./constants"
|
import { ActionTypes } from "./constants"
|
||||||
import { fetchDatasourceSchema } from "./utils/schema.js"
|
import { fetchDatasourceSchema } from "./utils/schema.js"
|
||||||
import { getAPIKey } from "./utils/api.js"
|
import { getAPIKey } from "./utils/api.js"
|
||||||
|
@ -44,4 +46,6 @@ export default {
|
||||||
Provider,
|
Provider,
|
||||||
ActionTypes,
|
ActionTypes,
|
||||||
getAPIKey,
|
getAPIKey,
|
||||||
|
Block,
|
||||||
|
BlockComponent,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{
|
{
|
||||||
"watch": ["src", "../backend-core", "../pro"],
|
"watch": [
|
||||||
"ext": "js,ts,json",
|
"src",
|
||||||
"ignore": [
|
"../backend-core",
|
||||||
"src/**/*.spec.ts",
|
"../pro",
|
||||||
"src/**/*.spec.js",
|
"../types",
|
||||||
"../backend-core/dist/**/*"
|
"../shared-core",
|
||||||
|
"../string-templates"
|
||||||
],
|
],
|
||||||
|
"ext": "js,ts,json",
|
||||||
|
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js", "../*/dist/**/*"],
|
||||||
"exec": "yarn build && node ./dist/index.js"
|
"exec": "yarn build && node ./dist/index.js"
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,31 +179,5 @@
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"oracledb": "5.3.0"
|
"oracledb": "5.3.0"
|
||||||
},
|
}
|
||||||
"nx": {
|
|
||||||
"targets": {
|
|
||||||
"dev:builder": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": [
|
|
||||||
"@budibase/backend-core"
|
|
||||||
],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": [
|
|
||||||
"@budibase/string-templates",
|
|
||||||
"@budibase/shared-core"
|
|
||||||
],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ if [[ -n $CI ]]
|
||||||
then
|
then
|
||||||
# --runInBand performs better in ci where resources are limited
|
# --runInBand performs better in ci where resources are limited
|
||||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
echo "jest --coverage --runInBand --forceExit"
|
echo "jest --coverage --runInBand --forceExit --bail"
|
||||||
jest --coverage --runInBand --forceExit
|
jest --coverage --runInBand --forceExit --bail
|
||||||
else
|
else
|
||||||
# --maxWorkers performs better in development
|
# --maxWorkers performs better in development
|
||||||
echo "jest --coverage --maxWorkers=2 --forceExit"
|
echo "jest --coverage --maxWorkers=2 --forceExit"
|
||||||
|
|
|
@ -49,12 +49,18 @@ async function parseSchemaUI(ctx: Ctx, view: CreateViewRequest) {
|
||||||
const schemaUI =
|
const schemaUI =
|
||||||
view.schema &&
|
view.schema &&
|
||||||
Object.entries(view.schema).reduce((p, [fieldName, schemaValue]) => {
|
Object.entries(view.schema).reduce((p, [fieldName, schemaValue]) => {
|
||||||
p[fieldName] = {
|
const fieldSchema: RequiredKeys<UIFieldMetadata> = {
|
||||||
order: schemaValue.order,
|
order: schemaValue.order,
|
||||||
width: schemaValue.width,
|
width: schemaValue.width,
|
||||||
visible: schemaValue.visible,
|
visible: schemaValue.visible,
|
||||||
icon: schemaValue.icon,
|
icon: schemaValue.icon,
|
||||||
}
|
}
|
||||||
|
Object.entries(fieldSchema)
|
||||||
|
.filter(([_, val]) => val === undefined)
|
||||||
|
.forEach(([key]) => {
|
||||||
|
delete fieldSchema[key as keyof UIFieldMetadata]
|
||||||
|
})
|
||||||
|
p[fieldName] = fieldSchema
|
||||||
return p
|
return p
|
||||||
}, {} as Record<string, RequiredKeys<UIFieldMetadata>>)
|
}, {} as Record<string, RequiredKeys<UIFieldMetadata>>)
|
||||||
return schemaUI
|
return schemaUI
|
||||||
|
@ -66,13 +72,14 @@ export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
||||||
|
|
||||||
const schemaUI = await parseSchemaUI(ctx, view)
|
const schemaUI = await parseSchemaUI(ctx, view)
|
||||||
|
|
||||||
const parsedView: Omit<ViewV2, "id" | "version"> = {
|
const parsedView: Omit<RequiredKeys<ViewV2>, "id" | "version"> = {
|
||||||
name: view.name,
|
name: view.name,
|
||||||
tableId: view.tableId,
|
tableId: view.tableId,
|
||||||
query: view.query,
|
query: view.query,
|
||||||
sort: view.sort,
|
sort: view.sort,
|
||||||
columns: view.schema && Object.keys(view.schema),
|
columns: view.schema && Object.keys(view.schema),
|
||||||
schemaUI,
|
schemaUI,
|
||||||
|
primaryDisplay: view.primaryDisplay,
|
||||||
}
|
}
|
||||||
const result = await sdk.views.create(tableId, parsedView)
|
const result = await sdk.views.create(tableId, parsedView)
|
||||||
ctx.status = 201
|
ctx.status = 201
|
||||||
|
@ -95,7 +102,7 @@ export async function update(ctx: Ctx<UpdateViewRequest, ViewResponse>) {
|
||||||
const { tableId } = view
|
const { tableId } = view
|
||||||
|
|
||||||
const schemaUI = await parseSchemaUI(ctx, view)
|
const schemaUI = await parseSchemaUI(ctx, view)
|
||||||
const parsedView: ViewV2 = {
|
const parsedView: RequiredKeys<ViewV2> = {
|
||||||
id: view.id,
|
id: view.id,
|
||||||
name: view.name,
|
name: view.name,
|
||||||
version: view.version,
|
version: view.version,
|
||||||
|
@ -104,6 +111,7 @@ export async function update(ctx: Ctx<UpdateViewRequest, ViewResponse>) {
|
||||||
sort: view.sort,
|
sort: view.sort,
|
||||||
columns: view.schema && Object.keys(view.schema),
|
columns: view.schema && Object.keys(view.schema),
|
||||||
schemaUI,
|
schemaUI,
|
||||||
|
primaryDisplay: view.primaryDisplay,
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await sdk.views.update(tableId, parsedView)
|
const result = await sdk.views.update(tableId, parsedView)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
SortOrder,
|
SortOrder,
|
||||||
SortType,
|
SortType,
|
||||||
Table,
|
Table,
|
||||||
|
UpdateViewRequest,
|
||||||
ViewV2,
|
ViewV2,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
|
@ -34,20 +35,6 @@ function priceTable(): Table {
|
||||||
describe("/v2/views", () => {
|
describe("/v2/views", () => {
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
|
|
||||||
const viewFilters: Omit<CreateViewRequest, "name" | "tableId"> = {
|
|
||||||
query: { allOr: false, equal: { field: "value" } },
|
|
||||||
sort: {
|
|
||||||
field: "fieldToSort",
|
|
||||||
order: SortOrder.DESCENDING,
|
|
||||||
type: SortType.STRING,
|
|
||||||
},
|
|
||||||
schema: {
|
|
||||||
name: {
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
afterAll(setup.afterAll)
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
@ -70,20 +57,30 @@ describe("/v2/views", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can persist views with queries", async () => {
|
it("can persist views with all fields", async () => {
|
||||||
const newView: CreateViewRequest = {
|
const newView: Required<CreateViewRequest> = {
|
||||||
name: generator.name(),
|
name: generator.name(),
|
||||||
tableId: config.table!._id!,
|
tableId: config.table!._id!,
|
||||||
query: viewFilters.query,
|
primaryDisplay: generator.word(),
|
||||||
sort: viewFilters.sort,
|
query: { allOr: false, equal: { field: "value" } },
|
||||||
|
sort: {
|
||||||
|
field: "fieldToSort",
|
||||||
|
order: SortOrder.DESCENDING,
|
||||||
|
type: SortType.STRING,
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
name: {
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
delete newView.schema
|
|
||||||
const res = await config.api.viewV2.create(newView)
|
const res = await config.api.viewV2.create(newView)
|
||||||
|
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
...newView,
|
...newView,
|
||||||
query: viewFilters.query,
|
schema: undefined,
|
||||||
sort: viewFilters.sort,
|
columns: ["name"],
|
||||||
|
schemaUI: newView.schema,
|
||||||
id: expect.any(String),
|
id: expect.any(String),
|
||||||
version: 2,
|
version: 2,
|
||||||
})
|
})
|
||||||
|
@ -210,6 +207,46 @@ describe("/v2/views", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("can update all fields", async () => {
|
||||||
|
const tableId = config.table!._id!
|
||||||
|
|
||||||
|
const updatedData: Required<UpdateViewRequest> = {
|
||||||
|
version: view.version,
|
||||||
|
id: view.id,
|
||||||
|
tableId,
|
||||||
|
name: view.name,
|
||||||
|
primaryDisplay: generator.word(),
|
||||||
|
query: { equal: { [generator.word()]: generator.word() } },
|
||||||
|
sort: {
|
||||||
|
field: generator.word(),
|
||||||
|
order: SortOrder.DESCENDING,
|
||||||
|
type: SortType.STRING,
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
Category: {
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
await config.api.viewV2.update(updatedData)
|
||||||
|
|
||||||
|
expect(await config.api.table.get(tableId)).toEqual({
|
||||||
|
...config.table,
|
||||||
|
views: {
|
||||||
|
[view.name]: {
|
||||||
|
...updatedData,
|
||||||
|
schema: {
|
||||||
|
Category: expect.objectContaining({
|
||||||
|
visible: false,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_rev: expect.any(String),
|
||||||
|
updatedAt: expect.any(String),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it("can update an existing view name", async () => {
|
it("can update an existing view name", async () => {
|
||||||
const tableId = config.table!._id!
|
const tableId = config.table!._id!
|
||||||
await config.api.viewV2.update({ ...view, name: "View B" })
|
await config.api.viewV2.update({ ...view, name: "View B" })
|
||||||
|
|
|
@ -86,6 +86,7 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
|
||||||
: schema[fieldName].order,
|
: schema[fieldName].order,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete view.schemaUI
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view?.columns?.length) {
|
if (view?.columns?.length) {
|
||||||
|
@ -97,6 +98,7 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
|
||||||
pickedSchema[fieldName] = { ...schema[fieldName] }
|
pickedSchema[fieldName] = { ...schema[fieldName] }
|
||||||
}
|
}
|
||||||
schema = pickedSchema
|
schema = pickedSchema
|
||||||
|
delete view.columns
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,22 +2,21 @@
|
||||||
"name": "@budibase/shared-core",
|
"name": "@budibase/shared-core",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Shared data utils",
|
"description": "Shared data utils",
|
||||||
"main": "dist/cjs/src/index.js",
|
"main": "src/index.ts",
|
||||||
"types": "dist/mjs/src/index.d.ts",
|
"types": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/mjs/src/index.js",
|
"import": "./dist/index.js",
|
||||||
"require": "./dist/cjs/src/index.js"
|
"require": "./src/index.ts"
|
||||||
},
|
}
|
||||||
"./package.json": "./dist/mjs/package.json"
|
|
||||||
},
|
},
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist/",
|
"prebuild": "rimraf dist/",
|
||||||
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig-cjs.build.json",
|
"build": "tsc -p tsconfig.build.json",
|
||||||
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
||||||
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\"",
|
"dev:builder": "yarn prebuild && tsc -p tsconfig.json --watch --preserveWatchOutput",
|
||||||
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
|
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -27,19 +26,5 @@
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"typescript": "4.7.3"
|
"typescript": "4.7.3"
|
||||||
},
|
|
||||||
"nx": {
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": [
|
|
||||||
"@budibase/types"
|
|
||||||
],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es6",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"lib": ["es2020"],
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"incremental": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": true,
|
|
||||||
"types": ["node"],
|
|
||||||
"outDir": "dist",
|
|
||||||
"skipLibCheck": true
|
|
||||||
},
|
|
||||||
"include": ["**/*.js", "**/*.ts"],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist",
|
|
||||||
"**/*.spec.ts",
|
|
||||||
"**/*.spec.js",
|
|
||||||
"__mocks__"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "./tsconfig-base.build.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"outDir": "dist/cjs/src",
|
|
||||||
"target": "es2015"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,25 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig-base.build.json",
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "esnext",
|
"target": "es6",
|
||||||
"outDir": "dist/mjs/src",
|
"moduleResolution": "node",
|
||||||
"target": "esnext"
|
"lib": ["es2020"],
|
||||||
}
|
"strict": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"incremental": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": true,
|
||||||
|
"types": ["node"],
|
||||||
|
"outDir": "dist",
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["**/*.js", "**/*.ts"],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"__mocks__"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.build.json",
|
"extends": "./tsconfig.build.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"composite": true,
|
||||||
|
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@budibase/types": ["../types/src"]
|
"@budibase/types": ["../../types/src"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["**/*.js", "**/*.ts"],
|
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,5 @@
|
||||||
"rollup-plugin-node-resolve": "^5.2.0",
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"typescript": "4.7.3"
|
"typescript": "4.7.3"
|
||||||
},
|
}
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
"name": "@budibase/types",
|
"name": "@budibase/types",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Budibase types",
|
"description": "Budibase types",
|
||||||
"main": "dist/cjs/index.js",
|
"main": "src/index.ts",
|
||||||
"types": "dist/mjs/index.d.ts",
|
"types": "src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/mjs/index.js",
|
"import": "./dist/index.js",
|
||||||
"require": "./dist/cjs/index.js"
|
"require": "./src/index.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist/",
|
"prebuild": "rimraf dist/",
|
||||||
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig-cjs.build.json",
|
"build": "tsc -p tsconfig.build.json",
|
||||||
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
||||||
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\"",
|
"dev:builder": "yarn prebuild && tsc -p tsconfig.json --watch --preserveWatchOutput",
|
||||||
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
|
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
|
||||||
},
|
},
|
||||||
"jest": {},
|
"jest": {},
|
||||||
|
|
|
@ -18,6 +18,7 @@ export interface ViewV2 {
|
||||||
version: 2
|
version: 2
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
|
primaryDisplay?: string
|
||||||
tableId: string
|
tableId: string
|
||||||
query?: SearchFilters
|
query?: SearchFilters
|
||||||
sort?: {
|
sort?: {
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"lib": ["es2020"],
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"incremental": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": true,
|
|
||||||
"skipLibCheck": true
|
|
||||||
},
|
|
||||||
"include": ["src/**/*"],
|
|
||||||
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.spec.js"]
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "./tsconfig-base.build.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"outDir": "dist/cjs",
|
|
||||||
"target": "es2015"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,18 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig-base.build.json",
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "dist/mjs"
|
"lib": ["es2020"],
|
||||||
}
|
"strict": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"incremental": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"outDir": "dist"
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.spec.js"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.build.json",
|
"extends": "./tsconfig.build.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true
|
"baseUrl": ".",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"composite": true,
|
||||||
|
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{
|
{
|
||||||
"watch": ["src", "../backend-core", "../pro"],
|
"watch": [
|
||||||
"ext": "js,ts,json",
|
"src",
|
||||||
"ignore": [
|
"../backend-core",
|
||||||
"src/**/*.spec.ts",
|
"../pro",
|
||||||
"src/**/*.spec.js",
|
"../types",
|
||||||
"../backend-core/dist/**/*"
|
"../shared-core",
|
||||||
|
"../string-templates"
|
||||||
],
|
],
|
||||||
|
"ext": "js,ts,json",
|
||||||
|
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js", "../*/dist/**/*"],
|
||||||
"exec": "yarn build && node dist/index.js"
|
"exec": "yarn build && node dist/index.js"
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,20 +102,5 @@
|
||||||
"tsconfig-paths": "4.0.0",
|
"tsconfig-paths": "4.0.0",
|
||||||
"typescript": "4.7.3",
|
"typescript": "4.7.3",
|
||||||
"update-dotenv": "1.1.1"
|
"update-dotenv": "1.1.1"
|
||||||
},
|
}
|
||||||
"nx": {
|
|
||||||
"targets": {
|
|
||||||
"dev:builder": {
|
|
||||||
"dependsOn": [
|
|
||||||
{
|
|
||||||
"projects": [
|
|
||||||
"@budibase/backend-core"
|
|
||||||
],
|
|
||||||
"target": "build"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ set -e
|
||||||
if [[ -n $CI ]]
|
if [[ -n $CI ]]
|
||||||
then
|
then
|
||||||
# --runInBand performs better in ci where resources are limited
|
# --runInBand performs better in ci where resources are limited
|
||||||
echo "jest --coverage --runInBand --forceExit"
|
echo "jest --coverage --runInBand --forceExit --bail"
|
||||||
jest --coverage --runInBand --forceExit
|
jest --coverage --runInBand --forceExit --bail
|
||||||
else
|
else
|
||||||
# --maxWorkers performs better in development
|
# --maxWorkers performs better in development
|
||||||
echo "jest --coverage --maxWorkers=2 --forceExit"
|
echo "jest --coverage --maxWorkers=2 --forceExit"
|
||||||
|
|
Loading…
Reference in New Issue