|
|
|
@ -11,7 +11,6 @@ module Firebase { |
|
|
|
email: string |
|
|
|
privateKey: string |
|
|
|
projectId: string |
|
|
|
serviceAccount?: string |
|
|
|
} |
|
|
|
|
|
|
|
const SCHEMA: Integration = { |
|
|
|
@ -32,10 +31,6 @@ module Firebase { |
|
|
|
type: DatasourceFieldTypes.STRING, |
|
|
|
required: true, |
|
|
|
}, |
|
|
|
serviceAccount: { |
|
|
|
type: DatasourceFieldTypes.JSON, |
|
|
|
required: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
query: { |
|
|
|
create: { |
|
|
|
@ -96,24 +91,13 @@ module Firebase { |
|
|
|
|
|
|
|
constructor(config: FirebaseConfig) { |
|
|
|
this.config = config |
|
|
|
if (config.serviceAccount) { |
|
|
|
const serviceAccount = JSON.parse(config.serviceAccount) |
|
|
|
this.client = new Firestore({ |
|
|
|
projectId: serviceAccount.project_id, |
|
|
|
credentials: { |
|
|
|
client_email: serviceAccount.client_email, |
|
|
|
private_key: serviceAccount.private_key, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.client = new Firestore({ |
|
|
|
projectId: config.projectId, |
|
|
|
credentials: { |
|
|
|
client_email: config.email, |
|
|
|
private_key: config.privateKey, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
this.client = new Firestore({ |
|
|
|
projectId: config.projectId, |
|
|
|
credentials: { |
|
|
|
client_email: config.email, |
|
|
|
private_key: config.privateKey, |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
async create(query: { json: object; extra: { [key: string]: string } }) { |
|
|
|
|