@breeztech/breez-sdk-spark 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/breez-sdk-spark.tgz +0 -0
- package/bundler/breez_sdk_spark_wasm.d.ts +114 -40
- package/bundler/breez_sdk_spark_wasm.js +1 -1
- package/bundler/breez_sdk_spark_wasm_bg.js +118 -104
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/deno/breez_sdk_spark_wasm.d.ts +114 -40
- package/deno/breez_sdk_spark_wasm.js +118 -104
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/nodejs/breez_sdk_spark_wasm.d.ts +114 -40
- package/nodejs/breez_sdk_spark_wasm.js +121 -106
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
- package/nodejs/index.mjs +3 -2
- package/nodejs/mysql-session-manager/index.cjs +26 -8
- package/nodejs/mysql-session-manager/migrations.cjs +40 -3
- package/nodejs/mysql-storage/index.cjs +67 -48
- package/nodejs/mysql-storage/migrations.cjs +220 -85
- package/nodejs/mysql-token-store/index.cjs +133 -68
- package/nodejs/mysql-token-store/migrations.cjs +309 -80
- package/nodejs/mysql-tree-store/index.cjs +76 -41
- package/nodejs/mysql-tree-store/migrations.cjs +254 -71
- package/nodejs/postgres-session-manager/index.cjs +27 -9
- package/nodejs/postgres-session-manager/migrations.cjs +45 -6
- package/nodejs/postgres-storage/index.cjs +81 -62
- package/nodejs/postgres-storage/migrations.cjs +207 -79
- package/nodejs/postgres-token-store/index.cjs +111 -67
- package/nodejs/postgres-token-store/migrations.cjs +153 -61
- package/nodejs/postgres-tree-store/index.cjs +60 -42
- package/nodejs/postgres-tree-store/migrations.cjs +130 -46
- package/package.json +1 -1
- package/ssr/index.js +14 -9
- package/web/breez_sdk_spark_wasm.d.ts +126 -51
- package/web/breez_sdk_spark_wasm.js +118 -104
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +12 -11
|
@@ -358,6 +358,13 @@ class BreezSdk {
|
|
|
358
358
|
const ret = wasm.breezsdk_refundDeposit(this.__wbg_ptr, request);
|
|
359
359
|
return ret;
|
|
360
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* @returns {Promise<void>}
|
|
363
|
+
*/
|
|
364
|
+
refundPendingConversions() {
|
|
365
|
+
const ret = wasm.breezsdk_refundPendingConversions(this.__wbg_ptr);
|
|
366
|
+
return ret;
|
|
367
|
+
}
|
|
361
368
|
/**
|
|
362
369
|
* @param {RegisterLightningAddressRequest} request
|
|
363
370
|
* @returns {Promise<LightningAddressInfo>}
|
|
@@ -775,7 +782,8 @@ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderly
|
|
|
775
782
|
exports.IntoUnderlyingSource = IntoUnderlyingSource;
|
|
776
783
|
|
|
777
784
|
/**
|
|
778
|
-
* A shareable MySQL connection pool. See
|
|
785
|
+
* A shareable `MySQL` connection pool. See
|
|
786
|
+
* [`PostgresConnectionPool`](super::postgres_pool::PostgresConnectionPool)
|
|
779
787
|
* for sharing semantics and lifecycle.
|
|
780
788
|
*/
|
|
781
789
|
class MysqlConnectionPool {
|
|
@@ -1003,7 +1011,8 @@ class SdkBuilder {
|
|
|
1003
1011
|
return SdkBuilder.__wrap(ret);
|
|
1004
1012
|
}
|
|
1005
1013
|
/**
|
|
1006
|
-
* **Deprecated.** Call `
|
|
1014
|
+
* **Deprecated.** Call `createMysqlConnectionPool(config)` and
|
|
1015
|
+
* `withMysqlConnectionPool(pool)` instead.
|
|
1007
1016
|
* @param {MysqlStorageConfig} config
|
|
1008
1017
|
* @returns {SdkBuilder}
|
|
1009
1018
|
*/
|
|
@@ -1017,8 +1026,9 @@ class SdkBuilder {
|
|
|
1017
1026
|
}
|
|
1018
1027
|
/**
|
|
1019
1028
|
* Sets a shared `MySQL` connection pool as the backend for all stores.
|
|
1020
|
-
*
|
|
1021
|
-
* `
|
|
1029
|
+
*
|
|
1030
|
+
* If the same builder also receives a `WasmSdkContext` carrying a MySQL
|
|
1031
|
+
* pool, `build()` returns an error — pick one source.
|
|
1022
1032
|
* @param {MysqlConnectionPool} pool
|
|
1023
1033
|
* @returns {SdkBuilder}
|
|
1024
1034
|
*/
|
|
@@ -1038,7 +1048,8 @@ class SdkBuilder {
|
|
|
1038
1048
|
return SdkBuilder.__wrap(ret);
|
|
1039
1049
|
}
|
|
1040
1050
|
/**
|
|
1041
|
-
* **Deprecated.** Call `
|
|
1051
|
+
* **Deprecated.** Call `createPostgresConnectionPool(config)` and
|
|
1052
|
+
* `withPostgresConnectionPool(pool)` instead.
|
|
1042
1053
|
* @param {PostgresStorageConfig} config
|
|
1043
1054
|
* @returns {SdkBuilder}
|
|
1044
1055
|
*/
|
|
@@ -1051,9 +1062,10 @@ class SdkBuilder {
|
|
|
1051
1062
|
return SdkBuilder.__wrap(ret[0]);
|
|
1052
1063
|
}
|
|
1053
1064
|
/**
|
|
1054
|
-
* Sets a shared
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1065
|
+
* Sets a shared Postgres connection pool as the backend for all stores.
|
|
1066
|
+
*
|
|
1067
|
+
* If the same builder also receives a `WasmSdkContext` carrying a
|
|
1068
|
+
* Postgres pool, `build()` returns an error — pick one source.
|
|
1057
1069
|
* @param {PostgresConnectionPool} pool
|
|
1058
1070
|
* @returns {SdkBuilder}
|
|
1059
1071
|
*/
|
|
@@ -1077,30 +1089,18 @@ class SdkBuilder {
|
|
|
1077
1089
|
return SdkBuilder.__wrap(ret);
|
|
1078
1090
|
}
|
|
1079
1091
|
/**
|
|
1080
|
-
*
|
|
1092
|
+
* Threads a shared [`WasmSdkContext`] into the builder.
|
|
1081
1093
|
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1085
|
-
* @param {
|
|
1086
|
-
* @returns {SdkBuilder}
|
|
1087
|
-
*/
|
|
1088
|
-
withSessionManager(session_manager) {
|
|
1089
|
-
const ptr = this.__destroy_into_raw();
|
|
1090
|
-
const ret = wasm.sdkbuilder_withSessionManager(ptr, session_manager);
|
|
1091
|
-
return SdkBuilder.__wrap(ret);
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Reuses a shared SSP connection across SDK instances. Pass the same
|
|
1095
|
-
* manager to every `SdkBuilder` whose SSP traffic should share an
|
|
1096
|
-
* underlying HTTP client.
|
|
1097
|
-
* @param {SspConnectionManager} manager
|
|
1094
|
+
* Construct the context once via `newSharedSdkContext` and pass the same
|
|
1095
|
+
* handle to every `SdkBuilder` whose SDKs should share its resources
|
|
1096
|
+
* (operator gRPC channels, SSP HTTP client, database pool).
|
|
1097
|
+
* @param {WasmSdkContext} context
|
|
1098
1098
|
* @returns {SdkBuilder}
|
|
1099
1099
|
*/
|
|
1100
|
-
|
|
1100
|
+
withSharedContext(context) {
|
|
1101
1101
|
const ptr = this.__destroy_into_raw();
|
|
1102
|
-
_assertClass(
|
|
1103
|
-
const ret = wasm.
|
|
1102
|
+
_assertClass(context, WasmSdkContext);
|
|
1103
|
+
const ret = wasm.sdkbuilder_withSharedContext(ptr, context.__wbg_ptr);
|
|
1104
1104
|
return SdkBuilder.__wrap(ret);
|
|
1105
1105
|
}
|
|
1106
1106
|
/**
|
|
@@ -1116,33 +1116,6 @@ class SdkBuilder {
|
|
|
1116
1116
|
if (Symbol.dispose) SdkBuilder.prototype[Symbol.dispose] = SdkBuilder.prototype.free;
|
|
1117
1117
|
exports.SdkBuilder = SdkBuilder;
|
|
1118
1118
|
|
|
1119
|
-
/**
|
|
1120
|
-
* Shared transport for SSP GraphQL traffic across SDK instances.
|
|
1121
|
-
*
|
|
1122
|
-
* All SDK instances built with the same `SspConnectionManager` share a single
|
|
1123
|
-
* underlying HTTP client (and its h2 connection pool) for SSP requests.
|
|
1124
|
-
*/
|
|
1125
|
-
class SspConnectionManager {
|
|
1126
|
-
static __wrap(ptr) {
|
|
1127
|
-
const obj = Object.create(SspConnectionManager.prototype);
|
|
1128
|
-
obj.__wbg_ptr = ptr;
|
|
1129
|
-
SspConnectionManagerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1130
|
-
return obj;
|
|
1131
|
-
}
|
|
1132
|
-
__destroy_into_raw() {
|
|
1133
|
-
const ptr = this.__wbg_ptr;
|
|
1134
|
-
this.__wbg_ptr = 0;
|
|
1135
|
-
SspConnectionManagerFinalization.unregister(this);
|
|
1136
|
-
return ptr;
|
|
1137
|
-
}
|
|
1138
|
-
free() {
|
|
1139
|
-
const ptr = this.__destroy_into_raw();
|
|
1140
|
-
wasm.__wbg_sspconnectionmanager_free(ptr, 0);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
if (Symbol.dispose) SspConnectionManager.prototype[Symbol.dispose] = SspConnectionManager.prototype.free;
|
|
1144
|
-
exports.SspConnectionManager = SspConnectionManager;
|
|
1145
|
-
|
|
1146
1119
|
class TokenIssuer {
|
|
1147
1120
|
static __wrap(ptr) {
|
|
1148
1121
|
const obj = Object.create(TokenIssuer.prototype);
|
|
@@ -1218,6 +1191,34 @@ class TokenIssuer {
|
|
|
1218
1191
|
if (Symbol.dispose) TokenIssuer.prototype[Symbol.dispose] = TokenIssuer.prototype.free;
|
|
1219
1192
|
exports.TokenIssuer = TokenIssuer;
|
|
1220
1193
|
|
|
1194
|
+
/**
|
|
1195
|
+
* Process-shared resources backing one or more `BreezSdk` instances on WASM.
|
|
1196
|
+
*
|
|
1197
|
+
* Construct once via `newSharedSdkContext` and pass the handle to every
|
|
1198
|
+
* `SdkBuilder` whose SDKs should share its operator gRPC channels, SSP HTTP
|
|
1199
|
+
* client, and (optionally) database connection pool.
|
|
1200
|
+
*/
|
|
1201
|
+
class WasmSdkContext {
|
|
1202
|
+
static __wrap(ptr) {
|
|
1203
|
+
const obj = Object.create(WasmSdkContext.prototype);
|
|
1204
|
+
obj.__wbg_ptr = ptr;
|
|
1205
|
+
WasmSdkContextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1206
|
+
return obj;
|
|
1207
|
+
}
|
|
1208
|
+
__destroy_into_raw() {
|
|
1209
|
+
const ptr = this.__wbg_ptr;
|
|
1210
|
+
this.__wbg_ptr = 0;
|
|
1211
|
+
WasmSdkContextFinalization.unregister(this);
|
|
1212
|
+
return ptr;
|
|
1213
|
+
}
|
|
1214
|
+
free() {
|
|
1215
|
+
const ptr = this.__destroy_into_raw();
|
|
1216
|
+
wasm.__wbg_wasmsdkcontext_free(ptr, 0);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
if (Symbol.dispose) WasmSdkContext.prototype[Symbol.dispose] = WasmSdkContext.prototype.free;
|
|
1220
|
+
exports.WasmSdkContext = WasmSdkContext;
|
|
1221
|
+
|
|
1221
1222
|
/**
|
|
1222
1223
|
* @param {ConnectRequest} request
|
|
1223
1224
|
* @returns {Promise<BreezSdk>}
|
|
@@ -1243,7 +1244,7 @@ function connectWithSigner(config, signer, storage_dir) {
|
|
|
1243
1244
|
exports.connectWithSigner = connectWithSigner;
|
|
1244
1245
|
|
|
1245
1246
|
/**
|
|
1246
|
-
* Creates a shareable MySQL connection pool from the given config.
|
|
1247
|
+
* Creates a shareable `MySQL` connection pool from the given config.
|
|
1247
1248
|
* @param {MysqlStorageConfig} config
|
|
1248
1249
|
* @returns {MysqlConnectionPool}
|
|
1249
1250
|
*/
|
|
@@ -1307,6 +1308,7 @@ exports.defaultExternalSigner = defaultExternalSigner;
|
|
|
1307
1308
|
* - `maxPoolSize`: 10
|
|
1308
1309
|
* - `createTimeoutSecs`: 0 (no timeout)
|
|
1309
1310
|
* - `recycleTimeoutSecs`: 10
|
|
1311
|
+
* - `foreignKeyMode`: `Enforced`
|
|
1310
1312
|
* @param {string} connection_string
|
|
1311
1313
|
* @returns {MysqlStorageConfig}
|
|
1312
1314
|
*/
|
|
@@ -1336,6 +1338,16 @@ function defaultPostgresStorageConfig(connection_string) {
|
|
|
1336
1338
|
}
|
|
1337
1339
|
exports.defaultPostgresStorageConfig = defaultPostgresStorageConfig;
|
|
1338
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* @param {Network} network
|
|
1343
|
+
* @returns {Config}
|
|
1344
|
+
*/
|
|
1345
|
+
function defaultServerConfig(network) {
|
|
1346
|
+
const ret = wasm.defaultServerConfig(network);
|
|
1347
|
+
return ret;
|
|
1348
|
+
}
|
|
1349
|
+
exports.defaultServerConfig = defaultServerConfig;
|
|
1350
|
+
|
|
1339
1351
|
/**
|
|
1340
1352
|
* Creates a default external signer from a mnemonic phrase.
|
|
1341
1353
|
*
|
|
@@ -1384,16 +1396,15 @@ function newRestChainService(url, network, api_type, credentials) {
|
|
|
1384
1396
|
exports.newRestChainService = newRestChainService;
|
|
1385
1397
|
|
|
1386
1398
|
/**
|
|
1387
|
-
*
|
|
1388
|
-
* @
|
|
1399
|
+
* Constructs a [`WasmSdkContext`] from a `WasmSdkContextConfig`.
|
|
1400
|
+
* @param {WasmSdkContextConfig} config
|
|
1401
|
+
* @returns {Promise<WasmSdkContext>}
|
|
1389
1402
|
*/
|
|
1390
|
-
function
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const ret = wasm.newSspConnectionManager(ptr0, len0);
|
|
1394
|
-
return SspConnectionManager.__wrap(ret);
|
|
1403
|
+
function newSharedSdkContext(config) {
|
|
1404
|
+
const ret = wasm.newSharedSdkContext(config);
|
|
1405
|
+
return ret;
|
|
1395
1406
|
}
|
|
1396
|
-
exports.
|
|
1407
|
+
exports.newSharedSdkContext = newSharedSdkContext;
|
|
1397
1408
|
|
|
1398
1409
|
/**
|
|
1399
1410
|
* Entry point invoked by JavaScript in a worker.
|
|
@@ -1667,40 +1678,40 @@ function __wbg_get_imports() {
|
|
|
1667
1678
|
const ret = createMysqlPool(arg0);
|
|
1668
1679
|
return ret;
|
|
1669
1680
|
}, arguments); },
|
|
1670
|
-
|
|
1671
|
-
const ret = createMysqlSessionManagerWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1681
|
+
__wbg_createMysqlSessionManagerWithPool_81f4147900a5a954: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1682
|
+
const ret = createMysqlSessionManagerWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1672
1683
|
return ret;
|
|
1673
1684
|
}, arguments); },
|
|
1674
|
-
|
|
1675
|
-
const ret = createMysqlStorageWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1685
|
+
__wbg_createMysqlStorageWithPool_22d23b0d068eae47: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1686
|
+
const ret = createMysqlStorageWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1676
1687
|
return ret;
|
|
1677
1688
|
}, arguments); },
|
|
1678
|
-
|
|
1679
|
-
const ret = createMysqlTokenStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1689
|
+
__wbg_createMysqlTokenStoreWithPool_f59d99943757f602: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
1690
|
+
const ret = createMysqlTokenStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0);
|
|
1680
1691
|
return ret;
|
|
1681
1692
|
}, arguments); },
|
|
1682
|
-
|
|
1683
|
-
const ret = createMysqlTreeStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1693
|
+
__wbg_createMysqlTreeStoreWithPool_4c6bcff518c7f9c4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
1694
|
+
const ret = createMysqlTreeStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0);
|
|
1684
1695
|
return ret;
|
|
1685
1696
|
}, arguments); },
|
|
1686
1697
|
__wbg_createPostgresPool_3c396c7ab2f0eab2: function() { return handleError(function (arg0) {
|
|
1687
1698
|
const ret = createPostgresPool(arg0);
|
|
1688
1699
|
return ret;
|
|
1689
1700
|
}, arguments); },
|
|
1690
|
-
|
|
1691
|
-
const ret = createPostgresSessionManagerWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1701
|
+
__wbg_createPostgresSessionManagerWithPool_989bf80d96829c18: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1702
|
+
const ret = createPostgresSessionManagerWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1692
1703
|
return ret;
|
|
1693
1704
|
}, arguments); },
|
|
1694
|
-
|
|
1695
|
-
const ret = createPostgresStorageWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1705
|
+
__wbg_createPostgresStorageWithPool_9408116e32ab58f8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1706
|
+
const ret = createPostgresStorageWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1696
1707
|
return ret;
|
|
1697
1708
|
}, arguments); },
|
|
1698
|
-
|
|
1699
|
-
const ret = createPostgresTokenStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1709
|
+
__wbg_createPostgresTokenStoreWithPool_5e936f3aa8bd424a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1710
|
+
const ret = createPostgresTokenStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1700
1711
|
return ret;
|
|
1701
1712
|
}, arguments); },
|
|
1702
|
-
|
|
1703
|
-
const ret = createPostgresTreeStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
1713
|
+
__wbg_createPostgresTreeStoreWithPool_03a03c4c0664703c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1714
|
+
const ret = createPostgresTreeStoreWithPool(arg0, getArrayU8FromWasm0(arg1, arg2), arg3, arg4 !== 0);
|
|
1704
1715
|
return ret;
|
|
1705
1716
|
}, arguments); },
|
|
1706
1717
|
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
@@ -2120,10 +2131,6 @@ function __wbg_get_imports() {
|
|
|
2120
2131
|
const ret = arg0.insertPayment(arg1);
|
|
2121
2132
|
return ret;
|
|
2122
2133
|
}, arguments); },
|
|
2123
|
-
__wbg_insertTokenOutputs_11b256443d099417: function() { return handleError(function (arg0, arg1) {
|
|
2124
|
-
const ret = arg0.insertTokenOutputs(arg1);
|
|
2125
|
-
return ret;
|
|
2126
|
-
}, arguments); },
|
|
2127
2134
|
__wbg_instanceof_ArrayBuffer_eab9f28fbec23477: function(arg0) {
|
|
2128
2135
|
let result;
|
|
2129
2136
|
try {
|
|
@@ -2791,6 +2798,10 @@ function __wbg_get_imports() {
|
|
|
2791
2798
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2792
2799
|
}
|
|
2793
2800
|
}, arguments); },
|
|
2801
|
+
__wbg_updateTokenOutputs_d978e01c817e8230: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2802
|
+
const ret = arg0.updateTokenOutputs(arg1, arg2);
|
|
2803
|
+
return ret;
|
|
2804
|
+
}, arguments); },
|
|
2794
2805
|
__wbg_url_68fd9a221360e0db: function(arg0, arg1) {
|
|
2795
2806
|
const ret = arg1.url;
|
|
2796
2807
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -2821,48 +2832,52 @@ function __wbg_get_imports() {
|
|
|
2821
2832
|
const ret = arg0.wasClean;
|
|
2822
2833
|
return ret;
|
|
2823
2834
|
},
|
|
2835
|
+
__wbg_wasmsdkcontext_new: function(arg0) {
|
|
2836
|
+
const ret = WasmSdkContext.__wrap(arg0);
|
|
2837
|
+
return ret;
|
|
2838
|
+
},
|
|
2824
2839
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2825
2840
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 16, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2826
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2841
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21);
|
|
2827
2842
|
return ret;
|
|
2828
2843
|
},
|
|
2829
2844
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2830
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2845
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2831
2846
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57);
|
|
2832
2847
|
return ret;
|
|
2833
2848
|
},
|
|
2834
2849
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2835
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
2850
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2836
2851
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_2);
|
|
2837
2852
|
return ret;
|
|
2838
2853
|
},
|
|
2839
2854
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
2840
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
2855
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 403, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2841
2856
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_3);
|
|
2842
2857
|
return ret;
|
|
2843
2858
|
},
|
|
2844
2859
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2845
2860
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("SessionManager")], shim_idx: 16, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2846
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2861
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_4);
|
|
2847
2862
|
return ret;
|
|
2848
2863
|
},
|
|
2849
2864
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
2850
2865
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Storage")], shim_idx: 16, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2851
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2866
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_5);
|
|
2852
2867
|
return ret;
|
|
2853
2868
|
},
|
|
2854
2869
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2855
2870
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TokenStore")], shim_idx: 16, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2856
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2871
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_6);
|
|
2857
2872
|
return ret;
|
|
2858
2873
|
},
|
|
2859
2874
|
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
2860
2875
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("TreeStore")], shim_idx: 16, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2861
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2876
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_7);
|
|
2862
2877
|
return ret;
|
|
2863
2878
|
},
|
|
2864
2879
|
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
2865
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2880
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 408, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2866
2881
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h124479769cd429fd);
|
|
2867
2882
|
return ret;
|
|
2868
2883
|
},
|
|
@@ -2963,36 +2978,36 @@ function wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_3(arg0, a
|
|
|
2963
2978
|
wasm.wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_3(arg0, arg1, arg2);
|
|
2964
2979
|
}
|
|
2965
2980
|
|
|
2966
|
-
function
|
|
2967
|
-
const ret = wasm.
|
|
2981
|
+
function wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21(arg0, arg1, arg2) {
|
|
2982
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21(arg0, arg1, arg2);
|
|
2968
2983
|
if (ret[1]) {
|
|
2969
2984
|
throw takeFromExternrefTable0(ret[0]);
|
|
2970
2985
|
}
|
|
2971
2986
|
}
|
|
2972
2987
|
|
|
2973
|
-
function
|
|
2974
|
-
const ret = wasm.
|
|
2988
|
+
function wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_4(arg0, arg1, arg2) {
|
|
2989
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_4(arg0, arg1, arg2);
|
|
2975
2990
|
if (ret[1]) {
|
|
2976
2991
|
throw takeFromExternrefTable0(ret[0]);
|
|
2977
2992
|
}
|
|
2978
2993
|
}
|
|
2979
2994
|
|
|
2980
|
-
function
|
|
2981
|
-
const ret = wasm.
|
|
2995
|
+
function wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_5(arg0, arg1, arg2) {
|
|
2996
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_5(arg0, arg1, arg2);
|
|
2982
2997
|
if (ret[1]) {
|
|
2983
2998
|
throw takeFromExternrefTable0(ret[0]);
|
|
2984
2999
|
}
|
|
2985
3000
|
}
|
|
2986
3001
|
|
|
2987
|
-
function
|
|
2988
|
-
const ret = wasm.
|
|
3002
|
+
function wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_6(arg0, arg1, arg2) {
|
|
3003
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_6(arg0, arg1, arg2);
|
|
2989
3004
|
if (ret[1]) {
|
|
2990
3005
|
throw takeFromExternrefTable0(ret[0]);
|
|
2991
3006
|
}
|
|
2992
3007
|
}
|
|
2993
3008
|
|
|
2994
|
-
function
|
|
2995
|
-
const ret = wasm.
|
|
3009
|
+
function wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_7(arg0, arg1, arg2) {
|
|
3010
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_7(arg0, arg1, arg2);
|
|
2996
3011
|
if (ret[1]) {
|
|
2997
3012
|
throw takeFromExternrefTable0(ret[0]);
|
|
2998
3013
|
}
|
|
@@ -3052,12 +3067,12 @@ const PostgresConnectionPoolFinalization = (typeof FinalizationRegistry === 'und
|
|
|
3052
3067
|
const SdkBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3053
3068
|
? { register: () => {}, unregister: () => {} }
|
|
3054
3069
|
: new FinalizationRegistry(ptr => wasm.__wbg_sdkbuilder_free(ptr, 1));
|
|
3055
|
-
const SspConnectionManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3056
|
-
? { register: () => {}, unregister: () => {} }
|
|
3057
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_sspconnectionmanager_free(ptr, 1));
|
|
3058
3070
|
const TokenIssuerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3059
3071
|
? { register: () => {}, unregister: () => {} }
|
|
3060
3072
|
: new FinalizationRegistry(ptr => wasm.__wbg_tokenissuer_free(ptr, 1));
|
|
3073
|
+
const WasmSdkContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3074
|
+
? { register: () => {}, unregister: () => {} }
|
|
3075
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsdkcontext_free(ptr, 1));
|
|
3061
3076
|
|
|
3062
3077
|
function addToExternrefTable0(obj) {
|
|
3063
3078
|
const idx = wasm.__externref_table_alloc();
|
|
Binary file
|
|
@@ -6,9 +6,10 @@ export const __wbg_breezsdk_free: (a: number, b: number) => void;
|
|
|
6
6
|
export const __wbg_defaultsigner_free: (a: number, b: number) => void;
|
|
7
7
|
export const __wbg_mysqlconnectionpool_free: (a: number, b: number) => void;
|
|
8
8
|
export const __wbg_passkey_free: (a: number, b: number) => void;
|
|
9
|
+
export const __wbg_postgresconnectionpool_free: (a: number, b: number) => void;
|
|
9
10
|
export const __wbg_sdkbuilder_free: (a: number, b: number) => void;
|
|
10
|
-
export const __wbg_sspconnectionmanager_free: (a: number, b: number) => void;
|
|
11
11
|
export const __wbg_tokenissuer_free: (a: number, b: number) => void;
|
|
12
|
+
export const __wbg_wasmsdkcontext_free: (a: number, b: number) => void;
|
|
12
13
|
export const bitcoinchainservicehandle_broadcastTransaction: (a: number, b: number, c: number) => any;
|
|
13
14
|
export const bitcoinchainservicehandle_getAddressUtxos: (a: number, b: number, c: number) => any;
|
|
14
15
|
export const bitcoinchainservicehandle_getTransactionHex: (a: number, b: number, c: number) => any;
|
|
@@ -48,6 +49,7 @@ export const breezsdk_prepareSendPayment: (a: number, b: any) => any;
|
|
|
48
49
|
export const breezsdk_receivePayment: (a: number, b: any) => any;
|
|
49
50
|
export const breezsdk_recommendedFees: (a: number) => any;
|
|
50
51
|
export const breezsdk_refundDeposit: (a: number, b: any) => any;
|
|
52
|
+
export const breezsdk_refundPendingConversions: (a: number) => any;
|
|
51
53
|
export const breezsdk_registerLightningAddress: (a: number, b: any) => any;
|
|
52
54
|
export const breezsdk_registerWebhook: (a: number, b: any) => any;
|
|
53
55
|
export const breezsdk_removeEventListener: (a: number, b: number, c: number) => any;
|
|
@@ -65,6 +67,8 @@ export const createPostgresConnectionPool: (a: any) => [number, number, number];
|
|
|
65
67
|
export const defaultConfig: (a: any) => any;
|
|
66
68
|
export const defaultExternalSigner: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number, number];
|
|
67
69
|
export const defaultMysqlStorageConfig: (a: number, b: number) => any;
|
|
70
|
+
export const defaultPostgresStorageConfig: (a: number, b: number) => any;
|
|
71
|
+
export const defaultServerConfig: (a: any) => any;
|
|
68
72
|
export const defaultsigner_aggregateFrost: (a: number, b: any) => any;
|
|
69
73
|
export const defaultsigner_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
70
74
|
export const defaultsigner_derivePublicKey: (a: number, b: number, c: number) => any;
|
|
@@ -88,7 +92,7 @@ export const defaultsigner_subtractSecrets: (a: number, b: any, c: any) => any;
|
|
|
88
92
|
export const getSparkStatus: () => any;
|
|
89
93
|
export const initLogging: (a: any, b: number, c: number) => any;
|
|
90
94
|
export const newRestChainService: (a: number, b: number, c: any, d: any, e: number) => any;
|
|
91
|
-
export const
|
|
95
|
+
export const newSharedSdkContext: (a: any) => any;
|
|
92
96
|
export const passkey_getWallet: (a: number, b: number, c: number) => any;
|
|
93
97
|
export const passkey_isAvailable: (a: number) => any;
|
|
94
98
|
export const passkey_listLabels: (a: number) => any;
|
|
@@ -108,8 +112,7 @@ export const sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
|
|
|
108
112
|
export const sdkbuilder_withPostgresBackend: (a: number, b: any) => [number, number, number];
|
|
109
113
|
export const sdkbuilder_withPostgresConnectionPool: (a: number, b: number) => number;
|
|
110
114
|
export const sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
|
|
111
|
-
export const
|
|
112
|
-
export const sdkbuilder_withSspConnectionManager: (a: number, b: number) => number;
|
|
115
|
+
export const sdkbuilder_withSharedContext: (a: number, b: number) => number;
|
|
113
116
|
export const sdkbuilder_withStorage: (a: number, b: any) => number;
|
|
114
117
|
export const tokenissuer_burnIssuerToken: (a: number, b: any) => any;
|
|
115
118
|
export const tokenissuer_createIssuerToken: (a: number, b: any) => any;
|
|
@@ -136,13 +139,11 @@ export const intounderlyingsink_close: (a: number) => any;
|
|
|
136
139
|
export const intounderlyingsink_write: (a: number, b: any) => any;
|
|
137
140
|
export const intounderlyingsource_cancel: (a: number) => void;
|
|
138
141
|
export const intounderlyingsource_pull: (a: number, b: any) => any;
|
|
139
|
-
export const
|
|
140
|
-
export const
|
|
141
|
-
export const
|
|
142
|
-
export const
|
|
143
|
-
export const
|
|
144
|
-
export const wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_6: (a: number, b: number, c: any) => [number, number];
|
|
145
|
-
export const wasm_bindgen__convert__closures_____invoke__h459c42c6ffe5f52c_7: (a: number, b: number, c: any) => [number, number];
|
|
142
|
+
export const wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21: (a: number, b: number, c: any) => [number, number];
|
|
143
|
+
export const wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_4: (a: number, b: number, c: any) => [number, number];
|
|
144
|
+
export const wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_5: (a: number, b: number, c: any) => [number, number];
|
|
145
|
+
export const wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_6: (a: number, b: number, c: any) => [number, number];
|
|
146
|
+
export const wasm_bindgen__convert__closures_____invoke__h013a98c02f3b4b21_7: (a: number, b: number, c: any) => [number, number];
|
|
146
147
|
export const wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
|
|
147
148
|
export const wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57: (a: number, b: number, c: any) => void;
|
|
148
149
|
export const wasm_bindgen__convert__closures_____invoke__h4819aba3eed2db57_2: (a: number, b: number, c: any) => void;
|
package/nodejs/index.mjs
CHANGED
|
@@ -12,10 +12,11 @@ export const {
|
|
|
12
12
|
defaultExternalSigner,
|
|
13
13
|
defaultMysqlStorageConfig,
|
|
14
14
|
defaultPostgresStorageConfig,
|
|
15
|
+
defaultServerConfig,
|
|
15
16
|
getSparkStatus,
|
|
16
17
|
initLogging,
|
|
17
18
|
newRestChainService,
|
|
18
|
-
|
|
19
|
+
newSharedSdkContext,
|
|
19
20
|
task_worker_entry_point,
|
|
20
21
|
BitcoinChainServiceHandle,
|
|
21
22
|
BreezSdk,
|
|
@@ -27,8 +28,8 @@ export const {
|
|
|
27
28
|
Passkey,
|
|
28
29
|
PostgresConnectionPool,
|
|
29
30
|
SdkBuilder,
|
|
30
|
-
SspConnectionManager,
|
|
31
31
|
TokenIssuer,
|
|
32
|
+
WasmSdkContext,
|
|
32
33
|
} = pkg;
|
|
33
34
|
|
|
34
35
|
export default pkg;
|
|
@@ -33,7 +33,7 @@ class MysqlSessionManager {
|
|
|
33
33
|
* identifying the tenant. All reads and writes are scoped by this.
|
|
34
34
|
* @param {object} [logger]
|
|
35
35
|
*/
|
|
36
|
-
constructor(pool, identity, logger = null) {
|
|
36
|
+
constructor(pool, identity, logger = null, runMigration = true) {
|
|
37
37
|
if (!identity || identity.length !== 33) {
|
|
38
38
|
throw new SessionManagerError(
|
|
39
39
|
"tenant identity (33-byte secp256k1 pubkey) is required"
|
|
@@ -42,12 +42,15 @@ class MysqlSessionManager {
|
|
|
42
42
|
this.pool = pool;
|
|
43
43
|
this.identity = Buffer.from(identity);
|
|
44
44
|
this.logger = logger;
|
|
45
|
+
this.runMigration = runMigration;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
async initialize() {
|
|
48
49
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
if (this.runMigration) {
|
|
51
|
+
const migrationManager = new MysqlSessionManagerMigrationManager(this.logger);
|
|
52
|
+
await migrationManager.migrate(this.pool);
|
|
53
|
+
}
|
|
51
54
|
return this;
|
|
52
55
|
} catch (error) {
|
|
53
56
|
throw new SessionManagerError(
|
|
@@ -72,7 +75,7 @@ class MysqlSessionManager {
|
|
|
72
75
|
const serviceKey = _decodePubkey(serviceIdentityKey);
|
|
73
76
|
try {
|
|
74
77
|
const [rows] = await this.pool.execute(
|
|
75
|
-
`SELECT token, expiration FROM
|
|
78
|
+
`SELECT token, expiration FROM brz_sessions
|
|
76
79
|
WHERE user_id = ? AND service_identity_key = ?`,
|
|
77
80
|
[this.identity, serviceKey]
|
|
78
81
|
);
|
|
@@ -100,7 +103,7 @@ class MysqlSessionManager {
|
|
|
100
103
|
const serviceKey = _decodePubkey(serviceIdentityKey);
|
|
101
104
|
try {
|
|
102
105
|
await this.pool.execute(
|
|
103
|
-
`INSERT INTO
|
|
106
|
+
`INSERT INTO brz_sessions (user_id, service_identity_key, token, expiration)
|
|
104
107
|
VALUES (?, ?, ?, ?)
|
|
105
108
|
ON DUPLICATE KEY UPDATE token = VALUES(token), expiration = VALUES(expiration)`,
|
|
106
109
|
[this.identity, serviceKey, session.token, session.expiration]
|
|
@@ -125,13 +128,28 @@ function _decodePubkey(hex) {
|
|
|
125
128
|
|
|
126
129
|
async function createMysqlSessionManager(poolConfig, identity, logger = null) {
|
|
127
130
|
const pool = mysql.createPool(poolConfig);
|
|
128
|
-
const manager = new MysqlSessionManager(
|
|
131
|
+
const manager = new MysqlSessionManager(
|
|
132
|
+
pool,
|
|
133
|
+
identity,
|
|
134
|
+
logger,
|
|
135
|
+
poolConfig.runMigration !== false
|
|
136
|
+
);
|
|
129
137
|
await manager.initialize();
|
|
130
138
|
return manager;
|
|
131
139
|
}
|
|
132
140
|
|
|
133
|
-
async function createMysqlSessionManagerWithPool(
|
|
134
|
-
|
|
141
|
+
async function createMysqlSessionManagerWithPool(
|
|
142
|
+
pool,
|
|
143
|
+
identity,
|
|
144
|
+
logger = null,
|
|
145
|
+
runMigration = true
|
|
146
|
+
) {
|
|
147
|
+
const manager = new MysqlSessionManager(
|
|
148
|
+
pool,
|
|
149
|
+
identity,
|
|
150
|
+
logger,
|
|
151
|
+
runMigration
|
|
152
|
+
);
|
|
135
153
|
await manager.initialize();
|
|
136
154
|
return manager;
|
|
137
155
|
}
|