diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/Redis.svelte b/packages/builder/src/components/backend/DatasourceNavigator/icons/Redis.svelte new file mode 100644 index 0000000000..d325782fd5 --- /dev/null +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/Redis.svelte @@ -0,0 +1,49 @@ + + + + + + + + + + + + + diff --git a/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js b/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js index 515f20a93b..1a8df2507e 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js +++ b/packages/builder/src/components/backend/DatasourceNavigator/icons/index.js @@ -13,6 +13,7 @@ import Budibase from "./Budibase.svelte" import Oracle from "./Oracle.svelte" import GoogleSheets from "./GoogleSheets.svelte" import Firebase from "./Firebase.svelte" +import Redis from "./Redis.svelte" export default { BUDIBASE: Budibase, @@ -30,4 +31,5 @@ export default { ORACLE: Oracle, GOOGLE_SHEETS: GoogleSheets, FIREBASE: Firebase, + REDIS: Redis, } diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index 9a623241ca..2f5f26e476 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -179,6 +179,7 @@ export const IntegrationTypes = { INTERNAL: "INTERNAL", GOOGLE_SHEETS: "GOOGLE_SHEETS", FIREBASE: "FIREBASE", + REDIS: "REDIS", } export const IntegrationNames = { @@ -197,6 +198,7 @@ export const IntegrationNames = { [IntegrationTypes.INTERNAL]: "Internal", [IntegrationTypes.GOOGLE_SHEETS]: "Google Sheets", [IntegrationTypes.FIREBASE]: "Firebase", + [IntegrationTypes.REDIS]: "Redis", } export const SchemaTypeOptions = [ diff --git a/packages/server/src/definitions/datasource.ts b/packages/server/src/definitions/datasource.ts index 4df08683f0..23266991ee 100644 --- a/packages/server/src/definitions/datasource.ts +++ b/packages/server/src/definitions/datasource.ts @@ -49,6 +49,7 @@ export enum SourceNames { ORACLE = "ORACLE", GOOGLE_SHEETS = "GOOGLE_SHEETS", FIREBASE = "FIREBASE", + REDIS = "REDIS", } export enum IncludeRelationships { diff --git a/packages/server/src/integrations/index.ts b/packages/server/src/integrations/index.ts index 0a892d7317..711e9d2262 100644 --- a/packages/server/src/integrations/index.ts +++ b/packages/server/src/integrations/index.ts @@ -11,6 +11,7 @@ const arangodb = require("./arangodb") const rest = require("./rest") const googlesheets = require("./googlesheets") const firebase = require("./firebase") +const redis = require("./redis") const { SourceNames } = require("../definitions/datasource") const environment = require("../environment") @@ -27,6 +28,7 @@ const DEFINITIONS = { [SourceNames.ARANGODB]: arangodb.schema, [SourceNames.REST]: rest.schema, [SourceNames.FIREBASE]: firebase.schema, + [SourceNames.REDIS]: redis.schema, } const INTEGRATIONS = { @@ -43,6 +45,7 @@ const INTEGRATIONS = { [SourceNames.REST]: rest.integration, [SourceNames.FIREBASE]: firebase.integration, [SourceNames.GOOGLE_SHEETS]: googlesheets.integration, + [SourceNames.REDIS]: redis.integration, } // optionally add oracle integration if the oracle binary can be installed diff --git a/packages/server/src/integrations/redis.ts b/packages/server/src/integrations/redis.ts new file mode 100644 index 0000000000..1ec0179b15 --- /dev/null +++ b/packages/server/src/integrations/redis.ts @@ -0,0 +1,61 @@ +import { Integration, QueryTypes } from "../definitions/datasource" +import { IntegrationBase } from "./base/IntegrationBase" + +module RedisModule { + const redis = require("ioredis") + + interface RedisConfig { + host: string + port: number + username: string + password?: string + } + + const SCHEMA: Integration = { + docs: "https://redis.io/docs/", + description: "", + friendlyName: "Redis", + datasource: { + host: { + type: "string", + required: true, + default: "localhost", + }, + port: { + type: "number", + required: true, + default: 6379, + }, + username: { + type: "string", + required: false, + }, + password: { + type: "password", + required: false, + }, + }, + query: { + read: { + type: QueryTypes.JSON, + }, + }, + } + + class RedisIntegration implements IntegrationBase { + private readonly config: RedisConfig + private client: any + + constructor(config: RedisConfig) { + this.config = config + this.client = {} + } + + async read(query: { bucket: string }) {} + } + + module.exports = { + schema: SCHEMA, + integration: RedisIntegration, + } +}