feat: implement universal Node.js compatibility with automatic database adapter fallback
This commit is contained in:
@@ -41,7 +41,7 @@ async function rebuildDocumentationDatabase() {
|
||||
}
|
||||
|
||||
// Get and display statistics
|
||||
const stats = service.getStatistics();
|
||||
const stats = await service.getStatistics();
|
||||
console.log('\n📈 Database Statistics:');
|
||||
console.log(` Total nodes: ${stats.totalNodes}`);
|
||||
console.log(` Nodes with documentation: ${stats.nodesWithDocs}`);
|
||||
@@ -56,7 +56,7 @@ async function rebuildDocumentationDatabase() {
|
||||
});
|
||||
|
||||
// Close database connection
|
||||
service.close();
|
||||
await service.close();
|
||||
|
||||
console.log('\n✨ Enhanced documentation database is ready!');
|
||||
console.log('💡 The database now includes:');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2024 AiAdvisors Romuald Czlonkowski
|
||||
* Licensed under the Sustainable Use License v1.0
|
||||
*/
|
||||
import Database from 'better-sqlite3';
|
||||
import { createDatabaseAdapter } from '../database/database-adapter';
|
||||
import { N8nNodeLoader } from '../loaders/node-loader';
|
||||
import { NodeParser } from '../parsers/node-parser';
|
||||
import { DocsMapper } from '../mappers/docs-mapper';
|
||||
@@ -14,7 +14,7 @@ import * as path from 'path';
|
||||
async function rebuild() {
|
||||
console.log('🔄 Rebuilding n8n node database...\n');
|
||||
|
||||
const db = new Database('./data/nodes.db');
|
||||
const db = await createDatabaseAdapter('./data/nodes.db');
|
||||
const loader = new N8nNodeLoader();
|
||||
const parser = new NodeParser();
|
||||
const mapper = new DocsMapper();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2024 AiAdvisors Romuald Czlonkowski
|
||||
* Licensed under the Sustainable Use License v1.0
|
||||
*/
|
||||
import Database from 'better-sqlite3';
|
||||
import { createDatabaseAdapter } from '../database/database-adapter';
|
||||
import { NodeRepository } from '../database/node-repository';
|
||||
|
||||
const TEST_CASES = [
|
||||
@@ -34,7 +34,7 @@ const TEST_CASES = [
|
||||
];
|
||||
|
||||
async function runTests() {
|
||||
const db = new Database('./data/nodes.db');
|
||||
const db = await createDatabaseAdapter('./data/nodes.db');
|
||||
const repository = new NodeRepository(db);
|
||||
|
||||
console.log('🧪 Running node tests...\n');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (c) 2024 AiAdvisors Romuald Czlonkowski
|
||||
* Licensed under the Sustainable Use License v1.0
|
||||
*/
|
||||
import Database from 'better-sqlite3';
|
||||
import { createDatabaseAdapter } from '../database/database-adapter';
|
||||
|
||||
interface NodeRow {
|
||||
node_type: string;
|
||||
@@ -25,7 +25,7 @@ interface NodeRow {
|
||||
}
|
||||
|
||||
async function validate() {
|
||||
const db = new Database('./data/nodes.db');
|
||||
const db = await createDatabaseAdapter('./data/nodes.db');
|
||||
|
||||
console.log('🔍 Validating critical nodes...\n');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user