@@ -86,49 +86,29 @@ index 4530653..5ac01a0 100644
8686 clean:
8787 rm -f out/* dist/* cache/*
8888diff --git a/src/api.js b/src/api.js
89- index c7f102b..df7e901 100644
89+ index c7f102b..4c20316 100644
9090--- a/src/api.js
9191+++ b/src/api.js
92- @@ -72,6 +72,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
92+ @@ -72,6 +72,10 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
9393 var SQLITE_UPDATE = 23;
9494 var SQLITE_DELETE = 9;
9595 // var - cwrap function
9696+ Module['ccall']('powersync_init_static', 'int', []);
97+ + Module['ccall']('register_update_hook_extension', 'void', []);
98+ +
9799+
98100 var sqlite3_open = cwrap("sqlite3_open", "number", ["string", "number"]);
99101 var sqlite3_close_v2 = cwrap("sqlite3_close_v2", "number", ["number"]);
100102 var sqlite3_exec = cwrap(
101- @@ -122,6 +124 ,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
103+ @@ -122,6 +126 ,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
102104 "number",
103105 ["number", "string"]
104106 );
105107+ var sqlite3_last_insert_rowid = cwrap("sqlite3_last_insert_rowid", "number", ["number"]);
106108 var sqlite3_step = cwrap("sqlite3_step", "number", ["number"]);
107109 var sqlite3_errmsg = cwrap("sqlite3_errmsg", "string", ["number"]);
108110 var sqlite3_column_count = cwrap(
109- @@ -239,6 +242,12 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
110- ["number"]
111- );
112-
113- + var registerUpdateHook = cwrap(
114- + "register_sqlite_update_hook",
115- + "void",
116- + ["number"]
117- + );
118- +
119- var sqlite3_update_hook = cwrap(
120- "sqlite3_update_hook",
121- "number",
122- @@ -833,6 +842,8 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
123- }
124- this.handleError(sqlite3_open(this.filename, apiTemp));
125- this.db = getValue(apiTemp, "i32");
126- + registerUpdateHook(this.db)
127- + // Module['ccall']('register_sqlite_update_hook', 'void', ['number'], [apiTemp]);
128- registerExtensionFunctions(this.db);
129- // A list of all prepared statements of the database
130- this.statements = {};
131- @@ -1155,6 +1166,13 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
111+ @@ -1155,6 +1160,13 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
132112 return sqlite3_changes(this.db);
133113 };
134114
@@ -143,7 +123,7 @@ index c7f102b..df7e901 100644
143123 var size = sqlite3_value_bytes(ptr);
144124 var blob_ptr = sqlite3_value_blob(ptr);
145125diff --git a/src/exported_functions.json b/src/exported_functions.json
146- index 3be2595..d1c0037 100644
126+ index 3be2595..709bc5c 100644
147127--- a/src/exported_functions.json
148128+++ b/src/exported_functions.json
149129@@ -1,47 +1,50 @@
@@ -240,7 +220,7 @@ index 3be2595..d1c0037 100644
240220+ "_sqlite3_last_insert_rowid",
241221+ "_sqlite3_update_hook",
242222+ "_powersync_init_static",
243- + "_register_sqlite_update_hook "
223+ + "_register_update_hook_extension "
244224 ]
245225diff --git a/src/exported_runtime_methods.json b/src/exported_runtime_methods.json
246226index f099056..b1712fc 100644
0 commit comments