From 70f505d562a804eeee0cda068164860d60c9477f Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 25 Jul 2023 17:03:44 +0100 Subject: [PATCH 001/183] Update helm chart to expose OFFLINE_MODE env var --- charts/budibase/templates/app-service-deployment.yaml | 2 ++ charts/budibase/templates/worker-service-deployment.yaml | 2 ++ charts/budibase/values.yaml | 1 + 3 files changed, 5 insertions(+) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 2b2589406a..a1d4753cdb 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -120,6 +120,8 @@ spec: {{ end }} - name: MULTI_TENANCY value: {{ .Values.globals.multiTenancy | quote }} + - name: OFFLINE_MODE + value: {{ .Values.globals.offlineMode | quote }} - name: LOG_LEVEL value: {{ .Values.services.apps.logLevel | quote }} - name: REDIS_PASSWORD diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 5fed80b355..3d1a7369c9 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -116,6 +116,8 @@ spec: value: {{ .Values.services.worker.port | quote }} - name: MULTI_TENANCY value: {{ .Values.globals.multiTenancy | quote }} + - name: OFFLINE_MODE + value: {{ .Values.globals.offlineMode | quote }} - name: LOG_LEVEL value: {{ .Values.services.worker.logLevel | quote }} - name: REDIS_PASSWORD diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 74e4c52654..bed92bfe05 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -82,6 +82,7 @@ globals: posthogToken: "phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU" selfHosted: "1" # set to 0 for budibase cloud environment, set to 1 for self-hosted setup multiTenancy: "0" # set to 0 to disable multiple orgs, set to 1 to enable multiple orgs + offlineMode: "0" # set to 1 to enable offline mode accountPortalUrl: "" accountPortalApiKey: "" cookieDomain: "" From aff286807ce2bdfc394c63a40323a4320a2c2426 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Jul 2023 10:00:56 +0100 Subject: [PATCH 002/183] fail pipeline if unreleased changes in master --- .../workflows/check_unreleased_changes.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/check_unreleased_changes.yml diff --git a/.github/workflows/check_unreleased_changes.yml b/.github/workflows/check_unreleased_changes.yml new file mode 100644 index 0000000000..2312990c3c --- /dev/null +++ b/.github/workflows/check_unreleased_changes.yml @@ -0,0 +1,29 @@ +name: Check for Unreleased Changes + +on: + pull_request: + branches: + - master + +jobs: + check_unreleased: + runs-on: ubuntu-latest + steps: + - name: Check for unreleased changes + env: + REPO: "Budibase/budibase" + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + RELEASE_TIMESTAMP=$(curl -s -H "Authorization: token $TOKEN" \ + "https://api.github.com/repos/$REPO/releases/latest" | \ + jq -r .published_at) + COMMIT_TIMESTAMP=$(curl -s -H "Authorization: token $TOKEN" \ + "https://api.github.com/repos/$REPO/commits/master" | \ + jq -r .commit.committer.date) + RELEASE_SECONDS=$(date --date="$RELEASE_TIMESTAMP" "+%s") + COMMIT_SECONDS=$(date --date="$COMMIT_TIMESTAMP" "+%s") + if (( COMMIT_SECONDS > RELEASE_SECONDS )); then + echo "There are unreleased changes. Please release these changes before merging." + exit 1 + fi + echo "No unreleased changes detected." From c11706440dc0ff82adf1041a6901ad70a5e914dd Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Jul 2023 10:27:19 +0100 Subject: [PATCH 003/183] change pipeline name to match filename --- .github/workflows/check_unreleased_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_unreleased_changes.yml b/.github/workflows/check_unreleased_changes.yml index 2312990c3c..d558330545 100644 --- a/.github/workflows/check_unreleased_changes.yml +++ b/.github/workflows/check_unreleased_changes.yml @@ -1,4 +1,4 @@ -name: Check for Unreleased Changes +name: check_unreleased_changes on: pull_request: From aef9ff06af6634479ec73e2bf036dbafd90fa7dc Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 27 Jul 2023 16:09:38 +0100 Subject: [PATCH 004/183] Disable component validation for old app imports --- packages/server/src/api/controllers/application.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 53453b8538..8a871e28cf 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -331,6 +331,11 @@ async function performAppCreate(ctx: UserCtx) { } }) + // Keep existing validation setting + if (!existing.features?.componentValidation) { + newApplication.features!.componentValidation = false + } + // Migrate navigation settings and screens if required if (existing) { const navigation = await migrateAppNavigation() From 1531ff710f28ee882385679e05fa152bb1ce90b5 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Jul 2023 23:35:13 +0100 Subject: [PATCH 005/183] fix gsheets onboarding --- .../src/pages/builder/app/[application]/data/_layout.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte index a2db33306c..4f64edb34d 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_layout.svelte @@ -2,14 +2,15 @@ import { Button, Layout } from "@budibase/bbui" import DatasourceNavigator from "components/backend/DatasourceNavigator/DatasourceNavigator.svelte" import Panel from "components/design/Panel.svelte" - import { isActive, goto, redirect } from "@roxi/routify" + import { isActive, redirect, goto, params } from "@roxi/routify" import BetaButton from "./_components/BetaButton.svelte" import { datasources } from "stores/backend" $: { // If we ever don't have any data other than the users table, prompt the // user to add some - if (!$datasources.hasData) { + // Don't redirect if setting up google sheets, or we lose the query parameter + if (!$datasources.hasData && !$params["?continue_google_setup"]) { $redirect("./new") } } From 74183d3a463264bf1353d7970a58f631e267ad7f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 28 Jul 2023 08:39:16 +0000 Subject: [PATCH 006/183] Bump version to 2.8.29 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index b9545165d8..b02f81e499 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.28", + "version": "2.8.29", "npmClient": "yarn", "packages": [ "packages/*" From 546c16f1180bffb3e1f7a42ccd964642d8aaa233 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 17:20:42 +0200 Subject: [PATCH 007/183] Update local tools --- .nvmrc | 2 +- .tool-versions | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.nvmrc b/.nvmrc index 835d07c442..7950a44576 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v14.20.1 +v18.17.0 diff --git a/.tool-versions b/.tool-versions index 9f2ea77b14..a909d60941 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -nodejs 14.21.3 +nodejs 18.17.0 python 3.10.0 -yarn 1.22.19 \ No newline at end of file +yarn 1.22.19 From d8c2499c15d5e5d1db8444dbe8069cba08836b35 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 17:46:57 +0200 Subject: [PATCH 008/183] Fix automation issues --- packages/server/src/automations/tests/automation.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/automations/tests/automation.spec.ts b/packages/server/src/automations/tests/automation.spec.ts index 67ff6d40ec..0cdc69c5ac 100644 --- a/packages/server/src/automations/tests/automation.spec.ts +++ b/packages/server/src/automations/tests/automation.spec.ts @@ -33,7 +33,7 @@ describe("Run through some parts of the automations system", () => { setup.afterAll() }) - it("should be able to init in builder", async () => { + it.only("should be able to init in builder", async () => { const automation: Automation = { ...basicAutomation(), appId: config.appId, From 5e59d735332b288ff86b51dcd7399e6c7efe2e24 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 17:48:10 +0200 Subject: [PATCH 009/183] Change actions to use node 18 --- .github/workflows/budibase_ci.yml | 24 +++++++++++------------ .github/workflows/release-develop.yml | 2 +- .github/workflows/release-master.yml | 2 +- .github/workflows/release-selfhost.yml | 4 ++-- .github/workflows/release-singleimage.yml | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 9509a22e99..661fcb170b 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -33,10 +33,10 @@ jobs: uses: actions/checkout@v3 if: github.repository != github.event.pull_request.head.repo.full_name - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn - run: yarn lint @@ -54,10 +54,10 @@ jobs: uses: actions/checkout@v3 if: github.repository != github.event.pull_request.head.repo.full_name - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn # Run build all the projects @@ -78,10 +78,10 @@ jobs: uses: actions/checkout@v3 if: github.repository != github.event.pull_request.head.repo.full_name - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro @@ -104,10 +104,10 @@ jobs: uses: actions/checkout@v3 if: github.repository != github.event.pull_request.head.repo.full_name - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn - run: yarn test --scope=@budibase/worker --scope=@budibase/server @@ -127,10 +127,10 @@ jobs: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn - run: yarn test --scope=@budibase/pro @@ -148,10 +148,10 @@ jobs: uses: actions/checkout@v3 if: github.repository != github.event.pull_request.head.repo.full_name - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18.x cache: "yarn" - run: yarn - run: yarn build diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index 61cb283e28..bd727b7865 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -44,7 +44,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 18.x - run: yarn install --frozen-lockfile - name: Update versions diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 7f8b8f1d55..db2723cdfe 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 18.x - run: yarn install --frozen-lockfile - name: Update versions diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index 39ee812726..ddfe202465 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -28,10 +28,10 @@ jobs: exit 1 fi - - name: Use Node.js 14.x + - name: Use Node.js 18.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 18.x - name: Get the latest budibase release version id: version diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index 5b75c20d29..25be68feb0 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x] + node-version: [18.x] steps: - name: Fail if not a tag run: | From e2ac7e3463a165ac9ecfc58fcc500ce5112b3d7a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 25 Jul 2023 10:44:53 +0200 Subject: [PATCH 010/183] Fix minio usage --- .../backend-core/tests/core/utilities/testContainerUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/tests/core/utilities/testContainerUtils.ts b/packages/backend-core/tests/core/utilities/testContainerUtils.ts index f6c702f7ef..06bd91392e 100644 --- a/packages/backend-core/tests/core/utilities/testContainerUtils.ts +++ b/packages/backend-core/tests/core/utilities/testContainerUtils.ts @@ -80,7 +80,7 @@ function getRedisConfig() { export function setupEnv(...envs: any[]) { const couch = getCouchConfig(), - minio = getCouchConfig(), + minio = getMinioConfig(), redis = getRedisConfig() const configs = [ { key: "COUCH_DB_PORT", value: couch.port }, From f7cae98a963dad0b3469332ef9151bbd98fe87b0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 10:00:10 +0200 Subject: [PATCH 011/183] Change node engine --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a392aeee78..358c027026 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "@budibase/types": "0.0.0" }, "engines": { - "node": ">=14.0.0 <15.0.0" + "node": ">=18.0.0 <19.0.0" }, "dependencies": {} } From c7b0960bb3063013c08f516ec3b90b09d8b77d39 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 11:30:44 +0200 Subject: [PATCH 012/183] Make use of workerIdleMemoryLimit --- packages/server/jest.config.ts | 1 + packages/worker/jest.config.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index f36864f999..b43bd742c0 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,6 +16,7 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, + workerIdleMemoryLimit: "40%", } // add pro sources if they exist diff --git a/packages/worker/jest.config.ts b/packages/worker/jest.config.ts index 0a640766f4..f03f8006cc 100644 --- a/packages/worker/jest.config.ts +++ b/packages/worker/jest.config.ts @@ -16,6 +16,7 @@ const config: Config.InitialOptions = { "@budibase/types": "/../types/src", "@budibase/shared-core": ["/../shared-core/src"], }, + workerIdleMemoryLimit: "40%", } // add pro sources if they exist From 225d498909580f6b8912e99f3d0402b5a0d6c424 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 16:02:03 +0200 Subject: [PATCH 013/183] Run with concurrency 1 --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 661fcb170b..bdb2e640b5 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -110,7 +110,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn - - run: yarn test --scope=@budibase/worker --scope=@budibase/server + - run: yarn test --concurrency=1 --scope=@budibase/worker --scope=@budibase/server - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos From 5dc36238667104cd9745defe5f048ac6da5c3dbe Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 16:03:53 +0200 Subject: [PATCH 014/183] Remove workerIdleMemoryLimit from worker --- packages/worker/jest.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/worker/jest.config.ts b/packages/worker/jest.config.ts index f03f8006cc..0a640766f4 100644 --- a/packages/worker/jest.config.ts +++ b/packages/worker/jest.config.ts @@ -16,7 +16,6 @@ const config: Config.InitialOptions = { "@budibase/types": "/../types/src", "@budibase/shared-core": ["/../shared-core/src"], }, - workerIdleMemoryLimit: "40%", } // add pro sources if they exist From e71ec971a093b6c1d40d4571da80e623230ab400 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 16:04:19 +0200 Subject: [PATCH 015/183] workerIdleMemoryLimit server at 50% --- packages/server/jest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index b43bd742c0..a683be8150 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,7 +16,7 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, - workerIdleMemoryLimit: "40%", + workerIdleMemoryLimit: "50%", } // add pro sources if they exist From c2a5a37c487e1961d4d132c158d159db5aecfb1f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 16:23:56 +0200 Subject: [PATCH 016/183] Split tests --- .github/workflows/budibase_ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index bdb2e640b5..d12e632fd4 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -110,7 +110,12 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn - - run: yarn test --concurrency=1 --scope=@budibase/worker --scope=@budibase/server + - name: Test worker + run: yarn test --scope=@budibase/worker + - name: Test server + env: + NODE_OPTIONS: "--max_old_space_size=4096" + run: yarn test --scope=@budibase/server - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos From 0f75660808d0206e3f40299f3310be49acd5cd73 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 16:47:09 +0200 Subject: [PATCH 017/183] Attempt different commands --- .github/workflows/budibase_ci.yml | 8 ++------ packages/server/scripts/test.sh | 5 +++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index d12e632fd4..5dc3ba1222 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -110,12 +110,8 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn - - name: Test worker - run: yarn test --scope=@budibase/worker - - name: Test server - env: - NODE_OPTIONS: "--max_old_space_size=4096" - run: yarn test --scope=@budibase/server + - name: Test worker and server + run: yarn test --concurrency=1 --scope=@budibase/worker --scope=@budibase/server - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index f3f679c4da..4aad5b3c7c 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -5,8 +5,9 @@ if [[ -n $CI ]] then # --runInBand performs better in ci where resources are limited export NODE_OPTIONS="--max-old-space-size=4096" - echo "jest --coverage --runInBand --forceExit" - jest --coverage --runInBand --forceExit + node ../../node_modules/jest/bin/jest.js --version + echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js" + node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js else # --maxWorkers performs better in development echo "jest --coverage --maxWorkers=2 --forceExit" From f82c10782fb3da16e8022433d0dc440e686dbdef Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 17:14:34 +0200 Subject: [PATCH 018/183] Log heap usage --- packages/server/jest.config.ts | 1 - packages/server/scripts/test.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index a683be8150..f36864f999 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,7 +16,6 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, - workerIdleMemoryLimit: "50%", } // add pro sources if they exist diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index 4aad5b3c7c..19f3fb33d7 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -7,7 +7,7 @@ then export NODE_OPTIONS="--max-old-space-size=4096" node ../../node_modules/jest/bin/jest.js --version echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js" - node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js + node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --logHeapUsage else # --maxWorkers performs better in development echo "jest --coverage --maxWorkers=2 --forceExit" From 2e1903f95577275e102dfbf26de80e683541f9fb Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 17:40:44 +0200 Subject: [PATCH 019/183] Log --- packages/server/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index 19f3fb33d7..3adc5abbd0 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -6,7 +6,7 @@ then # --runInBand performs better in ci where resources are limited export NODE_OPTIONS="--max-old-space-size=4096" node ../../node_modules/jest/bin/jest.js --version - echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js" + echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --logHeapUsage" node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --logHeapUsage else # --maxWorkers performs better in development From 42b14fe712aa04124f3c65acef66bfa05db34630 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 17:45:47 +0200 Subject: [PATCH 020/183] Add workerIdleMemoryLimit --- packages/server/jest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index f36864f999..f12e2e46c7 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,6 +16,7 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, + workerIdleMemoryLimit: 0.2, } // add pro sources if they exist From e5ceaf8ffd75f3cec86373671504ccd7e8d71aef Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 18:03:13 +0200 Subject: [PATCH 021/183] Add 2gb limit --- packages/server/jest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index f12e2e46c7..87e2ef4d0a 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,7 +16,7 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, - workerIdleMemoryLimit: 0.2, + workerIdleMemoryLimit: "2GB", } // add pro sources if they exist From 800f5c5095e2eeca639414d1293b311293e112cd Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 18:11:34 +0200 Subject: [PATCH 022/183] Use --frozen-lock --- .github/workflows/budibase_ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 5dc3ba1222..6c9fb1c253 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -38,7 +38,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile - run: yarn lint build: @@ -59,7 +59,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile # Run build all the projects - run: yarn build # Check the types of the projects built via esbuild @@ -83,7 +83,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro - uses: codecov/codecov-action@v3 with: @@ -109,7 +109,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile - name: Test worker and server run: yarn test --concurrency=1 --scope=@budibase/worker --scope=@budibase/server - uses: codecov/codecov-action@v3 @@ -133,7 +133,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile - run: yarn test --scope=@budibase/pro integration-test: @@ -154,7 +154,7 @@ jobs: with: node-version: 18.x cache: "yarn" - - run: yarn + - run: yarn --frozen-lockfile - run: yarn build - name: Run tests run: | From 712732f79589353ffed3817207c25980fa9c17e8 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 18:37:13 +0200 Subject: [PATCH 023/183] Run in band? --- packages/server/scripts/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index 3adc5abbd0..5d0c793846 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -6,8 +6,8 @@ then # --runInBand performs better in ci where resources are limited export NODE_OPTIONS="--max-old-space-size=4096" node ../../node_modules/jest/bin/jest.js --version - echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --logHeapUsage" - node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --logHeapUsage + echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage" + node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage else # --maxWorkers performs better in development echo "jest --coverage --maxWorkers=2 --forceExit" From a0be6029b3bd8a7524f5c07ef10ed5b5c278ba6e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 21:10:28 +0200 Subject: [PATCH 024/183] Remove concurrency --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 6c9fb1c253..9e2d0b3fbe 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -111,7 +111,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Test worker and server - run: yarn test --concurrency=1 --scope=@budibase/worker --scope=@budibase/server + run: yarn test --scope=@budibase/worker --scope=@budibase/server - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos From e2758d3da18c90f062d7749c86cfaa320914e7bb Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 27 Jul 2023 21:12:26 +0200 Subject: [PATCH 025/183] Remove it.only( --- packages/server/src/automations/tests/automation.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/automations/tests/automation.spec.ts b/packages/server/src/automations/tests/automation.spec.ts index 0cdc69c5ac..67ff6d40ec 100644 --- a/packages/server/src/automations/tests/automation.spec.ts +++ b/packages/server/src/automations/tests/automation.spec.ts @@ -33,7 +33,7 @@ describe("Run through some parts of the automations system", () => { setup.afterAll() }) - it.only("should be able to init in builder", async () => { + it("should be able to init in builder", async () => { const automation: Automation = { ...basicAutomation(), appId: config.appId, From 51a1d1c183664809022461a66d72e6fed4fe8f06 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 28 Jul 2023 10:59:12 +0200 Subject: [PATCH 026/183] Add force exists --- packages/server/scripts/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index 5d0c793846..353995f8bb 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -6,8 +6,8 @@ then # --runInBand performs better in ci where resources are limited export NODE_OPTIONS="--max-old-space-size=4096" node ../../node_modules/jest/bin/jest.js --version - echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage" - node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage + echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage --forceExit" + node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage --forceExit else # --maxWorkers performs better in development echo "jest --coverage --maxWorkers=2 --forceExit" From d5533c00d609a73847d06d25f4396c42abc69ae6 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 28 Jul 2023 12:53:52 +0200 Subject: [PATCH 027/183] Fix workerIdleMemoryLimit usage --- packages/server/jest.config.ts | 1 - packages/server/scripts/test.sh | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/server/jest.config.ts b/packages/server/jest.config.ts index 87e2ef4d0a..f36864f999 100644 --- a/packages/server/jest.config.ts +++ b/packages/server/jest.config.ts @@ -16,7 +16,6 @@ const baseConfig: Config.InitialProjectOptions = { "@budibase/shared-core": "/../shared-core/src", "@budibase/types": "/../types/src", }, - workerIdleMemoryLimit: "2GB", } // add pro sources if they exist diff --git a/packages/server/scripts/test.sh b/packages/server/scripts/test.sh index 353995f8bb..a2c6f2cdf2 100644 --- a/packages/server/scripts/test.sh +++ b/packages/server/scripts/test.sh @@ -6,8 +6,8 @@ then # --runInBand performs better in ci where resources are limited export NODE_OPTIONS="--max-old-space-size=4096" node ../../node_modules/jest/bin/jest.js --version - echo "node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage --forceExit" - node --expose-gc --no-compilation-cache ../../node_modules/jest/bin/jest.js --runInBand --logHeapUsage --forceExit + echo "jest --coverage --maxWorkers=2 --forceExit" + jest --coverage --maxWorkers=2 --forceExit --workerIdleMemoryLimit=2000MB else # --maxWorkers performs better in development echo "jest --coverage --maxWorkers=2 --forceExit" From 52078d6fd7475c8a17e6d2ebdb537d3dd70b2d4f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 28 Jul 2023 17:52:24 +0200 Subject: [PATCH 028/183] Don't modify production pipelines --- .github/workflows/release-master.yml | 2 +- .github/workflows/release-selfhost.yml | 4 ++-- .github/workflows/release-singleimage.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index db2723cdfe..7f8b8f1d55 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: 18.x + node-version: 14.x - run: yarn install --frozen-lockfile - name: Update versions diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index ddfe202465..39ee812726 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -28,10 +28,10 @@ jobs: exit 1 fi - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 18.x + node-version: 14.x - name: Get the latest budibase release version id: version diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index 25be68feb0..5b75c20d29 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [18.x] + node-version: [14.x] steps: - name: Fail if not a tag run: | From 8c56235ca5692879c4ca2fea0102523c50450f46 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 31 Jul 2023 13:39:06 +0000 Subject: [PATCH 029/183] Bump version to 2.8.30 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index b02f81e499..fba4ed5b60 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29", + "version": "2.8.30", "npmClient": "yarn", "packages": [ "packages/*" From b69943c074de1514726e01ac3d1f045d8fc1429e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 2 Aug 2023 15:13:43 +0200 Subject: [PATCH 030/183] Move tests --- .../server/src/api/routes/tests/row.spec.ts | 497 +++++++++--------- 1 file changed, 251 insertions(+), 246 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index b986ffb945..012ed537ee 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -813,252 +813,6 @@ describe("/rows", () => { }) }) - describe("view search", () => { - function userTable(): Table { - return { - name: "user", - type: "user", - schema: { - name: { - type: FieldType.STRING, - name: "name", - constraints: { type: "string" }, - }, - age: { - type: FieldType.NUMBER, - name: "age", - constraints: {}, - }, - }, - } - } - - it("returns table rows from view", async () => { - const table = await config.createTable(userTable()) - const rows = [] - for (let i = 0; i < 10; i++) { - rows.push(await config.createRow({ tableId: table._id })) - } - - const createViewResponse = await config.api.viewV2.create() - const response = await config.api.viewV2.search(createViewResponse.id) - - expect(response.body.rows).toHaveLength(10) - expect(response.body).toEqual({ - rows: expect.arrayContaining(rows.map(expect.objectContaining)), - }) - }) - - it("searching respects the view filters", async () => { - const table = await config.createTable(userTable()) - const expectedRows = [] - for (let i = 0; i < 10; i++) - await config.createRow({ - tableId: table._id, - name: generator.name(), - age: generator.integer({ min: 10, max: 30 }), - }) - - for (let i = 0; i < 5; i++) - expectedRows.push( - await config.createRow({ - tableId: table._id, - name: generator.name(), - age: 40, - }) - ) - - const createViewResponse = await config.api.viewV2.create({ - query: { equal: { age: 40 } }, - }) - - const response = await config.api.viewV2.search(createViewResponse.id) - - expect(response.body.rows).toHaveLength(5) - expect(response.body).toEqual({ - rows: expect.arrayContaining(expectedRows.map(expect.objectContaining)), - }) - }) - - const sortTestOptions: [ - { - field: string - order?: SortOrder - type?: SortType - }, - string[] - ][] = [ - [ - { - field: "name", - order: SortOrder.ASCENDING, - type: SortType.STRING, - }, - ["Alice", "Bob", "Charly", "Danny"], - ], - [ - { - field: "name", - }, - ["Alice", "Bob", "Charly", "Danny"], - ], - [ - { - field: "name", - order: SortOrder.DESCENDING, - }, - ["Danny", "Charly", "Bob", "Alice"], - ], - [ - { - field: "name", - order: SortOrder.DESCENDING, - type: SortType.STRING, - }, - ["Danny", "Charly", "Bob", "Alice"], - ], - [ - { - field: "age", - order: SortOrder.ASCENDING, - type: SortType.number, - }, - ["Danny", "Alice", "Charly", "Bob"], - ], - [ - { - field: "age", - order: SortOrder.ASCENDING, - }, - ["Danny", "Alice", "Charly", "Bob"], - ], - [ - { - field: "age", - order: SortOrder.DESCENDING, - }, - ["Bob", "Charly", "Alice", "Danny"], - ], - [ - { - field: "age", - order: SortOrder.DESCENDING, - type: SortType.number, - }, - ["Bob", "Charly", "Alice", "Danny"], - ], - ] - - it.each(sortTestOptions)( - "allow sorting (%s)", - async (sortParams, expected) => { - await config.createTable(userTable()) - const users = [ - { name: "Alice", age: 25 }, - { name: "Bob", age: 30 }, - { name: "Charly", age: 27 }, - { name: "Danny", age: 15 }, - ] - for (const user of users) { - await config.createRow({ - tableId: config.table!._id, - ...user, - }) - } - - const createViewResponse = await config.api.viewV2.create({ - sort: sortParams, - }) - - const response = await config.api.viewV2.search(createViewResponse.id) - - expect(response.body.rows).toHaveLength(4) - expect(response.body).toEqual({ - rows: expected.map(name => expect.objectContaining({ name })), - }) - } - ) - - it.each(sortTestOptions)( - "allow override the default view sorting (%s)", - async (sortParams, expected) => { - await config.createTable(userTable()) - const users = [ - { name: "Alice", age: 25 }, - { name: "Bob", age: 30 }, - { name: "Charly", age: 27 }, - { name: "Danny", age: 15 }, - ] - for (const user of users) { - await config.createRow({ - tableId: config.table!._id, - ...user, - }) - } - - const createViewResponse = await config.api.viewV2.create({ - sort: { - field: "name", - order: SortOrder.ASCENDING, - type: SortType.STRING, - }, - }) - - const response = await config.api.viewV2.search(createViewResponse.id, { - sort: { - column: sortParams.field, - order: sortParams.order, - type: sortParams.type, - }, - }) - - expect(response.body.rows).toHaveLength(4) - expect(response.body).toEqual({ - rows: expected.map(name => expect.objectContaining({ name })), - }) - } - ) - - it("when schema is defined, defined columns and row attributes are returned", async () => { - const table = await config.createTable(userTable()) - const rows = [] - for (let i = 0; i < 10; i++) { - rows.push( - await config.createRow({ - tableId: table._id, - name: generator.name(), - age: generator.age(), - }) - ) - } - - const view = await config.api.viewV2.create({ - schema: { name: {} }, - }) - const response = await config.api.viewV2.search(view.id) - - expect(response.body.rows).toHaveLength(10) - expect(response.body.rows).toEqual( - expect.arrayContaining( - rows.map(r => ({ - ...expectAnyInternalColsAttributes, - _viewId: view.id, - name: r.name, - })) - ) - ) - }) - - it("views without data can be returned", async () => { - const table = await config.createTable(userTable()) - - const createViewResponse = await config.api.viewV2.create() - const response = await config.api.viewV2.search(createViewResponse.id) - - expect(response.body.rows).toHaveLength(0) - }) - }) - describe("view 2.0", () => { function userTable(): Table { return { @@ -1261,5 +1015,256 @@ describe("/rows", () => { await config.api.row.get(tableId, rows[1]._id!, { expectStatus: 200 }) }) }) + + describe("view search", () => { + function userTable(): Table { + return { + name: "user", + type: "user", + schema: { + name: { + type: FieldType.STRING, + name: "name", + constraints: { type: "string" }, + }, + age: { + type: FieldType.NUMBER, + name: "age", + constraints: {}, + }, + }, + } + } + + it("returns table rows from view", async () => { + const table = await config.createTable(userTable()) + const rows = [] + for (let i = 0; i < 10; i++) { + rows.push(await config.createRow({ tableId: table._id })) + } + + const createViewResponse = await config.api.viewV2.create() + const response = await config.api.viewV2.search(createViewResponse.id) + + expect(response.body.rows).toHaveLength(10) + expect(response.body).toEqual({ + rows: expect.arrayContaining(rows.map(expect.objectContaining)), + }) + }) + + it("searching respects the view filters", async () => { + const table = await config.createTable(userTable()) + const expectedRows = [] + for (let i = 0; i < 10; i++) + await config.createRow({ + tableId: table._id, + name: generator.name(), + age: generator.integer({ min: 10, max: 30 }), + }) + + for (let i = 0; i < 5; i++) + expectedRows.push( + await config.createRow({ + tableId: table._id, + name: generator.name(), + age: 40, + }) + ) + + const createViewResponse = await config.api.viewV2.create({ + query: { equal: { age: 40 } }, + }) + + const response = await config.api.viewV2.search(createViewResponse.id) + + expect(response.body.rows).toHaveLength(5) + expect(response.body).toEqual({ + rows: expect.arrayContaining( + expectedRows.map(expect.objectContaining) + ), + }) + }) + + const sortTestOptions: [ + { + field: string + order?: SortOrder + type?: SortType + }, + string[] + ][] = [ + [ + { + field: "name", + order: SortOrder.ASCENDING, + type: SortType.STRING, + }, + ["Alice", "Bob", "Charly", "Danny"], + ], + [ + { + field: "name", + }, + ["Alice", "Bob", "Charly", "Danny"], + ], + [ + { + field: "name", + order: SortOrder.DESCENDING, + }, + ["Danny", "Charly", "Bob", "Alice"], + ], + [ + { + field: "name", + order: SortOrder.DESCENDING, + type: SortType.STRING, + }, + ["Danny", "Charly", "Bob", "Alice"], + ], + [ + { + field: "age", + order: SortOrder.ASCENDING, + type: SortType.number, + }, + ["Danny", "Alice", "Charly", "Bob"], + ], + [ + { + field: "age", + order: SortOrder.ASCENDING, + }, + ["Danny", "Alice", "Charly", "Bob"], + ], + [ + { + field: "age", + order: SortOrder.DESCENDING, + }, + ["Bob", "Charly", "Alice", "Danny"], + ], + [ + { + field: "age", + order: SortOrder.DESCENDING, + type: SortType.number, + }, + ["Bob", "Charly", "Alice", "Danny"], + ], + ] + + it.each(sortTestOptions)( + "allow sorting (%s)", + async (sortParams, expected) => { + await config.createTable(userTable()) + const users = [ + { name: "Alice", age: 25 }, + { name: "Bob", age: 30 }, + { name: "Charly", age: 27 }, + { name: "Danny", age: 15 }, + ] + for (const user of users) { + await config.createRow({ + tableId: config.table!._id, + ...user, + }) + } + + const createViewResponse = await config.api.viewV2.create({ + sort: sortParams, + }) + + const response = await config.api.viewV2.search(createViewResponse.id) + + expect(response.body.rows).toHaveLength(4) + expect(response.body).toEqual({ + rows: expected.map(name => expect.objectContaining({ name })), + }) + } + ) + + it.each(sortTestOptions)( + "allow override the default view sorting (%s)", + async (sortParams, expected) => { + await config.createTable(userTable()) + const users = [ + { name: "Alice", age: 25 }, + { name: "Bob", age: 30 }, + { name: "Charly", age: 27 }, + { name: "Danny", age: 15 }, + ] + for (const user of users) { + await config.createRow({ + tableId: config.table!._id, + ...user, + }) + } + + const createViewResponse = await config.api.viewV2.create({ + sort: { + field: "name", + order: SortOrder.ASCENDING, + type: SortType.STRING, + }, + }) + + const response = await config.api.viewV2.search( + createViewResponse.id, + { + sort: { + column: sortParams.field, + order: sortParams.order, + type: sortParams.type, + }, + } + ) + + expect(response.body.rows).toHaveLength(4) + expect(response.body).toEqual({ + rows: expected.map(name => expect.objectContaining({ name })), + }) + } + ) + + it("when schema is defined, defined columns and row attributes are returned", async () => { + const table = await config.createTable(userTable()) + const rows = [] + for (let i = 0; i < 10; i++) { + rows.push( + await config.createRow({ + tableId: table._id, + name: generator.name(), + age: generator.age(), + }) + ) + } + + const view = await config.api.viewV2.create({ + schema: { name: {} }, + }) + const response = await config.api.viewV2.search(view.id) + + expect(response.body.rows).toHaveLength(10) + expect(response.body.rows).toEqual( + expect.arrayContaining( + rows.map(r => ({ + ...expectAnyInternalColsAttributes, + _viewId: view.id, + name: r.name, + })) + ) + ) + }) + + it("views without data can be returned", async () => { + const table = await config.createTable(userTable()) + + const createViewResponse = await config.api.viewV2.create() + const response = await config.api.viewV2.search(createViewResponse.id) + + expect(response.body.rows).toHaveLength(0) + }) + }) }) }) From d28120de3a75f89fd9a547eb4d1970240f1387d0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 3 Aug 2023 04:58:37 +0200 Subject: [PATCH 031/183] Make search a post request --- .../server/src/api/controllers/row/views.ts | 44 ++++--------------- packages/server/src/api/routes/row.ts | 2 +- .../server/src/tests/utilities/api/viewV2.ts | 28 ++---------- packages/types/src/api/web/app/rows.ts | 9 ++++ 4 files changed, 23 insertions(+), 60 deletions(-) diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index c38b7fe56e..963576fff3 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -1,14 +1,8 @@ import { quotas } from "@budibase/pro" -import { - UserCtx, - SearchResponse, - SortOrder, - SortType, - ViewV2, -} from "@budibase/types" +import { UserCtx, SearchResponse, ViewV2, SearchRequest } from "@budibase/types" import sdk from "../../../sdk" -export async function searchView(ctx: UserCtx) { +export async function searchView(ctx: UserCtx) { const { viewId } = ctx.params const view = await sdk.views.get(viewId) @@ -35,7 +29,7 @@ export async function searchView(ctx: UserCtx) { tableId: view.tableId, query: view.query || {}, fields: viewFields, - ...getSortOptions(ctx, view), + ...getSortOptions(ctx.request.body, view), }), { datasourceId: view.tableId, @@ -46,32 +40,12 @@ export async function searchView(ctx: UserCtx) { ctx.body = result } -function getSortOptions( - ctx: UserCtx, - view: ViewV2 -): - | { - sort: string - sortOrder?: SortOrder - sortType?: SortType - } - | undefined { - const { sort_column, sort_order, sort_type } = ctx.query - if (Array.isArray(sort_column)) { - ctx.throw(400, "sort_column cannot be an array") - } - if (Array.isArray(sort_order)) { - ctx.throw(400, "sort_order cannot be an array") - } - if (Array.isArray(sort_type)) { - ctx.throw(400, "sort_type cannot be an array") - } - - if (sort_column) { +function getSortOptions(request: SearchRequest, view: ViewV2) { + if (request.sort?.column) { return { - sort: sort_column, - sortOrder: sort_order as SortOrder, - sortType: sort_type as SortType, + sort: request.sort.column, + sortOrder: request.sort.order, + sortType: request.sort.type, } } if (view.sort) { @@ -82,5 +56,5 @@ function getSortOptions( } } - return + return undefined } diff --git a/packages/server/src/api/routes/row.ts b/packages/server/src/api/routes/row.ts index ac0cd2b4a4..cb1bab3361 100644 --- a/packages/server/src/api/routes/row.ts +++ b/packages/server/src/api/routes/row.ts @@ -269,7 +269,7 @@ router ) router - .get( + .post( "/api/v2/views/:viewId/search", authorized(PermissionType.VIEW, PermissionLevel.READ), rowController.views.searchView diff --git a/packages/server/src/tests/utilities/api/viewV2.ts b/packages/server/src/tests/utilities/api/viewV2.ts index 5ad2b2d3d7..0622fb823c 100644 --- a/packages/server/src/tests/utilities/api/viewV2.ts +++ b/packages/server/src/tests/utilities/api/viewV2.ts @@ -1,13 +1,12 @@ import { CreateViewRequest, - SortOrder, - SortType, UpdateViewRequest, DeleteRowRequest, PatchRowRequest, PatchRowResponse, Row, ViewV2, + SearchRequest, } from "@budibase/types" import TestConfiguration from "../TestConfiguration" import { TestAPI } from "./base" @@ -81,31 +80,12 @@ export class ViewV2API extends TestAPI { search = async ( viewId: string, - options?: { - sort: { - column: string - order?: SortOrder - type?: SortType - } - }, + params?: SearchRequest, { expectStatus } = { expectStatus: 200 } ) => { - const qs: [string, any][] = [] - if (options?.sort.column) { - qs.push(["sort_column", options.sort.column]) - } - if (options?.sort.order) { - qs.push(["sort_order", options.sort.order]) - } - if (options?.sort.type) { - qs.push(["sort_type", options.sort.type]) - } - let url = `/api/v2/views/${viewId}/search` - if (qs.length) { - url += "?" + qs.map(q => q.join("=")).join("&") - } return this.request - .get(url) + .post(`/api/v2/views/${viewId}/search`) + .send(params) .set(this.config.defaultHeaders()) .expect("Content-Type", /json/) .expect(expectStatus) diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index fedb8ec146..e5bbdb8645 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -1,4 +1,5 @@ import { Row } from "../../../documents" +import { SortOrder, SortType } from "../pagination" export interface PatchRowRequest extends Row { _id: string @@ -8,6 +9,14 @@ export interface PatchRowRequest extends Row { export interface PatchRowResponse extends Row {} +export interface SearchRequest { + sort?: { + column: string + order?: SortOrder + type?: SortType + } +} + export interface SearchResponse { rows: any[] } From a91ce15c9bf4ad33106da760e96a4e177cdc807c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 3 Aug 2023 05:14:50 +0200 Subject: [PATCH 032/183] Move interface SearchParams to types --- packages/server/src/sdk/app/rows/search.ts | 16 +--------------- packages/types/src/sdk/index.ts | 1 + packages/types/src/sdk/row.ts | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 packages/types/src/sdk/row.ts diff --git a/packages/server/src/sdk/app/rows/search.ts b/packages/server/src/sdk/app/rows/search.ts index a523d828f3..4861f473ea 100644 --- a/packages/server/src/sdk/app/rows/search.ts +++ b/packages/server/src/sdk/app/rows/search.ts @@ -1,23 +1,9 @@ -import { SearchFilters, SortOrder, SortType } from "@budibase/types" +import { SearchFilters, SearchParams } from "@budibase/types" import { isExternalTable } from "../../../integrations/utils" import * as internal from "./search/internal" import * as external from "./search/external" import { Format } from "../../../api/controllers/view/exporters" -export interface SearchParams { - tableId: string - paginate?: boolean - query: SearchFilters - bookmark?: string - limit?: number - sort?: string - sortOrder?: SortOrder - sortType?: SortType - version?: string - disableEscaping?: boolean - fields?: string[] -} - export interface ViewParams { calculation: string group: string diff --git a/packages/types/src/sdk/index.ts b/packages/types/src/sdk/index.ts index e4b5778ed9..0eab2ba556 100644 --- a/packages/types/src/sdk/index.ts +++ b/packages/types/src/sdk/index.ts @@ -19,3 +19,4 @@ export * from "./user" export * from "./cli" export * from "./websocket" export * from "./permissions" +export * from "./row" diff --git a/packages/types/src/sdk/row.ts b/packages/types/src/sdk/row.ts new file mode 100644 index 0000000000..7e4b89e0f7 --- /dev/null +++ b/packages/types/src/sdk/row.ts @@ -0,0 +1,16 @@ +import { SortOrder, SortType } from "../api" +import { SearchFilters } from "./search" + +export interface SearchParams { + tableId: string + paginate?: boolean + query: SearchFilters + bookmark?: string + limit?: number + sort?: string + sortOrder?: SortOrder + sortType?: SortType + version?: string + disableEscaping?: boolean + fields?: string[] +} From cb59a2fc9bdeb7d2724a83dd71589d88086eb798 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 3 Aug 2023 05:16:10 +0200 Subject: [PATCH 033/183] Type search request --- packages/server/src/api/controllers/row/index.ts | 7 +++++-- packages/server/src/api/controllers/row/views.ts | 4 ++-- packages/types/src/api/web/app/rows.ts | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/controllers/row/index.ts b/packages/server/src/api/controllers/row/index.ts index 7f6f494621..695e626630 100644 --- a/packages/server/src/api/controllers/row/index.ts +++ b/packages/server/src/api/controllers/row/index.ts @@ -11,6 +11,9 @@ import { Row, PatchRowRequest, PatchRowResponse, + SearchRowResponse, + SearchRowRequest, + SearchParams, } from "@budibase/types" import * as utils from "./utils" import { gridSocket } from "../../../websockets" @@ -197,10 +200,10 @@ export async function destroy(ctx: UserCtx) { ctx.body = response } -export async function search(ctx: any) { +export async function search(ctx: Ctx) { const tableId = utils.getTableId(ctx) - const searchParams = { + const searchParams: SearchParams = { ...ctx.request.body, tableId, } diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index c38b7fe56e..2af95f444e 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -1,14 +1,14 @@ import { quotas } from "@budibase/pro" import { UserCtx, - SearchResponse, + SearchRowResponse, SortOrder, SortType, ViewV2, } from "@budibase/types" import sdk from "../../../sdk" -export async function searchView(ctx: UserCtx) { +export async function searchView(ctx: UserCtx) { const { viewId } = ctx.params const view = await sdk.views.get(viewId) diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index fedb8ec146..493cff09bc 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -1,3 +1,4 @@ +import { SearchParams } from "../../../sdk" import { Row } from "../../../documents" export interface PatchRowRequest extends Row { @@ -8,6 +9,8 @@ export interface PatchRowRequest extends Row { export interface PatchRowResponse extends Row {} -export interface SearchResponse { +export interface SearchRowRequest extends SearchParams {} + +export interface SearchRowResponse { rows: any[] } From 464ba92b47bf2dbacc383078d3c315022737ea11 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 3 Aug 2023 14:32:03 +0300 Subject: [PATCH 034/183] Fix tests --- packages/server/src/api/routes/tests/row.spec.ts | 8 +++----- packages/server/src/tests/utilities/api/viewV2.ts | 4 ++-- packages/types/src/api/web/app/rows.ts | 5 ++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 012ed537ee..3061cf6356 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -1212,11 +1212,9 @@ describe("/rows", () => { const response = await config.api.viewV2.search( createViewResponse.id, { - sort: { - column: sortParams.field, - order: sortParams.order, - type: sortParams.type, - }, + sort: sortParams.field, + sortOrder: sortParams.order, + sortType: sortParams.type, } ) diff --git a/packages/server/src/tests/utilities/api/viewV2.ts b/packages/server/src/tests/utilities/api/viewV2.ts index 0622fb823c..813d2ebfd1 100644 --- a/packages/server/src/tests/utilities/api/viewV2.ts +++ b/packages/server/src/tests/utilities/api/viewV2.ts @@ -6,7 +6,7 @@ import { PatchRowResponse, Row, ViewV2, - SearchRequest, + SearchViewRowRequest, } from "@budibase/types" import TestConfiguration from "../TestConfiguration" import { TestAPI } from "./base" @@ -80,7 +80,7 @@ export class ViewV2API extends TestAPI { search = async ( viewId: string, - params?: SearchRequest, + params?: SearchViewRowRequest, { expectStatus } = { expectStatus: 200 } ) => { return this.request diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index 493cff09bc..39e856b297 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -9,7 +9,10 @@ export interface PatchRowRequest extends Row { export interface PatchRowResponse extends Row {} -export interface SearchRowRequest extends SearchParams {} +export interface SearchRowRequest extends Omit {} + +export interface SearchViewRowRequest + extends Pick {} export interface SearchRowResponse { rows: any[] From 8c61359b9d940b6f4eaa6d4840d7f53c2e199066 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 3 Aug 2023 17:23:15 +0100 Subject: [PATCH 035/183] Allow user specified type casting in MySQL queries --- .vscode/launch.json | 72 ++++++++----------- packages/server/package.json | 2 +- .../server/src/api/controllers/query/index.ts | 4 +- .../tests/{filter.spec.js => filter.spec.ts} | 23 +++--- packages/server/src/integrations/mysql.ts | 11 ++- packages/server/src/threads/definitions.ts | 6 ++ packages/server/src/threads/query.ts | 31 +++++++- 7 files changed, 94 insertions(+), 55 deletions(-) rename packages/server/src/automations/tests/{filter.spec.js => filter.spec.ts} (76%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 8cb49d5825..6c0089bb6b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,42 +1,32 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Budibase Server", - "type": "node", - "request": "launch", - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register/transpile-only" - ], - "args": [ - "${workspaceFolder}/packages/server/src/index.ts" - ], - "cwd": "${workspaceFolder}/packages/server" - }, - { - "name": "Budibase Worker", - "type": "node", - "request": "launch", - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register/transpile-only" - ], - "args": [ - "${workspaceFolder}/packages/worker/src/index.ts" - ], - "cwd": "${workspaceFolder}/packages/worker" - }, - ], - "compounds": [ - { - "name": "Start Budibase", - "configurations": ["Budibase Server", "Budibase Worker"] - } - ] -} \ No newline at end of file + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Budibase Server", + "type": "node", + "request": "launch", + "runtimeVersion": "14.20.1", + "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], + "args": ["${workspaceFolder}/packages/server/src/index.ts"], + "cwd": "${workspaceFolder}/packages/server" + }, + { + "name": "Budibase Worker", + "type": "node", + "request": "launch", + "runtimeVersion": "14.20.1", + "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], + "args": ["${workspaceFolder}/packages/worker/src/index.ts"], + "cwd": "${workspaceFolder}/packages/worker" + } + ], + "compounds": [ + { + "name": "Start Budibase", + "configurations": ["Budibase Server", "Budibase Worker"] + } + ] +} diff --git a/packages/server/package.json b/packages/server/package.json index e112c1f572..aedab54a81 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -100,7 +100,7 @@ "memorystream": "0.3.1", "mongodb": "5.7", "mssql": "9.1.1", - "mysql2": "2.3.3", + "mysql2": "3.5.2", "node-fetch": "2.6.7", "object-sizeof": "2.6.1", "open": "8.4.0", diff --git a/packages/server/src/api/controllers/query/index.ts b/packages/server/src/api/controllers/query/index.ts index c32e17bd92..8e13041bf4 100644 --- a/packages/server/src/api/controllers/query/index.ts +++ b/packages/server/src/api/controllers/query/index.ts @@ -120,7 +120,7 @@ export async function preview(ctx: any) { const query = ctx.request.body // preview may not have a queryId as it hasn't been saved, but if it does // this stops dynamic variables from calling the same query - const { fields, parameters, queryVerb, transformer, queryId } = query + const { fields, parameters, queryVerb, transformer, queryId, schema } = query const authConfigCtx: any = getAuthConfig(ctx) @@ -133,6 +133,7 @@ export async function preview(ctx: any) { parameters, transformer, queryId, + schema, // have to pass down to the thread runner - can't put into context now environmentVariables: envVars, ctx: { @@ -228,6 +229,7 @@ async function execute( user: ctx.user, auth: { ...authConfigCtx }, }, + schema: query.schema, } const runFn = () => Runner.run(inputs) diff --git a/packages/server/src/automations/tests/filter.spec.js b/packages/server/src/automations/tests/filter.spec.ts similarity index 76% rename from packages/server/src/automations/tests/filter.spec.js rename to packages/server/src/automations/tests/filter.spec.ts index 5fa5e0e202..c2c5d13e2d 100644 --- a/packages/server/src/automations/tests/filter.spec.js +++ b/packages/server/src/automations/tests/filter.spec.ts @@ -1,11 +1,18 @@ -const setup = require("./utilities") -const { FilterConditions } = require("../steps/filter") +import * as setup from "./utilities" +import { FilterConditions } from "../steps/filter" describe("test the filter logic", () => { - async function checkFilter(field, condition, value, pass = true) { - let res = await setup.runStep(setup.actions.FILTER.stepId, - { field, condition, value } - ) + async function checkFilter( + field: any, + condition: string, + value: any, + pass = true + ) { + let res = await setup.runStep(setup.actions.FILTER.stepId, { + field, + condition, + value, + }) expect(res.result).toEqual(pass) expect(res.success).toEqual(true) } @@ -36,9 +43,9 @@ describe("test the filter logic", () => { it("check date coercion", async () => { await checkFilter( - (new Date()).toISOString(), + new Date().toISOString(), FilterConditions.GREATER_THAN, - (new Date(-10000)).toISOString(), + new Date(-10000).toISOString(), true ) }) diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index a01f6b71f9..cb71a78013 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -148,7 +148,9 @@ class MySQLIntegration extends Sql implements DatasourcePlus { this.config = { ...config, multipleStatements: true, - typeCast: function (field: any, next: any) { + } + if (!this.config.typeCast) { + this.config.typeCast = function (field: any, next: any) { if ( field.type == "DATETIME" || field.type === "DATE" || @@ -161,7 +163,7 @@ class MySQLIntegration extends Sql implements DatasourcePlus { return field.buffer()?.[0] } return next() - }, + } } } @@ -204,7 +206,10 @@ class MySQLIntegration extends Sql implements DatasourcePlus { async internalQuery( query: SqlQuery, - opts: { connect?: boolean; disableCoercion?: boolean } = { + opts: { + connect?: boolean + disableCoercion?: boolean + } = { connect: true, disableCoercion: false, } diff --git a/packages/server/src/threads/definitions.ts b/packages/server/src/threads/definitions.ts index 21e7ce0b69..dd0891d34a 100644 --- a/packages/server/src/threads/definitions.ts +++ b/packages/server/src/threads/definitions.ts @@ -11,6 +11,12 @@ export interface QueryEvent { queryId: string environmentVariables?: Record ctx?: any + schema?: { + [key: string]: { + name: string + type: string + } + } } export interface QueryVariable { diff --git a/packages/server/src/threads/query.ts b/packages/server/src/threads/query.ts index 9901ddffa6..d3949f7e25 100644 --- a/packages/server/src/threads/query.ts +++ b/packages/server/src/threads/query.ts @@ -8,6 +8,7 @@ import { context, cache, auth } from "@budibase/backend-core" import { getGlobalIDFromUserMetadataID } from "../db/utils" import sdk from "../sdk" import { cloneDeep } from "lodash/fp" +import { SourceName } from "@budibase/types" import { isSQL } from "../integrations/utils" import { interpolateSQL } from "../integrations/queries/sql" @@ -27,6 +28,7 @@ class QueryRunner { hasRerun: boolean hasRefreshedOAuth: boolean hasDynamicVariables: boolean + schema: any constructor(input: QueryEvent, flags = { noRecursiveQuery: false }) { this.datasource = input.datasource @@ -36,6 +38,7 @@ class QueryRunner { this.pagination = input.pagination this.transformer = input.transformer this.queryId = input.queryId + this.schema = input.schema this.noRecursiveQuery = flags.noRecursiveQuery this.cachedVariables = [] // Additional context items for enrichment @@ -50,7 +53,7 @@ class QueryRunner { } async execute(): Promise { - let { datasource, fields, queryVerb, transformer } = this + let { datasource, fields, queryVerb, transformer, schema } = this let datasourceClone = cloneDeep(datasource) let fieldsClone = cloneDeep(fields) @@ -67,6 +70,32 @@ class QueryRunner { datasourceClone.config.authConfigs = updatedConfigs } + if (datasource.source === SourceName.MYSQL && schema) { + datasourceClone.config.typeCast = function (field: any, next: any) { + if (schema[field.name]?.name === field.name) { + if (["LONGLONG", "NEWDECIMAL", "DECIMAL"].includes(field.type)) { + if (schema[field.name]?.type === "number") { + const value = field.string() + return value ? Number(value) : null + } else { + return field.string() + } + } + } + if ( + field.type == "DATETIME" || + field.type === "DATE" || + field.type === "TIMESTAMP" + ) { + return field.string() + } + if (field.type === "BIT" && field.length === 1) { + return field.buffer()?.[0] + } + return next() + } + } + const integration = new Integration(datasourceClone.config) // pre-query, make sure datasource variables are added to parameters From 057761fdd902c8455e15b99316be39e0f973b358 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 3 Aug 2023 18:13:51 +0100 Subject: [PATCH 036/183] Update filters types with schemaFields --- .../controls/FilterEditor/FilterDrawer.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte index e8bbb8a354..25a03a93de 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte @@ -17,7 +17,7 @@ import { generate } from "shortid" import { LuceneUtils, Constants } from "@budibase/frontend-core" import { getFields } from "helpers/searchFields" - import { createEventDispatcher } from "svelte" + import { createEventDispatcher, onMount } from "svelte" export let schemaFields export let filters = [] @@ -64,6 +64,15 @@ }) } + onMount(() => { + parseFilters(filters) + rawFilters.forEach(filter => { + filter.type = + schemaFields.find(field => field.name === filter.field)?.type || + filter.type + }) + }) + // Add field key prefixes and a special metadata filter object to indicate // whether to use the "match all" or "match any" behaviour const enrichFilters = (rawFilters, matchAny) => { From 20f71fadd32fb7f92e8e6ae972ccbf79707e509a Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 3 Aug 2023 18:52:55 +0100 Subject: [PATCH 037/183] Refactor --- packages/server/src/integrations/mysql.ts | 63 +++++++++++++++++------ packages/server/src/threads/query.ts | 29 ++--------- packages/types/src/sdk/datasources.ts | 6 +++ 3 files changed, 56 insertions(+), 42 deletions(-) diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index cb71a78013..b88162c59a 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -93,6 +93,21 @@ const SCHEMA: Integration = { }, } +const defaultTypeCasting = function (field: any, next: any) { + if ( + field.type == "DATETIME" || + field.type === "DATE" || + field.type === "TIMESTAMP" || + field.type === "LONGLONG" + ) { + return field.string() + } + if (field.type === "BIT" && field.length === 1) { + return field.buffer()?.[0] + } + return next() +} + export function bindingTypeCoerce(bindings: any[]) { for (let i = 0; i < bindings.length; i++) { const binding = bindings[i] @@ -147,24 +162,9 @@ class MySQLIntegration extends Sql implements DatasourcePlus { delete config.rejectUnauthorized this.config = { ...config, + typeCast: defaultTypeCasting, multipleStatements: true, } - if (!this.config.typeCast) { - this.config.typeCast = function (field: any, next: any) { - if ( - field.type == "DATETIME" || - field.type === "DATE" || - field.type === "TIMESTAMP" || - field.type === "LONGLONG" - ) { - return field.string() - } - if (field.type === "BIT" && field.length === 1) { - return field.buffer()?.[0] - } - return next() - } - } } async testConnection() { @@ -196,6 +196,37 @@ class MySQLIntegration extends Sql implements DatasourcePlus { return `concat(${parts.join(", ")})` } + defineTypeCastingFromSchema(schema: { + [key: string]: { name: string; type: string } + }): void { + if (!schema) { + return + } + this.config.typeCast = function (field: any, next: any) { + if (schema[field.name]?.name === field.name) { + if (["LONGLONG", "NEWDECIMAL", "DECIMAL"].includes(field.type)) { + if (schema[field.name]?.type === "number") { + const value = field.string() + return value ? Number(value) : null + } else { + return field.string() + } + } + } + if ( + field.type == "DATETIME" || + field.type === "DATE" || + field.type === "TIMESTAMP" + ) { + return field.string() + } + if (field.type === "BIT" && field.length === 1) { + return field.buffer()?.[0] + } + return next() + } + } + async connect() { this.client = await mysql.createConnection(this.config) } diff --git a/packages/server/src/threads/query.ts b/packages/server/src/threads/query.ts index d3949f7e25..37720c66ba 100644 --- a/packages/server/src/threads/query.ts +++ b/packages/server/src/threads/query.ts @@ -70,34 +70,11 @@ class QueryRunner { datasourceClone.config.authConfigs = updatedConfigs } - if (datasource.source === SourceName.MYSQL && schema) { - datasourceClone.config.typeCast = function (field: any, next: any) { - if (schema[field.name]?.name === field.name) { - if (["LONGLONG", "NEWDECIMAL", "DECIMAL"].includes(field.type)) { - if (schema[field.name]?.type === "number") { - const value = field.string() - return value ? Number(value) : null - } else { - return field.string() - } - } - } - if ( - field.type == "DATETIME" || - field.type === "DATE" || - field.type === "TIMESTAMP" - ) { - return field.string() - } - if (field.type === "BIT" && field.length === 1) { - return field.buffer()?.[0] - } - return next() - } - } - const integration = new Integration(datasourceClone.config) + // define the type casting from the schema + integration.defineTypeCastingFromSchema?.(schema) + // pre-query, make sure datasource variables are added to parameters const parameters = await this.addDatasourceVariables() diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts index 2391f6e878..d6a0d4a7c8 100644 --- a/packages/types/src/sdk/datasources.ts +++ b/packages/types/src/sdk/datasources.ts @@ -166,6 +166,12 @@ export interface IntegrationBase { delete?(query: any): Promise testConnection?(): Promise getExternalSchema?(): Promise + defineTypeCastingFromSchema?(schema: { + [key: string]: { + name: string + type: string + } + }): void } export interface DatasourcePlus extends IntegrationBase { From d3470dfcb06ed8ce69e0a3fa3c25d6f163ddeffa Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 12:00:25 +0300 Subject: [PATCH 038/183] Fix imports --- packages/server/src/sdk/app/rows/search/external.ts | 3 ++- packages/server/src/sdk/app/rows/search/internal.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/external.ts b/packages/server/src/sdk/app/rows/search/external.ts index 159f3d84fd..447d1d7d16 100644 --- a/packages/server/src/sdk/app/rows/search/external.ts +++ b/packages/server/src/sdk/app/rows/search/external.ts @@ -6,6 +6,7 @@ import { IncludeRelationship, Row, SearchFilters, + SearchParams, } from "@budibase/types" import * as exporters from "../../../../api/controllers/view/exporters" import sdk from "../../../../sdk" @@ -13,7 +14,7 @@ import { handleRequest } from "../../../../api/controllers/row/external" import { breakExternalTableId } from "../../../../integrations/utils" import { cleanExportRows } from "../utils" import { utils } from "@budibase/shared-core" -import { ExportRowsParams, ExportRowsResult, SearchParams } from "../search" +import { ExportRowsParams, ExportRowsResult } from "../search" import { HTTPError, db } from "@budibase/backend-core" import pick from "lodash/pick" diff --git a/packages/server/src/sdk/app/rows/search/internal.ts b/packages/server/src/sdk/app/rows/search/internal.ts index e7f0aadfd6..dfc5b7dcab 100644 --- a/packages/server/src/sdk/app/rows/search/internal.ts +++ b/packages/server/src/sdk/app/rows/search/internal.ts @@ -12,7 +12,7 @@ import { } from "../../../../db/utils" import { getGlobalUsersFromMetadata } from "../../../../utilities/global" import { outputProcessing } from "../../../../utilities/rowProcessor" -import { Database, Row, Table } from "@budibase/types" +import { Database, Row, Table, SearchParams } from "@budibase/types" import { cleanExportRows } from "../utils" import { Format, @@ -28,7 +28,7 @@ import { getFromMemoryDoc, } from "../../../../api/controllers/view/utils" import sdk from "../../../../sdk" -import { ExportRowsParams, ExportRowsResult, SearchParams } from "../search" +import { ExportRowsParams, ExportRowsResult } from "../search" import pick from "lodash/pick" export async function search(options: SearchParams) { From ece1c421fa616513f260382e3e7265f75a45e45a Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:53:30 +0100 Subject: [PATCH 039/183] Fix/formula as display (#11439) * Allow formulas to be display columns in the grid * Ensure SQL Server always has a sort order --- .../components/grid/cells/HeaderCell.svelte | 1 - packages/server/src/integrations/base/sql.ts | 2 +- .../server/src/integrations/tests/sql.spec.ts | 21 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/frontend-core/src/components/grid/cells/HeaderCell.svelte b/packages/frontend-core/src/components/grid/cells/HeaderCell.svelte index 8123871666..575a216c6f 100644 --- a/packages/frontend-core/src/components/grid/cells/HeaderCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/HeaderCell.svelte @@ -27,7 +27,6 @@ "array", "attachment", "boolean", - "formula", "json", ] diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index 90107dfd4e..2cdae682b0 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -315,7 +315,7 @@ class InternalBuilder { addSorting(query: KnexQuery, json: QueryJson): KnexQuery { let { sort, paginate } = json const table = json.meta?.table - if (sort) { + if (sort && Object.keys(sort || {}).length > 0) { for (let [key, value] of Object.entries(sort)) { const direction = value.direction === SortDirection.ASCENDING ? "asc" : "desc" diff --git a/packages/server/src/integrations/tests/sql.spec.ts b/packages/server/src/integrations/tests/sql.spec.ts index bd1497bdc7..0bf1498f5f 100644 --- a/packages/server/src/integrations/tests/sql.spec.ts +++ b/packages/server/src/integrations/tests/sql.spec.ts @@ -26,6 +26,12 @@ function generateReadJson({ filters: filters || {}, sort: sort || {}, paginate: paginate || {}, + meta: { + table: { + name: table || TABLE_NAME, + primary: ["id"], + }, + }, } } @@ -636,4 +642,19 @@ describe("SQL query builder", () => { sql: `select * from (select * from (select * from \"test\" where LOWER(\"test\".\"name\") LIKE :1) where rownum <= :2) \"test\"`, }) }) + + it("should sort SQL Server tables by the primary key if no sort data is provided", () => { + let query = new Sql(SqlClient.MS_SQL, limit)._query( + generateReadJson({ + sort: {}, + paginate: { + limit: 10, + }, + }) + ) + expect(query).toEqual({ + bindings: [10], + sql: `select * from (select top (@p0) * from [test] order by [test].[id] asc) as [test]`, + }) + }) }) From c29b48291398c3e8fd9edaad5e6a9a5e42e6bde0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 4 Aug 2023 12:53:47 +0000 Subject: [PATCH 040/183] Bump version to 2.8.29-alpha.18 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f33b6d0a7d..9ae6b7b4f8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.17", + "version": "2.8.29-alpha.18", "npmClient": "yarn", "packages": [ "packages/*" From 4d74a6615fc383599066adec12b078e48c391a98 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 18:22:33 +0300 Subject: [PATCH 041/183] Fix types --- .../src/sdk/app/rows/search/tests/external.spec.ts | 11 +++++++++-- .../src/sdk/app/rows/search/tests/internal.spec.ts | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts index b24557fd4f..b3bddfbc97 100644 --- a/packages/server/src/sdk/app/rows/search/tests/external.spec.ts +++ b/packages/server/src/sdk/app/rows/search/tests/external.spec.ts @@ -1,8 +1,15 @@ import { GenericContainer } from "testcontainers" -import { Datasource, FieldType, Row, SourceName, Table } from "@budibase/types" +import { + Datasource, + FieldType, + Row, + SourceName, + Table, + SearchParams, +} from "@budibase/types" + import TestConfiguration from "../../../../../tests/utilities/TestConfiguration" -import { SearchParams } from "../../search" import { search } from "../external" import { expectAnyExternalColsAttributes, diff --git a/packages/server/src/sdk/app/rows/search/tests/internal.spec.ts b/packages/server/src/sdk/app/rows/search/tests/internal.spec.ts index a58c368cea..b3e98a1149 100644 --- a/packages/server/src/sdk/app/rows/search/tests/internal.spec.ts +++ b/packages/server/src/sdk/app/rows/search/tests/internal.spec.ts @@ -1,6 +1,5 @@ -import { FieldType, Row, Table } from "@budibase/types" +import { FieldType, Row, Table, SearchParams } from "@budibase/types" import TestConfiguration from "../../../../../tests/utilities/TestConfiguration" -import { SearchParams } from "../../search" import { search } from "../internal" import { expectAnyInternalColsAttributes, From 3097c9162f1d8447f8fed08ac5ba856538049c4d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:25:14 +0100 Subject: [PATCH 042/183] Fix for app action fields and don't clone testData (#11441) --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 0ab933d925..6b57fe3d18 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -108,7 +108,13 @@ /****************************************************/ const getInputData = (testData, blockInputs) => { - let newInputData = cloneDeep(testData || blockInputs) + // Test data is not cloned for reactivity + let newInputData = testData || cloneDeep(blockInputs) + + // Ensures the app action fields are populated + if (block.event === "app:trigger" && !newInputData?.fields) { + newInputData = cloneDeep(blockInputs) + } /** * TODO - Remove after November 2023 From 60c676af64b212171d35e86f8175269eca57d076 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 4 Aug 2023 15:25:33 +0000 Subject: [PATCH 043/183] Bump version to 2.8.29-alpha.19 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 9ae6b7b4f8..9b2b50788a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.18", + "version": "2.8.29-alpha.19", "npmClient": "yarn", "packages": [ "packages/*" From 4f08f900ed79f92b9ba5441c99a0a67d8cd10e6a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 18:38:07 +0300 Subject: [PATCH 044/183] Type view search --- .../server/src/api/controllers/row/views.ts | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index b8a407399c..629515417b 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -2,13 +2,15 @@ import { quotas } from "@budibase/pro" import { UserCtx, ViewV2, - SearchRowRequest, SearchRowResponse, + SearchViewRowRequest, + RequiredKeys, + SearchParams, } from "@budibase/types" import sdk from "../../../sdk" export async function searchView( - ctx: UserCtx + ctx: UserCtx ) { const { viewId } = ctx.params @@ -30,24 +32,24 @@ export async function searchView( undefined ctx.status = 200 - const result = await quotas.addQuery( - () => - sdk.rows.search({ - tableId: view.tableId, - query: view.query || {}, - fields: viewFields, - ...getSortOptions(ctx.request.body, view), - }), - { - datasourceId: view.tableId, - } - ) + + const searchOptions: RequiredKeys & + RequiredKeys> = { + tableId: view.tableId, + query: view.query || {}, + fields: viewFields, + ...getSortOptions(ctx.request.body, view), + } + + const result = await quotas.addQuery(() => sdk.rows.search(searchOptions), { + datasourceId: view.tableId, + }) result.rows.forEach(r => (r._viewId = view.id)) ctx.body = result } -function getSortOptions(request: SearchRowRequest, view: ViewV2) { +function getSortOptions(request: SearchViewRowRequest, view: ViewV2) { if (request.sort) { return { sort: request.sort, @@ -63,5 +65,9 @@ function getSortOptions(request: SearchRowRequest, view: ViewV2) { } } - return undefined + return { + sort: undefined, + sortOrder: undefined, + sortType: undefined, + } } From 250505a19b5ed74f18757e02dd50e6810dc9f155 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 18:41:49 +0300 Subject: [PATCH 045/183] Add limit on request --- packages/server/src/api/controllers/row/views.ts | 1 + packages/server/src/api/routes/tests/row.spec.ts | 16 ++++++++++++++++ packages/types/src/api/web/app/rows.ts | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index 629515417b..9ac052c1e9 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -39,6 +39,7 @@ export async function searchView( query: view.query || {}, fields: viewFields, ...getSortOptions(ctx.request.body, view), + limit: ctx.request.body.limit, } const result = await quotas.addQuery(() => sdk.rows.search(searchOptions), { diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 3061cf6356..2f81a78950 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -1263,6 +1263,22 @@ describe("/rows", () => { expect(response.body.rows).toHaveLength(0) }) + + it("returns table rows from view", async () => { + const table = await config.createTable(userTable()) + const rows = [] + for (let i = 0; i < 10; i++) { + rows.push(await config.createRow({ tableId: table._id })) + } + const limit = generator.integer({ min: 1, max: 8 }) + + const createViewResponse = await config.api.viewV2.create() + const response = await config.api.viewV2.search(createViewResponse.id, { + limit, + }) + + expect(response.body.rows).toHaveLength(limit) + }) }) }) }) diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index 39e856b297..e95afa6e59 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -12,7 +12,7 @@ export interface PatchRowResponse extends Row {} export interface SearchRowRequest extends Omit {} export interface SearchViewRowRequest - extends Pick {} + extends Pick {} export interface SearchRowResponse { rows: any[] From a1d85a831c7118c62918722d3923fc4255945f59 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 4 Aug 2023 16:58:40 +0100 Subject: [PATCH 046/183] Some quick modifications to allow the views to go through the standard row CRUD, the view search is still separate for now however this may change. --- packages/server/src/api/routes/row.ts | 91 +------------------ .../server/src/api/routes/tests/row.spec.ts | 17 ---- packages/server/src/db/utils.ts | 12 ++- packages/server/src/middleware/noViewData.ts | 9 -- .../src/middleware/tests/noViewData.spec.ts | 83 ----------------- .../server/src/middleware/trimViewRowInfo.ts | 14 +-- packages/server/src/sdk/app/views/index.ts | 7 +- packages/types/src/documents/document.ts | 1 + packages/types/src/sdk/permissions.ts | 1 - 9 files changed, 25 insertions(+), 210 deletions(-) delete mode 100644 packages/server/src/middleware/noViewData.ts delete mode 100644 packages/server/src/middleware/tests/noViewData.spec.ts diff --git a/packages/server/src/api/routes/row.ts b/packages/server/src/api/routes/row.ts index ac0cd2b4a4..3227df98ed 100644 --- a/packages/server/src/api/routes/row.ts +++ b/packages/server/src/api/routes/row.ts @@ -4,9 +4,7 @@ import authorized from "../../middleware/authorized" import { paramResource, paramSubResource } from "../../middleware/resourceId" import { permissions } from "@budibase/backend-core" import { internalSearchValidator } from "./utils/validators" -import noViewData from "../../middleware/noViewData" import trimViewRowInfo from "../../middleware/trimViewRowInfo" -import * as utils from "../../db/utils" const { PermissionType, PermissionLevel } = permissions const router: Router = new Router() @@ -177,7 +175,7 @@ router "/api/:tableId/rows", paramResource("tableId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), - noViewData, + trimViewRowInfo, rowController.save ) /** @@ -192,7 +190,7 @@ router "/api/:tableId/rows", paramResource("tableId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), - noViewData, + trimViewRowInfo, rowController.patch ) /** @@ -245,6 +243,7 @@ router "/api/:tableId/rows", paramResource("tableId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), + trimViewRowInfo, rowController.destroy ) @@ -267,92 +266,10 @@ router authorized(PermissionType.TABLE, PermissionLevel.WRITE), rowController.exportRows ) - -router .get( "/api/v2/views/:viewId/search", - authorized(PermissionType.VIEW, PermissionLevel.READ), + authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.views.searchView ) - /** - * @api {post} /api/:tableId/rows Creates a new row - * @apiName Creates a new row - * @apiGroup rows - * @apiPermission table write access - * @apiDescription This API will create a new row based on the supplied body. If the - * body includes an "_id" field then it will update an existing row if the field - * links to one. Please note that "_id", "_rev" and "tableId" are fields that are - * already used by Budibase tables and cannot be used for columns. - * - * @apiParam {string} tableId The ID of the table to save a row to. - * - * @apiParam (Body) {string} [_id] If the row exists already then an ID for the row must be provided. - * @apiParam (Body) {string} [_rev] If working with an existing row for an internal table its revision - * must also be provided. - * @apiParam (Body) {string} _viewId The ID of the view should be specified in the row body itself. - * @apiParam (Body) {string} tableId The ID of the table should also be specified in the row body itself. - * @apiParam (Body) {any} [any] Any field supplied in the body will be assessed to see if it matches - * a column in the specified table. All other fields will be dropped and not stored. - * - * @apiSuccess {string} _id The ID of the row that was just saved, if it was just created this - * is the rows new ID. - * @apiSuccess {string} [_rev] If saving to an internal table a revision will also be returned. - * @apiSuccess {object} body The contents of the row that was saved will be returned as well. - */ - .post( - "/api/v2/views/:viewId/rows", - paramResource("viewId"), - authorized(PermissionType.VIEW, PermissionLevel.WRITE), - trimViewRowInfo, - rowController.save - ) - /** - * @api {patch} /api/v2/views/:viewId/rows/:rowId Updates a row - * @apiName Update a row - * @apiGroup rows - * @apiPermission table write access - * @apiDescription This endpoint is identical to the row creation endpoint but instead it will - * error if an _id isn't provided, it will only function for existing rows. - */ - .patch( - "/api/v2/views/:viewId/rows/:rowId", - paramResource("viewId"), - authorized(PermissionType.VIEW, PermissionLevel.WRITE), - trimViewRowInfo, - rowController.patch - ) - /** - * @api {delete} /api/v2/views/:viewId/rows Delete rows for a view - * @apiName Delete rows for a view - * @apiGroup rows - * @apiPermission table write access - * @apiDescription This endpoint can delete a single row, or delete them in a bulk - * fashion. - * - * @apiParam {string} tableId The ID of the table the row is to be deleted from. - * - * @apiParam (Body) {object[]} [rows] If bulk deletion is desired then provide the rows in this - * key of the request body that are to be deleted. - * @apiParam (Body) {string} [_id] If deleting a single row then provide its ID in this field. - * @apiParam (Body) {string} [_rev] If deleting a single row from an internal table then provide its - * revision here. - * - * @apiSuccess {object[]|object} body If deleting bulk then the response body will be an array - * of the deleted rows, if deleting a single row then the body will contain a "row" property which - * is the deleted row. - */ - .delete( - "/api/v2/views/:viewId/rows", - paramResource("viewId"), - authorized(PermissionType.VIEW, PermissionLevel.WRITE), - // This is required as the implementation relies on the table id - (ctx, next) => { - ctx.params.tableId = utils.extractViewInfoFromID( - ctx.params.viewId - ).tableId - return next() - }, - rowController.destroy - ) export default router diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index b986ffb945..86c41b8503 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -24,7 +24,6 @@ import { structures, } from "@budibase/backend-core/tests" import trimViewRowInfoMiddleware from "../../../middleware/trimViewRowInfo" -import noViewDataMiddleware from "../../../middleware/noViewData" import router from "../row" describe("/rows", () => { @@ -406,14 +405,6 @@ describe("/rows", () => { "Table row endpoints cannot contain view info" ) }) - - it("should setup the noViewData middleware", async () => { - const route = router.stack.find( - r => r.methods.includes("POST") && r.path === "/api/:tableId/rows" - ) - expect(route).toBeDefined() - expect(route?.stack).toContainEqual(noViewDataMiddleware) - }) }) describe("patch", () => { @@ -482,14 +473,6 @@ describe("/rows", () => { "Table row endpoints cannot contain view info" ) }) - - it("should setup the noViewData middleware", async () => { - const route = router.stack.find( - r => r.methods.includes("PATCH") && r.path === "/api/:tableId/rows" - ) - expect(route).toBeDefined() - expect(route?.stack).toContainEqual(noViewDataMiddleware) - }) }) describe("destroy", () => { diff --git a/packages/server/src/db/utils.ts b/packages/server/src/db/utils.ts index dda14a9187..e8dc3b3f6c 100644 --- a/packages/server/src/db/utils.ts +++ b/packages/server/src/db/utils.ts @@ -284,10 +284,20 @@ export function getMultiIDParams(ids: string[]) { * @returns {string} The new view ID which the view doc can be stored under. */ export function generateViewID(tableId: string) { - return `${tableId}${SEPARATOR}${newid()}` + return `${DocumentType.VIEW}${SEPARATOR}${tableId}${SEPARATOR}${newid()}` +} + +export function isViewID(viewId: string) { + return viewId?.split(SEPARATOR)[0] === DocumentType.VIEW } export function extractViewInfoFromID(viewId: string) { + if (!isViewID(viewId)) { + throw new Error("Unable to extract table ID, is not a view ID") + } + const split = viewId.split(SEPARATOR) + split.shift() + viewId = split.join(SEPARATOR) const regex = new RegExp(`^(?.+)${SEPARATOR}([^${SEPARATOR}]+)$`) const res = regex.exec(viewId) return { diff --git a/packages/server/src/middleware/noViewData.ts b/packages/server/src/middleware/noViewData.ts deleted file mode 100644 index 809424b6bf..0000000000 --- a/packages/server/src/middleware/noViewData.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Ctx, Row } from "@budibase/types" - -export default async (ctx: Ctx, next: any) => { - if (ctx.request.body._viewId) { - return ctx.throw(400, "Table row endpoints cannot contain view info") - } - - return next() -} diff --git a/packages/server/src/middleware/tests/noViewData.spec.ts b/packages/server/src/middleware/tests/noViewData.spec.ts deleted file mode 100644 index 54b0ca8ff8..0000000000 --- a/packages/server/src/middleware/tests/noViewData.spec.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { generator } from "@budibase/backend-core/tests" -import { BBRequest, FieldType, Row, Table } from "@budibase/types" -import { Next } from "koa" -import * as utils from "../../db/utils" -import noViewDataMiddleware from "../noViewData" - -class TestConfiguration { - next: Next - throw: jest.Mock<(status: number, message: string) => never> - middleware: typeof noViewDataMiddleware - params: Record - request?: Pick, "body"> - - constructor() { - this.next = jest.fn() - this.throw = jest.fn() - this.params = {} - - this.middleware = noViewDataMiddleware - } - - executeMiddleware(ctxRequestBody: Row) { - this.request = { - body: ctxRequestBody, - } - return this.middleware( - { - request: this.request as any, - throw: this.throw as any, - params: this.params, - } as any, - this.next - ) - } - - afterEach() { - jest.clearAllMocks() - } -} - -describe("noViewData middleware", () => { - let config: TestConfiguration - - beforeEach(() => { - config = new TestConfiguration() - }) - - afterEach(() => { - config.afterEach() - }) - - const getRandomData = () => ({ - _id: generator.guid(), - name: generator.name(), - age: generator.age(), - address: generator.address(), - }) - - it("it should pass without view id data", async () => { - const data = getRandomData() - await config.executeMiddleware({ - ...data, - }) - - expect(config.next).toBeCalledTimes(1) - expect(config.throw).not.toBeCalled() - }) - - it("it should throw an error if _viewid is provided", async () => { - const data = getRandomData() - await config.executeMiddleware({ - _viewId: generator.guid(), - ...data, - }) - - expect(config.throw).toBeCalledTimes(1) - expect(config.throw).toBeCalledWith( - 400, - "Table row endpoints cannot contain view info" - ) - expect(config.next).not.toBeCalled() - }) -}) diff --git a/packages/server/src/middleware/trimViewRowInfo.ts b/packages/server/src/middleware/trimViewRowInfo.ts index 2e3ded27f5..763552c3d7 100644 --- a/packages/server/src/middleware/trimViewRowInfo.ts +++ b/packages/server/src/middleware/trimViewRowInfo.ts @@ -7,15 +7,15 @@ import { Next } from "koa" export default async (ctx: Ctx, next: Next) => { const { body } = ctx.request const { _viewId: viewId } = body - if (!viewId) { - return ctx.throw(400, "_viewId is required") + + const possibleViewId = ctx.params.tableId + + // nothing to do, it is not a view (just a table ID) + if (!viewId || !utils.isViewID(possibleViewId)) { + return next() } - if (!ctx.params.viewId) { - return ctx.throw(400, "viewId path is required") - } - - const { tableId } = utils.extractViewInfoFromID(ctx.params.viewId) + const { tableId } = utils.extractViewInfoFromID(possibleViewId) const { _viewId, ...trimmedView } = await trimViewFields( viewId, tableId, diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index 7e75f22060..637caa06ee 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -1,17 +1,14 @@ -import { HTTPError, context } from "@budibase/backend-core" +import { context, HTTPError } from "@budibase/backend-core" import { FieldSchema, TableSchema, View, ViewV2 } from "@budibase/types" import sdk from "../../../sdk" import * as utils from "../../../db/utils" -import merge from "lodash/merge" export async function get(viewId: string): Promise { const { tableId } = utils.extractViewInfoFromID(viewId) const table = await sdk.tables.getTable(tableId) const views = Object.values(table.views!) - const view = views.find(v => isV2(v) && v.id === viewId) as ViewV2 | undefined - - return view + return views.find(v => isV2(v) && v.id === viewId) as ViewV2 | undefined } export async function create( diff --git a/packages/types/src/documents/document.ts b/packages/types/src/documents/document.ts index 6ba318269b..164aa79ac9 100644 --- a/packages/types/src/documents/document.ts +++ b/packages/types/src/documents/document.ts @@ -37,6 +37,7 @@ export enum DocumentType { USER_FLAG = "flag", AUTOMATION_METADATA = "meta_au", AUDIT_LOG = "al", + VIEW = "view", } export interface Document { diff --git a/packages/types/src/sdk/permissions.ts b/packages/types/src/sdk/permissions.ts index 9e51e4c7b4..9fe1970e44 100644 --- a/packages/types/src/sdk/permissions.ts +++ b/packages/types/src/sdk/permissions.ts @@ -14,6 +14,5 @@ export enum PermissionType { WEBHOOK = "webhook", BUILDER = "builder", GLOBAL_BUILDER = "globalBuilder", - VIEW = "view", QUERY = "query", } From 497943930ea4e68ad0a879a0002e0e0abdc264a0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 09:22:39 +0300 Subject: [PATCH 047/183] Rename --- packages/server/src/api/routes/tests/row.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 2f81a78950..8f7c6741be 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -1264,7 +1264,7 @@ describe("/rows", () => { expect(response.body.rows).toHaveLength(0) }) - it("returns table rows from view", async () => { + it("respects the limit parameter", async () => { const table = await config.createTable(userTable()) const rows = [] for (let i = 0; i < 10; i++) { From 39d099b443b179ad6b371df4d95a84ef4ac6eb21 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 10:49:04 +0300 Subject: [PATCH 048/183] Handle and test pagination --- .../server/src/api/controllers/row/views.ts | 8 ++- .../server/src/api/routes/tests/row.spec.ts | 57 +++++++++++++++++++ packages/types/src/api/web/app/rows.ts | 5 +- 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index 9ac052c1e9..204cb6b4bc 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -33,13 +33,17 @@ export async function searchView( ctx.status = 200 + const { body } = ctx.request + const searchOptions: RequiredKeys & RequiredKeys> = { tableId: view.tableId, query: view.query || {}, fields: viewFields, - ...getSortOptions(ctx.request.body, view), - limit: ctx.request.body.limit, + ...getSortOptions(body, view), + limit: body.limit, + bookmark: body.bookmark, + paginate: body.paginate, } const result = await quotas.addQuery(() => sdk.rows.search(searchOptions), { diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 8f7c6741be..b9f584706e 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -1279,6 +1279,63 @@ describe("/rows", () => { expect(response.body.rows).toHaveLength(limit) }) + + it("can handle pagination", async () => { + const table = await config.createTable(userTable()) + const rows = [] + for (let i = 0; i < 10; i++) { + rows.push(await config.createRow({ tableId: table._id })) + } + // rows.sort((a, b) => (a._id! > b._id! ? 1 : -1)) + + const createViewResponse = await config.api.viewV2.create() + const allRows = (await config.api.viewV2.search(createViewResponse.id)) + .body.rows + + const firstPageResponse = await config.api.viewV2.search( + createViewResponse.id, + { + paginate: true, + limit: 4, + } + ) + expect(firstPageResponse.body).toEqual({ + rows: expect.arrayContaining(allRows.slice(0, 4)), + totalRows: 10, + hasNextPage: true, + bookmark: expect.any(String), + }) + + const secondPageResponse = await config.api.viewV2.search( + createViewResponse.id, + { + paginate: true, + limit: 4, + bookmark: firstPageResponse.body.bookmark, + } + ) + expect(secondPageResponse.body).toEqual({ + rows: expect.arrayContaining(allRows.slice(4, 8)), + totalRows: 10, + hasNextPage: true, + bookmark: expect.any(String), + }) + + const lastPageResponse = await config.api.viewV2.search( + createViewResponse.id, + { + paginate: true, + limit: 4, + bookmark: secondPageResponse.body.bookmark, + } + ) + expect(lastPageResponse.body).toEqual({ + rows: expect.arrayContaining(allRows.slice(8)), + totalRows: 10, + hasNextPage: false, + bookmark: expect.any(String), + }) + }) }) }) }) diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index e95afa6e59..f1890ef777 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -12,7 +12,10 @@ export interface PatchRowResponse extends Row {} export interface SearchRowRequest extends Omit {} export interface SearchViewRowRequest - extends Pick {} + extends Pick< + SearchRowRequest, + "sort" | "sortOrder" | "sortType" | "limit" | "bookmark" | "paginate" + > {} export interface SearchRowResponse { rows: any[] From 74287370dff0508c3fcee59455cbfc5a587b1f11 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 11:18:36 +0300 Subject: [PATCH 049/183] Move filter types to types --- packages/shared-core/src/filters.ts | 78 +++++----------------- packages/types/src/api/web/index.ts | 1 + packages/types/src/api/web/searchFilter.ts | 49 ++++++++++++++ 3 files changed, 66 insertions(+), 62 deletions(-) create mode 100644 packages/types/src/api/web/searchFilter.ts diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index 54e0df92df..6602762160 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -1,4 +1,12 @@ -import { Datasource, FieldType, SortDirection, SortType } from "@budibase/types" +import { + Datasource, + FieldType, + SearchFilter, + SearchQuery, + SearchQueryFields, + SortDirection, + SortType, +} from "@budibase/types" import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants" import { deepGet } from "./helpers" @@ -73,13 +81,13 @@ export const NoEmptyFilterStrings = [ OperatorOptions.NotEquals.value, OperatorOptions.Contains.value, OperatorOptions.NotContains.value, -] as (keyof QueryFields)[] +] as (keyof SearchQueryFields)[] /** * Removes any fields that contain empty strings that would cause inconsistent * behaviour with how backend tables are filtered (no value means no filter). */ -const cleanupQuery = (query: Query) => { +const cleanupQuery = (query: SearchQuery) => { if (!query) { return query } @@ -110,66 +118,12 @@ const removeKeyNumbering = (key: string) => { } } -type Filter = { - operator: keyof Query - field: string - type: any - value: any - externalType: keyof typeof SqlNumberTypeRangeMap -} - -type Query = QueryFields & QueryConfig -type QueryFields = { - string?: { - [key: string]: string - } - fuzzy?: { - [key: string]: string - } - range?: { - [key: string]: { - high: number | string - low: number | string - } - } - equal?: { - [key: string]: any - } - notEqual?: { - [key: string]: any - } - empty?: { - [key: string]: any - } - notEmpty?: { - [key: string]: any - } - oneOf?: { - [key: string]: any[] - } - contains?: { - [key: string]: any[] - } - notContains?: { - [key: string]: any[] - } - containsAny?: { - [key: string]: any[] - } -} - -type QueryConfig = { - allOr?: boolean -} - -type QueryFieldsType = keyof QueryFields - /** * Builds a lucene JSON query from the filter structure generated in the builder * @param filter the builder filter structure */ -export const buildLuceneQuery = (filter: Filter[]) => { - let query: Query = { +export const buildLuceneQuery = (filter: SearchFilter[]) => { + let query: SearchQuery = { string: {}, fuzzy: {}, range: {}, @@ -275,7 +229,7 @@ export const buildLuceneQuery = (filter: Filter[]) => { * @param docs the data * @param query the JSON lucene query */ -export const runLuceneQuery = (docs: any[], query?: Query) => { +export const runLuceneQuery = (docs: any[], query?: SearchQuery) => { if (!docs || !Array.isArray(docs)) { return [] } @@ -289,7 +243,7 @@ export const runLuceneQuery = (docs: any[], query?: Query) => { // Iterates over a set of filters and evaluates a fail function against a doc const match = ( - type: QueryFieldsType, + type: keyof SearchQueryFields, failFn: (docValue: any, testValue: any) => boolean ) => (doc: any) => { @@ -456,7 +410,7 @@ export const luceneLimit = (docs: any[], limit: string) => { return docs.slice(0, numLimit) } -export const hasFilters = (query?: Query) => { +export const hasFilters = (query?: SearchQuery) => { if (!query) { return false } diff --git a/packages/types/src/api/web/index.ts b/packages/types/src/api/web/index.ts index 0e0527eb7f..cba1e04f9a 100644 --- a/packages/types/src/api/web/index.ts +++ b/packages/types/src/api/web/index.ts @@ -8,3 +8,4 @@ export * from "./system" export * from "./app" export * from "./global" export * from "./pagination" +export * from "./searchFilter" diff --git a/packages/types/src/api/web/searchFilter.ts b/packages/types/src/api/web/searchFilter.ts new file mode 100644 index 0000000000..4dc00453d3 --- /dev/null +++ b/packages/types/src/api/web/searchFilter.ts @@ -0,0 +1,49 @@ +export type SearchFilter = { + operator: keyof SearchQuery + field: string + type: any + value: any + externalType: "integer" | "int" | "smallint" | "mediumint" +} + +export type SearchQuery = { + allOr?: boolean + string?: { + [key: string]: string + } + fuzzy?: { + [key: string]: string + } + range?: { + [key: string]: { + high: number | string + low: number | string + } + } + equal?: { + [key: string]: any + } + notEqual?: { + [key: string]: any + } + empty?: { + [key: string]: any + } + notEmpty?: { + [key: string]: any + } + oneOf?: { + [key: string]: any[] + } + contains?: { + [key: string]: any[] + } + notContains?: { + [key: string]: any[] + } + containsAny?: { + [key: string]: any[] + } +} + +export type SearchQueryFields = Omit From e4c49fccaf7d6844010ba31bdb61af95d14fe33c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 08:24:29 +0000 Subject: [PATCH 050/183] Bump version to 2.8.31-alpha.0 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index fba4ed5b60..7ff0c4a509 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.30", + "version": "2.8.31-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" From 1dc5f039b9767c9fd5f8a192b6b969bf86187579 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 10:17:01 +0100 Subject: [PATCH 051/183] Updating pro reference. --- packages/pro | 2 +- yarn.lock | 597 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 596 insertions(+), 3 deletions(-) diff --git a/packages/pro b/packages/pro index 44fa63cc0f..3495feff36 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 44fa63cc0f536648ac57ba61b62c60dd2812dbc6 +Subproject commit 3495feff36b73ab9abf2cc45df39900e79d38e27 diff --git a/yarn.lock b/yarn.lock index 8d49f98d5e..9a44c7e82f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2745,6 +2745,18 @@ jest-util "^29.5.0" slash "^3.0.0" +"@jest/console@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.6.2.tgz#bf1d4101347c23e07c029a1b1ae07d550f5cc541" + integrity sha512-0N0yZof5hi44HAR2pPS+ikJ3nzKNoZdVu8FffRf3wy47I7Dm7etk/3KetMdRUqzVd16V4O2m2ISpNTbnIuqy1w== + dependencies: + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^29.6.2" + jest-util "^29.6.2" + slash "^3.0.0" + "@jest/core@^26.6.3": version "26.6.3" resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.3.tgz#7639fcb3833d748a4656ada54bde193051e45fad" @@ -2848,6 +2860,40 @@ slash "^3.0.0" strip-ansi "^6.0.0" +"@jest/core@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.6.2.tgz#6f2d1dbe8aa0265fcd4fb8082ae1952f148209c8" + integrity sha512-Oj+5B+sDMiMWLhPFF+4/DvHOf+U10rgvCLGPHP8Xlsy/7QxS51aU/eBngudHlJXnaWD5EohAgJ4js+T6pa+zOg== + dependencies: + "@jest/console" "^29.6.2" + "@jest/reporters" "^29.6.2" + "@jest/test-result" "^29.6.2" + "@jest/transform" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^29.5.0" + jest-config "^29.6.2" + jest-haste-map "^29.6.2" + jest-message-util "^29.6.2" + jest-regex-util "^29.4.3" + jest-resolve "^29.6.2" + jest-resolve-dependencies "^29.6.2" + jest-runner "^29.6.2" + jest-runtime "^29.6.2" + jest-snapshot "^29.6.2" + jest-util "^29.6.2" + jest-validate "^29.6.2" + jest-watcher "^29.6.2" + micromatch "^4.0.4" + pretty-format "^29.6.2" + slash "^3.0.0" + strip-ansi "^6.0.0" + "@jest/create-cache-key-function@^27.4.2": version "27.5.1" resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-27.5.1.tgz#7448fae15602ea95c828f5eceed35c202a820b31" @@ -2885,6 +2931,16 @@ "@types/node" "*" jest-mock "^29.5.0" +"@jest/environment@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.6.2.tgz#794c0f769d85e7553439d107d3f43186dc6874a9" + integrity sha512-AEcW43C7huGd/vogTddNNTDRpO6vQ2zaQNrttvWV18ArBx9Z56h7BIsXkNFJVOO4/kblWEQz30ckw0+L3izc+Q== + dependencies: + "@jest/fake-timers" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + jest-mock "^29.6.2" + "@jest/expect-utils@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-28.1.3.tgz#58561ce5db7cd253a7edddbc051fb39dda50f525" @@ -2906,6 +2962,13 @@ dependencies: jest-get-type "^29.4.3" +"@jest/expect-utils@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.6.2.tgz#1b97f290d0185d264dd9fdec7567a14a38a90534" + integrity sha512-6zIhM8go3RV2IG4aIZaZbxwpOzz3ZiM23oxAlkquOIole+G6TrbeXnykxWYlqF7kz2HlBjdKtca20x9atkEQYg== + dependencies: + jest-get-type "^29.4.3" + "@jest/expect@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-28.1.3.tgz#9ac57e1d4491baca550f6bdbd232487177ad6a72" @@ -2922,6 +2985,14 @@ expect "^29.5.0" jest-snapshot "^29.5.0" +"@jest/expect@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.6.2.tgz#5a2ad58bb345165d9ce0a1845bbf873c480a4b28" + integrity sha512-m6DrEJxVKjkELTVAztTLyS/7C92Y2b0VYqmDROYKLLALHn8T/04yPs70NADUYPrV3ruI+H3J0iUIuhkjp7vkfg== + dependencies: + expect "^29.6.2" + jest-snapshot "^29.6.2" + "@jest/fake-timers@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" @@ -2958,6 +3029,18 @@ jest-mock "^29.5.0" jest-util "^29.5.0" +"@jest/fake-timers@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.6.2.tgz#fe9d43c5e4b1b901168fe6f46f861b3e652a2df4" + integrity sha512-euZDmIlWjm1Z0lJ1D0f7a0/y5Kh/koLFMUBE5SUYWrmy8oNhJpbTBDAP6CxKnadcMLDoDf4waRYCe35cH6G6PA== + dependencies: + "@jest/types" "^29.6.1" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.6.2" + jest-mock "^29.6.2" + jest-util "^29.6.2" + "@jest/globals@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.2.tgz#5b613b78a1aa2655ae908eba638cc96a20df720a" @@ -2986,6 +3069,16 @@ "@jest/types" "^29.5.0" jest-mock "^29.5.0" +"@jest/globals@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.6.2.tgz#74af81b9249122cc46f1eb25793617eec69bf21a" + integrity sha512-cjuJmNDjs6aMijCmSa1g2TNG4Lby/AeU7/02VtpW+SLcZXzOLK2GpN2nLqcFjmhy3B3AoPeQVx7BnyOf681bAw== + dependencies: + "@jest/environment" "^29.6.2" + "@jest/expect" "^29.6.2" + "@jest/types" "^29.6.1" + jest-mock "^29.6.2" + "@jest/reporters@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.2.tgz#1f518b99637a5f18307bd3ecf9275f6882a667f6" @@ -3079,6 +3172,36 @@ strip-ansi "^6.0.0" v8-to-istanbul "^9.0.1" +"@jest/reporters@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.6.2.tgz#524afe1d76da33d31309c2c4a2c8062d0c48780a" + integrity sha512-sWtijrvIav8LgfJZlrGCdN0nP2EWbakglJY49J1Y5QihcQLfy7ovyxxjJBRXMNltgt4uPtEcFmIMbVshEDfFWw== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^29.6.2" + "@jest/test-result" "^29.6.2" + "@jest/transform" "^29.6.2" + "@jest/types" "^29.6.1" + "@jridgewell/trace-mapping" "^0.3.18" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^5.1.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^29.6.2" + jest-util "^29.6.2" + jest-worker "^29.6.2" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + "@jest/schemas@^28.1.3": version "28.1.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" @@ -3093,6 +3216,13 @@ dependencies: "@sinclair/typebox" "^0.25.16" +"@jest/schemas@^29.6.0": + version "29.6.0" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.0.tgz#0f4cb2c8e3dca80c135507ba5635a4fd755b0040" + integrity sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ== + dependencies: + "@sinclair/typebox" "^0.27.8" + "@jest/source-map@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" @@ -3120,6 +3250,15 @@ callsites "^3.0.0" graceful-fs "^4.2.9" +"@jest/source-map@^29.6.0": + version "29.6.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.0.tgz#bd34a05b5737cb1a99d43e1957020ac8e5b9ddb1" + integrity sha512-oA+I2SHHQGxDCZpbrsCQSoMLb3Bz547JnM+jUr9qEbuw0vQlWZfpPS7CO9J7XiwKicEz9OFn/IYoLkkiUD7bzA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + callsites "^3.0.0" + graceful-fs "^4.2.9" + "@jest/test-result@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" @@ -3150,6 +3289,16 @@ "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" +"@jest/test-result@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.6.2.tgz#fdd11583cd1608e4db3114e8f0cce277bf7a32ed" + integrity sha512-3VKFXzcV42EYhMCsJQURptSqnyjqCGbtLuX5Xxb6Pm6gUf1wIRIl+mandIRGJyWKgNKYF9cnstti6Ls5ekduqw== + dependencies: + "@jest/console" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + "@jest/test-sequencer@29.5.0", "@jest/test-sequencer@^29.5.0": version "29.5.0" resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz#34d7d82d3081abd523dbddc038a3ddcb9f6d3cc4" @@ -3181,6 +3330,16 @@ jest-haste-map "^28.1.3" slash "^3.0.0" +"@jest/test-sequencer@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.6.2.tgz#585eff07a68dd75225a7eacf319780cb9f6b9bf4" + integrity sha512-GVYi6PfPwVejO7slw6IDO0qKVum5jtrJ3KoLGbgBWyr2qr4GaxFV6su+ZAjdTX75Sr1DkMFRk09r2ZVa+wtCGw== + dependencies: + "@jest/test-result" "^29.6.2" + graceful-fs "^4.2.9" + jest-haste-map "^29.6.2" + slash "^3.0.0" + "@jest/transform@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" @@ -3244,6 +3403,27 @@ slash "^3.0.0" write-file-atomic "^4.0.2" +"@jest/transform@^29.6.2": + version "29.6.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.6.2.tgz#522901ebbb211af08835bc3bcdf765ab778094e3" + integrity sha512-ZqCqEISr58Ce3U+buNFJYUktLJZOggfyvR+bZMaiV1e8B1SIvJbwZMrYz3gx/KAPn9EXmOmN+uB08yLCjWkQQg== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.1" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.6.2" + jest-regex-util "^29.4.3" + jest-util "^29.6.2" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + "@jest/types@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" @@ -3302,6 +3482,18 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" +"@jest/types@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.1.tgz#ae79080278acff0a6af5eb49d063385aaa897bf2" + integrity sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw== + dependencies: + "@jest/schemas" "^29.6.0" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + "@jimp/bmp@^0.16.13": version "0.16.13" resolved "https://registry.yarnpkg.com/@jimp/bmp/-/bmp-0.16.13.tgz#57ffa5b17417b5a181f6f184bdabc8218e8448ef" @@ -3653,7 +3845,7 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@jridgewell/trace-mapping@^0.3.15": +"@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.18": version "0.3.18" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== @@ -4691,6 +4883,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -5369,7 +5566,7 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== -"@trendyol/jest-testcontainers@^2.1.1": +"@trendyol/jest-testcontainers@2.1.1", "@trendyol/jest-testcontainers@^2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@trendyol/jest-testcontainers/-/jest-testcontainers-2.1.1.tgz#dced95cf9c37b75efe0a65db9b75ae8912f2f14a" integrity sha512-4iAc2pMsev4BTUzoA7jO1VvbTOU2N3juQUYa8TwiSPXPuQtxKwV9WB9ZEP+JQ+Pj15YqfGOXp5H0WNMPtapjiA== @@ -5727,6 +5924,14 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/jest@29.5.3": + version "29.5.3" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.3.tgz#7a35dc0044ffb8b56325c6802a4781a626b05777" + integrity sha512-1Nq7YrO/vJE/FYnqYyw0FS8LdrjExSgIiHyKg7xPpn+yi8Q4huZryKnkJatN1ZRH89Kw2v33/8ZMB7DuZeSLlA== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + "@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" @@ -7442,6 +7647,19 @@ babel-jest@^28.1.3: graceful-fs "^4.2.9" slash "^3.0.0" +babel-jest@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.6.2.tgz#cada0a59e07f5acaeb11cbae7e3ba92aec9c1126" + integrity sha512-BYCzImLos6J3BH/+HvUCHG1dTf2MzmAB4jaVxHV+29RZLjR29XuYTmsf2sdDwkrb+FczkGo3kOhE7ga6sI0P4A== + dependencies: + "@jest/transform" "^29.6.2" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^29.5.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + babel-plugin-const-enum@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/babel-plugin-const-enum/-/babel-plugin-const-enum-1.2.0.tgz#3d25524106f68f081e187829ba736b251c289861" @@ -9707,6 +9925,11 @@ dedent@0.7.0, dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +dedent@^1.0.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" + integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== + deep-eql@^4.1.2: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" @@ -11608,6 +11831,18 @@ expect@^29.5.0: jest-message-util "^29.5.0" jest-util "^29.5.0" +expect@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.6.2.tgz#7b08e83eba18ddc4a2cf62b5f2d1918f5cd84521" + integrity sha512-iAErsLxJ8C+S02QbLAwgSGSezLQK+XXRDt8IuFXFpwCNw2ECmzZSmjKcCaFVp5VRMk+WAvz6h6jokzEzBFZEuA== + dependencies: + "@jest/expect-utils" "^29.6.2" + "@types/node" "*" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.6.2" + jest-message-util "^29.6.2" + jest-util "^29.6.2" + expose-loader@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/expose-loader/-/expose-loader-3.1.0.tgz#7a0bdecb345b921ca238a8c4715a4ea7e227213f" @@ -14738,6 +14973,32 @@ jest-circus@^29.5.0: slash "^3.0.0" stack-utils "^2.0.3" +jest-circus@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.6.2.tgz#1e6ffca60151ac66cad63fce34f443f6b5bb4258" + integrity sha512-G9mN+KOYIUe2sB9kpJkO9Bk18J4dTDArNFPwoZ7WKHKel55eKIS/u2bLthxgojwlf9NLCVQfgzM/WsOVvoC6Fw== + dependencies: + "@jest/environment" "^29.6.2" + "@jest/expect" "^29.6.2" + "@jest/test-result" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^1.0.0" + is-generator-fn "^2.0.0" + jest-each "^29.6.2" + jest-matcher-utils "^29.6.2" + jest-message-util "^29.6.2" + jest-runtime "^29.6.2" + jest-snapshot "^29.6.2" + jest-util "^29.6.2" + p-limit "^3.1.0" + pretty-format "^29.6.2" + pure-rand "^6.0.0" + slash "^3.0.0" + stack-utils "^2.0.3" + jest-cli@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.3.tgz#43117cfef24bc4cd691a174a8796a532e135e92a" @@ -14793,6 +15054,24 @@ jest-cli@^29.5.0: prompts "^2.0.1" yargs "^17.3.1" +jest-cli@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.6.2.tgz#edb381763398d1a292cd1b636a98bfa5644b8fda" + integrity sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q== + dependencies: + "@jest/core" "^29.6.2" + "@jest/test-result" "^29.6.2" + "@jest/types" "^29.6.1" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + import-local "^3.0.2" + jest-config "^29.6.2" + jest-util "^29.6.2" + jest-validate "^29.6.2" + prompts "^2.0.1" + yargs "^17.3.1" + jest-config@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.6.3.tgz#64f41444eef9eb03dc51d5c53b75c8c71f645349" @@ -14873,6 +15152,34 @@ jest-config@^29.5.0: slash "^3.0.0" strip-json-comments "^3.1.1" +jest-config@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.6.2.tgz#c68723f06b31ca5e63030686e604727d406cd7c3" + integrity sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.6.2" + "@jest/types" "^29.6.1" + babel-jest "^29.6.2" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^29.6.2" + jest-environment-node "^29.6.2" + jest-get-type "^29.4.3" + jest-regex-util "^29.4.3" + jest-resolve "^29.6.2" + jest-runner "^29.6.2" + jest-util "^29.6.2" + jest-validate "^29.6.2" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^29.6.2" + slash "^3.0.0" + strip-json-comments "^3.1.1" + "jest-diff@>=29.4.3 < 30", jest-diff@^29.5.0: version "29.5.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.5.0.tgz#e0d83a58eb5451dcc1fa61b1c3ee4e8f5a290d63" @@ -14923,6 +15230,16 @@ jest-diff@^29.4.3: jest-get-type "^29.4.3" pretty-format "^29.4.3" +jest-diff@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.6.2.tgz#c36001e5543e82a0805051d3ceac32e6825c1c46" + integrity sha512-t+ST7CB9GX5F2xKwhwCf0TAR17uNDiaPTZnVymP9lw0lssa9vG+AFyDZoeIHStU3WowFFwT+ky+er0WVl2yGhA== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.6.2" + jest-docblock@^26.0.0: version "26.0.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5" @@ -14977,6 +15294,17 @@ jest-each@^29.5.0: jest-util "^29.5.0" pretty-format "^29.5.0" +jest-each@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.6.2.tgz#c9e4b340bcbe838c73adf46b76817b15712d02ce" + integrity sha512-MsrsqA0Ia99cIpABBc3izS1ZYoYfhIy0NNWqPSE0YXbQjwchyt6B1HD2khzyPe1WiJA7hbxXy77ZoUQxn8UlSw== + dependencies: + "@jest/types" "^29.6.1" + chalk "^4.0.0" + jest-get-type "^29.4.3" + jest-util "^29.6.2" + pretty-format "^29.6.2" + jest-environment-jsdom@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e" @@ -15026,6 +15354,18 @@ jest-environment-node@^28.1.3: jest-mock "^28.1.3" jest-util "^28.1.3" +jest-environment-node@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.6.2.tgz#a9ea2cabff39b08eca14ccb32c8ceb924c8bb1ad" + integrity sha512-YGdFeZ3T9a+/612c5mTQIllvWkddPbYcN2v95ZH24oWMbGA4GGS2XdIF92QMhUhvrjjuQWYgUGW2zawOyH63MQ== + dependencies: + "@jest/environment" "^29.6.2" + "@jest/fake-timers" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + jest-mock "^29.6.2" + jest-util "^29.6.2" + jest-get-type@^26.3.0: version "26.3.0" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" @@ -15105,6 +15445,25 @@ jest-haste-map@^29.5.0: optionalDependencies: fsevents "^2.3.2" +jest-haste-map@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.6.2.tgz#298c25ea5255cfad8b723179d4295cf3a50a70d1" + integrity sha512-+51XleTDAAysvU8rT6AnS1ZJ+WHVNqhj1k6nTvN2PYP+HjU3kqlaKQ1Lnw3NYW3bm2r8vq82X0Z1nDDHZMzHVA== + dependencies: + "@jest/types" "^29.6.1" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.4.3" + jest-util "^29.6.2" + jest-worker "^29.6.2" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + jest-jasmine2@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz#adc3cf915deacb5212c93b9f3547cd12958f2edd" @@ -15153,6 +15512,14 @@ jest-leak-detector@^29.5.0: jest-get-type "^29.4.3" pretty-format "^29.5.0" +jest-leak-detector@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.6.2.tgz#e2b307fee78cab091c37858a98c7e1d73cdf5b38" + integrity sha512-aNqYhfp5uYEO3tdWMb2bfWv6f0b4I0LOxVRpnRLAeque2uqOVVMLh6khnTcE2qJ5wAKop0HcreM1btoysD6bPQ== + dependencies: + jest-get-type "^29.4.3" + pretty-format "^29.6.2" + jest-matcher-utils@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" @@ -15203,6 +15570,16 @@ jest-matcher-utils@^29.5.0: jest-get-type "^29.4.3" pretty-format "^29.5.0" +jest-matcher-utils@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.6.2.tgz#39de0be2baca7a64eacb27291f0bd834fea3a535" + integrity sha512-4LiAk3hSSobtomeIAzFTe+N8kL6z0JtF3n6I4fg29iIW7tt99R7ZcIFW34QkX+DuVrf+CUe6wuVOpm7ZKFJzZQ== + dependencies: + chalk "^4.0.0" + jest-diff "^29.6.2" + jest-get-type "^29.4.3" + pretty-format "^29.6.2" + jest-message-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" @@ -15263,6 +15640,21 @@ jest-message-util@^29.5.0: slash "^3.0.0" stack-utils "^2.0.3" +jest-message-util@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.6.2.tgz#af7adc2209c552f3f5ae31e77cf0a261f23dc2bb" + integrity sha512-vnIGYEjoPSuRqV8W9t+Wow95SDp6KPX2Uf7EoeG9G99J2OVh7OSwpS4B6J0NfpEIpfkBNHlBZpA2rblEuEFhZQ== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.1" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.6.2" + slash "^3.0.0" + stack-utils "^2.0.3" + jest-mock@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" @@ -15288,6 +15680,15 @@ jest-mock@^29.5.0: "@types/node" "*" jest-util "^29.5.0" +jest-mock@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.6.2.tgz#ef9c9b4d38c34a2ad61010a021866dad41ce5e00" + integrity sha512-hoSv3lb3byzdKfwqCuT6uTscan471GUECqgNYykg6ob0yiAw3zYc7OrPnI9Qv8Wwoa4lC7AZ9hyS4AiIx5U2zg== + dependencies: + "@jest/types" "^29.6.1" + "@types/node" "*" + jest-util "^29.6.2" + jest-openapi@0.14.2: version "0.14.2" resolved "https://registry.yarnpkg.com/jest-openapi/-/jest-openapi-0.14.2.tgz#5a78f4b5c98ae2b7a7c622d368b71d52a75523c4" @@ -15341,6 +15742,14 @@ jest-resolve-dependencies@^29.5.0: jest-regex-util "^29.4.3" jest-snapshot "^29.5.0" +jest-resolve-dependencies@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.2.tgz#36435269b6672c256bcc85fb384872c134cc4cf2" + integrity sha512-LGqjDWxg2fuQQm7ypDxduLu/m4+4Lb4gczc13v51VMZbVP5tSBILqVx8qfWcsdP8f0G7aIqByIALDB0R93yL+w== + dependencies: + jest-regex-util "^29.4.3" + jest-snapshot "^29.6.2" + jest-resolve@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.2.tgz#a3ab1517217f469b504f1b56603c5bb541fbb507" @@ -15385,6 +15794,21 @@ jest-resolve@^29.5.0: resolve.exports "^2.0.0" slash "^3.0.0" +jest-resolve@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.6.2.tgz#f18405fe4b50159b7b6d85e81f6a524d22afb838" + integrity sha512-G/iQUvZWI5e3SMFssc4ug4dH0aZiZpsDq9o1PtXTV1210Ztyb2+w+ZgQkB3iOiC5SmAEzJBOHWz6Hvrd+QnNPw== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.6.2" + jest-pnp-resolver "^1.2.2" + jest-util "^29.6.2" + jest-validate "^29.6.2" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + jest-runner@29.5.0, jest-runner@^29.5.0: version "29.5.0" resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.5.0.tgz#6a57c282eb0ef749778d444c1d758c6a7693b6f8" @@ -15465,6 +15889,33 @@ jest-runner@^28.1.3: p-limit "^3.1.0" source-map-support "0.5.13" +jest-runner@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.6.2.tgz#89e8e32a8fef24781a7c4c49cd1cb6358ac7fc01" + integrity sha512-wXOT/a0EspYgfMiYHxwGLPCZfC0c38MivAlb2lMEAlwHINKemrttu1uSbcGbfDV31sFaPWnWJPmb2qXM8pqZ4w== + dependencies: + "@jest/console" "^29.6.2" + "@jest/environment" "^29.6.2" + "@jest/test-result" "^29.6.2" + "@jest/transform" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.4.3" + jest-environment-node "^29.6.2" + jest-haste-map "^29.6.2" + jest-leak-detector "^29.6.2" + jest-message-util "^29.6.2" + jest-resolve "^29.6.2" + jest-runtime "^29.6.2" + jest-util "^29.6.2" + jest-watcher "^29.6.2" + jest-worker "^29.6.2" + p-limit "^3.1.0" + source-map-support "0.5.13" + jest-runtime@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.6.3.tgz#4f64efbcfac398331b74b4b3c82d27d401b8fa2b" @@ -15554,6 +16005,34 @@ jest-runtime@^29.5.0: slash "^3.0.0" strip-bom "^4.0.0" +jest-runtime@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.6.2.tgz#692f25e387f982e89ab83270e684a9786248e545" + integrity sha512-2X9dqK768KufGJyIeLmIzToDmsN0m7Iek8QNxRSI/2+iPFYHF0jTwlO3ftn7gdKd98G/VQw9XJCk77rbTGZnJg== + dependencies: + "@jest/environment" "^29.6.2" + "@jest/fake-timers" "^29.6.2" + "@jest/globals" "^29.6.2" + "@jest/source-map" "^29.6.0" + "@jest/test-result" "^29.6.2" + "@jest/transform" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.6.2" + jest-message-util "^29.6.2" + jest-mock "^29.6.2" + jest-regex-util "^29.4.3" + jest-resolve "^29.6.2" + jest-snapshot "^29.6.2" + jest-util "^29.6.2" + slash "^3.0.0" + strip-bom "^4.0.0" + jest-serial-runner@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/jest-serial-runner/-/jest-serial-runner-1.2.1.tgz#0f5f8dbe6f077119bd1fdd7e8518f92353c194d5" @@ -15647,6 +16126,32 @@ jest-snapshot@^29.5.0: pretty-format "^29.5.0" semver "^7.3.5" +jest-snapshot@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.6.2.tgz#9b431b561a83f2bdfe041e1cab8a6becdb01af9c" + integrity sha512-1OdjqvqmRdGNvWXr/YZHuyhh5DeaLp1p/F8Tht/MrMw4Kr1Uu/j4lRG+iKl1DAqUJDWxtQBMk41Lnf/JETYBRA== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.6.2" + "@jest/transform" "^29.6.2" + "@jest/types" "^29.6.1" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.6.2" + graceful-fs "^4.2.9" + jest-diff "^29.6.2" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.6.2" + jest-message-util "^29.6.2" + jest-util "^29.6.2" + natural-compare "^1.4.0" + pretty-format "^29.6.2" + semver "^7.5.3" + jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" @@ -15695,6 +16200,18 @@ jest-util@^29.4.3: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.2.tgz#8a052df8fff2eebe446769fd88814521a517664d" + integrity sha512-3eX1qb6L88lJNCFlEADKOkjpXJQyZRiavX1INZ4tRnrBVr2COd3RgcTLyUiEXMNBlDU/cgYq6taUS0fExrWW4w== + dependencies: + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-validate@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" @@ -15731,6 +16248,18 @@ jest-validate@^29.5.0: leven "^3.1.0" pretty-format "^29.5.0" +jest-validate@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.6.2.tgz#25d972af35b2415b83b1373baf1a47bb266c1082" + integrity sha512-vGz0yMN5fUFRRbpJDPwxMpgSXW1LDKROHfBopAvDcmD6s+B/s8WJrwi+4bfH4SdInBA5C3P3BI19dBtKzx1Arg== + dependencies: + "@jest/types" "^29.6.1" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^29.4.3" + leven "^3.1.0" + pretty-format "^29.6.2" + jest-watcher@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.6.2.tgz#a5b683b8f9d68dbcb1d7dae32172d2cca0592975" @@ -15772,6 +16301,20 @@ jest-watcher@^29.5.0: jest-util "^29.5.0" string-length "^4.0.1" +jest-watcher@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.6.2.tgz#77c224674f0620d9f6643c4cfca186d8893ca088" + integrity sha512-GZitlqkMkhkefjfN/p3SJjrDaxPflqxEAv3/ik10OirZqJGYH5rPiIsgVcfof0Tdqg3shQGdEIxDBx+B4tuLzA== + dependencies: + "@jest/test-result" "^29.6.2" + "@jest/types" "^29.6.1" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.6.2" + string-length "^4.0.1" + jest-worker@^26.2.1, jest-worker@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" @@ -15809,6 +16352,16 @@ jest-worker@^29.5.0: merge-stream "^2.0.0" supports-color "^8.0.0" +jest-worker@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.2.tgz#682fbc4b6856ad0aa122a5403c6d048b83f3fb44" + integrity sha512-l3ccBOabTdkng8I/ORCkADz4eSMKejTYv1vB/Z83UiubqhC1oQ5Li6dWCyqOIvSifGjUBxuvxvlm6KGK2DtuAQ== + dependencies: + "@types/node" "*" + jest-util "^29.6.2" + merge-stream "^2.0.0" + supports-color "^8.0.0" + jest@28.1.1: version "28.1.1" resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.1.tgz#3c39a3a09791e16e9ef283597d24ab19a0df701e" @@ -15829,6 +16382,16 @@ jest@29.5.0: import-local "^3.0.2" jest-cli "^29.5.0" +jest@29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.6.2.tgz#3bd55b9fd46a161b2edbdf5f1d1bd0d1eab76c42" + integrity sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg== + dependencies: + "@jest/core" "^29.6.2" + "@jest/types" "^29.6.1" + import-local "^3.0.2" + jest-cli "^29.6.2" + jest@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.3.tgz#40e8fdbe48f00dfa1f0ce8121ca74b88ac9148ef" @@ -20876,6 +21439,15 @@ pretty-format@^29.5.0: ansi-styles "^5.0.0" react-is "^18.0.0" +pretty-format@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.6.2.tgz#3d5829261a8a4d89d8b9769064b29c50ed486a47" + integrity sha512-1q0oC8eRveTg5nnBEWMXAU2qpv65Gnuf2eCQzSjxpWFkPaPARwqZZDGuNE0zPAZfTCHzIk3A8dIjwlQKKLphyg== + dependencies: + "@jest/schemas" "^29.6.0" + ansi-styles "^5.0.0" + react-is "^18.0.0" + pretty-ms@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-7.0.1.tgz#7d903eaab281f7d8e03c66f867e239dc32fb73e8" @@ -22426,6 +22998,13 @@ semver@^7.2.1, semver@^7.3.5: dependencies: lru-cache "^6.0.0" +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + semver@~2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" @@ -24443,6 +25022,20 @@ ts-jest@29.0.5: semver "7.x" yargs-parser "^21.0.1" +ts-jest@29.1.1: + version "29.1.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" + integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== + dependencies: + bs-logger "0.x" + fast-json-stable-stringify "2.x" + jest-util "^29.0.0" + json5 "^2.2.3" + lodash.memoize "4.x" + make-error "1.x" + semver "^7.5.3" + yargs-parser "^21.0.1" + ts-node@10.8.1: version "10.8.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.1.tgz#ea2bd3459011b52699d7e88daa55a45a1af4f066" From 38af31835fbd0982191103b28d93305b73501525 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 09:17:25 +0000 Subject: [PATCH 052/183] Bump version to 2.8.31 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index fba4ed5b60..fc2a7b96b3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.30", + "version": "2.8.31", "npmClient": "yarn", "packages": [ "packages/*" From f75704bab36a0550e102b92b25c3d895000373d3 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 12:41:59 +0300 Subject: [PATCH 053/183] Update yarn.lock to match develop --- yarn.lock | 109 ++++++++++++------------------------------------------ 1 file changed, 24 insertions(+), 85 deletions(-) diff --git a/yarn.lock b/yarn.lock index 17451266e7..827c94a176 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3505,18 +3505,6 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-28.1.3.tgz#2030606ec03a18c31803b8a36382762e447655df" - integrity sha512-QPAkP5EwKdK/bxIr6C1I4Vs0rm2nHiANzj/Z5X2JQkrZo6IqvC4ldZ9K95tF0HdidhA8Bo6egxSzUFPYKcEXLw== - dependencies: - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - slash "^3.0.0" - "@jest/console@^29.6.2": version "29.6.2" resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.6.2.tgz#bf1d4101347c23e07c029a1b1ae07d550f5cc541" @@ -3654,13 +3642,6 @@ strip-ansi "^6.0.0" v8-to-istanbul "^9.0.1" -"@jest/schemas@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" - integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg== - dependencies: - "@sinclair/typebox" "^0.24.1" - "@jest/schemas@^29.4.3": version "29.4.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" @@ -3747,18 +3728,6 @@ "@types/yargs" "^16.0.0" chalk "^4.0.0" -"@jest/types@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" - integrity sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ== - dependencies: - "@jest/schemas" "^28.1.3" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - "@jest/types@^29.4.3": version "29.4.3" resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.4.3.tgz#9069145f4ef09adf10cec1b2901b2d390031431f" @@ -5183,11 +5152,6 @@ make-fetch-happen "^11.0.1" tuf-js "^1.1.3" -"@sinclair/typebox@^0.24.1": - version "0.24.51" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" - integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== - "@sinclair/typebox@^0.25.16": version "0.25.24" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" @@ -10144,9 +10108,9 @@ dedent@0.7.0: integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== dedent@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" - integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.3.0.tgz#15d6809eb15b581d5587a2dc208f34118e35bee3" + integrity sha512-7glNLfvdsMzZm3FpRY1CHuI2lbYDR+71YmrhmTZjYFD5pfT0ACgnGRdrrC9Mk2uICnzkcdelCx5at787UDGOvg== deep-eql@^4.1.2: version "4.1.3" @@ -15364,21 +15328,6 @@ jest-matcher-utils@^29.6.2: jest-get-type "^29.4.3" pretty-format "^29.6.2" -jest-message-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-28.1.3.tgz#232def7f2e333f1eecc90649b5b94b0055e7c43d" - integrity sha512-PFdn9Iewbt575zKPf1286Ht9EPoJmYT7P0kY+RibeYZ2XtOr53pDLEFoTWXbd1h4JiGiWpTBC84fc8xMXQMb7g== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^28.1.3" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^28.1.3" - slash "^3.0.0" - stack-utils "^2.0.3" - jest-message-util@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.4.3.tgz#65b5280c0fdc9419503b49d4f48d4999d481cb5b" @@ -15545,22 +15494,10 @@ jest-snapshot@^29.6.2: pretty-format "^29.6.2" semver "^7.5.3" -jest-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" - integrity sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ== - dependencies: - "@jest/types" "^28.1.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-util@^29.0.0, jest-util@^29.6.2: - version "29.6.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.2.tgz#8a052df8fff2eebe446769fd88814521a517664d" - integrity sha512-3eX1qb6L88lJNCFlEADKOkjpXJQyZRiavX1INZ4tRnrBVr2COd3RgcTLyUiEXMNBlDU/cgYq6taUS0fExrWW4w== +jest-util@^29.0.0: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.1.tgz#c9e29a87a6edbf1e39e6dee2b4689b8a146679cb" + integrity sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg== dependencies: "@jest/types" "^29.6.1" "@types/node" "*" @@ -15581,6 +15518,18 @@ jest-util@^29.4.3: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.6.2: + version "29.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.2.tgz#8a052df8fff2eebe446769fd88814521a517664d" + integrity sha512-3eX1qb6L88lJNCFlEADKOkjpXJQyZRiavX1INZ4tRnrBVr2COd3RgcTLyUiEXMNBlDU/cgYq6taUS0fExrWW4w== + dependencies: + "@jest/types" "^29.6.1" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-validate@^29.6.2: version "29.6.2" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.6.2.tgz#25d972af35b2415b83b1373baf1a47bb266c1082" @@ -20690,16 +20639,6 @@ pretty-format@^27.0.2, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-format@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" - integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== - dependencies: - "@jest/schemas" "^28.1.3" - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^18.0.0" - pretty-format@^29.0.0, pretty-format@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.4.3.tgz#25500ada21a53c9e8423205cf0337056b201244c" @@ -22231,7 +22170,7 @@ semver@7.3.7, semver@^7.3.4: dependencies: lru-cache "^6.0.0" -semver@7.5.3: +semver@7.5.3, semver@^7.5.3: version "7.5.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== @@ -22257,10 +22196,10 @@ semver@^7.2.1, semver@^7.3.5: dependencies: lru-cache "^6.0.0" -semver@^7.3.2, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== +semver@^7.3.2, semver@^7.3.7, semver@^7.3.8: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== dependencies: lru-cache "^6.0.0" From f0bcd3d6793818fef6f14dd45b8aa39972547ce9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 12:59:03 +0300 Subject: [PATCH 054/183] Update pro ref --- .github/workflows/budibase_ci.yml | 4 +++- packages/pro | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index b84fd54fae..04eaba5a03 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -190,6 +190,8 @@ jobs: base_commit=$(git rev-parse origin/develop) fi + echo "target_branch=$branch" + echo "target_branch=$branch" >> "$GITHUB_OUTPUT" echo "pro_commit=$pro_commit" echo "pro_commit=$pro_commit" >> "$GITHUB_OUTPUT" echo "base_commit=$base_commit" @@ -204,7 +206,7 @@ jobs: const baseCommit = '${{ steps.get_pro_commits.outputs.base_commit }}'; if (submoduleCommit !== baseCommit) { - console.error('Submodule commit does not match the latest commit on the develop branch.'); + console.error('Submodule commit does not match the latest commit on the "${{ steps.get_pro_commits.outputs.target_branch }}"" branch.'); console.error('Refer to the pro repo to merge your changes: https://github.com/Budibase/budibase-pro/blob/develop/docs/getting_started.md') process.exit(1); } else { diff --git a/packages/pro b/packages/pro index cf3bef2aad..3495feff36 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit cf3bef2aad9c739111b306fd0712397adc363f81 +Subproject commit 3495feff36b73ab9abf2cc45df39900e79d38e27 From ac5ce13f80cdbb8e80e2b3b460888dd3c7fc8fcc Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Aug 2023 10:59:42 +0100 Subject: [PATCH 055/183] debug log for automation ID --- packages/server/src/threads/automation.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 9831a96936..7d4a0f1dd1 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -486,6 +486,7 @@ class Orchestrator { const end = performance.now() const executionTime = end - start + console.debug(`[Automation ID]: ${automation._id} completed`) console.info(`Execution time: ${executionTime} milliseconds`, { _logKey: "automation", executionTime, From e1c997d96fe40d0d103f727870de4a73c72120c3 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 10:02:26 +0000 Subject: [PATCH 056/183] Bump version to 2.8.32-alpha.0 --- lerna.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lerna.json b/lerna.json index 5f0bed7e2a..42a7927172 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,9 @@ { - "version": "2.8.31", + "version": "2.8.32-alpha.0", "npmClient": "yarn", - "packages": ["packages/*"], + "packages": [ + "packages/*" + ], "useNx": true, "command": { "publish": { @@ -17,4 +19,4 @@ "loadEnvFiles": false } } -} +} \ No newline at end of file From 77568af7048cfdd569b9afe30dc83195d43fd21b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:14:18 +0300 Subject: [PATCH 057/183] Change filter query to store the expected shape --- packages/server/src/api/controllers/row/views.ts | 4 +++- packages/server/src/api/routes/tests/row.spec.ts | 9 ++++++++- packages/shared-core/src/filters.ts | 8 ++++++-- packages/types/src/api/web/searchFilter.ts | 6 ++++-- packages/types/src/documents/app/view.ts | 7 +++---- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index c38b7fe56e..9d6e38b1ec 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -6,6 +6,7 @@ import { SortType, ViewV2, } from "@budibase/types" +import { dataFilters } from "@budibase/shared-core" import sdk from "../../../sdk" export async function searchView(ctx: UserCtx) { @@ -29,11 +30,12 @@ export async function searchView(ctx: UserCtx) { undefined ctx.status = 200 + const query = dataFilters.buildLuceneQuery(view.query || []) const result = await quotas.addQuery( () => sdk.rows.search({ tableId: view.tableId, - query: view.query || {}, + query, fields: viewFields, ...getSortOptions(ctx, view), }), diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index b986ffb945..230aaa54cf 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -869,7 +869,14 @@ describe("/rows", () => { ) const createViewResponse = await config.api.viewV2.create({ - query: { equal: { age: 40 } }, + query: [ + { + operator: "equal", + field: "age", + value: "40", + type: FieldType.NUMBER, + }, + ], }) const response = await config.api.viewV2.search(createViewResponse.id) diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index 6602762160..8739db1b40 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -181,9 +181,13 @@ export const buildLuceneQuery = (filter: SearchFilter[]) => { } if (operator.startsWith("range") && query.range) { const minint = - SqlNumberTypeRangeMap[externalType]?.min || Number.MIN_SAFE_INTEGER + SqlNumberTypeRangeMap[ + externalType as keyof typeof SqlNumberTypeRangeMap + ]?.min || Number.MIN_SAFE_INTEGER const maxint = - SqlNumberTypeRangeMap[externalType]?.max || Number.MAX_SAFE_INTEGER + SqlNumberTypeRangeMap[ + externalType as keyof typeof SqlNumberTypeRangeMap + ]?.max || Number.MAX_SAFE_INTEGER if (!query.range[field]) { query.range[field] = { low: type === "number" ? minint : "0000-00-00T00:00:00.000Z", diff --git a/packages/types/src/api/web/searchFilter.ts b/packages/types/src/api/web/searchFilter.ts index 4dc00453d3..1b5948e50c 100644 --- a/packages/types/src/api/web/searchFilter.ts +++ b/packages/types/src/api/web/searchFilter.ts @@ -1,9 +1,11 @@ +import { FieldType } from "../../documents" + export type SearchFilter = { operator: keyof SearchQuery field: string - type: any + type?: FieldType value: any - externalType: "integer" | "int" | "smallint" | "mediumint" + externalType?: string } export type SearchQuery = { diff --git a/packages/types/src/documents/app/view.ts b/packages/types/src/documents/app/view.ts index 3fe8b4a500..204b995337 100644 --- a/packages/types/src/documents/app/view.ts +++ b/packages/types/src/documents/app/view.ts @@ -1,6 +1,5 @@ -import { SortOrder, SortType } from "../../api" -import { SearchFilters } from "../../sdk" -import { TableSchema, UIFieldMetadata } from "./table" +import { SearchFilter, SortOrder, SortType } from "../../api" +import { UIFieldMetadata } from "./table" export interface View { name: string @@ -20,7 +19,7 @@ export interface ViewV2 { name: string primaryDisplay?: string tableId: string - query?: SearchFilters + query?: SearchFilter[] sort?: { field: string order?: SortOrder From 62bebc3c2b1fcef6a4beb522b08bde417b03fe41 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:26:26 +0300 Subject: [PATCH 058/183] Hardcode reponame on action repo checks --- .github/workflows/budibase_ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 04eaba5a03..881da80ff3 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,13 +25,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != github.event.pull_request.head.repo.full_name + if: github.repository != Budibase/budibase - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -46,13 +46,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != github.event.pull_request.head.repo.full_name + if: github.repository != Budibase/budibase - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -70,13 +70,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != github.event.pull_request.head.repo.full_name + if: github.repository != Budibase/budibase - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -96,13 +96,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != github.event.pull_request.head.repo.full_name + if: github.repository != Budibase/budibase - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,13 +140,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != github.event.pull_request.head.repo.full_name + if: github.repository != Budibase/budibase - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.repository == github.event.pull_request.head.repo.full_name + if: github.repository == Budibase/budibase steps: - name: Checkout repo and submodules uses: actions/checkout@v3 From 48e07233156f9f2d46c0d20afb72ed93299a2eaf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:29:52 +0300 Subject: [PATCH 059/183] Fix pipeline --- .github/workflows/budibase_ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 881da80ff3..8d908a2b01 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,13 +25,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != Budibase/budibase + if: github.repository != "Budibase/budibase" - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -46,13 +46,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != Budibase/budibase + if: github.repository != "Budibase/budibase" - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -70,13 +70,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != Budibase/budibase + if: github.repository != "Budibase/budibase" - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -96,13 +96,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != Budibase/budibase + if: github.repository != "Budibase/budibase" - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,13 +140,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != Budibase/budibase + if: github.repository != "Budibase/budibase" - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.repository == Budibase/budibase + if: github.repository == "Budibase/budibase" steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -207,7 +207,7 @@ jobs: if (submoduleCommit !== baseCommit) { console.error('Submodule commit does not match the latest commit on the "${{ steps.get_pro_commits.outputs.target_branch }}"" branch.'); - console.error('Refer to the pro repo to merge your changes: https://github.com/Budibase/budibase-pro/blob/develop/docs/getting_started.md') + console.error('Refer to the pro repo to merge your changes: https://github.com/"Budibase/budibase"-pro/blob/develop/docs/getting_started.md') process.exit(1); } else { console.log('All good, the submodule had been merged and setup correctly!') From 2c21d5af05003ea31c93198ef3080c2a83ad4cda Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:31:13 +0300 Subject: [PATCH 060/183] Fix yaml --- .github/workflows/budibase_ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 8d908a2b01..6e3b519e91 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,13 +25,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != "Budibase/budibase" + if: github.repository != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -46,13 +46,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != "Budibase/budibase" + if: github.repository != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -70,13 +70,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != "Budibase/budibase" + if: github.repository != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -96,13 +96,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != "Budibase/budibase" + if: github.repository != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,13 +140,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != "Budibase/budibase" + if: github.repository != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.repository == "Budibase/budibase" + if: github.repository == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -207,7 +207,7 @@ jobs: if (submoduleCommit !== baseCommit) { console.error('Submodule commit does not match the latest commit on the "${{ steps.get_pro_commits.outputs.target_branch }}"" branch.'); - console.error('Refer to the pro repo to merge your changes: https://github.com/"Budibase/budibase"-pro/blob/develop/docs/getting_started.md') + console.error('Refer to the pro repo to merge your changes: https://github.com/'Budibase/budibase'-pro/blob/develop/docs/getting_started.md') process.exit(1); } else { console.log('All good, the submodule had been merged and setup correctly!') From 6cdeb4b108f7b00f10270adb9784bef0c99baf38 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:33:13 +0300 Subject: [PATCH 061/183] Revert --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 6e3b519e91..9da52f8bc0 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -207,7 +207,7 @@ jobs: if (submoduleCommit !== baseCommit) { console.error('Submodule commit does not match the latest commit on the "${{ steps.get_pro_commits.outputs.target_branch }}"" branch.'); - console.error('Refer to the pro repo to merge your changes: https://github.com/'Budibase/budibase'-pro/blob/develop/docs/getting_started.md') + console.error('Refer to the pro repo to merge your changes: https://github.com/Budibase/budibase-pro/blob/develop/docs/getting_started.md') process.exit(1); } else { console.log('All good, the submodule had been merged and setup correctly!') From e8f4376e25864e2172b0b02ddd72e99bddf56564 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 10:40:27 +0000 Subject: [PATCH 062/183] Bump version to 2.8.32-alpha.1 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 42a7927172..238a2a2192 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.0", + "version": "2.8.32-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" From c60a54bd23df677644f735594216f33cefdd1e90 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:50:48 +0300 Subject: [PATCH 063/183] Fix checks --- .github/workflows/budibase_ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 9da52f8bc0..f57a729ba9 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,13 +25,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != 'Budibase/budibase' + if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -46,13 +46,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != 'Budibase/budibase' + if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -70,13 +70,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != 'Budibase/budibase' + if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -96,13 +96,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != 'Budibase/budibase' + if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,13 +140,13 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.repository != 'Budibase/budibase' + if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.repository == 'Budibase/budibase' + if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 From be3912904e2f88577889b29464f9f14585b571a7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:56:57 +0300 Subject: [PATCH 064/183] Fix yaml --- .github/workflows/budibase_ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index f57a729ba9..60401099bc 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -70,7 +70,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -96,7 +96,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,7 +140,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.event_name = "pull_request" && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 From b5e7755948a8c98bf14de75c070a66e4dc1ebd47 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:59:59 +0300 Subject: [PATCH 065/183] Attempt yaml --- .github/workflows/budibase_ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 60401099bc..9730487684 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -70,7 +70,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -96,7 +96,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -119,7 +119,7 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 @@ -140,7 +140,7 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} @@ -166,7 +166,7 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.event_name = 'pull_request' && github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 From 02f28442d69238affa0cc356351db0aab75fe980 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:05:44 +0300 Subject: [PATCH 066/183] Fix double checkout --- .github/workflows/budibase_ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 9730487684..e060db8370 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -31,7 +31,7 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -52,7 +52,7 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -76,7 +76,7 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -102,7 +102,7 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 @@ -146,7 +146,7 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - name: Use Node.js 14.x uses: actions/setup-node@v3 From c6fba3a82787483229b78f661478f2f2383595ae Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:16:23 +0300 Subject: [PATCH 067/183] Fix types --- .../server/src/api/routes/tests/viewV2.spec.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index fc97e657c5..e30bc2c0b1 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -62,7 +62,7 @@ describe("/v2/views", () => { name: generator.name(), tableId: config.table!._id!, primaryDisplay: generator.word(), - query: { allOr: false, equal: { field: "value" } }, + query: [{ operator: "equal", field: "field", value: "value" }], sort: { field: "fieldToSort", order: SortOrder.DESCENDING, @@ -190,7 +190,7 @@ describe("/v2/views", () => { const tableId = config.table!._id! await config.api.viewV2.update({ ...view, - query: { equal: { newField: "thatValue" } }, + query: [{ operator: "equal", field: "newField", value: "thatValue" }], }) expect(await config.api.table.get(tableId)).toEqual({ @@ -198,7 +198,9 @@ describe("/v2/views", () => { views: { [view.name]: { ...view, - query: { equal: { newField: "thatValue" } }, + query: [ + { operator: "equal", field: "newField", value: "thatValue" }, + ], schema: expect.anything(), }, }, @@ -216,7 +218,13 @@ describe("/v2/views", () => { tableId, name: view.name, primaryDisplay: generator.word(), - query: { equal: { [generator.word()]: generator.word() } }, + query: [ + { + operator: "equal", + field: generator.word(), + value: generator.word(), + }, + ], sort: { field: generator.word(), order: SortOrder.DESCENDING, @@ -285,7 +293,7 @@ describe("/v2/views", () => { { ...view, tableId: generator.guid(), - query: { equal: { newField: "thatValue" } }, + query: [{ operator: "equal", field: "newField", value: "thatValue" }], }, { expectStatus: 404 } ) From e991a0bd9cc50cfdaf184762491a682448cb74c9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:26:11 +0000 Subject: [PATCH 068/183] Bump version to 2.8.32 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 238a2a2192..84d2a24b86 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.1", + "version": "2.8.32", "npmClient": "yarn", "packages": [ "packages/*" From 4bcffd553b6c74ab187fd88fbbf5ceee8c5e1e46 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:26:25 +0000 Subject: [PATCH 069/183] Bump version to 2.8.32-alpha.2 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 238a2a2192..f72055b174 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.1", + "version": "2.8.32-alpha.2", "npmClient": "yarn", "packages": [ "packages/*" From d956738cd456d5da03c56f9a54cd22602d72cdc5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 12:28:17 +0100 Subject: [PATCH 070/183] Reverting pro reference to develop. --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 3495feff36..cf3bef2aad 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 3495feff36b73ab9abf2cc45df39900e79d38e27 +Subproject commit cf3bef2aad9c739111b306fd0712397adc363f81 From 0247a6c4cc54fcb59a08f3a877c5fbf68b69a4ac Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:29:58 +0000 Subject: [PATCH 071/183] Bump version to 2.8.32-alpha.3 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f72055b174..4ad0562b73 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.2", + "version": "2.8.32-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" From 14785ca49ddf158d3f29aca5dc855b609b7e261b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Aug 2023 12:36:19 +0100 Subject: [PATCH 072/183] move to info log line --- packages/server/src/threads/automation.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 7d4a0f1dd1..e06abcb665 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -486,8 +486,7 @@ class Orchestrator { const end = performance.now() const executionTime = end - start - console.debug(`[Automation ID]: ${automation._id} completed`) - console.info(`Execution time: ${executionTime} milliseconds`, { + console.info(`Automation ID: ${automation._id} Execution time: ${executionTime} milliseconds`, { _logKey: "automation", executionTime, }) From 768016ce2e234c3be3e5e83ab67458469d391a10 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:36:47 +0300 Subject: [PATCH 073/183] Update docs --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 2fb4c36fa8..70f198a84c 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -90,7 +90,7 @@ Component libraries are collections of components as well as the definition of t #### 1. Prerequisites -- NodeJS version `14.x.x` +- NodeJS version `18.x.x` - Python version `3.x` ### Using asdf (recommended) From f6c042ae341e9f24849b8332d6d0c1d4aa082284 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:37:57 +0300 Subject: [PATCH 074/183] Remove hardcoded target in esbuild --- scripts/build.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index b93ae1bbe6..2ca41b5f7d 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -43,7 +43,6 @@ function runBuild(entry, outfile) { TsconfigPathsPlugin({ tsconfig: tsconfigPathPluginContent }), nodeExternalsPlugin(), ], - target: "node14", preserveSymlinks: true, loader: { ".svelte": "copy", From 12d6911ae390ce6a566862984a3d4c64876db484 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:38:16 +0300 Subject: [PATCH 075/183] Update docker images to 18.x --- hosting/single/Dockerfile | 2 +- packages/server/Dockerfile | 2 +- packages/worker/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hosting/single/Dockerfile b/hosting/single/Dockerfile index e43e5ad10c..6fc1f96d28 100644 --- a/hosting/single/Dockerfile +++ b/hosting/single/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim as build +FROM node:18-slim as build # install node-gyp dependencies RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index a526538b71..61f064ecfb 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim +FROM node:18-slim 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" diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index dd98f3b7f8..4230ee86f8 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-alpine +FROM node:18-alpine 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" From aed1874ef01613348d79f46e57b0dfba68f59bc0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:51:58 +0000 Subject: [PATCH 076/183] Bump version to 2.9.0 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 84d2a24b86..15fea034e6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32", + "version": "2.9.0", "npmClient": "yarn", "packages": [ "packages/*" From cb25a0d23a9180b37a8eec54abc905255c81febe Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:53:41 +0000 Subject: [PATCH 077/183] Bump version to 2.8.32-alpha.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 4ad0562b73..f687e46b24 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.3", + "version": "2.8.32-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" From b7810f915e89b40020d643738f00d5cb8b9d55d6 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Aug 2023 12:55:28 +0100 Subject: [PATCH 078/183] fix lint --- packages/server/src/threads/automation.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index e06abcb665..bc0629a939 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -486,10 +486,13 @@ class Orchestrator { const end = performance.now() const executionTime = end - start - console.info(`Automation ID: ${automation._id} Execution time: ${executionTime} milliseconds`, { - _logKey: "automation", - executionTime, - }) + console.info( + `Automation ID: ${automation._id} Execution time: ${executionTime} milliseconds`, + { + _logKey: "automation", + executionTime, + } + ) // store the logs for the automation run try { From 9bc008012d983068f476f46da8832ca7bd628129 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 15:23:12 +0300 Subject: [PATCH 079/183] Update master pipeline to fix the current tag issue --- .github/workflows/release-master.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 7f8b8f1d55..4d836aa9e4 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -61,8 +61,8 @@ jobs: id: currenttag run: | version=v$(./scripts/getCurrentVersion.sh) - echo 'Using tag $version' - echo "::set-output name=tag::$resversionult" + echo "Using tag $version" + echo "version=$version" >> "$GITHUB_OUTPUT" - name: Build/release Docker images run: | @@ -71,7 +71,7 @@ jobs: env: DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} - BUDIBASE_RELEASE_VERSION: ${{ steps.currenttag.outputs.tag }} + BUDIBASE_RELEASE_VERSION: ${{ steps.currenttag.outputs.version }} release-helm-chart: needs: [release-images] From 4c9dfb85c81df20e697cf4772b2c35a5dad8052f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 12:24:52 +0000 Subject: [PATCH 080/183] Bump version to 2.9.1 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 15fea034e6..911fd037d1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.0", + "version": "2.9.1", "npmClient": "yarn", "packages": [ "packages/*" From 3eb31c7a8140b3b63d4aa84214024d519feff25a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 12:28:09 +0000 Subject: [PATCH 081/183] Bump version to 2.8.32-alpha.5 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f687e46b24..a3162b37c3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.4", + "version": "2.8.32-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" From 4d2fef6b199aa0b4ecdb9cfc70d26deb1c6ebc6d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 15:33:50 +0300 Subject: [PATCH 082/183] Fix types after merge --- packages/server/src/api/routes/tests/row.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index b9f584706e..3284d25de8 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -1072,7 +1072,7 @@ describe("/rows", () => { ) const createViewResponse = await config.api.viewV2.create({ - query: { equal: { age: 40 } }, + query: [{ operator: "equal", field: "age", value: 40 }], }) const response = await config.api.viewV2.search(createViewResponse.id) From 206be7e8a1daf7f3174ce9711e3427c6e1d29f18 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 15:36:56 +0300 Subject: [PATCH 083/183] Update pro ref --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index cf3bef2aad..ecee8071eb 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit cf3bef2aad9c739111b306fd0712397adc363f81 +Subproject commit ecee8071ebe0f98a5bb19646954e373264be210d From 889face88cb4bd9b6d944b8cdb7f13bb4b8ca40c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Aug 2023 14:30:10 +0100 Subject: [PATCH 084/183] remove v from tagging --- .github/workflows/release-master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 4d836aa9e4..1dae4ae578 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -60,7 +60,7 @@ jobs: - name: "Get Current tag" id: currenttag run: | - version=v$(./scripts/getCurrentVersion.sh) + version=$(./scripts/getCurrentVersion.sh) echo "Using tag $version" echo "version=$version" >> "$GITHUB_OUTPUT" From e6196e5da63173a87de3608d094a842c628e4e62 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 13:30:34 +0000 Subject: [PATCH 085/183] Bump version to 2.9.2 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 911fd037d1..6a55972a43 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.1", + "version": "2.9.2", "npmClient": "yarn", "packages": [ "packages/*" From 1f49db1347b60154af604ad6803fe43846242ebb Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 13:41:18 +0000 Subject: [PATCH 086/183] Bump version to 2.8.32-alpha.6 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index a3162b37c3..8be4ff3061 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.5", + "version": "2.8.32-alpha.6", "npmClient": "yarn", "packages": [ "packages/*" From 0049cc74bbc7a10f0b6dc5627530b28cd159419f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 13:56:12 +0000 Subject: [PATCH 087/183] Bump version to 2.8.32-alpha.7 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 8be4ff3061..dc7cabb9fa 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.32-alpha.6", + "version": "2.8.32-alpha.7", "npmClient": "yarn", "packages": [ "packages/*" From 41a904126817d1f72014dc44c88e8c093ab927af Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 16:36:28 +0100 Subject: [PATCH 088/183] PR fixes. --- packages/backend-core/src/security/permissions.ts | 4 ---- packages/server/src/api/routes/row.ts | 11 +++++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/backend-core/src/security/permissions.ts b/packages/backend-core/src/security/permissions.ts index 70dae57ae6..aa0b20a30c 100644 --- a/packages/backend-core/src/security/permissions.ts +++ b/packages/backend-core/src/security/permissions.ts @@ -78,7 +78,6 @@ export const BUILTIN_PERMISSIONS = { permissions: [ new Permission(PermissionType.QUERY, PermissionLevel.READ), new Permission(PermissionType.TABLE, PermissionLevel.READ), - new Permission(PermissionType.VIEW, PermissionLevel.READ), ], }, WRITE: { @@ -87,7 +86,6 @@ export const BUILTIN_PERMISSIONS = { permissions: [ new Permission(PermissionType.QUERY, PermissionLevel.WRITE), new Permission(PermissionType.TABLE, PermissionLevel.WRITE), - new Permission(PermissionType.VIEW, PermissionLevel.READ), new Permission(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), ], }, @@ -98,7 +96,6 @@ export const BUILTIN_PERMISSIONS = { new Permission(PermissionType.TABLE, PermissionLevel.WRITE), new Permission(PermissionType.USER, PermissionLevel.READ), new Permission(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), - new Permission(PermissionType.VIEW, PermissionLevel.READ), new Permission(PermissionType.WEBHOOK, PermissionLevel.READ), ], }, @@ -109,7 +106,6 @@ export const BUILTIN_PERMISSIONS = { new Permission(PermissionType.TABLE, PermissionLevel.ADMIN), new Permission(PermissionType.USER, PermissionLevel.ADMIN), new Permission(PermissionType.AUTOMATION, PermissionLevel.ADMIN), - new Permission(PermissionType.VIEW, PermissionLevel.ADMIN), new Permission(PermissionType.WEBHOOK, PermissionLevel.READ), new Permission(PermissionType.QUERY, PermissionLevel.ADMIN), ], diff --git a/packages/server/src/api/routes/row.ts b/packages/server/src/api/routes/row.ts index 55906c2ffe..1fd45e0e92 100644 --- a/packages/server/src/api/routes/row.ts +++ b/packages/server/src/api/routes/row.ts @@ -267,11 +267,10 @@ router rowController.exportRows ) -router - .post( - "/api/v2/views/:viewId/search", - authorized(PermissionType.TABLE, PermissionLevel.READ), - rowController.views.searchView - ) +router.post( + "/api/v2/views/:viewId/search", + authorized(PermissionType.TABLE, PermissionLevel.READ), + rowController.views.searchView +) export default router From a2bf1e27fbcbff974432179ca56d2fbe05428a36 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 15:39:06 +0000 Subject: [PATCH 089/183] Bump version to 2.9.3 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 6a55972a43..14d17b0909 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.2", + "version": "2.9.3", "npmClient": "yarn", "packages": [ "packages/*" From 4c2e3a54893db23f7c8f0524e079004e7cbf4415 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 16:49:13 +0100 Subject: [PATCH 090/183] Updating last remaining view perms to table perms. --- packages/server/src/api/routes/view.ts | 2 +- packages/server/src/utilities/security.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/routes/view.ts b/packages/server/src/api/routes/view.ts index 18c58134b4..07e31fc701 100644 --- a/packages/server/src/api/routes/view.ts +++ b/packages/server/src/api/routes/view.ts @@ -34,7 +34,7 @@ router "/api/views/:viewName", paramResource("viewName"), authorized( - permissions.PermissionType.VIEW, + permissions.PermissionType.TABLE, permissions.PermissionLevel.READ ), rowController.fetchView diff --git a/packages/server/src/utilities/security.ts b/packages/server/src/utilities/security.ts index 694dff4360..54e19007f1 100644 --- a/packages/server/src/utilities/security.ts +++ b/packages/server/src/utilities/security.ts @@ -14,6 +14,7 @@ export function getPermissionType(resourceId: string) { switch (docType) { case DocumentType.TABLE: case DocumentType.ROW: + case DocumentType.VIEW: return permissions.PermissionType.TABLE case DocumentType.AUTOMATION: return permissions.PermissionType.AUTOMATION @@ -22,9 +23,6 @@ export function getPermissionType(resourceId: string) { case DocumentType.QUERY: case DocumentType.DATASOURCE: return permissions.PermissionType.QUERY - default: - // views don't have an ID, will end up here - return permissions.PermissionType.VIEW } } From 62b724400a4f7997c8c01de08257b199c2baf74a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 15:55:09 +0000 Subject: [PATCH 091/183] Bump version to 2.9.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 14d17b0909..0aaf9376d5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.3", + "version": "2.9.4", "npmClient": "yarn", "packages": [ "packages/*" From 986939b85d4bb186258a370d95931b8a742ffcf9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 17:44:44 +0100 Subject: [PATCH 092/183] Fix for DS+ unable to patch rows correctly. --- packages/server/src/api/controllers/row/external.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/controllers/row/external.ts b/packages/server/src/api/controllers/row/external.ts index 802c70b6cb..3ee4ca6edd 100644 --- a/packages/server/src/api/controllers/row/external.ts +++ b/packages/server/src/api/controllers/row/external.ts @@ -44,7 +44,7 @@ export async function handleRequest( export async function patch(ctx: UserCtx) { const tableId = ctx.params.tableId - const { id, ...rowData } = ctx.request.body + const { _id, ...rowData } = ctx.request.body const validateResult = await sdk.rows.utils.validate({ row: rowData, @@ -54,10 +54,10 @@ export async function patch(ctx: UserCtx) { throw { validation: validateResult.errors } } const response = await handleRequest(Operation.UPDATE, tableId, { - id: breakRowIdField(id), + id: breakRowIdField(_id), row: rowData, }) - const row = await sdk.rows.external.getRow(tableId, id, { + const row = await sdk.rows.external.getRow(tableId, _id, { relationships: true, }) const table = await sdk.tables.getTable(tableId) @@ -104,9 +104,9 @@ export async function find(ctx: UserCtx) { export async function destroy(ctx: UserCtx) { const tableId = ctx.params.tableId - const id = ctx.request.body._id + const _id = ctx.request.body._id const { row } = (await handleRequest(Operation.DELETE, tableId, { - id: breakRowIdField(id), + id: breakRowIdField(_id), includeSqlRelationships: IncludeRelationship.EXCLUDE, })) as { row: Row } return { response: { ok: true }, row } From b367c7cbe40fc08e0e0247f42299d5e259d095de Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 16:59:41 +0000 Subject: [PATCH 093/183] Bump version to 2.9.5 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 0aaf9376d5..660ac559ab 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.4", + "version": "2.9.5", "npmClient": "yarn", "packages": [ "packages/*" From 4d0c7e56e17c5f7917bbde00a38a75f494ead152 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 19:03:23 +0100 Subject: [PATCH 094/183] Utilising esbuild for the CLI to bundle in backend-core and types as required. --- packages/cli/package.json | 6 +++--- packages/cli/tsconfig.build.json | 7 ++++++- packages/cli/tsconfig.json | 7 +------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index cb59bf7c69..76780acf30 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,16 +2,16 @@ "name": "@budibase/cli", "version": "0.0.0", "description": "Budibase CLI, for developers, self hosting and migrations.", - "main": "dist/src/index.js", + "main": "dist/index.js", "bin": { - "budi": "dist/src/index.js" + "budi": "dist/index.js" }, "author": "Budibase", "license": "GPL-3.0", "scripts": { "prebuild": "rm -rf prebuilds 2> /dev/null && cp -r ../../node_modules/leveldown/prebuilds prebuilds", "rename": "renamer --find .node --replace .fake 'prebuilds/**'", - "tsc": "tsc -p tsconfig.build.json", + "tsc": "node ../../scripts/build.js", "pkg": "pkg . --out-path build --no-bytecode --public --public-packages \"*\" -C GZip", "build": "yarn prebuild && yarn rename && yarn tsc && yarn pkg && yarn postbuild", "check:types": "tsc -p tsconfig.json --noEmit --paths null", diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json index 8b2d44aec8..34a89f54c3 100644 --- a/packages/cli/tsconfig.build.json +++ b/packages/cli/tsconfig.build.json @@ -10,7 +10,12 @@ "incremental": true, "types": [ "node", "jest" ], "outDir": "dist", - "skipLibCheck": true + "skipLibCheck": true, + "paths": { + "@budibase/types": ["../types/src"], + "@budibase/backend-core": ["../backend-core/src"], + "@budibase/backend-core/*": ["../backend-core/*"] + } }, "include": [ "src/**/*" diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index c2935129a8..6ca641e214 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -5,12 +5,7 @@ "declaration": true, "sourceMap": true, "baseUrl": ".", - "resolveJsonModule": true, - "paths": { - "@budibase/types": ["../types/src"], - "@budibase/backend-core": ["../backend-core/src"], - "@budibase/backend-core/*": ["../backend-core/*"] - } + "resolveJsonModule": true }, "ts-node": { "require": ["tsconfig-paths/register"], From cb1cec27746f29b441d07df544736a1785087464 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 7 Aug 2023 20:21:36 +0100 Subject: [PATCH 095/183] Fixing pkg built CLI after using esbuild. --- packages/cli/package.json | 7 +++---- packages/cli/src/prebuilds.ts | 15 +++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 76780acf30..99771adbd3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,12 +19,11 @@ }, "pkg": { "targets": [ - "node16-linux", - "node16-win", - "node16-macos" + "node18-linux", + "node18-win", + "node18-macos" ], "assets": [ - "node_modules/@budibase/backend-core/dist/**/*", "prebuilds/**/*" ], "outputPath": "build" diff --git a/packages/cli/src/prebuilds.ts b/packages/cli/src/prebuilds.ts index 17e084160a..21f3042274 100644 --- a/packages/cli/src/prebuilds.ts +++ b/packages/cli/src/prebuilds.ts @@ -5,7 +5,7 @@ import { error } from "./utils" const PREBUILDS = "prebuilds" const ARCH = `${os.platform()}-${os.arch()}` -const PREBUILD_DIR = join(process.execPath, "..", PREBUILDS, ARCH) +const PREBUILD_DIR = join(process.execPath, "..", "cli", PREBUILDS, ARCH) // running as built CLI pkg bundle if (!process.argv[0].includes("node")) { @@ -13,17 +13,19 @@ if (!process.argv[0].includes("node")) { } function checkForBinaries() { - const readDir = join(__filename, "..", "..", "..", PREBUILDS, ARCH) + const readDir = join(__filename, "..", "..", "..", "cli", PREBUILDS, ARCH) if (fs.existsSync(PREBUILD_DIR) || !fs.existsSync(readDir)) { return } const natives = fs.readdirSync(readDir) if (fs.existsSync(readDir)) { - fs.mkdirSync(PREBUILD_DIR, { recursive: true }) + const writePath = join(process.execPath, PREBUILDS, ARCH) + fs.mkdirSync(writePath, { recursive: true }) for (let native of natives) { const filename = `${native.split(".fake")[0]}.node` - fs.cpSync(join(readDir, native), join(PREBUILD_DIR, filename)) + fs.cpSync(join(readDir, native), join(writePath, filename)) } + console.log("copied something") } } @@ -39,8 +41,9 @@ function cleanup(evt?: number) { ) console.error(error(evt)) } - if (fs.existsSync(PREBUILD_DIR)) { - fs.rmSync(PREBUILD_DIR, { recursive: true }) + const path = join(process.execPath, PREBUILDS) + if (fs.existsSync(path)) { + fs.rmSync(path, { recursive: true }) } } From 3a99f6baa66b420c632d22d7b8e225e25aeb7183 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 19:35:14 +0000 Subject: [PATCH 096/183] Bump version to 2.9.6 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 660ac559ab..f580610019 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.5", + "version": "2.9.6", "npmClient": "yarn", "packages": [ "packages/*" From ad882b6685c5c751caa74c459983feecf1c09bef Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Mon, 7 Aug 2023 21:06:40 +0100 Subject: [PATCH 097/183] Running the releases in parallel causes the old architecture tag that was released to be overwritten, meaning we only end up with a single release. --- .github/workflows/release-singleimage.yml | 78 +---------------------- 1 file changed, 2 insertions(+), 76 deletions(-) diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index 5b75c20d29..1f4a2d0b32 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -8,7 +8,7 @@ env: PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} REGISTRY_URL: registry.hub.docker.com jobs: - build-amd64: + build-amd64-arm64: name: "build-amd64" runs-on: ubuntu-latest strategy: @@ -68,81 +68,7 @@ jobs: with: context: . push: true - platforms: linux/amd64 - tags: budibase/budibase,budibase/budibase:v${{ env.RELEASE_VERSION }} - file: ./hosting/single/Dockerfile - - - name: Tag and release Budibase Azure App Service docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - platforms: linux/amd64 - build-args: TARGETBUILD=aas - tags: budibase/budibase-aas,budibase/budibase-aas:v${{ env.RELEASE_VERSION }} - file: ./hosting/single/Dockerfile - - build-arm64: - name: "build-arm64" - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - steps: - - name: Fail if not a tag - run: | - if [[ $GITHUB_REF != refs/tags/* ]]; then - echo "Workflow Dispatch can only be run on tags" - exit 1 - fi - - name: "Checkout" - uses: actions/checkout@v2 - with: - submodules: true - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - fetch-depth: 0 - - name: Fail if tag is not in master - run: | - if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then - echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch" - exit 1 - fi - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - - name: Setup Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - name: Run Yarn - run: yarn - - name: Update versions - run: ./scripts/updateVersions.sh - - name: Runt Yarn Lint - run: yarn lint - - name: Update versions - run: ./scripts/updateVersions.sh - - name: Run Yarn Build - run: yarn build:docker:pre - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_API_KEY }} - - name: Get the latest release version - id: version - run: | - release_version=$(cat lerna.json | jq -r '.version') - echo $release_version - echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - - name: Tag and release Budibase service docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - platforms: linux/arm64 + platforms: linux/amd64,linux/arm64 tags: budibase/budibase,budibase/budibase:v${{ env.RELEASE_VERSION }} file: ./hosting/single/Dockerfile From 2e4e55e2cfa5532a95e65faf8f19fd21840be972 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 20:30:10 +0000 Subject: [PATCH 098/183] Bump version to 2.9.7 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f580610019..86af55741a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.6", + "version": "2.9.7", "npmClient": "yarn", "packages": [ "packages/*" From f6c992964e3229b6f1d11f96c64e900b4fd3238b Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Mon, 7 Aug 2023 21:31:55 +0100 Subject: [PATCH 099/183] Fixing issue with CLI build, removing some old cjs exports that shouldn't be there. --- packages/cli/src/exec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/exec.ts b/packages/cli/src/exec.ts index b121ca0e03..fb84d4fd0f 100644 --- a/packages/cli/src/exec.ts +++ b/packages/cli/src/exec.ts @@ -1,5 +1,6 @@ import util from "util" -const runCommand = util.promisify(require("child_process").exec) +import childProcess from "child_process" +const runCommand = util.promisify(childProcess.exec) export async function exec(command: string, dir = "./") { const { stdout } = await runCommand(command, { cwd: dir }) @@ -16,12 +17,12 @@ export async function utilityInstalled(utilName: string) { } export async function runPkgCommand(command: string, dir = "./") { - const yarn = await exports.utilityInstalled("yarn") - const npm = await exports.utilityInstalled("npm") + const yarn = await utilityInstalled("yarn") + const npm = await utilityInstalled("npm") if (!yarn && !npm) { throw new Error("Must have yarn or npm installed to run build.") } const npmCmd = command === "install" ? `npm ${command}` : `npm run ${command}` const cmd = yarn ? `yarn ${command} --ignore-engines` : npmCmd - await exports.exec(cmd, dir) + await exec(cmd, dir) } From c6e657a7b45cbf5e8897309b005bdf7d0a2f214d Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 20:32:27 +0000 Subject: [PATCH 100/183] Bump version to 2.9.8 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 86af55741a..c33d100e72 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.7", + "version": "2.9.8", "npmClient": "yarn", "packages": [ "packages/*" From 07a28fc284c4f1b26730d4bcf74d0a96faa84e99 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 20:33:14 +0000 Subject: [PATCH 101/183] Bump version to 2.9.8-alpha.0 --- lerna.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 0d412b0cbc..9640694d79 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.7", + "version": "2.9.8-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" @@ -19,4 +19,4 @@ "loadEnvFiles": false } } -} +} \ No newline at end of file From 51f086030012f74d08f73879ccde797db097d531 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 8 Aug 2023 08:12:18 +0000 Subject: [PATCH 102/183] Bump version to 2.9.8-alpha.1 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 9640694d79..0d8ae345e8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.8-alpha.0", + "version": "2.9.8-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" From b925a347d2ffdcd7144c7dfcad62fcd9f3deeb1a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:35:04 +0300 Subject: [PATCH 103/183] Remove fetch-depth --- .github/workflows/budibase_ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 08fc2fe0b8..683f8cbfe8 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -173,7 +173,6 @@ jobs: uses: actions/checkout@v3 with: submodules: true - fetch-depth: 0 token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Check pro commit From a882e3341f4927f467b36e436fb017261cf11147 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:43:31 +0300 Subject: [PATCH 104/183] Add since flag --- .github/workflows/budibase_ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 683f8cbfe8..135fa035f5 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,6 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + NX_BASE_BRANCH: ${{ github.base_ref || "origin/master"}} jobs: lint: @@ -61,9 +62,9 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile # Run build all the projects - - run: yarn build + - run: yarn build --since=${{ NX_BASE_BRANCH }} # Check the types of the projects built via esbuild - - run: yarn check:types + - run: yarn check:types --since=${{ NX_BASE_BRANCH }} test-libraries: runs-on: ubuntu-latest @@ -84,7 +85,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro + - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos @@ -111,7 +112,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Test worker and server - run: yarn test --scope=@budibase/worker --scope=@budibase/server + run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos @@ -134,7 +135,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - run: yarn test --scope=@budibase/pro + - run: yarn test --scope=@budibase/pro --since=${{ NX_BASE_BRANCH }} integration-test: runs-on: ubuntu-latest From 19b3def9b855355b7c31df1a8808eabf19b49d05 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:45:59 +0300 Subject: [PATCH 105/183] Fix env --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 135fa035f5..b12b371f24 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,7 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: ${{ github.base_ref || "origin/master"}} + NX_BASE_BRANCH: ${{ github.base_ref || origin/master}} jobs: lint: From 3e7da2bfd10b9cdb495a1d632196f756209d7d44 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:47:10 +0300 Subject: [PATCH 106/183] Fix --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index b12b371f24..3218f69ff6 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,7 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: ${{ github.base_ref || origin/master}} + NX_BASE_BRANCH: ${{ github.base_ref || 'origin/master'}} jobs: lint: From 49bc467eb982686af6cd014e8d31dd9908148da6 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:48:16 +0300 Subject: [PATCH 107/183] Prefix env --- .github/workflows/budibase_ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 3218f69ff6..ea00c9438a 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -62,9 +62,9 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile # Run build all the projects - - run: yarn build --since=${{ NX_BASE_BRANCH }} + - run: yarn build --since=${{ env.NX_BASE_BRANCH }} # Check the types of the projects built via esbuild - - run: yarn check:types --since=${{ NX_BASE_BRANCH }} + - run: yarn check:types --since=${{ env.NX_BASE_BRANCH }} test-libraries: runs-on: ubuntu-latest @@ -85,7 +85,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ NX_BASE_BRANCH }} + - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos @@ -112,7 +112,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Test worker and server - run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ NX_BASE_BRANCH }} + run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos @@ -135,7 +135,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - run: yarn test --scope=@budibase/pro --since=${{ NX_BASE_BRANCH }} + - run: yarn test --scope=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} integration-test: runs-on: ubuntu-latest From d5d5c21ef80afcb09fd9eee992d1adf5bb1cef88 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:56:44 +0300 Subject: [PATCH 108/183] Change build to run in lerna --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4294e83883..4e4befb5f2 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "preinstall": "node scripts/syncProPackage.js", "setup": "git config submodule.recurse true && git submodule update && node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev", "bootstrap": "./scripts/link-dependencies.sh && echo '***BOOTSTRAP ONLY REQUIRED FOR USE WITH ACCOUNT PORTAL***'", - "build": "yarn nx run-many -t=build", + "build": "lerna run build --stream", "build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput", "check:types": "lerna run check:types", "backend:bootstrap": "./scripts/scopeBackend.sh && yarn run bootstrap", From 987ee1b8b27b612f66ba165291311e002df503b9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 11:58:29 +0300 Subject: [PATCH 109/183] Prefix NX_BASE_BRANCH --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index ea00c9438a..693d81372d 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,7 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: ${{ github.base_ref || 'origin/master'}} + NX_BASE_BRANCH: origin/${{ github.base_ref || 'master'}} jobs: lint: From 5eb49fbb293a737afd528e640701b425fd80ff2a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 12:08:39 +0300 Subject: [PATCH 110/183] Fetch remote refs --- .github/workflows/budibase_ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 693d81372d..52bff87e0c 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -61,6 +61,8 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile + - name: Fetch remote references + run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" # Run build all the projects - run: yarn build --since=${{ env.NX_BASE_BRANCH }} # Check the types of the projects built via esbuild @@ -85,6 +87,8 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile + - name: Fetch remote references + run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: @@ -111,6 +115,8 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile + - name: Fetch remote references + run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" - name: Test worker and server run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 From 62bb5bb4ff85ee59296b3e88492920d3e42346e1 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 12:14:22 +0300 Subject: [PATCH 111/183] Fetch only required branch --- .github/workflows/budibase_ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 52bff87e0c..49d06fc430 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,7 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: origin/${{ github.base_ref || 'master'}} + NX_BASE_BRANCH: ${{ github.base_ref || 'master'}} jobs: lint: @@ -62,7 +62,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Fetch remote references - run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" + run: git fetch origin ${{ env.NX_BASE_BRANCH }} # Run build all the projects - run: yarn build --since=${{ env.NX_BASE_BRANCH }} # Check the types of the projects built via esbuild @@ -88,7 +88,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Fetch remote references - run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" + run: git fetch origin ${{ env.NX_BASE_BRANCH }} - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: @@ -116,7 +116,7 @@ jobs: cache: "yarn" - run: yarn --frozen-lockfile - name: Fetch remote references - run: git fetch origin "+refs/heads/*:refs/remotes/origin/*" + run: git fetch origin ${{ env.NX_BASE_BRANCH }} - name: Test worker and server run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 From 903b1eac09f7bdbdcaa788dcf767933469094306 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 12:27:14 +0300 Subject: [PATCH 112/183] Fetch-depth --- .github/workflows/budibase_ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 49d06fc430..b2e256b044 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -51,9 +51,12 @@ jobs: with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} + fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + with: + fetch-depth: 0 - name: Use Node.js 18.x uses: actions/setup-node@v3 @@ -61,8 +64,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - name: Fetch remote references - run: git fetch origin ${{ env.NX_BASE_BRANCH }} + # Run build all the projects - run: yarn build --since=${{ env.NX_BASE_BRANCH }} # Check the types of the projects built via esbuild @@ -77,9 +79,12 @@ jobs: with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} + fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + with: + fetch-depth: 0 - name: Use Node.js 18.x uses: actions/setup-node@v3 @@ -87,8 +92,6 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - name: Fetch remote references - run: git fetch origin ${{ env.NX_BASE_BRANCH }} - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 with: @@ -105,9 +108,12 @@ jobs: with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} + fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + with: + fetch-depth: 0 - name: Use Node.js 18.x uses: actions/setup-node@v3 @@ -115,8 +121,6 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - name: Fetch remote references - run: git fetch origin ${{ env.NX_BASE_BRANCH }} - name: Test worker and server run: yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} - uses: codecov/codecov-action@v3 From fc6472c0cccd6ad783232d32ed196ab289bee12a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 12:31:46 +0300 Subject: [PATCH 113/183] Prefix --- .github/workflows/budibase_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index b2e256b044..2953aa0575 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,7 +18,7 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: ${{ github.base_ref || 'master'}} + NX_BASE_BRANCH: origin/${{ github.base_ref || 'master'}} jobs: lint: From ee2f3e3157e81b9906225601d1fb48ca45d04be5 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 12:39:40 +0300 Subject: [PATCH 114/183] Fix build --- .github/workflows/budibase_ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 2953aa0575..cc1244e01a 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -138,6 +138,7 @@ jobs: with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} + fetch-depth: 0 - name: Use Node.js 18.x uses: actions/setup-node@v3 @@ -166,7 +167,7 @@ jobs: node-version: 18.x cache: "yarn" - run: yarn --frozen-lockfile - - run: yarn build --projects=@budibase/server,@budibase/worker,@budibase/client + - run: yarn build --scope @budibase/server --scope @budibase/worker --scope @budibase/client - name: Run tests run: | cd qa-core From b22aeb03c40c7f410e47fdba6287572c7b32aef2 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 11:39:36 +0100 Subject: [PATCH 115/183] Using the self hosted runners in the dev environment to build our single image ARM, AMD and AAS images. --- .github/workflows/release-selfhost.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index 39ee812726..1455f0838f 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -5,7 +5,7 @@ on: jobs: release: - runs-on: ubuntu-latest + runs-on: [self-hosted, dev] steps: - name: Fail if not a tag From aab04339b82078d3fb46b3e857cac8c246a72fb9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 8 Aug 2023 11:01:28 +0000 Subject: [PATCH 116/183] Bump version to 2.9.9 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index c33d100e72..fd7dc65c76 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.8", + "version": "2.9.9", "npmClient": "yarn", "packages": [ "packages/*" From 2011e1693e35b4102bdbb131dfd23d2f9abd3632 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 12:06:25 +0100 Subject: [PATCH 117/183] PR comments. --- .../server/src/api/controllers/row/utils.ts | 9 ++- packages/server/src/api/routes/row.ts | 72 +++++++++---------- packages/server/src/db/utils.ts | 9 ++- packages/server/src/utilities/security.ts | 6 +- packages/types/src/documents/document.ts | 6 ++ 5 files changed, 57 insertions(+), 45 deletions(-) diff --git a/packages/server/src/api/controllers/row/utils.ts b/packages/server/src/api/controllers/row/utils.ts index 6ff90f2b25..6cc342b8a0 100644 --- a/packages/server/src/api/controllers/row/utils.ts +++ b/packages/server/src/api/controllers/row/utils.ts @@ -45,13 +45,16 @@ export async function findRow(ctx: UserCtx, tableId: string, rowId: string) { } export function getTableId(ctx: Ctx) { - if (ctx.request.body && ctx.request.body.tableId) { + if (ctx.request.body?.tableId) { return ctx.request.body.tableId } - if (ctx.params && ctx.params.tableId) { + if (ctx.params?.sourceId) { + return ctx.params.sourceId + } + if (ctx.params?.tableId) { return ctx.params.tableId } - if (ctx.params && ctx.params.viewName) { + if (ctx.params?.viewName) { return ctx.params.viewName } } diff --git a/packages/server/src/api/routes/row.ts b/packages/server/src/api/routes/row.ts index 1fd45e0e92..a4ac8aa3ee 100644 --- a/packages/server/src/api/routes/row.ts +++ b/packages/server/src/api/routes/row.ts @@ -11,7 +11,7 @@ const router: Router = new Router() router /** - * @api {get} /api/:tableId/:rowId/enrich Get an enriched row + * @api {get} /api/:sourceId/:rowId/enrich Get an enriched row * @apiName Get an enriched row * @apiGroup rows * @apiPermission table read access @@ -25,13 +25,13 @@ router * @apiSuccess {object} row The response body will be the enriched row. */ .get( - "/api/:tableId/:rowId/enrich", - paramSubResource("tableId", "rowId"), + "/api/:sourceId/:rowId/enrich", + paramSubResource("sourceId", "rowId"), authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.fetchEnrichedRow ) /** - * @api {get} /api/:tableId/rows Get all rows in a table + * @api {get} /api/:sourceId/rows Get all rows in a table * @apiName Get all rows in a table * @apiGroup rows * @apiPermission table read access @@ -40,37 +40,37 @@ router * due to its lack of support for pagination. With SQL tables this will retrieve up to a limit and then * will simply stop. * - * @apiParam {string} tableId The ID of the table to retrieve all rows within. + * @apiParam {string} sourceId The ID of the table to retrieve all rows within. * * @apiSuccess {object[]} rows The response body will be an array of all rows found. */ .get( - "/api/:tableId/rows", - paramResource("tableId"), + "/api/:sourceId/rows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.fetch ) /** - * @api {get} /api/:tableId/rows/:rowId Retrieve a single row + * @api {get} /api/:sourceId/rows/:rowId Retrieve a single row * @apiName Retrieve a single row * @apiGroup rows * @apiPermission table read access * @apiDescription This endpoint retrieves only the specified row. If you wish to retrieve * a row by anything other than its _id field, use the search endpoint. * - * @apiParam {string} tableId The ID of the table to retrieve a row from. + * @apiParam {string} sourceId The ID of the table to retrieve a row from. * @apiParam {string} rowId The ID of the row to retrieve. * * @apiSuccess {object} body The response body will be the row that was found. */ .get( - "/api/:tableId/rows/:rowId", - paramSubResource("tableId", "rowId"), + "/api/:sourceId/rows/:rowId", + paramSubResource("sourceId", "rowId"), authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.find ) /** - * @api {post} /api/:tableId/search Search for rows in a table + * @api {post} /api/:sourceId/search Search for rows in a table * @apiName Search for rows in a table * @apiGroup rows * @apiPermission table read access @@ -78,7 +78,7 @@ router * and data UI in the builder are built atop this. All filtering, sorting and pagination is * handled through this, for internal and external (datasource plus, e.g. SQL) tables. * - * @apiParam {string} tableId The ID of the table to retrieve rows from. + * @apiParam {string} sourceId The ID of the table to retrieve rows from. * * @apiParam (Body) {boolean} [paginate] If pagination is required then this should be set to true, * defaults to false. @@ -133,22 +133,22 @@ router * page. */ .post( - "/api/:tableId/search", + "/api/:sourceId/search", internalSearchValidator(), - paramResource("tableId"), + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.search ) // DEPRECATED - this is an old API, but for backwards compat it needs to be // supported still .post( - "/api/search/:tableId/rows", - paramResource("tableId"), + "/api/search/:sourceId/rows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.READ), rowController.search ) /** - * @api {post} /api/:tableId/rows Creates a new row + * @api {post} /api/:sourceId/rows Creates a new row * @apiName Creates a new row * @apiGroup rows * @apiPermission table write access @@ -157,7 +157,7 @@ router * links to one. Please note that "_id", "_rev" and "tableId" are fields that are * already used by Budibase tables and cannot be used for columns. * - * @apiParam {string} tableId The ID of the table to save a row to. + * @apiParam {string} sourceId The ID of the table to save a row to. * * @apiParam (Body) {string} [_id] If the row exists already then an ID for the row must be provided. * @apiParam (Body) {string} [_rev] If working with an existing row for an internal table its revision @@ -172,14 +172,14 @@ router * @apiSuccess {object} body The contents of the row that was saved will be returned as well. */ .post( - "/api/:tableId/rows", - paramResource("tableId"), + "/api/:sourceId/rows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), trimViewRowInfo, rowController.save ) /** - * @api {patch} /api/:tableId/rows Updates a row + * @api {patch} /api/:sourceId/rows Updates a row * @apiName Update a row * @apiGroup rows * @apiPermission table write access @@ -187,14 +187,14 @@ router * error if an _id isn't provided, it will only function for existing rows. */ .patch( - "/api/:tableId/rows", - paramResource("tableId"), + "/api/:sourceId/rows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), trimViewRowInfo, rowController.patch ) /** - * @api {post} /api/:tableId/rows/validate Validate inputs for a row + * @api {post} /api/:sourceId/rows/validate Validate inputs for a row * @apiName Validate inputs for a row * @apiGroup rows * @apiPermission table write access @@ -202,7 +202,7 @@ router * given the table schema, this will iterate through all the constraints on the table and * check if the request body is valid. * - * @apiParam {string} tableId The ID of the table the row is to be validated for. + * @apiParam {string} sourceId The ID of the table the row is to be validated for. * * @apiParam (Body) {any} [any] Any fields provided in the request body will be tested * against the table schema and constraints. @@ -214,20 +214,20 @@ router * the schema. */ .post( - "/api/:tableId/rows/validate", - paramResource("tableId"), + "/api/:sourceId/rows/validate", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), rowController.validate ) /** - * @api {delete} /api/:tableId/rows Delete rows + * @api {delete} /api/:sourceId/rows Delete rows * @apiName Delete rows * @apiGroup rows * @apiPermission table write access * @apiDescription This endpoint can delete a single row, or delete them in a bulk * fashion. * - * @apiParam {string} tableId The ID of the table the row is to be deleted from. + * @apiParam {string} sourceId The ID of the table the row is to be deleted from. * * @apiParam (Body) {object[]} [rows] If bulk deletion is desired then provide the rows in this * key of the request body that are to be deleted. @@ -240,29 +240,29 @@ router * is the deleted row. */ .delete( - "/api/:tableId/rows", - paramResource("tableId"), + "/api/:sourceId/rows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), trimViewRowInfo, rowController.destroy ) /** - * @api {post} /api/:tableId/rows/exportRows Export Rows + * @api {post} /api/:sourceId/rows/exportRows Export Rows * @apiName Export rows * @apiGroup rows * @apiPermission table write access * @apiDescription This API can export a number of provided rows * - * @apiParam {string} tableId The ID of the table the row is to be deleted from. + * @apiParam {string} sourceId The ID of the table the row is to be deleted from. * * @apiParam (Body) {object[]} [rows] The row IDs which are to be exported * * @apiSuccess {object[]|object} */ .post( - "/api/:tableId/rows/exportRows", - paramResource("tableId"), + "/api/:sourceId/rows/exportRows", + paramResource("sourceId"), authorized(PermissionType.TABLE, PermissionLevel.WRITE), rowController.exportRows ) diff --git a/packages/server/src/db/utils.ts b/packages/server/src/db/utils.ts index e8dc3b3f6c..abea725707 100644 --- a/packages/server/src/db/utils.ts +++ b/packages/server/src/db/utils.ts @@ -1,5 +1,7 @@ import newid from "./newid" import { db as dbCore } from "@budibase/backend-core" +import { DocumentType, VirtualDocumentType } from "@budibase/types" +export { DocumentType, VirtualDocumentType } from "@budibase/types" type Optional = string | null @@ -19,7 +21,6 @@ export const BudibaseInternalDB = { export const SEPARATOR = dbCore.SEPARATOR export const StaticDatabases = dbCore.StaticDatabases -export const DocumentType = dbCore.DocumentType export const APP_PREFIX = dbCore.APP_PREFIX export const APP_DEV_PREFIX = dbCore.APP_DEV_PREFIX export const isDevAppID = dbCore.isDevAppID @@ -284,11 +285,13 @@ export function getMultiIDParams(ids: string[]) { * @returns {string} The new view ID which the view doc can be stored under. */ export function generateViewID(tableId: string) { - return `${DocumentType.VIEW}${SEPARATOR}${tableId}${SEPARATOR}${newid()}` + return `${ + VirtualDocumentType.VIEW + }${SEPARATOR}${tableId}${SEPARATOR}${newid()}` } export function isViewID(viewId: string) { - return viewId?.split(SEPARATOR)[0] === DocumentType.VIEW + return viewId?.split(SEPARATOR)[0] === VirtualDocumentType.VIEW } export function extractViewInfoFromID(viewId: string) { diff --git a/packages/server/src/utilities/security.ts b/packages/server/src/utilities/security.ts index 54e19007f1..0da7621773 100644 --- a/packages/server/src/utilities/security.ts +++ b/packages/server/src/utilities/security.ts @@ -1,5 +1,5 @@ import { permissions, roles } from "@budibase/backend-core" -import { DocumentType } from "../db/utils" +import { DocumentType, VirtualDocumentType } from "../db/utils" export const CURRENTLY_SUPPORTED_LEVELS: string[] = [ permissions.PermissionLevel.WRITE, @@ -11,10 +11,10 @@ export function getPermissionType(resourceId: string) { const docType = Object.values(DocumentType).filter(docType => resourceId.startsWith(docType) )[0] - switch (docType) { + switch (docType as DocumentType | VirtualDocumentType) { case DocumentType.TABLE: case DocumentType.ROW: - case DocumentType.VIEW: + case VirtualDocumentType.VIEW: return permissions.PermissionType.TABLE case DocumentType.AUTOMATION: return permissions.PermissionType.AUTOMATION diff --git a/packages/types/src/documents/document.ts b/packages/types/src/documents/document.ts index 164aa79ac9..75f55e1367 100644 --- a/packages/types/src/documents/document.ts +++ b/packages/types/src/documents/document.ts @@ -37,6 +37,12 @@ export enum DocumentType { USER_FLAG = "flag", AUTOMATION_METADATA = "meta_au", AUDIT_LOG = "al", + VIEW = "awd", +} + +// these documents don't really exist, they are part of other +// documents or enriched into existence as part of get requests +export enum VirtualDocumentType { VIEW = "view", } From 0abd1deb3492f80b98b0d34a6709254f393020a6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 13:19:22 +0100 Subject: [PATCH 118/183] Updating test cases, fixes based on running through view/row API. --- .../src/api/controllers/row/external.ts | 13 ++-- .../src/api/controllers/row/internal.ts | 23 +++--- .../server/src/api/controllers/row/utils.ts | 10 ++- .../server/src/api/routes/tests/row.spec.ts | 71 ++----------------- .../server/src/middleware/trimViewRowInfo.ts | 31 +++++--- .../server/src/tests/utilities/api/row.ts | 37 ++++++++-- .../server/src/tests/utilities/api/viewV2.ts | 46 ------------ packages/types/src/api/web/app/rows.ts | 2 + 8 files changed, 87 insertions(+), 146 deletions(-) diff --git a/packages/server/src/api/controllers/row/external.ts b/packages/server/src/api/controllers/row/external.ts index 3ee4ca6edd..bc4edbd661 100644 --- a/packages/server/src/api/controllers/row/external.ts +++ b/packages/server/src/api/controllers/row/external.ts @@ -15,6 +15,7 @@ import { UserCtx, } from "@budibase/types" import sdk from "../../../sdk" +import * as utils from "./utils" export async function handleRequest( operation: Operation, @@ -43,7 +44,7 @@ export async function handleRequest( } export async function patch(ctx: UserCtx) { - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const { _id, ...rowData } = ctx.request.body const validateResult = await sdk.rows.utils.validate({ @@ -70,7 +71,7 @@ export async function patch(ctx: UserCtx) { export async function save(ctx: UserCtx) { const inputs = ctx.request.body - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const validateResult = await sdk.rows.utils.validate({ row: inputs, tableId, @@ -98,12 +99,12 @@ export async function save(ctx: UserCtx) { export async function find(ctx: UserCtx) { const id = ctx.params.rowId - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) return sdk.rows.external.getRow(tableId, id) } export async function destroy(ctx: UserCtx) { - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const _id = ctx.request.body._id const { row } = (await handleRequest(Operation.DELETE, tableId, { id: breakRowIdField(_id), @@ -114,7 +115,7 @@ export async function destroy(ctx: UserCtx) { export async function bulkDestroy(ctx: UserCtx) { const { rows } = ctx.request.body - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) let promises: Promise[] = [] for (let row of rows) { promises.push( @@ -130,7 +131,7 @@ export async function bulkDestroy(ctx: UserCtx) { export async function fetchEnrichedRow(ctx: UserCtx) { const id = ctx.params.rowId - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const { datasourceId, tableName } = breakExternalTableId(tableId) const datasource: Datasource = await sdk.datasources.get(datasourceId!) if (!tableName) { diff --git a/packages/server/src/api/controllers/row/internal.ts b/packages/server/src/api/controllers/row/internal.ts index 2ff1df0933..3432ec80f3 100644 --- a/packages/server/src/api/controllers/row/internal.ts +++ b/packages/server/src/api/controllers/row/internal.ts @@ -13,7 +13,7 @@ import { import { FieldTypes } from "../../../constants" import * as utils from "./utils" import { cloneDeep } from "lodash/fp" -import { context, db as dbCore } from "@budibase/backend-core" +import { context } from "@budibase/backend-core" import { finaliseRow, updateRelatedFormula } from "./staticFormula" import { UserCtx, @@ -26,8 +26,8 @@ import { import sdk from "../../../sdk" export async function patch(ctx: UserCtx) { + const tableId = utils.getTableId(ctx) const inputs = ctx.request.body - const tableId = inputs.tableId const isUserTable = tableId === InternalTables.USER_METADATA let oldRow const dbTable = await sdk.tables.getTable(tableId) @@ -94,7 +94,8 @@ export async function patch(ctx: UserCtx) { export async function save(ctx: UserCtx) { let inputs = ctx.request.body - inputs.tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) + inputs.tableId = tableId if (!inputs._rev && !inputs._id) { inputs._id = generateRowID(inputs.tableId) @@ -132,20 +133,22 @@ export async function save(ctx: UserCtx) { } export async function find(ctx: UserCtx) { - const db = dbCore.getDB(ctx.appId) - const table = await sdk.tables.getTable(ctx.params.tableId) - let row = await utils.findRow(ctx, ctx.params.tableId, ctx.params.rowId) + const tableId = utils.getTableId(ctx), + rowId = ctx.params.rowId + const table = await sdk.tables.getTable(tableId) + let row = await utils.findRow(ctx, tableId, rowId) row = await outputProcessing(table, row) return row } export async function destroy(ctx: UserCtx) { const db = context.getAppDB() + const tableId = utils.getTableId(ctx) const { _id } = ctx.request.body let row = await db.get(_id) let _rev = ctx.request.body._rev || row._rev - if (row.tableId !== ctx.params.tableId) { + if (row.tableId !== tableId) { throw "Supplied tableId doesn't match the row's tableId" } const table = await sdk.tables.getTable(row.tableId) @@ -163,7 +166,7 @@ export async function destroy(ctx: UserCtx) { await updateRelatedFormula(table, row) let response - if (ctx.params.tableId === InternalTables.USER_METADATA) { + if (tableId === InternalTables.USER_METADATA) { ctx.params = { id: _id, } @@ -176,7 +179,7 @@ export async function destroy(ctx: UserCtx) { } export async function bulkDestroy(ctx: UserCtx) { - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const table = await sdk.tables.getTable(tableId) let { rows } = ctx.request.body @@ -216,7 +219,7 @@ export async function bulkDestroy(ctx: UserCtx) { export async function fetchEnrichedRow(ctx: UserCtx) { const db = context.getAppDB() - const tableId = ctx.params.tableId + const tableId = utils.getTableId(ctx) const rowId = ctx.params.rowId // need table to work out where links go in row let [table, row] = await Promise.all([ diff --git a/packages/server/src/api/controllers/row/utils.ts b/packages/server/src/api/controllers/row/utils.ts index 6cc342b8a0..157f18e231 100644 --- a/packages/server/src/api/controllers/row/utils.ts +++ b/packages/server/src/api/controllers/row/utils.ts @@ -45,15 +45,19 @@ export async function findRow(ctx: UserCtx, tableId: string, rowId: string) { } export function getTableId(ctx: Ctx) { - if (ctx.request.body?.tableId) { - return ctx.request.body.tableId - } + // top priority, use the URL first if (ctx.params?.sourceId) { return ctx.params.sourceId } + // check body for a table ID + if (ctx.request.body?.tableId) { + return ctx.request.body.tableId + } + // now check for old way of specifying table ID if (ctx.params?.tableId) { return ctx.params.tableId } + // now check if a specific view name if (ctx.params?.viewName) { return ctx.params.viewName } diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 5e1616340f..8d4c9a91fd 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -16,15 +16,12 @@ import { FieldType, SortType, SortOrder, - DeleteRow, } from "@budibase/types" import { expectAnyInternalColsAttributes, generator, structures, } from "@budibase/backend-core/tests" -import trimViewRowInfoMiddleware from "../../../middleware/trimViewRowInfo" -import router from "../row" describe("/rows", () => { let request = setup.getRequest() @@ -393,18 +390,6 @@ describe("/rows", () => { expect(saved.arrayFieldArrayStrKnown).toEqual(["One"]) expect(saved.optsFieldStrKnown).toEqual("Alpha") }) - - it("should throw an error when creating a table row with view id data", async () => { - const res = await request - .post(`/api/${row.tableId}/rows`) - .send({ ...row, _viewId: generator.guid() }) - .set(config.defaultHeaders()) - .expect("Content-Type", /json/) - .expect(400) - expect(res.body.message).toEqual( - "Table row endpoints cannot contain view info" - ) - }) }) describe("patch", () => { @@ -454,25 +439,6 @@ describe("/rows", () => { await assertRowUsage(rowUsage) await assertQueryUsage(queryUsage) }) - - it("should throw an error when creating a table row with view id data", async () => { - const existing = await config.createRow() - - const res = await config.api.row.patch( - table._id!, - { - ...existing, - _id: existing._id!, - _rev: existing._rev!, - tableId: table._id!, - _viewId: generator.guid(), - }, - { expectStatus: 400 } - ) - expect(res.body.message).toEqual( - "Table row endpoints cannot contain view info" - ) - }) }) describe("destroy", () => { @@ -741,7 +707,7 @@ describe("/rows", () => { }) // the environment needs configured for this await setup.switchToSelfHosted(async () => { - context.doInAppContext(config.getAppId(), async () => { + return context.doInAppContext(config.getAppId(), async () => { const enriched = await outputProcessing(table, [row]) expect((enriched as Row[])[0].attachment[0].url).toBe( `/files/signed/prod-budi-app-assets/${config.getProdAppId()}/attachments/${attachmentId}` @@ -847,7 +813,7 @@ describe("/rows", () => { }) const data = randomRowData() - const newRow = await config.api.viewV2.row.create(view.id, { + const newRow = await config.api.row.save(view.id, { tableId: config.table!._id, _viewId: view.id, ...data, @@ -869,16 +835,6 @@ describe("/rows", () => { expect(row.body.age).toBeUndefined() expect(row.body.jobTitle).toBeUndefined() }) - - it("should setup the trimViewRowInfo middleware", async () => { - const route = router.stack.find( - r => - r.methods.includes("POST") && - r.path === "/api/v2/views/:viewId/rows" - ) - expect(route).toBeDefined() - expect(route?.stack).toContainEqual(trimViewRowInfoMiddleware) - }) }) describe("patch", () => { @@ -893,13 +849,13 @@ describe("/rows", () => { }, }) - const newRow = await config.api.viewV2.row.create(view.id, { + const newRow = await config.api.row.save(view.id, { tableId, _viewId: view.id, ...randomRowData(), }) const newData = randomRowData() - await config.api.viewV2.row.update(view.id, newRow._id!, { + await config.api.row.patch(view.id, { tableId, _viewId: view.id, _id: newRow._id!, @@ -922,16 +878,6 @@ describe("/rows", () => { expect(row.body.age).toBeUndefined() expect(row.body.jobTitle).toBeUndefined() }) - - it("should setup the trimViewRowInfo middleware", async () => { - const route = router.stack.find( - r => - r.methods.includes("PATCH") && - r.path === "/api/v2/views/:viewId/rows/:rowId" - ) - expect(route).toBeDefined() - expect(route?.stack).toContainEqual(trimViewRowInfoMiddleware) - }) }) describe("destroy", () => { @@ -950,10 +896,7 @@ describe("/rows", () => { const rowUsage = await getRowUsage() const queryUsage = await getQueryUsage() - const body: DeleteRow = { - _id: createdRow._id!, - } - await config.api.viewV2.row.delete(view.id, body) + await config.api.row.delete(view.id, [createdRow]) await assertRowUsage(rowUsage - 1) await assertQueryUsage(queryUsage + 1) @@ -982,9 +925,7 @@ describe("/rows", () => { const rowUsage = await getRowUsage() const queryUsage = await getQueryUsage() - await config.api.viewV2.row.delete(view.id, { - rows: [rows[0], rows[2]], - }) + await config.api.row.delete(view.id, [rows[0], rows[2]]) await assertRowUsage(rowUsage - 2) await assertQueryUsage(queryUsage + 1) diff --git a/packages/server/src/middleware/trimViewRowInfo.ts b/packages/server/src/middleware/trimViewRowInfo.ts index 763552c3d7..5a207936b2 100644 --- a/packages/server/src/middleware/trimViewRowInfo.ts +++ b/packages/server/src/middleware/trimViewRowInfo.ts @@ -3,26 +3,35 @@ import * as utils from "../db/utils" import sdk from "../sdk" import { db } from "@budibase/backend-core" import { Next } from "koa" +import { getTableId } from "../api/controllers/row/utils" export default async (ctx: Ctx, next: Next) => { const { body } = ctx.request - const { _viewId: viewId } = body + let { _viewId: viewId } = body - const possibleViewId = ctx.params.tableId + const possibleViewId = getTableId(ctx) + if (utils.isViewID(possibleViewId)) { + viewId = possibleViewId + } // nothing to do, it is not a view (just a table ID) - if (!viewId || !utils.isViewID(possibleViewId)) { + if (!viewId) { return next() } - const { tableId } = utils.extractViewInfoFromID(possibleViewId) - const { _viewId, ...trimmedView } = await trimViewFields( - viewId, - tableId, - body - ) - ctx.request.body = trimmedView - ctx.params.tableId = tableId + const { tableId } = utils.extractViewInfoFromID(viewId) + + // don't need to trim delete requests + if (ctx.method.toLowerCase() !== "delete") { + const { _viewId, ...trimmedView } = await trimViewFields( + viewId, + tableId, + body + ) + ctx.request.body = trimmedView + } + + ctx.params.sourceId = tableId return next() } diff --git a/packages/server/src/tests/utilities/api/row.ts b/packages/server/src/tests/utilities/api/row.ts index c7c72368f5..c6ef4606d2 100644 --- a/packages/server/src/tests/utilities/api/row.ts +++ b/packages/server/src/tests/utilities/api/row.ts @@ -1,4 +1,4 @@ -import { PatchRowRequest } from "@budibase/types" +import { PatchRowRequest, SaveRowRequest, Row } from "@budibase/types" import TestConfiguration from "../TestConfiguration" import { TestAPI } from "./base" @@ -8,12 +8,12 @@ export class RowAPI extends TestAPI { } get = async ( - tableId: string, + sourceId: string, rowId: string, { expectStatus } = { expectStatus: 200 } ) => { const request = this.request - .get(`/api/${tableId}/rows/${rowId}`) + .get(`/api/${sourceId}/rows/${rowId}`) .set(this.config.defaultHeaders()) .expect(expectStatus) if (expectStatus !== 404) { @@ -22,16 +22,43 @@ export class RowAPI extends TestAPI { return request } + save = async ( + sourceId: string, + row: SaveRowRequest, + { expectStatus } = { expectStatus: 200 } + ): Promise => { + const resp = await this.request + .post(`/api/${sourceId}/rows`) + .send(row) + .set(this.config.defaultHeaders()) + .expect("Content-Type", /json/) + .expect(expectStatus) + return resp.body as Row + } + patch = async ( - tableId: string, + sourceId: string, row: PatchRowRequest, { expectStatus } = { expectStatus: 200 } ) => { return this.request - .patch(`/api/${tableId}/rows`) + .patch(`/api/${sourceId}/rows`) .send(row) .set(this.config.defaultHeaders()) .expect("Content-Type", /json/) .expect(expectStatus) } + + delete = async ( + sourceId: string, + rows: Row[], + { expectStatus } = { expectStatus: 200 } + ) => { + return this.request + .delete(`/api/${sourceId}/rows`) + .send({ rows }) + .set(this.config.defaultHeaders()) + .expect("Content-Type", /json/) + .expect(expectStatus) + } } diff --git a/packages/server/src/tests/utilities/api/viewV2.ts b/packages/server/src/tests/utilities/api/viewV2.ts index 813d2ebfd1..1520154641 100644 --- a/packages/server/src/tests/utilities/api/viewV2.ts +++ b/packages/server/src/tests/utilities/api/viewV2.ts @@ -1,10 +1,6 @@ import { CreateViewRequest, UpdateViewRequest, - DeleteRowRequest, - PatchRowRequest, - PatchRowResponse, - Row, ViewV2, SearchViewRowRequest, } from "@budibase/types" @@ -90,46 +86,4 @@ export class ViewV2API extends TestAPI { .expect("Content-Type", /json/) .expect(expectStatus) } - - row = { - create: async ( - viewId: string, - row: Row, - { expectStatus } = { expectStatus: 200 } - ): Promise => { - const result = await this.request - .post(`/api/v2/views/${viewId}/rows`) - .send(row) - .set(this.config.defaultHeaders()) - .expect("Content-Type", /json/) - .expect(expectStatus) - return result.body as Row - }, - update: async ( - viewId: string, - rowId: string, - row: PatchRowRequest, - { expectStatus } = { expectStatus: 200 } - ): Promise => { - const result = await this.request - .patch(`/api/v2/views/${viewId}/rows/${rowId}`) - .send(row) - .set(this.config.defaultHeaders()) - .expect("Content-Type", /json/) - .expect(expectStatus) - return result.body as PatchRowResponse - }, - delete: async ( - viewId: string, - body: DeleteRowRequest, - { expectStatus } = { expectStatus: 200 } - ): Promise => { - const result = await this.request - .delete(`/api/v2/views/${viewId}/rows`) - .send(body) - .set(this.config.defaultHeaders()) - .expect(expectStatus) - return result.body - }, - } } diff --git a/packages/types/src/api/web/app/rows.ts b/packages/types/src/api/web/app/rows.ts index f1890ef777..2b51c7b203 100644 --- a/packages/types/src/api/web/app/rows.ts +++ b/packages/types/src/api/web/app/rows.ts @@ -1,6 +1,8 @@ import { SearchParams } from "../../../sdk" import { Row } from "../../../documents" +export interface SaveRowRequest extends Row {} + export interface PatchRowRequest extends Row { _id: string _rev: string From c18459d84d7c8979e5402226b6b189033dd386fc Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 13:43:13 +0100 Subject: [PATCH 119/183] Updating trim view info test case. --- .../middleware/tests/trimViewRowInfo.spec.ts | 27 ++----------------- .../server/src/middleware/trimViewRowInfo.ts | 2 +- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/packages/server/src/middleware/tests/trimViewRowInfo.spec.ts b/packages/server/src/middleware/tests/trimViewRowInfo.spec.ts index 427ac9a608..69d1272df9 100644 --- a/packages/server/src/middleware/tests/trimViewRowInfo.spec.ts +++ b/packages/server/src/middleware/tests/trimViewRowInfo.spec.ts @@ -117,7 +117,7 @@ describe("trimViewRowInfo middleware", () => { }) expect(config.request?.body).toEqual(data) - expect(config.params.tableId).toEqual(table._id) + expect(config.params.sourceId).toEqual(table._id) expect(config.next).toBeCalledTimes(1) expect(config.throw).not.toBeCalled() @@ -143,32 +143,9 @@ describe("trimViewRowInfo middleware", () => { name: data.name, address: data.address, }) - expect(config.params.tableId).toEqual(table._id) + expect(config.params.sourceId).toEqual(table._id) expect(config.next).toBeCalledTimes(1) expect(config.throw).not.toBeCalled() }) - - it("it should throw an error if no viewid is provided on the body", async () => { - const data = getRandomData() - await config.executeMiddleware(viewId, { - ...data, - }) - - expect(config.throw).toBeCalledTimes(1) - expect(config.throw).toBeCalledWith(400, "_viewId is required") - expect(config.next).not.toBeCalled() - }) - - it("it should throw an error if no viewid is provided on the parameters", async () => { - const data = getRandomData() - await config.executeMiddleware(undefined as any, { - _viewId: viewId, - ...data, - }) - - expect(config.throw).toBeCalledTimes(1) - expect(config.throw).toBeCalledWith(400, "viewId path is required") - expect(config.next).not.toBeCalled() - }) }) diff --git a/packages/server/src/middleware/trimViewRowInfo.ts b/packages/server/src/middleware/trimViewRowInfo.ts index 5a207936b2..cff9dabd37 100644 --- a/packages/server/src/middleware/trimViewRowInfo.ts +++ b/packages/server/src/middleware/trimViewRowInfo.ts @@ -22,7 +22,7 @@ export default async (ctx: Ctx, next: Next) => { const { tableId } = utils.extractViewInfoFromID(viewId) // don't need to trim delete requests - if (ctx.method.toLowerCase() !== "delete") { + if (ctx?.method?.toLowerCase() !== "delete") { const { _viewId, ...trimmedView } = await trimViewFields( viewId, tableId, From a220b201fc344275587a589ac31944da7483c81f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 13:45:10 +0100 Subject: [PATCH 120/183] Updating self host single image build --- .github/workflows/release-singleimage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index 1f4a2d0b32..f62e4d2a55 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -9,8 +9,8 @@ env: REGISTRY_URL: registry.hub.docker.com jobs: build-amd64-arm64: - name: "build-amd64" - runs-on: ubuntu-latest + name: "build-amd64-arm64" + runs-on: [self-hosted, dev] strategy: matrix: node-version: [14.x] @@ -74,7 +74,7 @@ jobs: build-aas: name: "build-aas" - runs-on: ubuntu-latest + runs-on: [self-hosted, dev] strategy: matrix: node-version: [14.x] From 73124fab6ae29d8c95a68163f3a6a76ef7b65a76 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 8 Aug 2023 12:45:37 +0000 Subject: [PATCH 121/183] Bump version to 2.9.10 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index fd7dc65c76..7506a3606e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.9", + "version": "2.9.10", "npmClient": "yarn", "packages": [ "packages/*" From 555e066be04b162b7f9c9a1fe72fb60b7520e89e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 13:49:02 +0100 Subject: [PATCH 122/183] Fixing indentation. --- .github/workflows/release-singleimage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index f62e4d2a55..2da80a6b29 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -10,7 +10,7 @@ env: jobs: build-amd64-arm64: name: "build-amd64-arm64" - runs-on: [self-hosted, dev] + runs-on: [self-hosted, dev] strategy: matrix: node-version: [14.x] From 378d3ed40f155855a1903fcc8f630dc567d2e92b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 8 Aug 2023 12:49:40 +0000 Subject: [PATCH 123/183] Bump version to 2.9.11 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 7506a3606e..88644e88d9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.10", + "version": "2.9.11", "npmClient": "yarn", "packages": [ "packages/*" From e4841e8f2c608dff521b723799e813a6a3f48c44 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 8 Aug 2023 15:31:05 +0100 Subject: [PATCH 124/183] Removing the usage of the self hosted runners (unavailable in public repo) and attempting to get working using a Docker manifest in parallel. --- .github/workflows/release-selfhost.yml | 2 +- .github/workflows/release-singleimage.yml | 68 +++++++++++++++++++---- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index 1455f0838f..39ee812726 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -5,7 +5,7 @@ on: jobs: release: - runs-on: [self-hosted, dev] + runs-on: ubuntu-latest steps: - name: Fail if not a tag diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index 2da80a6b29..a46099908b 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -6,14 +6,18 @@ on: env: CI: true PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - REGISTRY_URL: registry.hub.docker.com + REGISTRY_IMAGE: budibase/budibase jobs: - build-amd64-arm64: - name: "build-amd64-arm64" - runs-on: [self-hosted, dev] + build-multiarch: + name: "build-multiarch" + runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x] + node-version: + - 14.x + platform: + - linux/amd64 + - linux/arm64 steps: - name: Fail if not a tag run: | @@ -67,17 +71,61 @@ jobs: uses: docker/build-push-action@v2 with: context: . - push: true - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} tags: budibase/budibase,budibase/budibase:v${{ env.RELEASE_VERSION }} file: ./hosting/single/Dockerfile + outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build-multiarch + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests + path: /tmp/digests + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY_IMAGE }} + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_API_KEY }} + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} build-aas: name: "build-aas" - runs-on: [self-hosted, dev] + runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x] + node-version: + - 14.x steps: - name: Fail if not a tag run: | @@ -101,8 +149,6 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 From 4f5d286f62e5d1c6a9f74c6edd22734f5ae2dddd Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 8 Aug 2023 14:39:04 +0000 Subject: [PATCH 125/183] Bump version to 2.9.12 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 88644e88d9..141491ae69 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.11", + "version": "2.9.12", "npmClient": "yarn", "packages": [ "packages/*" From 00e6a43e3ec2c4968af3fc531ad5aeb465b1d52a Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 8 Aug 2023 16:39:05 +0100 Subject: [PATCH 126/183] Form step and field group require form --- packages/client/manifest.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index b6a231917c..925c87e61d 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2445,6 +2445,7 @@ "name": "Form Step", "icon": "AssetsAdded", "hasChildren": true, + "requiredAncestors": ["form"], "illegalChildren": ["section", "form", "formstep", "formblock"], "styles": ["size"], "size": { @@ -2464,6 +2465,7 @@ "fieldgroup": { "name": "Field Group", "icon": "Group", + "requiredAncestors": ["form"], "illegalChildren": ["section"], "styles": ["size"], "hasChildren": true, From 0bc7a647dfd278b5b5eb125c89e21eb604038932 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 18:42:39 +0300 Subject: [PATCH 127/183] Types via esbuild --- packages/types/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/types/package.json b/packages/types/package.json index 96ab8cb095..317342e760 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "prebuild": "rimraf dist/", - "build": "tsc -p tsconfig.build.json", + "build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "dev:builder": "yarn prebuild && tsc -p tsconfig.json --watch --preserveWatchOutput", "check:types": "tsc -p tsconfig.json --noEmit --paths null" From b882a64ad756fa9d39e25f7cafaed5578b33f653 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 18:45:02 +0300 Subject: [PATCH 128/183] Shared-core via esbuild --- packages/shared-core/package.json | 2 +- packages/shared-core/tsconfig.build.json | 5 ++++- packages/shared-core/tsconfig.json | 9 --------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/shared-core/package.json b/packages/shared-core/package.json index 98ee89999b..61e97ddc76 100644 --- a/packages/shared-core/package.json +++ b/packages/shared-core/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "prebuild": "rimraf dist/", - "build": "tsc -p tsconfig.build.json", + "build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "dev:builder": "yarn prebuild && tsc -p tsconfig.json --watch --preserveWatchOutput", "check:types": "tsc -p tsconfig.json --noEmit --paths null" diff --git a/packages/shared-core/tsconfig.build.json b/packages/shared-core/tsconfig.build.json index 6930e3cb99..804e86c270 100644 --- a/packages/shared-core/tsconfig.build.json +++ b/packages/shared-core/tsconfig.build.json @@ -12,7 +12,10 @@ "declaration": true, "types": ["node"], "outDir": "dist", - "skipLibCheck": true + "skipLibCheck": true, + "paths": { + "@budibase/types": ["../../types/src"] + } }, "include": ["**/*.js", "**/*.ts"], "exclude": [ diff --git a/packages/shared-core/tsconfig.json b/packages/shared-core/tsconfig.json index f72933ff9b..33e37179d7 100644 --- a/packages/shared-core/tsconfig.json +++ b/packages/shared-core/tsconfig.json @@ -1,13 +1,4 @@ { "extends": "./tsconfig.build.json", - "compilerOptions": { - "baseUrl": ".", - "rootDir": "./src", - "composite": true, - "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo", - "paths": { - "@budibase/types": ["../../types/src"] - } - }, "exclude": ["node_modules", "dist"] } From bc5b4297a5e552db92dcd95e85aae7aec08c2da6 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 18:56:07 +0300 Subject: [PATCH 129/183] Backend-core via esbuild --- packages/backend-core/package.json | 2 +- packages/backend-core/plugins.ts | 1 - packages/backend-core/scripts/build.js | 8 ++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) delete mode 100644 packages/backend-core/plugins.ts create mode 100644 packages/backend-core/scripts/build.js diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 4631b090fe..25baccbe53 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -14,7 +14,7 @@ "scripts": { "prebuild": "rimraf dist/", "prepack": "cp package.json dist", - "build": "tsc -p tsconfig.build.json", + "build": "node ./scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly", "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput", "check:types": "tsc -p tsconfig.json --noEmit --paths null", "test": "bash scripts/test.sh", diff --git a/packages/backend-core/plugins.ts b/packages/backend-core/plugins.ts deleted file mode 100644 index 33354eaf64..0000000000 --- a/packages/backend-core/plugins.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src/plugin" diff --git a/packages/backend-core/scripts/build.js b/packages/backend-core/scripts/build.js new file mode 100644 index 0000000000..992513755a --- /dev/null +++ b/packages/backend-core/scripts/build.js @@ -0,0 +1,8 @@ +#!/usr/bin/node +const { join } = require("path") +const fs = require("fs") +const coreBuild = require("../../../scripts/build") + +coreBuild("./src/plugin/index.ts", "./dist/plugins.js") +coreBuild("./src/index.ts", "./dist/index.js") +coreBuild("./tests/index.ts", "./dist/tests.js") From 5ae100d4cc743fa2825f5d8b369ed2ea7f05a6da Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 18:58:50 +0300 Subject: [PATCH 130/183] Remove unneeded nx deps --- packages/cli/package.json | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 99771adbd3..a0c885657c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -63,20 +63,5 @@ "renamer": "^4.0.0", "ts-node": "^10.9.1", "typescript": "4.7.3" - }, - "nx": { - "targets": { - "build": { - "dependsOn": [ - { - "projects": [ - "@budibase/backend-core", - "@budibase/string-templates" - ], - "target": "build" - } - ] - } - } } } From 93654907c303768ddbe67307347fbf9878823a8f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 8 Aug 2023 19:08:57 +0300 Subject: [PATCH 131/183] Bundle bb dependencies in backend-core --- packages/backend-core/tsconfig.build.json | 6 +++++- packages/backend-core/tsconfig.json | 8 -------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/backend-core/tsconfig.build.json b/packages/backend-core/tsconfig.build.json index bfbed31e23..c714f4d942 100644 --- a/packages/backend-core/tsconfig.build.json +++ b/packages/backend-core/tsconfig.build.json @@ -12,7 +12,11 @@ "declaration": true, "types": ["node", "jest"], "outDir": "dist", - "skipLibCheck": true + "skipLibCheck": true, + "paths": { + "@budibase/types": ["../types/src"], + "@budibase/shared-core": ["../shared-core/src"] + } }, "include": ["**/*.js", "**/*.ts"], "exclude": [ diff --git a/packages/backend-core/tsconfig.json b/packages/backend-core/tsconfig.json index 128814b955..33e37179d7 100644 --- a/packages/backend-core/tsconfig.json +++ b/packages/backend-core/tsconfig.json @@ -1,12 +1,4 @@ { "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": true, - "baseUrl": ".", - "paths": { - "@budibase/types": ["../types/src"], - "@budibase/shared-core": ["../shared-core/src"] - } - }, "exclude": ["node_modules", "dist"] } From 22b456da5e2562c4efd2c6148e93aa3746132cb8 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 8 Aug 2023 17:13:40 +0100 Subject: [PATCH 132/183] Allow form step to be bindable --- .../ButtonActionEditor/actions/ChangeFormStep.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte index ca2df71c6d..81a2119474 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte @@ -1,10 +1,12 @@