1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Merge branch 'master' of github.com:budibase/budibase into reenable-no-unused-vars

This commit is contained in:
Sam Rose 2024-03-20 11:46:59 +00:00
commit 4783426b0f
No known key found for this signature in database
14 changed files with 43 additions and 53 deletions

@ -1 +1 @@
Subproject commit d68b4f40f85dba3184da8b9d63ef2cd66d4a8ef2
Subproject commit 8baf8586ec078951230c8466d5f13f9b6d5ed055

View file

@ -23,6 +23,12 @@ const DISABLED_WRITE_CLIENTS: SqlClient[] = [
SqlClient.ORACLE,
]
const DISABLED_OPERATIONS: Operation[] = [
Operation.CREATE_TABLE,
Operation.UPDATE_TABLE,
Operation.DELETE_TABLE,
]
class CharSequence {
static alphabet = "abcdefghijklmnopqrstuvwxyz"
counters: number[]
@ -59,13 +65,18 @@ export default class AliasTables {
}
isAliasingEnabled(json: QueryJson, datasource: Datasource) {
const operation = json.endpoint.operation
const fieldLength = json.resource?.fields?.length
if (!fieldLength || fieldLength <= 0) {
if (
!fieldLength ||
fieldLength <= 0 ||
DISABLED_OPERATIONS.includes(operation)
) {
return false
}
try {
const sqlClient = getSQLClient(datasource)
const isWrite = WRITE_OPERATIONS.includes(json.endpoint.operation)
const isWrite = WRITE_OPERATIONS.includes(operation)
const isDisabledClient = DISABLED_WRITE_CLIENTS.includes(sqlClient)
if (isWrite && isDisabledClient) {
return false

View file

@ -19,6 +19,7 @@ import env from "../../../environment"
import { type App } from "@budibase/types"
import tk from "timekeeper"
import * as uuid from "uuid"
import { structures } from "@budibase/backend-core/tests"
describe("/applications", () => {
let config = setup.getConfig()
@ -356,7 +357,7 @@ describe("/applications", () => {
it("should reject an unknown app id with a 404", async () => {
await config.api.application.duplicateApp(
app.appId.slice(0, -1) + "a",
structures.db.id(),
{
name: "to-dupe 123",
url: "/to-dupe-123",

View file

@ -0,0 +1,10 @@
export default {
preset: "ts-jest",
testEnvironment: "node",
transform: {
"^.+\\.ts?$": "@swc/jest",
},
moduleNameMapper: {
"@budibase/types": "<rootDir>/../types/src",
},
}

View file

@ -11,7 +11,9 @@
"build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly --paths null",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
"test": "jest",
"test:watch": "yarn test --watchAll"
},
"dependencies": {
"@budibase/types": "0.0.0",
@ -20,29 +22,5 @@
"devDependencies": {
"rimraf": "3.0.2",
"typescript": "5.2.2"
},
"nx": {
"targets": {
"build": {
"dependsOn": [
{
"projects": [
"@budibase/types"
],
"target": "build"
}
]
},
"dev": {
"dependsOn": [
{
"projects": [
"@budibase/types"
],
"target": "build"
}
]
}
}
}
}

View file

@ -1,4 +1,3 @@
import { expect, describe, it } from "vitest"
import { cron } from "../helpers"
describe("check valid and invalid crons", () => {

View file

@ -5,7 +5,6 @@ import {
SearchFilter,
} from "@budibase/types"
import { buildLuceneQuery, runLuceneQuery } from "../filters"
import { expect, describe, it, test } from "vitest"
describe("runLuceneQuery", () => {
const docs = [
@ -194,7 +193,7 @@ describe("runLuceneQuery", () => {
expect(runLuceneQuery(docs, query).map(row => row.order_id)).toEqual([2, 3])
})
test.each([[523, 259], "523,259"])(
it.each([[523, 259], "523,259"])(
"should return rows with matches on numeric oneOf filter",
input => {
const query = buildQuery({
@ -209,7 +208,7 @@ describe("runLuceneQuery", () => {
}
)
test.each([
it.each([
[false, []],
[true, [1, 2, 3]],
])("should return %s if allOr is %s ", (allOr, expectedResult) => {

View file

@ -18,13 +18,6 @@
},
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"include": ["**/*.js", "**/*.ts"],
"exclude": [
"node_modules",
"dist",
"**/*.spec.ts",
"**/*.spec.js",
"__mocks__",
"src/tests"
]
"include": ["src/**/*"],
"exclude": ["**/*.spec.ts", "**/*.spec.js", "__mocks__", "src/tests"]
}

View file

@ -1,9 +1,8 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"baseUrl": "..",
"rootDir": "src",
"composite": true
"composite": true,
"types": ["node", "jest"]
},
"exclude": ["node_modules", "dist"]
}

View file

@ -3,7 +3,7 @@
"version": "0.0.0",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"types": "src/index.ts",
"author": "Budibase",
"license": "GPL-3.0",
"scripts": {

View file

@ -7,7 +7,7 @@ import {
ViewTemplateOpts,
} from "../"
import { Writable } from "stream"
import PouchDB from "pouchdb-find"
import type PouchDB from "pouchdb-find"
export enum SearchIndex {
ROWS = "rows",

View file

@ -1,8 +1,6 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "./src",
"composite": true
},
"exclude": ["node_modules", "dist"]

View file

@ -4,10 +4,10 @@ set -e
if [[ -n $CI ]]
then
# Running in ci, where resources are limited
echo "jest --coverage --maxWorkers=2 --forceExit --bail $@"
jest --coverage --maxWorkers=2 --forceExit --bail $@
echo "jest --coverage --maxWorkers=2 --forceExit --bail $@"
jest --coverage --maxWorkers=2 --forceExit --bail $@
else
# --maxWorkers performs better in development
echo "jest --coverage --maxWorkers=2 --forceExit $@"
jest --coverage --maxWorkers=2 --forceExit $@
echo "jest --coverage --detectOpenHandles $@"
jest --coverage --detectOpenHandles $@
fi

View file

@ -6,6 +6,8 @@ import { TestConfiguration } from "../../../tests"
describe("auth", () => {
const config = new TestConfiguration()
afterAll(config.afterAll)
describe("resetUpdate", () => {
it("providing a valid code will update the password", async () => {
await context.doInTenant(structures.tenant.id(), async () => {