chore: snapshot main sync
This commit is contained in:
@@ -15,10 +15,6 @@ import type {
|
||||
CreateWorkflowRunData,
|
||||
} from '../engine/deps.js';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Optional dependency loading
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function loadBetterSqlite3(): Promise<typeof import('better-sqlite3')> {
|
||||
try {
|
||||
return await import('better-sqlite3');
|
||||
@@ -29,10 +25,6 @@ async function loadBetterSqlite3(): Promise<typeof import('better-sqlite3')> {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Schema
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const SCHEMA_SQL = `
|
||||
CREATE TABLE IF NOT EXISTS workflow_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
@@ -64,10 +56,6 @@ const SCHEMA_SQL = `
|
||||
ON workflow_events(run_id);
|
||||
`;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Row mappers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
interface RunRow {
|
||||
id: string;
|
||||
workflow_path: string;
|
||||
@@ -105,20 +93,6 @@ function rowToRun(row: RunRow): WorkflowRun {
|
||||
};
|
||||
}
|
||||
|
||||
function rowToEvent(row: EventRow): WorkflowEvent {
|
||||
return {
|
||||
id: row.id,
|
||||
runId: row.run_id,
|
||||
nodeId: row.node_id ?? undefined,
|
||||
type: row.type,
|
||||
data: JSON.parse(row.data),
|
||||
createdAt: new Date(row.created_at),
|
||||
};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Factory
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export async function createSqliteStore(
|
||||
dbPath: string,
|
||||
@@ -131,7 +105,6 @@ export async function createSqliteStore(
|
||||
// Enable WAL mode for better concurrent read performance
|
||||
db.pragma('journal_mode = WAL');
|
||||
|
||||
// Initialize schema
|
||||
db.exec(SCHEMA_SQL);
|
||||
|
||||
const ACTIVE_STATUSES: WorkflowRunStatus[] = ['pending', 'running'];
|
||||
|
||||
Reference in New Issue
Block a user