@agenticmail/enterprise 0.5.3 → 0.5.4
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-PQADDAC2.js → chunk-VRRCELRN.js} +43 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{setup-RCYNX5NA.js → setup-WUDZZ25K.js} +1 -1
- package/package.json +1 -1
- package/src/setup/index.ts +47 -0
- package/dist/chunk-ANW4OHXR.js +0 -764
- package/dist/chunk-E23VJ3QX.js +0 -9427
- package/dist/chunk-EOBN6RCA.js +0 -12652
- package/dist/chunk-HAUHDCUB.js +0 -764
- package/dist/chunk-HSF6OJ5Z.js +0 -154
- package/dist/chunk-SMUXH6FM.js +0 -1943
- package/dist/chunk-V2YIXYDJ.js +0 -1943
- package/dist/cli-recover-SSGGSKZJ.js +0 -97
- package/dist/cli-verify-V3GPFMWU.js +0 -98
- package/dist/domain-lock-URIFILHB.js +0 -7
- package/dist/routes-NJK5OI5N.js +0 -5673
- package/dist/runtime-SMA6JUMP.js +0 -46
- package/dist/server-OGQWCOT6.js +0 -11
- package/dist/server-ZT5NWHT4.js +0 -11
- package/dist/setup-5CVRQ5ES.js +0 -20
- package/dist/setup-HCMMUEW6.js +0 -20
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
getSupportedDatabases
|
|
3
3
|
} from "./chunk-NTVN3JHS.js";
|
|
4
4
|
|
|
5
|
+
// src/setup/index.ts
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
|
|
5
8
|
// src/setup/company.ts
|
|
6
9
|
function toSlug(name) {
|
|
7
10
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 63);
|
|
@@ -715,6 +718,45 @@ function printCustomDomainInstructions(chalk, domain, target, cnameTarget) {
|
|
|
715
718
|
}
|
|
716
719
|
|
|
717
720
|
// src/setup/index.ts
|
|
721
|
+
var DB_DRIVER_MAP = {
|
|
722
|
+
postgres: ["pg"],
|
|
723
|
+
supabase: ["pg"],
|
|
724
|
+
neon: ["pg"],
|
|
725
|
+
cockroachdb: ["pg"],
|
|
726
|
+
mysql: ["mysql2"],
|
|
727
|
+
planetscale: ["mysql2"],
|
|
728
|
+
mongodb: ["mongodb"],
|
|
729
|
+
sqlite: ["better-sqlite3"],
|
|
730
|
+
turso: ["@libsql/client"],
|
|
731
|
+
dynamodb: ["@aws-sdk/client-dynamodb", "@aws-sdk/lib-dynamodb"]
|
|
732
|
+
};
|
|
733
|
+
async function ensureDbDriver(dbType, ora, chalk) {
|
|
734
|
+
const packages = DB_DRIVER_MAP[dbType];
|
|
735
|
+
if (!packages?.length) return;
|
|
736
|
+
const missing = [];
|
|
737
|
+
for (const pkg of packages) {
|
|
738
|
+
try {
|
|
739
|
+
await import(pkg);
|
|
740
|
+
} catch {
|
|
741
|
+
missing.push(pkg);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (!missing.length) return;
|
|
745
|
+
const spinner = ora(`Installing database driver: ${missing.join(", ")}...`).start();
|
|
746
|
+
try {
|
|
747
|
+
execSync(`npm install --no-save ${missing.join(" ")}`, {
|
|
748
|
+
stdio: "pipe",
|
|
749
|
+
timeout: 12e4
|
|
750
|
+
});
|
|
751
|
+
spinner.succeed(`Database driver installed: ${missing.join(", ")}`);
|
|
752
|
+
} catch (err) {
|
|
753
|
+
spinner.fail(`Failed to install ${missing.join(", ")}`);
|
|
754
|
+
console.error(chalk.red(`
|
|
755
|
+
Run manually: npm install ${missing.join(" ")}
|
|
756
|
+
`));
|
|
757
|
+
process.exit(1);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
718
760
|
async function runSetupWizard() {
|
|
719
761
|
const { default: inquirer } = await import("inquirer");
|
|
720
762
|
const { default: ora } = await import("ora");
|
|
@@ -737,6 +779,7 @@ async function runSetupWizard() {
|
|
|
737
779
|
company.companyName,
|
|
738
780
|
company.adminEmail
|
|
739
781
|
);
|
|
782
|
+
await ensureDbDriver(database.type, ora, chalk);
|
|
740
783
|
console.log("");
|
|
741
784
|
console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
742
785
|
console.log("");
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/src/setup/index.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* → Provision (setup/provision.ts)
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { execSync } from 'child_process';
|
|
17
18
|
import { promptCompanyInfo } from './company.js';
|
|
18
19
|
import { promptDatabase } from './database.js';
|
|
19
20
|
import { promptDeployment } from './deployment.js';
|
|
@@ -34,6 +35,49 @@ export type { DomainSelection } from './domain.js';
|
|
|
34
35
|
export type { RegistrationSelection } from './registration.js';
|
|
35
36
|
export type { ProvisionConfig, ProvisionResult } from './provision.js';
|
|
36
37
|
|
|
38
|
+
// ─── DB Driver Requirements ──────────────────────
|
|
39
|
+
|
|
40
|
+
const DB_DRIVER_MAP: Record<string, string[]> = {
|
|
41
|
+
postgres: ['pg'],
|
|
42
|
+
supabase: ['pg'],
|
|
43
|
+
neon: ['pg'],
|
|
44
|
+
cockroachdb: ['pg'],
|
|
45
|
+
mysql: ['mysql2'],
|
|
46
|
+
planetscale: ['mysql2'],
|
|
47
|
+
mongodb: ['mongodb'],
|
|
48
|
+
sqlite: ['better-sqlite3'],
|
|
49
|
+
turso: ['@libsql/client'],
|
|
50
|
+
dynamodb: ['@aws-sdk/client-dynamodb', '@aws-sdk/lib-dynamodb'],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
async function ensureDbDriver(dbType: string, ora: any, chalk: any): Promise<void> {
|
|
54
|
+
const packages = DB_DRIVER_MAP[dbType];
|
|
55
|
+
if (!packages?.length) return;
|
|
56
|
+
|
|
57
|
+
const missing: string[] = [];
|
|
58
|
+
for (const pkg of packages) {
|
|
59
|
+
try {
|
|
60
|
+
await import(pkg);
|
|
61
|
+
} catch {
|
|
62
|
+
missing.push(pkg);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!missing.length) return;
|
|
66
|
+
|
|
67
|
+
const spinner = ora(`Installing database driver: ${missing.join(', ')}...`).start();
|
|
68
|
+
try {
|
|
69
|
+
execSync(`npm install --no-save ${missing.join(' ')}`, {
|
|
70
|
+
stdio: 'pipe',
|
|
71
|
+
timeout: 120_000,
|
|
72
|
+
});
|
|
73
|
+
spinner.succeed(`Database driver installed: ${missing.join(', ')}`);
|
|
74
|
+
} catch (err: any) {
|
|
75
|
+
spinner.fail(`Failed to install ${missing.join(', ')}`);
|
|
76
|
+
console.error(chalk.red(`\n Run manually: npm install ${missing.join(' ')}\n`));
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
37
81
|
/**
|
|
38
82
|
* Run the full interactive setup wizard.
|
|
39
83
|
* Returns when provisioning is complete (or the local server is running).
|
|
@@ -72,6 +116,9 @@ export async function runSetupWizard(): Promise<void> {
|
|
|
72
116
|
company.adminEmail,
|
|
73
117
|
);
|
|
74
118
|
|
|
119
|
+
// ─── Install DB driver if needed ───────────────
|
|
120
|
+
await ensureDbDriver(database.type, ora, chalk);
|
|
121
|
+
|
|
75
122
|
// ─── Provision ───────────────────────────────────
|
|
76
123
|
console.log('');
|
|
77
124
|
console.log(chalk.dim(' ─────────────────────────────────────────'));
|