2022-08-12 18:03:06 +02:00
|
|
|
import postgres from "./postgres"
|
|
|
|
import dynamodb from "./dynamodb"
|
|
|
|
import mongodb from "./mongodb"
|
|
|
|
import elasticsearch from "./elasticsearch"
|
|
|
|
import couchdb from "./couchdb"
|
|
|
|
import sqlServer from "./microsoftSqlServer"
|
|
|
|
import s3 from "./s3"
|
|
|
|
import airtable from "./airtable"
|
|
|
|
import mysql from "./mysql"
|
|
|
|
import arangodb from "./arangodb"
|
|
|
|
import rest from "./rest"
|
|
|
|
import googlesheets from "./googlesheets"
|
|
|
|
import firebase from "./firebase"
|
|
|
|
import redis from "./redis"
|
|
|
|
import snowflake from "./snowflake"
|
|
|
|
import { getPlugins } from "../api/controllers/plugin"
|
|
|
|
import { SourceName, Integration, PluginType } from "@budibase/types"
|
2022-02-10 11:34:50 +01:00
|
|
|
const environment = require("../environment")
|
2022-08-12 18:03:06 +02:00
|
|
|
const { cloneDeep } = require("lodash")
|
2020-11-26 15:43:56 +01:00
|
|
|
|
2022-08-12 18:03:06 +02:00
|
|
|
const DEFINITIONS: { [key: string]: Integration } = {
|
2022-08-11 14:50:05 +02:00
|
|
|
[SourceName.POSTGRES]: postgres.schema,
|
|
|
|
[SourceName.DYNAMODB]: dynamodb.schema,
|
|
|
|
[SourceName.MONGODB]: mongodb.schema,
|
|
|
|
[SourceName.ELASTICSEARCH]: elasticsearch.schema,
|
|
|
|
[SourceName.COUCHDB]: couchdb.schema,
|
|
|
|
[SourceName.SQL_SERVER]: sqlServer.schema,
|
|
|
|
[SourceName.S3]: s3.schema,
|
|
|
|
[SourceName.AIRTABLE]: airtable.schema,
|
|
|
|
[SourceName.MYSQL]: mysql.schema,
|
|
|
|
[SourceName.ARANGODB]: arangodb.schema,
|
|
|
|
[SourceName.REST]: rest.schema,
|
|
|
|
[SourceName.FIRESTORE]: firebase.schema,
|
|
|
|
[SourceName.REDIS]: redis.schema,
|
|
|
|
[SourceName.SNOWFLAKE]: snowflake.schema,
|
2020-11-26 15:43:56 +01:00
|
|
|
}
|
|
|
|
|
2022-08-12 18:03:06 +02:00
|
|
|
const INTEGRATIONS: { [key: string]: any } = {
|
2022-08-11 14:50:05 +02:00
|
|
|
[SourceName.POSTGRES]: postgres.integration,
|
|
|
|
[SourceName.DYNAMODB]: dynamodb.integration,
|
|
|
|
[SourceName.MONGODB]: mongodb.integration,
|
|
|
|
[SourceName.ELASTICSEARCH]: elasticsearch.integration,
|
|
|
|
[SourceName.COUCHDB]: couchdb.integration,
|
|
|
|
[SourceName.SQL_SERVER]: sqlServer.integration,
|
|
|
|
[SourceName.S3]: s3.integration,
|
|
|
|
[SourceName.AIRTABLE]: airtable.integration,
|
|
|
|
[SourceName.MYSQL]: mysql.integration,
|
|
|
|
[SourceName.ARANGODB]: arangodb.integration,
|
|
|
|
[SourceName.REST]: rest.integration,
|
|
|
|
[SourceName.FIRESTORE]: firebase.integration,
|
|
|
|
[SourceName.GOOGLE_SHEETS]: googlesheets.integration,
|
|
|
|
[SourceName.REDIS]: redis.integration,
|
2022-08-12 18:03:06 +02:00
|
|
|
[SourceName.FIRESTORE]: firebase.integration,
|
2022-08-11 14:50:05 +02:00
|
|
|
[SourceName.SNOWFLAKE]: snowflake.integration,
|
2021-11-22 16:26:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// optionally add oracle integration if the oracle binary can be installed
|
2022-07-13 13:37:55 +02:00
|
|
|
if (process.arch && !process.arch.startsWith("arm")) {
|
2021-11-22 16:26:31 +01:00
|
|
|
const oracle = require("./oracle")
|
2022-08-11 14:50:05 +02:00
|
|
|
DEFINITIONS[SourceName.ORACLE] = oracle.schema
|
|
|
|
INTEGRATIONS[SourceName.ORACLE] = oracle.integration
|
2020-11-26 15:43:56 +01:00
|
|
|
}
|
|
|
|
|
2022-03-28 17:46:05 +02:00
|
|
|
if (environment.SELF_HOSTED) {
|
2022-08-11 14:50:05 +02:00
|
|
|
DEFINITIONS[SourceName.GOOGLE_SHEETS] = googlesheets.schema
|
2022-03-28 17:46:05 +02:00
|
|
|
}
|
2022-02-10 11:34:50 +01:00
|
|
|
|
2020-11-26 15:43:56 +01:00
|
|
|
module.exports = {
|
2022-08-12 18:03:06 +02:00
|
|
|
getDefinitions: async () => {
|
2022-08-15 19:38:09 +02:00
|
|
|
const plugins = await getPlugins(PluginType.DATASOURCE)
|
|
|
|
// extract the actual schema from each custom
|
|
|
|
const pluginSchemas: { [key: string]: Integration } = {}
|
|
|
|
for (let plugin of plugins) {
|
|
|
|
const sourceId = plugin.name
|
|
|
|
pluginSchemas[sourceId] = {
|
|
|
|
...plugin.schema["schema"],
|
|
|
|
custom: true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...cloneDeep(DEFINITIONS),
|
|
|
|
...pluginSchemas,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getIntegration: async () => {
|
|
|
|
return INTEGRATIONS
|
2022-08-12 18:03:06 +02:00
|
|
|
},
|
2020-11-26 15:43:56 +01:00
|
|
|
}
|