@budibase/backend-core 2.13.6 → 2.13.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -0
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/db/couch/DatabaseImpl.d.ts +4 -1
- package/dist/src/db/couch/DatabaseImpl.js +26 -0
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -1
- package/dist/src/redis/redis.js +0 -1
- package/dist/src/redis/redis.js.map +1 -1
- package/package.json +4 -4
- package/src/db/couch/DatabaseImpl.ts +31 -1
- package/src/redis/redis.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -2282,6 +2282,27 @@ var init_DatabaseImpl = __esm({
|
|
|
2282
2282
|
}
|
|
2283
2283
|
return this.updateOutput(() => db.get(id));
|
|
2284
2284
|
}
|
|
2285
|
+
async getMultiple(ids, opts) {
|
|
2286
|
+
ids = [...new Set(ids)];
|
|
2287
|
+
const response = await this.allDocs({
|
|
2288
|
+
keys: ids,
|
|
2289
|
+
include_docs: true
|
|
2290
|
+
});
|
|
2291
|
+
const rowUnavailable = (row) => {
|
|
2292
|
+
if (row.doc == null || "deleted" in row.value && row.value.deleted) {
|
|
2293
|
+
return true;
|
|
2294
|
+
}
|
|
2295
|
+
return row.error === "not_found";
|
|
2296
|
+
};
|
|
2297
|
+
const rows = response.rows.filter((row) => !rowUnavailable(row));
|
|
2298
|
+
const someMissing = rows.length !== response.rows.length;
|
|
2299
|
+
if (!opts?.allowMissing && someMissing) {
|
|
2300
|
+
const missing = response.rows.filter((row) => rowUnavailable(row));
|
|
2301
|
+
const missingIds = missing.map((row) => row.key).join(", ");
|
|
2302
|
+
throw new Error(`Unable to get documents: ${missingIds}`);
|
|
2303
|
+
}
|
|
2304
|
+
return rows.map((row) => row.doc);
|
|
2305
|
+
}
|
|
2285
2306
|
async remove(idOrDoc, rev) {
|
|
2286
2307
|
const db = await this.checkSetup();
|
|
2287
2308
|
let _id;
|