@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.
@@ -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
@@ -48,7 +48,7 @@ Skill Development:
48
48
  break;
49
49
  case "setup":
50
50
  default:
51
- import("./setup-5CVRQ5ES.js").then((m) => m.runSetupWizard()).catch(fatal);
51
+ import("./setup-WUDZZ25K.js").then((m) => m.runSetupWizard()).catch(fatal);
52
52
  break;
53
53
  }
54
54
  function fatal(err) {
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  provision,
17
17
  runSetupWizard
18
- } from "./chunk-PQADDAC2.js";
18
+ } from "./chunk-VRRCELRN.js";
19
19
  import {
20
20
  ENGINE_TABLES,
21
21
  ENGINE_TABLES_POSTGRES,
@@ -6,7 +6,7 @@ import {
6
6
  promptRegistration,
7
7
  provision,
8
8
  runSetupWizard
9
- } from "./chunk-HAUHDCUB.js";
9
+ } from "./chunk-VRRCELRN.js";
10
10
  import "./chunk-NTVN3JHS.js";
11
11
  import "./chunk-KFQGP6VL.js";
12
12
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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(' ─────────────────────────────────────────'));