From e465422031aad5dbc5d30a934d04469a720ad854 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 16 May 2023 15:08:34 +0200 Subject: [PATCH] Implement connection --- packages/server/src/integrations/firebase.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/firebase.ts b/packages/server/src/integrations/firebase.ts index e8b3c8d92c..3907275f41 100644 --- a/packages/server/src/integrations/firebase.ts +++ b/packages/server/src/integrations/firebase.ts @@ -4,6 +4,7 @@ import { QueryType, IntegrationBase, DatasourceFeature, + ConnectionInfo, } from "@budibase/types" import { Firestore, WhereFilterOp } from "@google-cloud/firestore" @@ -19,7 +20,7 @@ const SCHEMA: Integration = { type: "Non-relational", description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.", - features: [], + features: [DatasourceFeature.CONNECTION_CHECKING], datasource: { email: { type: DatasourceFieldType.STRING, @@ -101,6 +102,18 @@ class FirebaseIntegration implements IntegrationBase { }) } + async testConnection(): Promise { + try { + await this.client.listCollections() + return { connected: true } + } catch (e: any) { + return { + connected: false, + error: e.message as string, + } + } + } + async create(query: { json: object; extra: { [key: string]: string } }) { try { const documentReference = this.client