@@ -1762,7 +1762,263 @@ declare class sqlite3_vtab_cursor extends SQLiteStruct {
17621762} 
17631763
17641764declare  module '@sqlite.org/sqlite-wasm'  { 
1765-   export  function  sqlite3Worker1Promiser ( ...args : any ) : any 
1765+   type  TODO  =  any ; 
1766+ 
1767+   /** 
1768+    * A function to be called when the SQLite3 module and worker APIs are done 
1769+    * loading asynchronously. This is the only way of knowing that the loading 
1770+    * has completed. 
1771+    * 
1772+    * @since  V3.46: Is passed the function which gets returned by 
1773+    *   `sqlite3Worker1Promiser()`, as accessing it from this callback is more 
1774+    *   convenient for certain usage patterns. The promiser v2 interface obviates 
1775+    *   the need for this callback. 
1776+    */ 
1777+   type  OnreadyFunction  =  ( )  =>  void ; 
1778+ 
1779+   type  Sqlite3Worker1PromiserConfig  =  { 
1780+     onready ?: OnreadyFunction ; 
1781+     /** 
1782+      * A worker instance which loads `sqlite3-worker1.js`, or a functional 
1783+      * equivalent. Note that the promiser factory replaces the 
1784+      * `worker.onmessage` property. This config option may alternately be a 
1785+      * function, in which case this function is called to instantiate the 
1786+      * worker. 
1787+      */ 
1788+     worker ?: Worker  |  ( ( )  =>  Worker ) ; 
1789+     /** Function to generate unique message IDs */ 
1790+     generateMessageId ?: ( messageObject : TODO )  =>  string ; 
1791+     /** 
1792+      * A `console.debug()` style function for logging information about Worker 
1793+      * messages. 
1794+      */ 
1795+     debug ?: ( ...args : any [ ] )  =>  void ; 
1796+     /** 
1797+      * A callback function that is called when a `message` event is received 
1798+      * from the worker, and the event is not handled by the proxy. 
1799+      * 
1800+      * @note  This *should* ideally never happen, as the proxy aims to handle 
1801+      * all known message types. 
1802+      */ 
1803+     onunhandled ?: ( event : MessageEvent )  =>  void ; 
1804+   } ; 
1805+ 
1806+   /** 
1807+    * A db identifier string (returned by 'open') which tells the operation which 
1808+    * database instance to work on. If not provided, the first-opened db is 
1809+    * used. 
1810+    * 
1811+    * @warning  This is an "opaque" value, with no inherently useful syntax 
1812+    * or information. Its value is subject to change with any given build 
1813+    * of this API and cannot be used as a basis for anything useful beyond 
1814+    * its one intended purpose. 
1815+    */ 
1816+   type  DbId  =  string  |  undefined ; 
1817+   type  Sqlite3Version  =  { 
1818+     libVersion : string ; 
1819+     sourceId : string ; 
1820+     libVersionNumber : number ; 
1821+     downloadVersion : number ; 
1822+   } ; 
1823+ 
1824+   // Message types and their corresponding arguments and results. Should be able to get better types for some of these (open, exec and stack) from the existing types, although the Promiser verions have minor differences 
1825+   type  PromiserMethods  =  { 
1826+     /** @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#method-open */ 
1827+     open : { 
1828+       args : Partial < 
1829+         { 
1830+           /** 
1831+            * The db filename. [=":memory:" or "" (unspecified)]: TODO: See the 
1832+            * sqlite3.oo1.DB constructor for peculiarities and transformations 
1833+            */ 
1834+           filename ?: string ; 
1835+         }  &  { 
1836+           /** 
1837+            * Sqlite3_vfs name. Ignored if filename is ":memory:" or "". This may 
1838+            * change how the given filename is resolved. The VFS may optionally 
1839+            * be provided via a URL-style filename argument: filename: 
1840+            * "file:foo.db?vfs=...". By default it uses a transient database, 
1841+            * created anew on each request. 
1842+            * 
1843+            * If both this argument and a URI-style argument are provided, which 
1844+            * one has precedence is unspecified. 
1845+            */ 
1846+           vfs ?: string ; 
1847+         } 
1848+       > ; 
1849+       result : { 
1850+         dbId : DbId ; 
1851+         /** Db filename, possibly differing from the input */ 
1852+         filename : string ; 
1853+         /** 
1854+          * Indicates if the given filename resides in the known-persistent 
1855+          * storage 
1856+          */ 
1857+         persistent : boolean ; 
1858+         /** Name of the underlying VFS */ 
1859+         vfs : 'string' ; 
1860+       } ; 
1861+       /** @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#method-close */ 
1862+     } ; 
1863+     close : { 
1864+       args : {  dbId ?: DbId  } ; 
1865+       result : { 
1866+         /** Filename of closed db, or undefined if no db was closed */ 
1867+         filename : string  |  undefined ; 
1868+       } ; 
1869+       /** @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#method-config-get */ 
1870+     } ; 
1871+     'config-get' : { 
1872+       args : { } ; 
1873+       result : { 
1874+         dbID : DbId ; 
1875+         version : Sqlite3Version ; 
1876+         /** Indicates if BigInt support is enabled */ 
1877+         bigIntEnabled : boolean ; 
1878+         /** Indicates if opfs support is enabled */ 
1879+         opfsEnabled : boolean ;  //not documented on sqlie.org? 
1880+         /** Result of sqlite3.capi.sqlite3_js_vfs_list() */ 
1881+         vfsList : string [ ] ;  // is there a full list somewhere I can use? 
1882+       } ; 
1883+     } ; 
1884+     /** 
1885+      * Interface for running arbitrary SQL. Wraps`oo1.DB.exec()` methods. And 
1886+      * supports most of its features as defined in 
1887+      * https://sqlite.org/wasm/doc/trunk/api-oo1.md#db-exec. There are a few 
1888+      * limitations imposed by the state having to cross thread boundaries. 
1889+      * 
1890+      * @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#method-exec 
1891+      */ 
1892+     exec : { 
1893+       args : { 
1894+         sql : string ; 
1895+         dbId ?: DbId ; 
1896+         /** 
1897+          * At the end of the result set, the same event is fired with 
1898+          * (row=undefined, rowNumber=null) to indicate that the end of the 
1899+          * result set has been reached. Note that the rows arrive via 
1900+          * worker-posted messages, with all the implications of that. 
1901+          */ 
1902+         callback ?: ( result : { 
1903+           /** 
1904+            * Internally-synthesized message type string used temporarily for 
1905+            * worker message dispatching. 
1906+            */ 
1907+           type : string ; 
1908+           /** Sqlilte3 VALUE */ 
1909+           row : TODO ; 
1910+           /** 1-based index */ 
1911+           rowNumber : number ; 
1912+           columnNames : string [ ] ; 
1913+         } )  =>  void ; 
1914+         /** 
1915+          * A single value valid as an argument for Stmt.bind(). This is only 
1916+          * applied to the first non-empty statement in the SQL which has any 
1917+          * bindable parameters. (Empty statements are skipped entirely.) 
1918+          */ 
1919+         bind ?: Exclude < TODO ,  null > ; 
1920+         [ key : string ] : TODO ;  // 
1921+       } ; 
1922+       result : {  [ key : string ] : TODO  } ; 
1923+     } ; 
1924+   } ; 
1925+ 
1926+   type  PromiserResponseSuccess < T  extends  keyof  PromiserMethods >  =  { 
1927+     /** Type of the inbound message */ 
1928+     type : T ; 
1929+     /** Operation dependent result */ 
1930+     result : PromiserMethods [ T ] [ 'result' ] ; 
1931+     /** Same value, if any, provided by the inbound message */ 
1932+     messageId : string ; 
1933+     /** 
1934+      * The id of the db which was operated on, if any, as returned by the 
1935+      * corresponding 'open' operation. 
1936+      */ 
1937+     dbId : DbId ; 
1938+     // possibly other metadata ... 
1939+     /*  
1940+ 		WorkerReceivedTime: number 
1941+ 		WorkerRespondTime: number 
1942+ 		departureTime: number 
1943+ 		 */ 
1944+   } ; 
1945+ 
1946+   type  PromiserResponseError  =  { 
1947+     type : 'error' ; 
1948+     /** Operation independent object */ 
1949+     result : { 
1950+       /** Type of the triggereing operation */ 
1951+       operation : string ; 
1952+       /** Error Message */ 
1953+       message : string ; 
1954+       /** The ErrorClass.name property from the thrown exception */ 
1955+       errorClass : string ; 
1956+       /** The message object which triggered the error */ 
1957+       input : object ; 
1958+       /** _if available_ a stack trace array */ 
1959+       stack : TODO [ ] ; 
1960+     } ; 
1961+     /** Same value, if any, provided by the inbound message */ 
1962+     messageId : string ; 
1963+     dbId : DbId ; 
1964+   } ; 
1965+   type  PromiserResponse < T  extends  keyof  PromiserMethods >  = 
1966+     |  PromiserResponseSuccess < T > 
1967+     |  PromiserResponseError ; 
1968+ 
1969+   type  Promiser  =  { 
1970+     < T  extends  keyof  PromiserMethods > ( 
1971+       /** The type of the message */ 
1972+       messageType : T , 
1973+       /** The arguments for the message type */ 
1974+       messageArguments : PromiserMethods [ T ] [ 'args' ] , 
1975+     ) : Promise < PromiserResponse < T > > ; 
1976+ 
1977+     < T  extends  keyof  PromiserMethods > ( message : { 
1978+       /** The type of the message */ 
1979+       type : T ; 
1980+       /** The arguments for the message type */ 
1981+       args : PromiserMethods [ T ] [ 'args' ] ; 
1982+     } ) : Promise < PromiserResponse < T > > ; 
1983+   } ; 
1984+ 
1985+   /** Factory for creating promiser instances. */ 
1986+   const  sqlite3Worker1Promiser : { 
1987+     /** 
1988+      * Promiser v1 
1989+      * 
1990+      * @example  
1991+      *   const factory = sqlite3Worker1Promiser({ 
1992+      *     onready: () => { 
1993+      *       promiser('open', { filename: 'my_database.sqlite' }) 
1994+      *         .then((msg) => { 
1995+      *           // ... 
1996+      *         }) 
1997+      *         .catch((e) => { 
1998+      *           console.error(e); 
1999+      *         }); 
2000+      *     }, 
2001+      *   }); 
2002+      * 
2003+      * @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#promiser 
2004+      */ 
2005+     ( config ?: Sqlite3Worker1PromiserConfig  |  OnreadyFunction ) : Promiser ; 
2006+ 
2007+     /** 
2008+      * Promiser v2 
2009+      * 
2010+      * @since  3.46: 
2011+      * @example  
2012+      *   const factoryPromise = sqlite3Worker1Promiser.v2(config); 
2013+      *   const factory = await factoryPromise; 
2014+      * 
2015+      * @link  https://sqlite.org/wasm/doc/trunk/api-worker1.md#promiser.v2 
2016+      */ 
2017+     v2 : ( 
2018+       config ?: Sqlite3Worker1PromiserConfig  |  OnreadyFunction , 
2019+     )  =>  Promise < Promiser > ; 
2020+     defaultConfig : Sqlite3Worker1PromiserConfig ; 
2021+   } ; 
17662022} 
17672023
17682024declare  class  sqlite3_module  extends  SQLiteStruct  { 
0 commit comments