Merge pull request #10610 from Budibase/budi-6932/check_firestore
Implement firestore connection checks
This commit is contained in:
commit
70b809e4f7
|
@ -4,6 +4,7 @@ import {
|
||||||
QueryType,
|
QueryType,
|
||||||
IntegrationBase,
|
IntegrationBase,
|
||||||
DatasourceFeature,
|
DatasourceFeature,
|
||||||
|
ConnectionInfo,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { Firestore, WhereFilterOp } from "@google-cloud/firestore"
|
import { Firestore, WhereFilterOp } from "@google-cloud/firestore"
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ const SCHEMA: Integration = {
|
||||||
type: "Non-relational",
|
type: "Non-relational",
|
||||||
description:
|
description:
|
||||||
"Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
"Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
||||||
features: [],
|
features: [DatasourceFeature.CONNECTION_CHECKING],
|
||||||
datasource: {
|
datasource: {
|
||||||
email: {
|
email: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
@ -101,6 +102,18 @@ class FirebaseIntegration implements IntegrationBase {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async testConnection(): Promise<ConnectionInfo> {
|
||||||
|
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 } }) {
|
async create(query: { json: object; extra: { [key: string]: string } }) {
|
||||||
try {
|
try {
|
||||||
const documentReference = this.client
|
const documentReference = this.client
|
||||||
|
|
Loading…
Reference in New Issue