@agenticmail/enterprise 0.5.7 → 0.5.9
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-2QYDZGOO.js +12666 -0
- package/dist/chunk-G5OKUKJH.js +48 -0
- package/dist/chunk-HDS2JMQ6.js +889 -0
- package/dist/chunk-IDTJIAJZ.js +2287 -0
- package/dist/chunk-L3MSZRJB.js +9040 -0
- package/dist/chunk-MUKGRCNR.js +1943 -0
- package/dist/chunk-QURS6HT5.js +1943 -0
- package/dist/chunk-VVQLDBGG.js +889 -0
- package/dist/cli-recover-LHRRZHAL.js +97 -0
- package/dist/cli-verify-JMWR6QC6.js +98 -0
- package/dist/cli.js +6 -6
- package/dist/db-adapter-UJHOXAIO.js +7 -0
- package/dist/dynamodb-QS64UREL.js +424 -0
- package/dist/factory-OVJZELPA.js +9 -0
- package/dist/index.js +9 -9
- package/dist/mongodb-MWH3DGZY.js +320 -0
- package/dist/mysql-SPPOCBFA.js +575 -0
- package/dist/postgres-AYNOP46Z.js +573 -0
- package/dist/registry/cli.js +1 -1
- package/dist/resolve-driver-VQXMFKLJ.js +27 -0
- package/dist/routes-T7QCPI6D.js +5674 -0
- package/dist/runtime-6PFTQWCV.js +47 -0
- package/dist/server-EQ454T4F.js +11 -0
- package/dist/server-FQPJCYVC.js +11 -0
- package/dist/setup-N2VGYYHM.js +20 -0
- package/dist/setup-SKZG3MS5.js +20 -0
- package/dist/sqlite-BA2TMKVB.js +491 -0
- package/dist/turso-CEAPRUFX.js +496 -0
- package/package.json +1 -1
- package/src/db/dynamodb.ts +4 -6
- package/src/db/mongodb.ts +1 -1
- package/src/db/mysql.ts +1 -1
- package/src/db/postgres.ts +5 -8
- package/src/db/resolve-driver.ts +29 -0
- package/src/db/sqlite.ts +1 -1
- package/src/db/turso.ts +1 -1
- package/src/engine/db-schema.ts +1 -0
- package/src/setup/index.ts +23 -17
package/src/setup/index.ts
CHANGED
|
@@ -57,39 +57,45 @@ async function ensureDbDriver(dbType: string, ora: any, chalk: any): Promise<voi
|
|
|
57
57
|
const packages = DB_DRIVER_MAP[dbType];
|
|
58
58
|
if (!packages?.length) return;
|
|
59
59
|
|
|
60
|
-
//
|
|
61
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
62
|
-
const pkgDir = join(dirname(__filename), '..');
|
|
63
|
-
|
|
60
|
+
// Check if any packages are missing
|
|
64
61
|
const missing: string[] = [];
|
|
65
62
|
for (const pkg of packages) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
let found = false;
|
|
64
|
+
// Try ESM import
|
|
65
|
+
try { await import(pkg); found = true; } catch {}
|
|
66
|
+
// Try CJS require from cwd
|
|
67
|
+
if (!found) {
|
|
68
|
+
try {
|
|
69
|
+
const req = createRequire(join(process.cwd(), 'index.js'));
|
|
70
|
+
req.resolve(pkg);
|
|
71
|
+
found = true;
|
|
72
|
+
} catch {}
|
|
73
|
+
}
|
|
74
|
+
// Try CJS require from global
|
|
75
|
+
if (!found) {
|
|
72
76
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
const globalPrefix = execSync('npm prefix -g', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
78
|
+
const req = createRequire(join(globalPrefix, 'lib', 'node_modules', '.package-lock.json'));
|
|
79
|
+
req.resolve(pkg);
|
|
80
|
+
found = true;
|
|
81
|
+
} catch {}
|
|
77
82
|
}
|
|
83
|
+
if (!found) missing.push(pkg);
|
|
78
84
|
}
|
|
79
85
|
if (!missing.length) return;
|
|
80
86
|
|
|
81
87
|
const spinner = ora(`Installing database driver: ${missing.join(', ')}...`).start();
|
|
82
88
|
try {
|
|
83
|
-
// Install
|
|
89
|
+
// Install in cwd so createRequire(cwd) can find it
|
|
84
90
|
execSync(`npm install --no-save ${missing.join(' ')}`, {
|
|
85
91
|
stdio: 'pipe',
|
|
86
92
|
timeout: 120_000,
|
|
87
|
-
cwd:
|
|
93
|
+
cwd: process.cwd(),
|
|
88
94
|
});
|
|
89
95
|
spinner.succeed(`Database driver installed: ${missing.join(', ')}`);
|
|
90
96
|
} catch (err: any) {
|
|
91
97
|
spinner.fail(`Failed to install ${missing.join(', ')}`);
|
|
92
|
-
console.error(chalk.red(`\n Run manually:
|
|
98
|
+
console.error(chalk.red(`\n Run manually: npm install ${missing.join(' ')}\n`));
|
|
93
99
|
process.exit(1);
|
|
94
100
|
}
|
|
95
101
|
}
|