feat: implement universal Node.js compatibility with automatic database adapter fallback

This commit is contained in:
czlonkowski
2025-06-12 23:51:47 +02:00
parent 66f5d74e42
commit b476d36275
20 changed files with 16668 additions and 4772 deletions

View File

@@ -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:');

View File

@@ -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();

View File

@@ -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');

View File

@@ -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');