From aff286807ce2bdfc394c63a40323a4320a2c2426 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 27 Jul 2023 10:00:56 +0100 Subject: [PATCH 01/57] 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 02/57] 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 546c16f1180bffb3e1f7a42ccd964642d8aaa233 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 17:20:42 +0200 Subject: [PATCH 03/57] 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 04/57] 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 05/57] 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 06/57] 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 07/57] 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 08/57] 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 09/57] 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 10/57] 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 11/57] 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 12/57] 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 13/57] 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 14/57] 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 15/57] 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 16/57] 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 17/57] 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 18/57] 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 19/57] 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 20/57] 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 21/57] 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 22/57] 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 23/57] 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 24/57] 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 b69943c074de1514726e01ac3d1f045d8fc1429e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 2 Aug 2023 15:13:43 +0200 Subject: [PATCH 25/57] 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 26/57] 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 27/57] 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 28/57] 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 29/57] 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 d3470dfcb06ed8ce69e0a3fa3c25d6f163ddeffa Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 12:00:25 +0300 Subject: [PATCH 30/57] 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 4d74a6615fc383599066adec12b078e48c391a98 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 18:22:33 +0300 Subject: [PATCH 31/57] 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 4f08f900ed79f92b9ba5441c99a0a67d8cd10e6a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 4 Aug 2023 18:38:07 +0300 Subject: [PATCH 32/57] 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 33/57] 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 497943930ea4e68ad0a879a0002e0e0abdc264a0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 09:22:39 +0300 Subject: [PATCH 34/57] 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 35/57] 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 36/57] 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 77568af7048cfdd569b9afe30dc83195d43fd21b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:14:18 +0300 Subject: [PATCH 37/57] 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 c60a54bd23df677644f735594216f33cefdd1e90 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 13:50:48 +0300 Subject: [PATCH 38/57] 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 39/57] 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 40/57] 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 41/57] 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 42/57] 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 4bcffd553b6c74ab187fd88fbbf5ceee8c5e1e46 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:26:25 +0000 Subject: [PATCH 43/57] 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 44/57] 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 45/57] 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 768016ce2e234c3be3e5e83ab67458469d391a10 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 7 Aug 2023 14:36:47 +0300 Subject: [PATCH 46/57] 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 47/57] 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 48/57] 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 cb25a0d23a9180b37a8eec54abc905255c81febe Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 11:53:41 +0000 Subject: [PATCH 49/57] 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 3eb31c7a8140b3b63d4aa84214024d519feff25a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 12:28:09 +0000 Subject: [PATCH 50/57] 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 51/57] 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 52/57] 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 1f49db1347b60154af604ad6803fe43846242ebb Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 13:41:18 +0000 Subject: [PATCH 53/57] 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 54/57] 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 07a28fc284c4f1b26730d4bcf74d0a96faa84e99 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 7 Aug 2023 20:33:14 +0000 Subject: [PATCH 55/57] 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 56/57] 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 9f842234dc551fb749f4c0b2b0b5f1bcaa94eca6 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 9 Aug 2023 10:40:10 +0000 Subject: [PATCH 57/57] Bump version to 2.9.19-alpha.0 --- lerna.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index ed343f9d5e..620924d95e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.9.18", + "version": "2.9.19-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" @@ -19,4 +19,4 @@ "loadEnvFiles": false } } -} +} \ No newline at end of file