Merge branch 'master' into feature/toggle-all-formblock-fields
This commit is contained in:
commit
83e5a2c144
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.13.7",
|
||||
"version": "2.13.9",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
DatabaseDeleteIndexOpts,
|
||||
Document,
|
||||
isDocument,
|
||||
RowResponse,
|
||||
} from "@budibase/types"
|
||||
import { getCouchInfo } from "./connections"
|
||||
import { directCouchUrlCall } from "./utils"
|
||||
|
@ -127,12 +128,19 @@ export class DatabaseImpl implements Database {
|
|||
keys: ids,
|
||||
include_docs: true,
|
||||
})
|
||||
const NOT_FOUND = "not_found"
|
||||
const rows = response.rows.filter(row => row.error !== NOT_FOUND)
|
||||
const rowUnavailable = (row: RowResponse<T>) => {
|
||||
// row is deleted - key lookup can return this
|
||||
if (row.doc == null || ("deleted" in row.value && row.value.deleted)) {
|
||||
return true
|
||||
}
|
||||
return row.error === "not_found"
|
||||
}
|
||||
|
||||
const rows = response.rows.filter(row => !rowUnavailable(row))
|
||||
const someMissing = rows.length !== response.rows.length
|
||||
// some were filtered out - means some missing
|
||||
if (!opts?.allowMissing && someMissing) {
|
||||
const missing = response.rows.filter(row => row.error === NOT_FOUND)
|
||||
const missing = response.rows.filter(row => rowUnavailable(row))
|
||||
const missingIds = missing.map(row => row.key).join(", ")
|
||||
throw new Error(`Unable to get documents: ${missingIds}`)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ const DEFAULT_SELECT_DB = SelectableDatabase.DEFAULT
|
|||
// for testing just generate the client once
|
||||
let CLOSED = false
|
||||
let CLIENTS: { [key: number]: any } = {}
|
||||
0
|
||||
let CONNECTED = false
|
||||
|
||||
// mock redis always connected
|
||||
|
|
Loading…
Reference in New Issue