-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug-persistence.ts
More file actions
58 lines (50 loc) · 1.87 KB
/
debug-persistence.ts
File metadata and controls
58 lines (50 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { initializeConfiguration, CustomConfigFactory } from "./src/domain/configuration/index";
import { PersistenceService } from "./src/domain/persistence/service";
async function testPersistence() {
try {
console.log("=== Testing Persistence Configuration ===");
// Test config
const testConfig = {
persistence: {
backend: "postgres" as const,
postgres: {
connectionString: "postgresql://localhost:5432/testdb",
},
},
sessiondb: {
backend: "postgres" as const,
connectionString: "postgresql://localhost:5432/testdb",
},
};
console.log("1. Initializing configuration...");
const factory = new CustomConfigFactory();
await initializeConfiguration(factory, {
overrides: testConfig,
enableCache: true,
skipValidation: true,
});
console.log("2. Initializing PersistenceService...");
await PersistenceService.initialize();
console.log("3. Getting provider...");
const provider = PersistenceService.getProvider();
console.log("Provider type:", provider.constructor.name);
console.log("Provider capabilities:", provider.capabilities);
console.log("Provider connection info:", provider.getConnectionInfo());
console.log("4. Checking getDatabaseConnection method...");
console.log("Has getDatabaseConnection:", typeof provider.getDatabaseConnection);
if (provider.getDatabaseConnection) {
console.log("5. Attempting to get database connection...");
try {
const connection = await provider.getDatabaseConnection();
console.log("Connection:", connection ? "Available" : "Null");
} catch (err) {
console.log("Connection error:", err);
}
} else {
console.log("5. No getDatabaseConnection method available");
}
} catch (error) {
console.error("Error:", error);
}
}
testPersistence();