1
0
Fork 0
mirror of synced 2024-06-29 19:41:03 +12:00

Merge branch 'master' into reenable-no-undef

This commit is contained in:
Sam Rose 2024-03-20 10:58:42 +00:00 committed by GitHub
commit 89e2b54aaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View file

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

View file

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