@agenticmail/enterprise 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ // src/db/factory.ts
2
+ var ADAPTER_MAP = {
3
+ postgres: () => import("./postgres-LN7A6MGQ.js").then((m) => m.PostgresAdapter),
4
+ supabase: () => import("./postgres-LN7A6MGQ.js").then((m) => m.PostgresAdapter),
5
+ // Supabase IS Postgres
6
+ neon: () => import("./postgres-LN7A6MGQ.js").then((m) => m.PostgresAdapter),
7
+ // Neon IS Postgres
8
+ cockroachdb: () => import("./postgres-LN7A6MGQ.js").then((m) => m.PostgresAdapter),
9
+ // CockroachDB is PG-compatible
10
+ mysql: () => import("./mysql-RM3S2FV5.js").then((m) => m.MysqlAdapter),
11
+ planetscale: () => import("./mysql-RM3S2FV5.js").then((m) => m.MysqlAdapter),
12
+ // PlanetScale IS MySQL
13
+ mongodb: () => import("./mongodb-ODTXIVPV.js").then((m) => m.MongoAdapter),
14
+ sqlite: () => import("./sqlite-VLKVAJA4.js").then((m) => m.SqliteAdapter),
15
+ turso: () => import("./turso-LDWODSDI.js").then((m) => m.TursoAdapter),
16
+ dynamodb: () => import("./dynamodb-CCGL2E77.js").then((m) => m.DynamoAdapter)
17
+ };
18
+ async function createAdapter(config) {
19
+ const loader = ADAPTER_MAP[config.type];
20
+ if (!loader) {
21
+ throw new Error(
22
+ `Unsupported database type: "${config.type}". Supported: ${Object.keys(ADAPTER_MAP).join(", ")}`
23
+ );
24
+ }
25
+ const AdapterClass = await loader();
26
+ const adapter = new AdapterClass();
27
+ await adapter.connect(config);
28
+ return adapter;
29
+ }
30
+ function getSupportedDatabases() {
31
+ return [
32
+ { type: "postgres", label: "PostgreSQL", group: "SQL" },
33
+ { type: "mysql", label: "MySQL / MariaDB", group: "SQL" },
34
+ { type: "sqlite", label: "SQLite (embedded, dev/small)", group: "SQL" },
35
+ { type: "mongodb", label: "MongoDB", group: "NoSQL" },
36
+ { type: "turso", label: "Turso (LibSQL, edge)", group: "Edge" },
37
+ { type: "dynamodb", label: "DynamoDB (AWS)", group: "Cloud" },
38
+ { type: "supabase", label: "Supabase (managed Postgres)", group: "Cloud" },
39
+ { type: "neon", label: "Neon (serverless Postgres)", group: "Cloud" },
40
+ { type: "planetscale", label: "PlanetScale (managed MySQL)", group: "Cloud" },
41
+ { type: "cockroachdb", label: "CockroachDB", group: "Distributed" }
42
+ ];
43
+ }
44
+
45
+ export {
46
+ createAdapter,
47
+ getSupportedDatabases
48
+ };