Merge branch 'master' into BUDI-8281/update-view-column-ui
This commit is contained in:
commit
ed506d0bb2
|
@ -40,7 +40,7 @@
|
|||
"build:oss": "NODE_OPTIONS=--max-old-space-size=1500 lerna run build --stream --ignore @budibase/account-portal --ignore @budibase/account-portal-server --ignore @budibase/account-portal-ui",
|
||||
"build:account-portal": "NODE_OPTIONS=--max-old-space-size=1500 lerna run build --stream --scope @budibase/account-portal --scope @budibase/account-portal-server --scope @budibase/account-portal-ui",
|
||||
"build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput",
|
||||
"check:types": "lerna run check:types",
|
||||
"check:types": "lerna run --concurrency 2 check:types",
|
||||
"build:sdk": "lerna run --stream build:sdk",
|
||||
"deps:circular": "madge packages/server/dist/index.js packages/worker/src/index.ts packages/backend-core/dist/src/index.js packages/cli/src/index.js --circular",
|
||||
"release": "lerna publish from-package --yes --force-publish --no-git-tag-version --no-push --no-git-reset",
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { Knex, knex } from "knex"
|
||||
import * as dbCore from "../db"
|
||||
import { isIsoDateString, isValidFilter, getNativeSql } from "./utils"
|
||||
import {
|
||||
isIsoDateString,
|
||||
isValidFilter,
|
||||
getNativeSql,
|
||||
isExternalTable,
|
||||
} from "./utils"
|
||||
import { SqlStatements } from "./sqlStatements"
|
||||
import SqlTableQueryBuilder from "./sqlTable"
|
||||
import {
|
||||
|
@ -21,6 +26,7 @@ import {
|
|||
SqlClient,
|
||||
QueryOptions,
|
||||
JsonTypes,
|
||||
prefixed,
|
||||
} from "@budibase/types"
|
||||
import environment from "../environment"
|
||||
import { helpers } from "@budibase/shared-core"
|
||||
|
@ -391,6 +397,16 @@ class InternalBuilder {
|
|||
contains(filters.containsAny, true)
|
||||
}
|
||||
|
||||
// when searching internal tables make sure long looking for rows
|
||||
if (filters.documentType && !isExternalTable(table)) {
|
||||
const tableRef = opts?.aliases?.[table._id!] || table._id
|
||||
// has to be its own option, must always be AND onto the search
|
||||
query.andWhereLike(
|
||||
`${tableRef}._id`,
|
||||
`${prefixed(filters.documentType)}%`
|
||||
)
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
||||
|
@ -592,6 +608,7 @@ class InternalBuilder {
|
|||
query = this.addFilters(query, filters, json.meta.table, {
|
||||
aliases: tableAliases,
|
||||
})
|
||||
|
||||
// add sorting to pre-query
|
||||
query = this.addSorting(query, json)
|
||||
const alias = tableAliases?.[tableName] || tableName
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
DocumentType,
|
||||
FieldType,
|
||||
Operation,
|
||||
QueryJson,
|
||||
|
@ -148,7 +149,10 @@ export async function search(
|
|||
entityId: table._id!,
|
||||
operation: Operation.READ,
|
||||
},
|
||||
filters: cleanupFilters(query, allTables),
|
||||
filters: {
|
||||
...cleanupFilters(query, allTables),
|
||||
documentType: DocumentType.ROW,
|
||||
},
|
||||
table,
|
||||
meta: {
|
||||
table,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Operation, SortDirection } from "./datasources"
|
||||
import { Row, Table } from "../documents"
|
||||
import { Row, Table, DocumentType } from "../documents"
|
||||
import { SortType } from "../api"
|
||||
import { Knex } from "knex"
|
||||
|
||||
|
@ -62,11 +62,15 @@ export interface SearchFilters {
|
|||
[SearchFilterOperator.CONTAINS_ANY]?: {
|
||||
[key: string]: any[]
|
||||
}
|
||||
// specific to SQS/SQLite search on internal tables this can be used
|
||||
// to make sure the documents returned are always filtered down to a
|
||||
// specific document type (such as just rows)
|
||||
documentType?: DocumentType
|
||||
}
|
||||
|
||||
export type SearchFilterKey = keyof Omit<
|
||||
SearchFilters,
|
||||
"allOr" | "onEmptyFilter" | "fuzzyOr"
|
||||
"allOr" | "onEmptyFilter" | "fuzzyOr" | "documentType"
|
||||
>
|
||||
|
||||
export type SearchQueryFields = Omit<SearchFilters, "allOr" | "onEmptyFilter">
|
||||
|
|
Loading…
Reference in New Issue