@agenticmail/enterprise 0.5.371 → 0.5.372
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.
- package/dist/chunk-CE4XOGCE.js +1727 -0
- package/dist/chunk-DPQWI26Y.js +5101 -0
- package/dist/chunk-P6W565WH.js +106 -0
- package/dist/cli-agent-H3DNHT44.js +2483 -0
- package/dist/cli-recover-4ENZIKE2.js +488 -0
- package/dist/cli-serve-AEW7G6YZ.js +281 -0
- package/dist/cli-verify-Q3NO5XBI.js +149 -0
- package/dist/cli.js +5 -5
- package/dist/dynamodb-INOHMFIV.js +424 -0
- package/dist/factory-XRYYBBCW.js +11 -0
- package/dist/index.js +3 -3
- package/dist/mongodb-WIDW2NQ7.js +320 -0
- package/dist/mysql-HJMQA6KU.js +580 -0
- package/dist/postgres-NW6H7LM5.js +879 -0
- package/dist/{resolve-driver-VQXMFKLJ.js → resolve-driver-CGIO5QM7.js} +8 -1
- package/dist/server-4XD4C4GA.js +28 -0
- package/dist/setup-JLD2NH4N.js +20 -0
- package/dist/sqlite-B4GPOI2J.js +572 -0
- package/dist/turso-VJEIGNZ6.js +501 -0
- package/logs/cloudflared-error.log +30 -0
- package/logs/enterprise-out.log +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// src/db/factory.ts
|
|
2
|
+
var ADAPTER_MAP = {
|
|
3
|
+
postgres: () => import("./postgres-NW6H7LM5.js").then((m) => m.PostgresAdapter),
|
|
4
|
+
supabase: () => import("./postgres-NW6H7LM5.js").then((m) => m.PostgresAdapter),
|
|
5
|
+
// Supabase IS Postgres
|
|
6
|
+
neon: () => import("./postgres-NW6H7LM5.js").then((m) => m.PostgresAdapter),
|
|
7
|
+
// Neon IS Postgres
|
|
8
|
+
cockroachdb: () => import("./postgres-NW6H7LM5.js").then((m) => m.PostgresAdapter),
|
|
9
|
+
// CockroachDB is PG-compatible
|
|
10
|
+
mysql: () => import("./mysql-HJMQA6KU.js").then((m) => m.MysqlAdapter),
|
|
11
|
+
planetscale: () => import("./mysql-HJMQA6KU.js").then((m) => m.MysqlAdapter),
|
|
12
|
+
// PlanetScale IS MySQL
|
|
13
|
+
mongodb: () => import("./mongodb-WIDW2NQ7.js").then((m) => m.MongoAdapter),
|
|
14
|
+
sqlite: () => import("./sqlite-B4GPOI2J.js").then((m) => m.SqliteAdapter),
|
|
15
|
+
turso: () => import("./turso-VJEIGNZ6.js").then((m) => m.TursoAdapter),
|
|
16
|
+
dynamodb: () => import("./dynamodb-INOHMFIV.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 smartDbConfig(connectionString, typeHint) {
|
|
31
|
+
const type = typeHint || (connectionString.startsWith("postgres") ? "postgres" : "sqlite");
|
|
32
|
+
const config = { type, connectionString };
|
|
33
|
+
if (type === "sqlite") return config;
|
|
34
|
+
try {
|
|
35
|
+
const u = new URL(connectionString);
|
|
36
|
+
const host = u.hostname || "";
|
|
37
|
+
const port = u.port || "5432";
|
|
38
|
+
if (host.includes("pooler.supabase.com") || host.includes(".supabase.co")) {
|
|
39
|
+
const projectRef = u.username.replace("postgres.", "");
|
|
40
|
+
if (host.includes("pooler.supabase.com")) {
|
|
41
|
+
const directU = new URL(connectionString);
|
|
42
|
+
directU.hostname = "db." + projectRef + ".supabase.co";
|
|
43
|
+
directU.port = "5432";
|
|
44
|
+
directU.searchParams.delete("pgbouncer");
|
|
45
|
+
config.directUrl = directU.toString();
|
|
46
|
+
if (port === "5432") {
|
|
47
|
+
const fixedU = new URL(connectionString);
|
|
48
|
+
fixedU.port = "6543";
|
|
49
|
+
fixedU.searchParams.set("pgbouncer", "true");
|
|
50
|
+
config.connectionString = fixedU.toString();
|
|
51
|
+
console.log("[db] Auto-optimized: Supabase session mode (5432) \u2192 transaction mode (6543)");
|
|
52
|
+
} else if (!u.searchParams.get("pgbouncer")) {
|
|
53
|
+
const fixedU = new URL(connectionString);
|
|
54
|
+
fixedU.searchParams.set("pgbouncer", "true");
|
|
55
|
+
config.connectionString = fixedU.toString();
|
|
56
|
+
console.log("[db] Auto-configured: Added ?pgbouncer=true for Supabase transaction mode");
|
|
57
|
+
}
|
|
58
|
+
} else if (host.startsWith("db.")) {
|
|
59
|
+
config.directUrl = connectionString;
|
|
60
|
+
console.log("[db] Supabase direct connection detected. For production, use the pooler URL (port 6543).");
|
|
61
|
+
}
|
|
62
|
+
} else if (host.includes(".neon.tech")) {
|
|
63
|
+
if (!host.includes("-pooler")) {
|
|
64
|
+
config.directUrl = connectionString;
|
|
65
|
+
const poolerU = new URL(connectionString);
|
|
66
|
+
const parts = poolerU.hostname.split(".");
|
|
67
|
+
if (parts[0] && !parts[0].endsWith("-pooler")) {
|
|
68
|
+
parts[0] = parts[0] + "-pooler";
|
|
69
|
+
poolerU.hostname = parts.join(".");
|
|
70
|
+
config.connectionString = poolerU.toString();
|
|
71
|
+
console.log("[db] Auto-optimized: Neon direct \u2192 pooler endpoint");
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
const directU = new URL(connectionString);
|
|
75
|
+
const parts = directU.hostname.split(".");
|
|
76
|
+
if (parts[0]) {
|
|
77
|
+
parts[0] = parts[0].replace(/-pooler$/, "");
|
|
78
|
+
directU.hostname = parts.join(".");
|
|
79
|
+
}
|
|
80
|
+
config.directUrl = directU.toString();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
return config;
|
|
86
|
+
}
|
|
87
|
+
function getSupportedDatabases() {
|
|
88
|
+
return [
|
|
89
|
+
{ type: "postgres", label: "PostgreSQL", group: "SQL" },
|
|
90
|
+
{ type: "mysql", label: "MySQL / MariaDB", group: "SQL" },
|
|
91
|
+
{ type: "sqlite", label: "SQLite (embedded, dev/small)", group: "SQL" },
|
|
92
|
+
{ type: "mongodb", label: "MongoDB", group: "NoSQL" },
|
|
93
|
+
{ type: "turso", label: "Turso (LibSQL, edge)", group: "Edge" },
|
|
94
|
+
{ type: "dynamodb", label: "DynamoDB (AWS)", group: "Cloud" },
|
|
95
|
+
{ type: "supabase", label: "Supabase (managed Postgres)", group: "Cloud" },
|
|
96
|
+
{ type: "neon", label: "Neon (serverless Postgres)", group: "Cloud" },
|
|
97
|
+
{ type: "planetscale", label: "PlanetScale (managed MySQL)", group: "Cloud" },
|
|
98
|
+
{ type: "cockroachdb", label: "CockroachDB", group: "Distributed" }
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
createAdapter,
|
|
104
|
+
smartDbConfig,
|
|
105
|
+
getSupportedDatabases
|
|
106
|
+
};
|