diff --git a/packages/cli/src/environment.ts b/packages/cli/src/environment.ts index 9d017f99b2..51f6e9b972 100644 --- a/packages/cli/src/environment.ts +++ b/packages/cli/src/environment.ts @@ -1,3 +1,4 @@ +process.env.DISABLE_PINO_LOGGER = "1" process.env.NO_JS = "1" process.env.JS_BCRYPT = "1" process.env.DISABLE_JWT_WARNING = "1" diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 86a6d2b7b3..317ccea974 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -process.env.DISABLE_PINO_LOGGER = "1" +// have to import this before anything else import "./environment" import { getCommands } from "./options" import { Command } from "commander" diff --git a/packages/cli/start.sh b/packages/cli/start.sh index 9650f0bbfa..ae39f73753 100755 --- a/packages/cli/start.sh +++ b/packages/cli/start.sh @@ -1,3 +1,3 @@ #!/bin/bash dir="$(dirname -- "$(readlink -f "${BASH_SOURCE}")")" -${dir}/node_modules/ts-node/dist/bin.js ${dir}/src/index.ts $@ +${dir}/../../node_modules/ts-node/dist/bin.js ${dir}/src/index.ts $@ diff --git a/packages/server/src/sdk/app/rows/utils.ts b/packages/server/src/sdk/app/rows/utils.ts index a9df4f89cd..777ebff655 100644 --- a/packages/server/src/sdk/app/rows/utils.ts +++ b/packages/server/src/sdk/app/rows/utils.ts @@ -14,7 +14,7 @@ import { makeExternalQuery } from "../../../integrations/base/query" import { Format } from "../../../api/controllers/view/exporters" import sdk from "../.." import { isRelationshipColumn } from "../../../db/utils" -import { SqlClient, isSQL } from "../../../integrations/utils" +import { isSQL, SqlClient } from "../../../integrations/utils" const SQL_CLIENT_SOURCE_MAP: Record = { [SourceName.POSTGRES]: SqlClient.POSTGRES, @@ -144,6 +144,10 @@ export async function validate({ throw new Error("Unable to fetch table for validation") } const errors: Record = {} + const disallowArrayTypes = [ + FieldType.ATTACHMENT_SINGLE, + FieldType.BB_REFERENCE_SINGLE, + ] for (let fieldName of Object.keys(fetchedTable.schema)) { const column = fetchedTable.schema[fieldName] const constraints = cloneDeep(column.constraints) @@ -160,6 +164,10 @@ export async function validate({ if (type === FieldType.OPTIONS && constraints?.inclusion) { constraints.inclusion.push(null as any, "") } + + if (disallowArrayTypes.includes(type) && Array.isArray(row[fieldName])) { + errors[fieldName] = `Cannot accept arrays` + } let res // Validate.js doesn't seem to handle array