Update the session-related JS bindings to account for today's internal API changes.

FossilOrigin-Name: be63944d4114f53f2dab65bc6c1b85f4766a4ea14ee7b2690acde239a2a0bf54
This commit is contained in:
stephan 2022-12-25 15:14:10 +00:00
parent 04071524ae
commit 3494ec15e5
3 changed files with 30 additions and 23 deletions

View File

@ -317,16 +317,23 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
// Add session/changeset APIs...
if(wasm.bigIntEnabled && !!wasm.exports.sqlite3changegroup_add){
/* ACHTUNG: 2022-12-23: the session/changeset API bindings are
COMPLETELY UNTESTED. Additionally, the callback-taking APIs
have a shortcoming which will make using those which take
string-type arguments more painful than it should be. How best
to resolve that, such that we can perform the same type conversions
as we do when binding in "the other direction," is as yet
undetermined.
COMPLETELY UNTESTED. */
/**
FuncPtrAdapter options for session-related callbacks with the
native signature "i(ps)". This proxy converts the 2nd argument
from a C string to a JS string before passing the arguments on
to the client-provided JS callback.
*/
/* TODO: we need hand-written wrappers to adapt callbacks which
take string arguments. Or we need to find a way to do this sort
of reverse-binding which includes type conversions. */
const __ipsProxy = {
signature: 'i(ps)',
callProxy:(callback)=>{
return (p,s)=>{
try{return callback(p, wasm.cstrToJs(s)) | 0}
catch(e){return e.resultCode || capi.SQLITE_ERROR}
}
}
};
wasm.bindingSignatures.int64.push(...[
['sqlite3changegroup_add', 'int', ['sqlite3_changegroup*', 'int', 'void*']],
['sqlite3changegroup_add_strm', 'int', [
@ -349,7 +356,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
['sqlite3changeset_apply', 'int', [
'sqlite3*', 'int', 'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)', bindScope: 'transient'
name: 'xFilter', bindScope: 'transient', ...__ipsProxy
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
@ -363,7 +370,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}),
'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)', bindScope: 'transient'
name: 'xFilter', bindScope: 'transient', ...__ipsProxy
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
@ -373,7 +380,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
['sqlite3changeset_apply_v2', 'int', [
'sqlite3*', 'int', 'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)', bindScope: 'transient'
name: 'xFilter', bindScope: 'transient', ...__ipsProxy
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
@ -384,7 +391,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
['sqlite3changeset_apply_v2', 'int', [
'sqlite3*', 'int', 'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)', bindScope: 'transient'
name: 'xFilter', bindScope: 'transient', ...__ipsProxy
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
@ -398,7 +405,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}),
'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)', bindScope: 'transient'
name: 'xFilter', bindScope: 'transient', ...__ipsProxy
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
@ -487,8 +494,8 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
['sqlite3session_table_filter', undefined, [
'sqlite3_session*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(ps)',
contextKey: (argIndex,argv)=>argv[0/* (sqlite3_session*) */]
name: 'xFilter', ...__ipsProxy,
contextKey: (argv,argIndex)=>argv[0/* (sqlite3_session*) */]
}),
'*'
]]

View File

@ -1,5 +1,5 @@
C Merge\strunk\sinto\swasm-session-api\sbranch.
D 2022-12-25T14:13:52.379
C Update\sthe\ssession-related\sJS\sbindings\sto\saccount\sfor\stoday's\sinternal\sAPI\schanges.
D 2022-12-25T15:14:10.329
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -503,7 +503,7 @@ F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 171657a8c758cba72d903b20b42c72a523915ca03c8d652339bf41f5f1da2f09
F ext/wasm/api/sqlite3-api-glue.js f22d7bc226b6b8b1f8399cdcc547ad3289b49f39722c91301fe07e529148a94f
F ext/wasm/api/sqlite3-api-oo1.js 5393fb0b325d2fdafada7fdbfb9219af9a865631acb351d5c5196a982b632c8b
F ext/wasm/api/sqlite3-api-prologue.js 4ffe2b80742e2fcf44de6174bfb2981ff26ea0d1fe505bb511ffe0d9ac8fe6d0
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 6cdb036d8e8c5ddb0c6578aeefe318e74d7a90228e57b9f9047057dae3252963 8e3d4f6294037396e388ec21abb18bf0201a6bec6ff004730cc5d11b705a6d2b
R 81fe514e1af16b08edf276165dc4ebe1
P 7f8f1acd82be7dc2eb2147d96299b1b443e86774dfe0b0a8d32669a0500fc9c6
R dfeb1d551c8453a8d3a795c7dad85108
U stephan
Z 68ce3f310d94edded8b970aa4257758a
Z 7d17f1f03aff9dd128f571dc7f5c762d
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
7f8f1acd82be7dc2eb2147d96299b1b443e86774dfe0b0a8d32669a0500fc9c6
be63944d4114f53f2dab65bc6c1b85f4766a4ea14ee7b2690acde239a2a0bf54