1- import { Absurd , SQLiteDatabase } from "@absurd-sqlite/sdk" ;
1+ import { Absurd , SQLiteConnection , SQLiteDatabase } from "@absurd-sqlite/sdk" ;
22import sqlite from "better-sqlite3" ;
33
44async function main ( ) {
@@ -9,9 +9,12 @@ async function main() {
99 "ABSURD_DATABASE_EXTENSION_PATH and ABSURD_DATABASE_PATH must be set" ,
1010 ) ;
1111 }
12- const db = sqlite ( dbPath ) as unknown as SQLiteDatabase ;
12+ const db = sqlite ( dbPath ) as SQLiteDatabase ;
13+ db . loadExtension ( extensionPath ) ;
14+ db . prepare ( "select absurd_apply_migrations()" ) . run ( ) ;
15+ const conn = new SQLiteConnection ( db , { verbose : console . log } ) ;
1316
14- const absurd = new Absurd ( db , extensionPath ) ;
17+ const absurd = new Absurd ( conn ) ;
1518
1619 absurd . registerTask (
1720 {
@@ -21,13 +24,15 @@ async function main() {
2124 await ctx . step ( "init" , async ( ) => {
2225 console . log ( "init step" ) ;
2326 ctx . emitEvent ( "progress" , { message : "Initialization complete" } ) ;
27+ return { } ;
2428 } ) ;
2529
2630 await ctx . sleepFor ( "back off 15s" , 15 ) ;
2731
2832 await ctx . step ( "process" , async ( ) => {
2933 console . log ( "process step" ) ;
3034 ctx . emitEvent ( "progress" , { message : "Processing complete" } ) ;
35+ return { } ;
3136 } ) ;
3237
3338 const name = params . name || "world" ;
0 commit comments