From c8700394163ef8e8d3f61055c2b334c1bba2d6c4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 24 Jul 2023 16:29:49 +0200 Subject: [PATCH] Refactor plus selector --- packages/server/src/db/utils.ts | 7 +++++++ packages/server/src/sdk/app/datasources/datasources.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/server/src/db/utils.ts b/packages/server/src/db/utils.ts index 266ddeb341..f2cc8618cb 100644 --- a/packages/server/src/db/utils.ts +++ b/packages/server/src/db/utils.ts @@ -186,6 +186,13 @@ export function getDatasourceParams( return getDocParams(DocumentType.DATASOURCE, datasourceId, otherProps) } +export function getDatasourcePlusParams( + datasourceId?: Optional, + otherProps?: { include_docs: boolean } +) { + return getDocParams(DocumentType.DATASOURCE_PLUS, datasourceId, otherProps) +} + /** * Generates a new query ID. * @returns {string} The new query ID which the query doc can be stored under. diff --git a/packages/server/src/sdk/app/datasources/datasources.ts b/packages/server/src/sdk/app/datasources/datasources.ts index 993db04523..9713cea38f 100644 --- a/packages/server/src/sdk/app/datasources/datasources.ts +++ b/packages/server/src/sdk/app/datasources/datasources.ts @@ -19,6 +19,7 @@ import _ from "lodash" import { BudibaseInternalDB, getDatasourceParams, + getDatasourcePlusParams, getTableParams, } from "../../../db/utils" import sdk from "../../index" @@ -248,7 +249,7 @@ export async function getExternalDatasources(): Promise { const db = context.getAppDB() const externalDatasources = await db.allDocs( - getDatasourceParams("plus", { + getDatasourcePlusParams(undefined, { include_docs: true, }) )