Renames
This commit is contained in:
parent
afd9ad9d8d
commit
3a095c5071
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
CONSTANT_EXTERNAL_ROW_COLS,
|
CONSTANT_EXTERNAL_ROW_COLS,
|
||||||
CONSTANT_INTERNAL_ROW_COLS,
|
PROTECTED_INTERNAL_COLUMNS,
|
||||||
} from "@budibase/shared-core"
|
} from "@budibase/shared-core"
|
||||||
|
|
||||||
export function expectFunctionWasCalledTimesWith(
|
export function expectFunctionWasCalledTimesWith(
|
||||||
|
@ -14,7 +14,7 @@ export function expectFunctionWasCalledTimesWith(
|
||||||
}
|
}
|
||||||
|
|
||||||
export const expectAnyInternalColsAttributes: {
|
export const expectAnyInternalColsAttributes: {
|
||||||
[K in (typeof CONSTANT_INTERNAL_ROW_COLS)[number]]: any
|
[K in (typeof PROTECTED_INTERNAL_COLUMNS)[number]]: any
|
||||||
} = {
|
} = {
|
||||||
tableId: expect.anything(),
|
tableId: expect.anything(),
|
||||||
type: expect.anything(),
|
type: expect.anything(),
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
SWITCHABLE_TYPES,
|
SWITCHABLE_TYPES,
|
||||||
ValidColumnNameRegex,
|
ValidColumnNameRegex,
|
||||||
helpers,
|
helpers,
|
||||||
CONSTANT_INTERNAL_ROW_COLS,
|
PROTECTED_INTERNAL_COLUMNS,
|
||||||
CONSTANT_EXTERNAL_ROW_COLS,
|
CONSTANT_EXTERNAL_ROW_COLS,
|
||||||
} from "@budibase/shared-core"
|
} from "@budibase/shared-core"
|
||||||
import { createEventDispatcher, getContext, onMount } from "svelte"
|
import { createEventDispatcher, getContext, onMount } from "svelte"
|
||||||
|
@ -490,7 +490,7 @@
|
||||||
const newError = {}
|
const newError = {}
|
||||||
const prohibited = externalTable
|
const prohibited = externalTable
|
||||||
? CONSTANT_EXTERNAL_ROW_COLS
|
? CONSTANT_EXTERNAL_ROW_COLS
|
||||||
: CONSTANT_INTERNAL_ROW_COLS
|
: PROTECTED_INTERNAL_COLUMNS
|
||||||
if (!externalTable && fieldInfo.name?.startsWith("_")) {
|
if (!externalTable && fieldInfo.name?.startsWith("_")) {
|
||||||
newError.name = `Column name cannot start with an underscore.`
|
newError.name = `Column name cannot start with an underscore.`
|
||||||
} else if (fieldInfo.name && !fieldInfo.name.match(ValidColumnNameRegex)) {
|
} else if (fieldInfo.name && !fieldInfo.name.match(ValidColumnNameRegex)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { context, HTTPError } from "@budibase/backend-core"
|
import { context, HTTPError } from "@budibase/backend-core"
|
||||||
import { CONSTANT_INTERNAL_ROW_COLS } from "@budibase/shared-core"
|
import { PROTECTED_INTERNAL_COLUMNS } from "@budibase/shared-core"
|
||||||
import env from "../../../../environment"
|
import env from "../../../../environment"
|
||||||
import { fullSearch, paginatedSearch } from "./utils"
|
import { fullSearch, paginatedSearch } from "./utils"
|
||||||
import { getRowParams, InternalTables } from "../../../../db/utils"
|
import { getRowParams, InternalTables } from "../../../../db/utils"
|
||||||
|
@ -75,7 +75,7 @@ export async function search(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.fields) {
|
if (options.fields) {
|
||||||
const fields = [...options.fields, ...CONSTANT_INTERNAL_ROW_COLS]
|
const fields = [...options.fields, ...PROTECTED_INTERNAL_COLUMNS]
|
||||||
response.rows = response.rows.map((r: any) => pick(r, fields))
|
response.rows = response.rows.map((r: any) => pick(r, fields))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { features } from "@budibase/pro"
|
||||||
import {
|
import {
|
||||||
helpers,
|
helpers,
|
||||||
CONSTANT_EXTERNAL_ROW_COLS,
|
CONSTANT_EXTERNAL_ROW_COLS,
|
||||||
CONSTANT_INTERNAL_ROW_COLS,
|
PROTECTED_INTERNAL_COLUMNS,
|
||||||
} from "@budibase/shared-core"
|
} from "@budibase/shared-core"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ export function allowedFields(view: View | ViewV2) {
|
||||||
return fieldSchema.visible && !fieldSchema.readonly
|
return fieldSchema.visible && !fieldSchema.readonly
|
||||||
}),
|
}),
|
||||||
...CONSTANT_EXTERNAL_ROW_COLS,
|
...CONSTANT_EXTERNAL_ROW_COLS,
|
||||||
...CONSTANT_INTERNAL_ROW_COLS,
|
...PROTECTED_INTERNAL_COLUMNS,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const CONSTANT_INTERNAL_ROW_COLS = [
|
export const PROTECTED_INTERNAL_COLUMNS = [
|
||||||
"_id",
|
"_id",
|
||||||
"_rev",
|
"_rev",
|
||||||
"type",
|
"type",
|
||||||
|
@ -10,5 +10,5 @@ export const CONSTANT_INTERNAL_ROW_COLS = [
|
||||||
export const CONSTANT_EXTERNAL_ROW_COLS = ["_id", "_rev", "tableId"] as const
|
export const CONSTANT_EXTERNAL_ROW_COLS = ["_id", "_rev", "tableId"] as const
|
||||||
|
|
||||||
export function isInternalColumnName(name: string): boolean {
|
export function isInternalColumnName(name: string): boolean {
|
||||||
return (CONSTANT_INTERNAL_ROW_COLS as readonly string[]).includes(name)
|
return (PROTECTED_INTERNAL_COLUMNS as readonly string[]).includes(name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { FieldType, Table } from "@budibase/types"
|
import { FieldType, Table } from "@budibase/types"
|
||||||
import { CONSTANT_INTERNAL_ROW_COLS } from "./constants"
|
import { PROTECTED_INTERNAL_COLUMNS } from "./constants"
|
||||||
|
|
||||||
const allowDisplayColumnByType: Record<FieldType, boolean> = {
|
const allowDisplayColumnByType: Record<FieldType, boolean> = {
|
||||||
[FieldType.STRING]: true,
|
[FieldType.STRING]: true,
|
||||||
|
@ -69,7 +69,7 @@ export function findDuplicateInternalColumns(table: Table): string[] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let internalColumn of CONSTANT_INTERNAL_ROW_COLS) {
|
for (let internalColumn of PROTECTED_INTERNAL_COLUMNS) {
|
||||||
if (casedKeys.find(key => key === internalColumn)) {
|
if (casedKeys.find(key => key === internalColumn)) {
|
||||||
duplicates.push(internalColumn)
|
duplicates.push(internalColumn)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue