@breeztech/breez-sdk-spark 0.15.1 → 0.16.1-dev1
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 +511 -215
- package/bundler/breez_sdk_spark_wasm.js +1 -1
- package/bundler/breez_sdk_spark_wasm_bg.js +567 -414
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +55 -46
- package/bundler/storage/index.js +205 -15
- package/deno/breez_sdk_spark_wasm.d.ts +511 -215
- package/deno/breez_sdk_spark_wasm.js +567 -414
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +55 -46
- package/nodejs/breez_sdk_spark_wasm.d.ts +511 -215
- package/nodejs/breez_sdk_spark_wasm.js +578 -421
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +55 -46
- package/nodejs/index.js +10 -10
- package/nodejs/index.mjs +12 -8
- package/nodejs/mysql-session-store/errors.cjs +13 -0
- package/nodejs/{mysql-session-manager → mysql-session-store}/index.cjs +24 -21
- package/nodejs/{mysql-session-manager → mysql-session-store}/migrations.cjs +17 -11
- package/nodejs/mysql-session-store/package.json +9 -0
- package/nodejs/mysql-storage/index.cjs +229 -111
- package/nodejs/mysql-storage/migrations.cjs +37 -2
- package/nodejs/mysql-token-store/index.cjs +99 -79
- package/nodejs/mysql-token-store/migrations.cjs +59 -2
- package/nodejs/mysql-tree-store/index.cjs +15 -9
- package/nodejs/mysql-tree-store/migrations.cjs +16 -2
- package/nodejs/package.json +2 -2
- package/nodejs/postgres-session-store/errors.cjs +13 -0
- package/nodejs/{postgres-session-manager → postgres-session-store}/index.cjs +23 -23
- package/nodejs/{postgres-session-manager → postgres-session-store}/migrations.cjs +14 -14
- package/nodejs/postgres-session-store/package.json +9 -0
- package/nodejs/postgres-storage/index.cjs +174 -107
- package/nodejs/postgres-storage/migrations.cjs +24 -0
- package/nodejs/postgres-token-store/index.cjs +89 -64
- package/nodejs/postgres-token-store/migrations.cjs +44 -0
- package/nodejs/storage/index.cjs +167 -113
- package/nodejs/storage/migrations.cjs +23 -0
- package/package.json +6 -1
- package/ssr/index.js +52 -28
- package/web/breez_sdk_spark_wasm.d.ts +566 -261
- package/web/breez_sdk_spark_wasm.js +567 -414
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +55 -46
- package/web/passkey-prf-provider/index.d.ts +203 -0
- package/web/passkey-prf-provider/index.js +733 -0
- package/web/storage/index.js +205 -15
- package/nodejs/mysql-session-manager/errors.cjs +0 -13
- package/nodejs/mysql-session-manager/package.json +0 -9
- package/nodejs/postgres-session-manager/errors.cjs +0 -13
- package/nodejs/postgres-session-manager/package.json +0 -9
package/nodejs/storage/index.cjs
CHANGED
|
@@ -41,7 +41,8 @@ const SELECT_PAYMENT_SQL = `
|
|
|
41
41
|
p.timestamp,
|
|
42
42
|
p.method,
|
|
43
43
|
p.withdraw_tx_id,
|
|
44
|
-
|
|
44
|
+
pd.tx_id AS deposit_tx_id,
|
|
45
|
+
pd.vout AS deposit_vout,
|
|
45
46
|
p.spark,
|
|
46
47
|
l.invoice AS lightning_invoice,
|
|
47
48
|
l.payment_hash AS lightning_payment_hash,
|
|
@@ -69,6 +70,7 @@ const SELECT_PAYMENT_SQL = `
|
|
|
69
70
|
LEFT JOIN payment_details_lightning l ON p.id = l.payment_id
|
|
70
71
|
LEFT JOIN payment_details_token t ON p.id = t.payment_id
|
|
71
72
|
LEFT JOIN payment_details_spark s ON p.id = s.payment_id
|
|
73
|
+
LEFT JOIN payment_details_deposit pd ON p.id = pd.payment_id
|
|
72
74
|
LEFT JOIN payment_metadata pm ON p.id = pm.payment_id
|
|
73
75
|
LEFT JOIN lnurl_receive_metadata lrm ON l.payment_hash = lrm.payment_hash`;
|
|
74
76
|
|
|
@@ -313,129 +315,180 @@ class SqliteStorage {
|
|
|
313
315
|
}
|
|
314
316
|
}
|
|
315
317
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
new StorageError("Payment cannot be null or undefined")
|
|
321
|
-
);
|
|
322
|
-
}
|
|
318
|
+
async applyPaymentUpdate(payment) {
|
|
319
|
+
if (!payment) {
|
|
320
|
+
throw new StorageError("Payment cannot be null or undefined");
|
|
321
|
+
}
|
|
323
322
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
328
|
-
payment_type=excluded.payment_type,
|
|
329
|
-
status=excluded.status,
|
|
330
|
-
amount=excluded.amount,
|
|
331
|
-
fees=excluded.fees,
|
|
332
|
-
timestamp=excluded.timestamp,
|
|
333
|
-
method=excluded.method,
|
|
334
|
-
withdraw_tx_id=excluded.withdraw_tx_id,
|
|
335
|
-
deposit_tx_id=excluded.deposit_tx_id,
|
|
336
|
-
spark=excluded.spark`
|
|
337
|
-
);
|
|
338
|
-
const lightningInsert = this.db.prepare(
|
|
339
|
-
`INSERT INTO payment_details_lightning
|
|
340
|
-
(payment_id, invoice, payment_hash, destination_pubkey, description, preimage, htlc_status, htlc_expiry_time)
|
|
341
|
-
VALUES (@id, @invoice, @paymentHash, @destinationPubkey, @description, @preimage, @htlcStatus, @htlcExpiryTime)
|
|
342
|
-
ON CONFLICT(payment_id) DO UPDATE SET
|
|
343
|
-
invoice=excluded.invoice,
|
|
344
|
-
payment_hash=excluded.payment_hash,
|
|
345
|
-
destination_pubkey=excluded.destination_pubkey,
|
|
346
|
-
description=excluded.description,
|
|
347
|
-
preimage=COALESCE(excluded.preimage, payment_details_lightning.preimage),
|
|
348
|
-
htlc_status=COALESCE(excluded.htlc_status, payment_details_lightning.htlc_status),
|
|
349
|
-
htlc_expiry_time=COALESCE(excluded.htlc_expiry_time, payment_details_lightning.htlc_expiry_time)`
|
|
350
|
-
);
|
|
351
|
-
const tokenInsert = this.db.prepare(
|
|
352
|
-
`INSERT INTO payment_details_token
|
|
353
|
-
(payment_id, metadata, tx_hash, tx_type, invoice_details)
|
|
354
|
-
VALUES (@id, @metadata, @txHash, @txType, @invoiceDetails)
|
|
355
|
-
ON CONFLICT(payment_id) DO UPDATE SET
|
|
356
|
-
metadata=excluded.metadata,
|
|
357
|
-
tx_hash=excluded.tx_hash,
|
|
358
|
-
tx_type=excluded.tx_type,
|
|
359
|
-
invoice_details=COALESCE(excluded.invoice_details, payment_details_token.invoice_details)`
|
|
360
|
-
);
|
|
361
|
-
const sparkInsert = this.db.prepare(
|
|
362
|
-
`INSERT INTO payment_details_spark
|
|
363
|
-
(payment_id, invoice_details, htlc_details)
|
|
364
|
-
VALUES (@id, @invoiceDetails, @htlcDetails)
|
|
365
|
-
ON CONFLICT(payment_id) DO UPDATE SET
|
|
366
|
-
invoice_details=COALESCE(excluded.invoice_details, payment_details_spark.invoice_details),
|
|
367
|
-
htlc_details=COALESCE(excluded.htlc_details, payment_details_spark.htlc_details)`
|
|
323
|
+
try {
|
|
324
|
+
const selectStatus = this.db.prepare(
|
|
325
|
+
"SELECT status FROM payments WHERE id = ?"
|
|
368
326
|
);
|
|
327
|
+
let shouldEmit = false;
|
|
369
328
|
const transaction = this.db.transaction(() => {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
? JSON.stringify(payment.details.invoiceDetails)
|
|
394
|
-
: null,
|
|
395
|
-
htlcDetails: payment.details.htlcDetails
|
|
396
|
-
? JSON.stringify(payment.details.htlcDetails)
|
|
397
|
-
: null,
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
if (payment.details?.type === "lightning") {
|
|
402
|
-
lightningInsert.run({
|
|
403
|
-
id: payment.id,
|
|
404
|
-
invoice: payment.details.invoice,
|
|
405
|
-
paymentHash: payment.details.htlcDetails.paymentHash,
|
|
406
|
-
destinationPubkey: payment.details.destinationPubkey,
|
|
407
|
-
description: payment.details.description,
|
|
408
|
-
preimage: payment.details.htlcDetails?.preimage,
|
|
409
|
-
htlcStatus: payment.details.htlcDetails?.status ?? null,
|
|
410
|
-
htlcExpiryTime: payment.details.htlcDetails?.expiryTime ?? 0,
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (payment.details?.type === "token") {
|
|
415
|
-
tokenInsert.run({
|
|
416
|
-
id: payment.id,
|
|
417
|
-
metadata: JSON.stringify(payment.details.metadata),
|
|
418
|
-
txHash: payment.details.txHash,
|
|
419
|
-
txType: payment.details.txType,
|
|
420
|
-
invoiceDetails: payment.details.invoiceDetails
|
|
421
|
-
? JSON.stringify(payment.details.invoiceDetails)
|
|
422
|
-
: null,
|
|
423
|
-
});
|
|
329
|
+
const row = selectStatus.get(payment.id);
|
|
330
|
+
const stored = row
|
|
331
|
+
? this._normalizePaymentStatus(row.status)
|
|
332
|
+
: null;
|
|
333
|
+
const next = this._normalizePaymentStatus(payment.status);
|
|
334
|
+
|
|
335
|
+
if (stored == null) {
|
|
336
|
+
this._runPaymentUpsert(payment);
|
|
337
|
+
shouldEmit = true;
|
|
338
|
+
} else if (stored === next) {
|
|
339
|
+
console.debug(
|
|
340
|
+
`Skipping redundant payment event: id=${payment.id} status=${next}`
|
|
341
|
+
);
|
|
342
|
+
this._runPaymentUpsert(payment);
|
|
343
|
+
shouldEmit = false;
|
|
344
|
+
} else if (this._isFinalPaymentStatus(stored)) {
|
|
345
|
+
console.warn(
|
|
346
|
+
`Skipping payment update (would replace terminal status): id=${payment.id} stored=${stored} new=${next}`
|
|
347
|
+
);
|
|
348
|
+
shouldEmit = false;
|
|
349
|
+
} else {
|
|
350
|
+
this._runPaymentUpsert(payment);
|
|
351
|
+
shouldEmit = true;
|
|
424
352
|
}
|
|
425
353
|
});
|
|
426
354
|
|
|
427
|
-
transaction();
|
|
428
|
-
return
|
|
355
|
+
transaction.immediate();
|
|
356
|
+
return shouldEmit;
|
|
429
357
|
} catch (error) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
error
|
|
434
|
-
)
|
|
358
|
+
throw new StorageError(
|
|
359
|
+
`Failed to apply payment update '${payment.id}': ${error.message}`,
|
|
360
|
+
error
|
|
435
361
|
);
|
|
436
362
|
}
|
|
437
363
|
}
|
|
438
364
|
|
|
365
|
+
_runPaymentUpsert(payment) {
|
|
366
|
+
const paymentInsert = this.db.prepare(
|
|
367
|
+
`INSERT INTO payments (id, payment_type, status, amount, fees, timestamp, method, withdraw_tx_id, spark)
|
|
368
|
+
VALUES (@id, @paymentType, @status, @amount, @fees, @timestamp, @method, @withdrawTxId, @spark)
|
|
369
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
370
|
+
payment_type=excluded.payment_type,
|
|
371
|
+
status=excluded.status,
|
|
372
|
+
amount=excluded.amount,
|
|
373
|
+
fees=excluded.fees,
|
|
374
|
+
timestamp=excluded.timestamp,
|
|
375
|
+
method=excluded.method,
|
|
376
|
+
withdraw_tx_id=excluded.withdraw_tx_id,
|
|
377
|
+
spark=excluded.spark`
|
|
378
|
+
);
|
|
379
|
+
const depositInsert = this.db.prepare(
|
|
380
|
+
`INSERT INTO payment_details_deposit
|
|
381
|
+
(payment_id, tx_id, vout)
|
|
382
|
+
VALUES (@id, @txId, @vout)
|
|
383
|
+
ON CONFLICT(payment_id) DO UPDATE SET
|
|
384
|
+
tx_id=excluded.tx_id,
|
|
385
|
+
vout=excluded.vout`
|
|
386
|
+
);
|
|
387
|
+
const lightningInsert = this.db.prepare(
|
|
388
|
+
`INSERT INTO payment_details_lightning
|
|
389
|
+
(payment_id, invoice, payment_hash, destination_pubkey, description, preimage, htlc_status, htlc_expiry_time)
|
|
390
|
+
VALUES (@id, @invoice, @paymentHash, @destinationPubkey, @description, @preimage, @htlcStatus, @htlcExpiryTime)
|
|
391
|
+
ON CONFLICT(payment_id) DO UPDATE SET
|
|
392
|
+
invoice=excluded.invoice,
|
|
393
|
+
payment_hash=excluded.payment_hash,
|
|
394
|
+
destination_pubkey=excluded.destination_pubkey,
|
|
395
|
+
description=excluded.description,
|
|
396
|
+
preimage=COALESCE(excluded.preimage, payment_details_lightning.preimage),
|
|
397
|
+
htlc_status=COALESCE(excluded.htlc_status, payment_details_lightning.htlc_status),
|
|
398
|
+
htlc_expiry_time=COALESCE(excluded.htlc_expiry_time, payment_details_lightning.htlc_expiry_time)`
|
|
399
|
+
);
|
|
400
|
+
const tokenInsert = this.db.prepare(
|
|
401
|
+
`INSERT INTO payment_details_token
|
|
402
|
+
(payment_id, metadata, tx_hash, tx_type, invoice_details)
|
|
403
|
+
VALUES (@id, @metadata, @txHash, @txType, @invoiceDetails)
|
|
404
|
+
ON CONFLICT(payment_id) DO UPDATE SET
|
|
405
|
+
metadata=excluded.metadata,
|
|
406
|
+
tx_hash=excluded.tx_hash,
|
|
407
|
+
tx_type=excluded.tx_type,
|
|
408
|
+
invoice_details=COALESCE(excluded.invoice_details, payment_details_token.invoice_details)`
|
|
409
|
+
);
|
|
410
|
+
const sparkInsert = this.db.prepare(
|
|
411
|
+
`INSERT INTO payment_details_spark
|
|
412
|
+
(payment_id, invoice_details, htlc_details)
|
|
413
|
+
VALUES (@id, @invoiceDetails, @htlcDetails)
|
|
414
|
+
ON CONFLICT(payment_id) DO UPDATE SET
|
|
415
|
+
invoice_details=COALESCE(excluded.invoice_details, payment_details_spark.invoice_details),
|
|
416
|
+
htlc_details=COALESCE(excluded.htlc_details, payment_details_spark.htlc_details)`
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
paymentInsert.run({
|
|
420
|
+
id: payment.id,
|
|
421
|
+
paymentType: payment.paymentType,
|
|
422
|
+
status: payment.status,
|
|
423
|
+
amount: payment.amount.toString(),
|
|
424
|
+
fees: payment.fees.toString(),
|
|
425
|
+
timestamp: payment.timestamp,
|
|
426
|
+
method: payment.method ? JSON.stringify(payment.method) : null,
|
|
427
|
+
withdrawTxId:
|
|
428
|
+
payment.details?.type === "withdraw" ? payment.details.txId : null,
|
|
429
|
+
spark: payment.details?.type === "spark" ? 1 : null,
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
if (payment.details?.type === "deposit") {
|
|
433
|
+
depositInsert.run({
|
|
434
|
+
id: payment.id,
|
|
435
|
+
txId: payment.details.txId,
|
|
436
|
+
vout: payment.details.vout,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (
|
|
441
|
+
payment.details?.type === "spark" &&
|
|
442
|
+
(payment.details.invoiceDetails != null ||
|
|
443
|
+
payment.details.htlcDetails != null)
|
|
444
|
+
) {
|
|
445
|
+
sparkInsert.run({
|
|
446
|
+
id: payment.id,
|
|
447
|
+
invoiceDetails: payment.details.invoiceDetails
|
|
448
|
+
? JSON.stringify(payment.details.invoiceDetails)
|
|
449
|
+
: null,
|
|
450
|
+
htlcDetails: payment.details.htlcDetails
|
|
451
|
+
? JSON.stringify(payment.details.htlcDetails)
|
|
452
|
+
: null,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (payment.details?.type === "lightning") {
|
|
457
|
+
lightningInsert.run({
|
|
458
|
+
id: payment.id,
|
|
459
|
+
invoice: payment.details.invoice,
|
|
460
|
+
paymentHash: payment.details.htlcDetails.paymentHash,
|
|
461
|
+
destinationPubkey: payment.details.destinationPubkey,
|
|
462
|
+
description: payment.details.description,
|
|
463
|
+
preimage: payment.details.htlcDetails?.preimage,
|
|
464
|
+
htlcStatus: payment.details.htlcDetails?.status ?? null,
|
|
465
|
+
htlcExpiryTime: payment.details.htlcDetails?.expiryTime ?? 0,
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (payment.details?.type === "token") {
|
|
470
|
+
tokenInsert.run({
|
|
471
|
+
id: payment.id,
|
|
472
|
+
metadata: JSON.stringify(payment.details.metadata),
|
|
473
|
+
txHash: payment.details.txHash,
|
|
474
|
+
txType: payment.details.txType,
|
|
475
|
+
invoiceDetails: payment.details.invoiceDetails
|
|
476
|
+
? JSON.stringify(payment.details.invoiceDetails)
|
|
477
|
+
: null,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
_normalizePaymentStatus(status) {
|
|
483
|
+
return typeof status === "string" ? status.toLowerCase() : status;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
_isFinalPaymentStatus(status) {
|
|
487
|
+
const normalized = this._normalizePaymentStatus(status);
|
|
488
|
+
return normalized === "completed" || normalized === "failed";
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
439
492
|
getPaymentById(id) {
|
|
440
493
|
try {
|
|
441
494
|
if (!id) {
|
|
@@ -769,6 +822,7 @@ class SqliteStorage {
|
|
|
769
822
|
details = {
|
|
770
823
|
type: "deposit",
|
|
771
824
|
txId: row.deposit_tx_id,
|
|
825
|
+
vout: row.deposit_vout,
|
|
772
826
|
};
|
|
773
827
|
} else if (row.spark) {
|
|
774
828
|
details = {
|
|
@@ -433,6 +433,29 @@ class MigrationManager {
|
|
|
433
433
|
`CREATE INDEX idx_payment_metadata_payment_id ON payment_metadata(payment_id)`,
|
|
434
434
|
],
|
|
435
435
|
},
|
|
436
|
+
{
|
|
437
|
+
// Move deposit details into their own table so vout can be NOT NULL and
|
|
438
|
+
// the schema matches payment_details_lightning / _token / _spark. We can't
|
|
439
|
+
// safely backfill the new table from the dropped deposit_tx_id column: we
|
|
440
|
+
// never stored the original SSP output_index, and vout=0 is a valid output
|
|
441
|
+
// index — defaulting would silently mislabel. Drop the column and leave
|
|
442
|
+
// the payments row in place. The read path sees an unjoined deposit row
|
|
443
|
+
// as `details: None` until the resync re-fetches the SSP user_request and
|
|
444
|
+
// the upsert inserts the new details row.
|
|
445
|
+
name: "Move deposit details into payment_details_deposit table",
|
|
446
|
+
sql: [
|
|
447
|
+
`CREATE TABLE payment_details_deposit (
|
|
448
|
+
payment_id TEXT PRIMARY KEY,
|
|
449
|
+
tx_id TEXT NOT NULL,
|
|
450
|
+
vout INTEGER NOT NULL,
|
|
451
|
+
FOREIGN KEY (payment_id) REFERENCES payments(id) ON DELETE CASCADE
|
|
452
|
+
)`,
|
|
453
|
+
`ALTER TABLE payments DROP COLUMN deposit_tx_id`,
|
|
454
|
+
`UPDATE settings
|
|
455
|
+
SET value = json_set(value, '$.offset', 0)
|
|
456
|
+
WHERE key = 'sync_offset' AND json_valid(value)`,
|
|
457
|
+
],
|
|
458
|
+
},
|
|
436
459
|
];
|
|
437
460
|
}
|
|
438
461
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breeztech/breez-sdk-spark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1-dev1",
|
|
4
4
|
"description": "Breez Spark SDK",
|
|
5
5
|
"repository": "https://github.com/breez/spark-sdk",
|
|
6
6
|
"author": "Breez <contact@breez.technology> (https://github.com/breez)",
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"./nodejs": "./nodejs/index.js",
|
|
24
24
|
"./web": "./web/index.js",
|
|
25
25
|
"./ssr": "./ssr/index.js",
|
|
26
|
+
"./passkey-prf-provider": {
|
|
27
|
+
"types": "./web/passkey-prf-provider/index.d.ts",
|
|
28
|
+
"import": "./web/passkey-prf-provider/index.js",
|
|
29
|
+
"default": "./web/passkey-prf-provider/index.js"
|
|
30
|
+
},
|
|
26
31
|
".": {
|
|
27
32
|
"node": {
|
|
28
33
|
"import": "./nodejs/index.mjs",
|
package/ssr/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SSR-safe entry point for Breez SDK
|
|
2
|
-
// Safe to import during server-side rendering
|
|
2
|
+
// Safe to import during server-side rendering: no WASM, no browser APIs, no Node.js APIs.
|
|
3
3
|
// Call init() on the client before using any SDK functions.
|
|
4
4
|
|
|
5
5
|
let _module = null;
|
|
@@ -33,14 +33,9 @@ export function connectWithSigner(...args) {
|
|
|
33
33
|
return _module.connectWithSigner(...args);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function
|
|
37
|
-
if (!_module) _notInitialized('
|
|
38
|
-
return _module.
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function createPostgresConnectionPool(...args) {
|
|
42
|
-
if (!_module) _notInitialized('createPostgresConnectionPool');
|
|
43
|
-
return _module.createPostgresConnectionPool(...args);
|
|
36
|
+
export function createTurnkeySigner(...args) {
|
|
37
|
+
if (!_module) _notInitialized('createTurnkeySigner');
|
|
38
|
+
return _module.createTurnkeySigner(...args);
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
export function defaultConfig(...args) {
|
|
@@ -48,9 +43,9 @@ export function defaultConfig(...args) {
|
|
|
48
43
|
return _module.defaultConfig(...args);
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
export function
|
|
52
|
-
if (!_module) _notInitialized('
|
|
53
|
-
return _module.
|
|
46
|
+
export function defaultExternalSigners(...args) {
|
|
47
|
+
if (!_module) _notInitialized('defaultExternalSigners');
|
|
48
|
+
return _module.defaultExternalSigners(...args);
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
export function defaultMysqlStorageConfig(...args) {
|
|
@@ -68,6 +63,11 @@ export function defaultServerConfig(...args) {
|
|
|
68
63
|
return _module.defaultServerConfig(...args);
|
|
69
64
|
}
|
|
70
65
|
|
|
66
|
+
export function defaultStorage(...args) {
|
|
67
|
+
if (!_module) _notInitialized('defaultStorage');
|
|
68
|
+
return _module.defaultStorage(...args);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
71
|
export function getSparkStatus(...args) {
|
|
72
72
|
if (!_module) _notInitialized('getSparkStatus');
|
|
73
73
|
return _module.getSparkStatus(...args);
|
|
@@ -78,6 +78,11 @@ export function initLogging(...args) {
|
|
|
78
78
|
return _module.initLogging(...args);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
export function mysqlStorage(...args) {
|
|
82
|
+
if (!_module) _notInitialized('mysqlStorage');
|
|
83
|
+
return _module.mysqlStorage(...args);
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
export function newRestChainService(...args) {
|
|
82
87
|
if (!_module) _notInitialized('newRestChainService');
|
|
83
88
|
return _module.newRestChainService(...args);
|
|
@@ -88,6 +93,11 @@ export function newSharedSdkContext(...args) {
|
|
|
88
93
|
return _module.newSharedSdkContext(...args);
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
export function postgresStorage(...args) {
|
|
97
|
+
if (!_module) _notInitialized('postgresStorage');
|
|
98
|
+
return _module.postgresStorage(...args);
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
export function task_worker_entry_point(...args) {
|
|
92
102
|
if (!_module) _notInitialized('task_worker_entry_point');
|
|
93
103
|
return _module.task_worker_entry_point(...args);
|
|
@@ -112,10 +122,24 @@ export class BreezSdk {
|
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
export class
|
|
125
|
+
export class ExternalBreezSignerHandle {
|
|
126
|
+
constructor(...args) {
|
|
127
|
+
if (!_module) _notInitialized('new ExternalBreezSignerHandle');
|
|
128
|
+
return new _module.ExternalBreezSignerHandle(...args);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class ExternalSigners {
|
|
116
133
|
constructor(...args) {
|
|
117
|
-
if (!_module) _notInitialized('new
|
|
118
|
-
return new _module.
|
|
134
|
+
if (!_module) _notInitialized('new ExternalSigners');
|
|
135
|
+
return new _module.ExternalSigners(...args);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export class ExternalSparkSignerHandle {
|
|
140
|
+
constructor(...args) {
|
|
141
|
+
if (!_module) _notInitialized('new ExternalSparkSignerHandle');
|
|
142
|
+
return new _module.ExternalSparkSignerHandle(...args);
|
|
119
143
|
}
|
|
120
144
|
}
|
|
121
145
|
|
|
@@ -140,24 +164,17 @@ export class IntoUnderlyingSource {
|
|
|
140
164
|
}
|
|
141
165
|
}
|
|
142
166
|
|
|
143
|
-
export class
|
|
144
|
-
constructor(...args) {
|
|
145
|
-
if (!_module) _notInitialized('new MysqlConnectionPool');
|
|
146
|
-
return new _module.MysqlConnectionPool(...args);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export class Passkey {
|
|
167
|
+
export class PasskeyClient {
|
|
151
168
|
constructor(...args) {
|
|
152
|
-
if (!_module) _notInitialized('new
|
|
153
|
-
return new _module.
|
|
169
|
+
if (!_module) _notInitialized('new PasskeyClient');
|
|
170
|
+
return new _module.PasskeyClient(...args);
|
|
154
171
|
}
|
|
155
172
|
}
|
|
156
173
|
|
|
157
|
-
export class
|
|
174
|
+
export class PasskeyLabels {
|
|
158
175
|
constructor(...args) {
|
|
159
|
-
if (!_module) _notInitialized('new
|
|
160
|
-
return new _module.
|
|
176
|
+
if (!_module) _notInitialized('new PasskeyLabels');
|
|
177
|
+
return new _module.PasskeyLabels(...args);
|
|
161
178
|
}
|
|
162
179
|
}
|
|
163
180
|
|
|
@@ -182,3 +199,10 @@ export class WasmSdkContext {
|
|
|
182
199
|
}
|
|
183
200
|
}
|
|
184
201
|
|
|
202
|
+
export class WasmStorageConfig {
|
|
203
|
+
constructor(...args) {
|
|
204
|
+
if (!_module) _notInitialized('new WasmStorageConfig');
|
|
205
|
+
return new _module.WasmStorageConfig(...args);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|