@budibase/backend-core 2.13.6 → 2.13.7

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 CHANGED
@@ -2282,6 +2282,22 @@ 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 NOT_FOUND = "not_found";
2292
+ const rows = response.rows.filter((row) => row.error !== NOT_FOUND);
2293
+ const someMissing = rows.length !== response.rows.length;
2294
+ if (!opts?.allowMissing && someMissing) {
2295
+ const missing = response.rows.filter((row) => row.error === NOT_FOUND);
2296
+ const missingIds = missing.map((row) => row.key).join(", ");
2297
+ throw new Error(`Unable to get documents: ${missingIds}`);
2298
+ }
2299
+ return rows.map((row) => row.doc);
2300
+ }
2285
2301
  async remove(idOrDoc, rev) {
2286
2302
  const db = await this.checkSetup();
2287
2303
  let _id;