fix: webhook and 4 other nodes incorrectly marked as non-triggers
Fixed issue where Docker images using sql.js adapter returned boolean fields as strings, causing is_trigger=0 to evaluate as true instead of false. Changes: - Added convertIntegerColumns() to sql.js adapter to convert SQLite integers - Updated server.ts and node-repository.ts to use Number() conversion as backup - Added test script to verify fix works with sql.js adapter This fixes webhook, cron, interval, and emailReadImap nodes showing isTrigger: false in Docker deployments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -338,7 +338,7 @@ class SQLJSStatement implements PreparedStatement {
|
||||
if (this.stmt.step()) {
|
||||
const result = this.stmt.getAsObject();
|
||||
this.stmt.reset();
|
||||
return result;
|
||||
return this.convertIntegerColumns(result);
|
||||
}
|
||||
|
||||
this.stmt.reset();
|
||||
@@ -354,7 +354,7 @@ class SQLJSStatement implements PreparedStatement {
|
||||
|
||||
const results: any[] = [];
|
||||
while (this.stmt.step()) {
|
||||
results.push(this.stmt.getAsObject());
|
||||
results.push(this.convertIntegerColumns(this.stmt.getAsObject()));
|
||||
}
|
||||
|
||||
this.stmt.reset();
|
||||
@@ -400,4 +400,24 @@ class SQLJSStatement implements PreparedStatement {
|
||||
this.boundParams = params;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert SQLite integer columns to JavaScript numbers
|
||||
* sql.js returns all values as strings, but we need proper types for boolean conversion
|
||||
*/
|
||||
private convertIntegerColumns(row: any): any {
|
||||
if (!row) return row;
|
||||
|
||||
// Known integer columns in the nodes table
|
||||
const integerColumns = ['is_ai_tool', 'is_trigger', 'is_webhook', 'is_versioned'];
|
||||
|
||||
const converted = { ...row };
|
||||
for (const col of integerColumns) {
|
||||
if (col in converted && typeof converted[col] === 'string') {
|
||||
converted[col] = parseInt(converted[col], 10);
|
||||
}
|
||||
}
|
||||
|
||||
return converted;
|
||||
}
|
||||
}
|
||||
@@ -53,10 +53,10 @@ export class NodeRepository {
|
||||
category: row.category,
|
||||
developmentStyle: row.development_style,
|
||||
package: row.package_name,
|
||||
isAITool: !!row.is_ai_tool,
|
||||
isTrigger: !!row.is_trigger,
|
||||
isWebhook: !!row.is_webhook,
|
||||
isVersioned: !!row.is_versioned,
|
||||
isAITool: Number(row.is_ai_tool) === 1,
|
||||
isTrigger: Number(row.is_trigger) === 1,
|
||||
isWebhook: Number(row.is_webhook) === 1,
|
||||
isVersioned: Number(row.is_versioned) === 1,
|
||||
version: row.version,
|
||||
properties: this.safeJsonParse(row.properties_schema, []),
|
||||
operations: this.safeJsonParse(row.operations, []),
|
||||
|
||||
Reference in New Issue
Block a user