allow users to select firestore databases other than the default

This commit is contained in:
andz-bb 2024-12-19 16:24:55 +00:00
parent 59a98ec0cb
commit 2d7ef6cee4
1 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ interface FirebaseConfig {
email: string email: string
privateKey: string privateKey: string
projectId: string projectId: string
databaseId?: string
} }
const SCHEMA: Integration = { const SCHEMA: Integration = {
@ -30,12 +31,21 @@ const SCHEMA: Integration = {
}, },
privateKey: { privateKey: {
type: DatasourceFieldType.STRING, type: DatasourceFieldType.STRING,
display: "Private Key",
required: true, required: true,
}, },
projectId: { projectId: {
type: DatasourceFieldType.STRING, type: DatasourceFieldType.STRING,
display: "Project ID",
required: true, required: true,
}, },
databaseId: {
type: DatasourceFieldType.STRING,
display: "Database ID",
required: false,
default: "(default)",
placeholder: "(default)",
},
}, },
query: { query: {
create: { create: {
@ -97,6 +107,7 @@ class FirebaseIntegration implements IntegrationBase {
this.config = config this.config = config
this.client = new Firestore({ this.client = new Firestore({
projectId: config.projectId, projectId: config.projectId,
databaseId: config.databaseId || "(default)",
credentials: { credentials: {
client_email: config.email, client_email: config.email,
private_key: config.privateKey?.replace(/\\n/g, "\n"), private_key: config.privateKey?.replace(/\\n/g, "\n"),