Update isTable and isView to depend on the ID format.
This commit is contained in:
parent
8dd21e5592
commit
d7ffdf02c2
|
@ -1,5 +1,6 @@
|
|||
import { Table, TableSourceType } from "@budibase/types"
|
||||
import { isExternalTableID } from "../../../integrations/utils"
|
||||
import { docIds } from "@budibase/backend-core"
|
||||
|
||||
export function isExternal(opts: { table?: Table; tableId?: string }): boolean {
|
||||
if (opts.table && opts.table.sourceType === TableSourceType.EXTERNAL) {
|
||||
|
@ -11,5 +12,5 @@ export function isExternal(opts: { table?: Table; tableId?: string }): boolean {
|
|||
}
|
||||
|
||||
export function isTable(table: any): table is Table {
|
||||
return table.type === "table"
|
||||
return table._id && docIds.isTableId(table._id)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
ViewV2ColumnEnriched,
|
||||
ViewV2Enriched,
|
||||
} from "@budibase/types"
|
||||
import { context, HTTPError } from "@budibase/backend-core"
|
||||
import { context, docIds, HTTPError } from "@budibase/backend-core"
|
||||
import {
|
||||
helpers,
|
||||
PROTECTED_EXTERNAL_COLUMNS,
|
||||
|
@ -53,9 +53,7 @@ export async function getTable(view: string | ViewV2): Promise<Table> {
|
|||
}
|
||||
|
||||
export function isView(view: any): view is ViewV2 {
|
||||
return (
|
||||
view.version === 2 && "id" in view && "tableId" in view && "name" in view
|
||||
)
|
||||
return view._id && docIds.isViewId(view._id) && view.version === 2
|
||||
}
|
||||
|
||||
async function guardCalculationViewSchema(
|
||||
|
|
Loading…
Reference in New Issue