@bsv/wallet-toolbox 1.1.6 → 1.1.8
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/docs/client.md +499 -900
- package/docs/monitor.md +29 -69
- package/docs/services.md +22 -40
- package/docs/setup.md +23 -65
- package/docs/storage.md +2163 -489
- package/docs/wallet.md +499 -900
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -4
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -2
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/sdk/StorageSyncReader.d.ts +30 -30
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -1
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +60 -60
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +36 -36
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +61 -61
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +2 -2
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +16 -15
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +8 -8
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts +21 -21
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/StorageReaderWriter.d.ts +60 -60
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
- package/out/src/storage/StorageReaderWriter.js.map +1 -1
- package/out/src/storage/StorageSyncReader.d.ts +17 -17
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
- package/out/src/storage/StorageSyncReader.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +9 -9
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +2 -2
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/index.all.d.ts +2 -2
- package/out/src/storage/index.all.d.ts.map +1 -1
- package/out/src/storage/index.all.js +3 -3
- package/out/src/storage/index.all.js.map +1 -1
- package/out/src/storage/index.client.d.ts +2 -2
- package/out/src/storage/index.client.d.ts.map +1 -1
- package/out/src/storage/index.client.js +2 -25
- package/out/src/storage/index.client.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +3 -3
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +1 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +2 -2
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
- package/out/src/storage/methods/getSyncChunk.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +1 -1
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActions.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/out/src/storage/methods/listCertificates.js.map +1 -1
- package/out/src/storage/methods/listOutputs.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +4 -4
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +2 -2
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeData.d.ts.map +1 -1
- package/out/src/storage/methods/purgeData.js +4 -2
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.js +1 -1
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +11 -11
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Certificate.js +5 -5
- package/out/src/storage/schema/entities/Certificate.js.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.js +5 -5
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/Commission.d.ts +9 -9
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Commission.js +5 -5
- package/out/src/storage/schema/entities/Commission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/entities/Output.d.ts +9 -9
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Output.js +5 -5
- package/out/src/storage/schema/entities/Output.js.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.js +5 -5
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.js +5 -5
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.js +11 -11
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/SyncState.js +27 -27
- package/out/src/storage/schema/entities/SyncState.js.map +1 -1
- package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Transaction.js +6 -6
- package/out/src/storage/schema/entities/Transaction.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.js +5 -5
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/User.d.ts +9 -9
- package/out/src/storage/schema/entities/User.d.ts.map +1 -1
- package/out/src/storage/schema/entities/User.js +5 -5
- package/out/src/storage/schema/entities/User.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
- package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Output.d.ts +5 -5
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
- package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/User.d.ts +1 -1
- package/out/src/storage/schema/tables/User.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.d.ts +1 -1
- package/out/src/storage/schema/tables/index.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.js +1 -1
- package/out/src/storage/schema/tables/index.js.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -2
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js +35 -1
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
- package/out/test/monitor/Monitor.test.js +7 -7
- package/out/test/monitor/Monitor.test.js.map +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
- package/out/test/storage/insert.test.js.map +1 -1
- package/out/test/storage/update.test.js.map +1 -1
- package/out/test/storage/update2.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +11 -4
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
- package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
- package/src/sdk/StorageSyncReader.ts +47 -30
- package/src/sdk/StorageSyncReaderWriter.ts +77 -63
- package/src/sdk/WalletStorage.interfaces.ts +55 -36
- package/src/signer/methods/acquireDirectCertificate.ts +2 -2
- package/src/storage/StorageKnex.ts +124 -104
- package/src/storage/StorageProvider.ts +43 -30
- package/src/storage/StorageReader.ts +36 -21
- package/src/storage/StorageReaderWriter.ts +78 -65
- package/src/storage/StorageSyncReader.ts +34 -17
- package/src/storage/WalletStorageManager.ts +17 -12
- package/src/storage/index.all.ts +2 -2
- package/src/storage/index.client.ts +2 -2
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
- package/src/storage/methods/createAction.ts +29 -26
- package/src/storage/methods/getBeefForTransaction.ts +3 -3
- package/src/storage/methods/getSyncChunk.ts +28 -13
- package/src/storage/methods/internalizeAction.ts +19 -17
- package/src/storage/methods/listActions.ts +5 -5
- package/src/storage/methods/listCertificates.ts +2 -2
- package/src/storage/methods/listOutputs.ts +5 -5
- package/src/storage/methods/processAction.ts +21 -17
- package/src/storage/methods/purgeData.ts +20 -12
- package/src/storage/methods/reviewStatus.ts +5 -5
- package/src/storage/remoting/StorageClient.ts +28 -18
- package/src/storage/schema/entities/Certificate.ts +16 -17
- package/src/storage/schema/entities/CertificateField.ts +17 -18
- package/src/storage/schema/entities/Commission.ts +16 -20
- package/src/storage/schema/entities/EntityBase.ts +1 -1
- package/src/storage/schema/entities/MergeEntity.ts +7 -7
- package/src/storage/schema/entities/Output.ts +16 -20
- package/src/storage/schema/entities/OutputBasket.ts +16 -17
- package/src/storage/schema/entities/OutputTag.ts +16 -20
- package/src/storage/schema/entities/OutputTagMap.ts +17 -18
- package/src/storage/schema/entities/ProvenTx.ts +24 -28
- package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
- package/src/storage/schema/entities/SyncState.ts +61 -38
- package/src/storage/schema/entities/Transaction.ts +23 -23
- package/src/storage/schema/entities/TxLabel.ts +16 -17
- package/src/storage/schema/entities/TxLabelMap.ts +16 -20
- package/src/storage/schema/entities/User.ts +15 -19
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
- package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
- package/src/storage/schema/tables/Certificate.ts +4 -4
- package/src/storage/schema/tables/CertificateField.ts +1 -1
- package/src/storage/schema/tables/Commission.ts +1 -1
- package/src/storage/schema/tables/MonitorEvent.ts +1 -1
- package/src/storage/schema/tables/Output.ts +5 -5
- package/src/storage/schema/tables/OutputBasket.ts +1 -1
- package/src/storage/schema/tables/OutputTag.ts +1 -1
- package/src/storage/schema/tables/OutputTagMap.ts +1 -1
- package/src/storage/schema/tables/ProvenTx.ts +1 -1
- package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
- package/src/storage/schema/tables/SyncState.ts +1 -1
- package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
- package/src/storage/schema/tables/Transaction.ts +1 -1
- package/src/storage/schema/tables/TxLabel.ts +1 -1
- package/src/storage/schema/tables/TxLabelMap.ts +1 -1
- package/src/storage/schema/tables/User.ts +1 -1
- package/src/storage/schema/tables/index.ts +1 -1
- package/src/storage/sync/StorageMySQLDojoReader.ts +67 -50
- package/test/Wallet/certificate/listCertificates.test.ts +12 -8
- package/test/Wallet/live/walletLive.man.test.ts +46 -6
- package/test/monitor/Monitor.test.ts +8 -8
- package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
- package/test/storage/insert.test.ts +2 -2
- package/test/storage/update.test.ts +30 -30
- package/test/storage/update2.test.ts +23 -24
- package/test/utils/TestUtilsWalletStorage.ts +103 -82
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
- package/ts2md.json +12 -6
- package/out/src/storage/index.db.d.ts +0 -1
- package/out/src/storage/index.db.d.ts.map +0 -1
- package/out/src/storage/index.db.js +0 -2
- package/out/src/storage/index.db.js.map +0 -1
- package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Settings.js.map +0 -1
- package/src/storage/index.db.ts +0 -0
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
entity,
|
|
3
2
|
randomBytesBase64,
|
|
4
3
|
sdk,
|
|
5
|
-
|
|
4
|
+
TableCertificate,
|
|
5
|
+
TableCertificateField,
|
|
6
|
+
TableCommission,
|
|
7
|
+
TableMonitorEvent,
|
|
8
|
+
TableOutput,
|
|
9
|
+
TableOutputBasket,
|
|
10
|
+
TableOutputTag,
|
|
11
|
+
TableOutputTagMap,
|
|
12
|
+
TableProvenTx,
|
|
13
|
+
TableProvenTxReq,
|
|
14
|
+
TableSyncState,
|
|
15
|
+
TableTransaction,
|
|
16
|
+
TableTxLabel,
|
|
17
|
+
TableTxLabelMap,
|
|
18
|
+
TableUser,
|
|
6
19
|
verifyId,
|
|
7
20
|
verifyOne,
|
|
8
21
|
verifyOneOrNone,
|
|
@@ -24,14 +37,14 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
24
37
|
|
|
25
38
|
abstract findOutputTagMaps(
|
|
26
39
|
args: sdk.FindOutputTagMapsArgs
|
|
27
|
-
): Promise<
|
|
40
|
+
): Promise<TableOutputTagMap[]>
|
|
28
41
|
abstract findProvenTxReqs(
|
|
29
42
|
args: sdk.FindProvenTxReqsArgs
|
|
30
|
-
): Promise<
|
|
31
|
-
abstract findProvenTxs(args: sdk.FindProvenTxsArgs): Promise<
|
|
43
|
+
): Promise<TableProvenTxReq[]>
|
|
44
|
+
abstract findProvenTxs(args: sdk.FindProvenTxsArgs): Promise<TableProvenTx[]>
|
|
32
45
|
abstract findTxLabelMaps(
|
|
33
46
|
args: sdk.FindTxLabelMapsArgs
|
|
34
|
-
): Promise<
|
|
47
|
+
): Promise<TableTxLabelMap[]>
|
|
35
48
|
|
|
36
49
|
abstract countOutputTagMaps(args: sdk.FindOutputTagMapsArgs): Promise<number>
|
|
37
50
|
abstract countProvenTxReqs(args: sdk.FindProvenTxReqsArgs): Promise<number>
|
|
@@ -39,139 +52,139 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
39
52
|
abstract countTxLabelMaps(args: sdk.FindTxLabelMapsArgs): Promise<number>
|
|
40
53
|
|
|
41
54
|
abstract insertCertificate(
|
|
42
|
-
certificate:
|
|
55
|
+
certificate: TableCertificate,
|
|
43
56
|
trx?: sdk.TrxToken
|
|
44
57
|
): Promise<number>
|
|
45
58
|
abstract insertCertificateField(
|
|
46
|
-
certificateField:
|
|
59
|
+
certificateField: TableCertificateField,
|
|
47
60
|
trx?: sdk.TrxToken
|
|
48
61
|
): Promise<void>
|
|
49
62
|
abstract insertCommission(
|
|
50
|
-
commission:
|
|
63
|
+
commission: TableCommission,
|
|
51
64
|
trx?: sdk.TrxToken
|
|
52
65
|
): Promise<number>
|
|
53
66
|
abstract insertMonitorEvent(
|
|
54
|
-
event:
|
|
67
|
+
event: TableMonitorEvent,
|
|
55
68
|
trx?: sdk.TrxToken
|
|
56
69
|
): Promise<number>
|
|
57
70
|
abstract insertOutput(
|
|
58
|
-
output:
|
|
71
|
+
output: TableOutput,
|
|
59
72
|
trx?: sdk.TrxToken
|
|
60
73
|
): Promise<number>
|
|
61
74
|
abstract insertOutputBasket(
|
|
62
|
-
basket:
|
|
75
|
+
basket: TableOutputBasket,
|
|
63
76
|
trx?: sdk.TrxToken
|
|
64
77
|
): Promise<number>
|
|
65
78
|
abstract insertOutputTag(
|
|
66
|
-
tag:
|
|
79
|
+
tag: TableOutputTag,
|
|
67
80
|
trx?: sdk.TrxToken
|
|
68
81
|
): Promise<number>
|
|
69
82
|
abstract insertOutputTagMap(
|
|
70
|
-
tagMap:
|
|
83
|
+
tagMap: TableOutputTagMap,
|
|
71
84
|
trx?: sdk.TrxToken
|
|
72
85
|
): Promise<void>
|
|
73
86
|
abstract insertProvenTx(
|
|
74
|
-
tx:
|
|
87
|
+
tx: TableProvenTx,
|
|
75
88
|
trx?: sdk.TrxToken
|
|
76
89
|
): Promise<number>
|
|
77
90
|
abstract insertProvenTxReq(
|
|
78
|
-
tx:
|
|
91
|
+
tx: TableProvenTxReq,
|
|
79
92
|
trx?: sdk.TrxToken
|
|
80
93
|
): Promise<number>
|
|
81
94
|
abstract insertSyncState(
|
|
82
|
-
syncState:
|
|
95
|
+
syncState: TableSyncState,
|
|
83
96
|
trx?: sdk.TrxToken
|
|
84
97
|
): Promise<number>
|
|
85
98
|
abstract insertTransaction(
|
|
86
|
-
tx:
|
|
99
|
+
tx: TableTransaction,
|
|
87
100
|
trx?: sdk.TrxToken
|
|
88
101
|
): Promise<number>
|
|
89
102
|
abstract insertTxLabel(
|
|
90
|
-
label:
|
|
103
|
+
label: TableTxLabel,
|
|
91
104
|
trx?: sdk.TrxToken
|
|
92
105
|
): Promise<number>
|
|
93
106
|
abstract insertTxLabelMap(
|
|
94
|
-
labelMap:
|
|
107
|
+
labelMap: TableTxLabelMap,
|
|
95
108
|
trx?: sdk.TrxToken
|
|
96
109
|
): Promise<void>
|
|
97
|
-
abstract insertUser(user:
|
|
110
|
+
abstract insertUser(user: TableUser, trx?: sdk.TrxToken): Promise<number>
|
|
98
111
|
|
|
99
112
|
abstract updateCertificate(
|
|
100
113
|
id: number,
|
|
101
|
-
update: Partial<
|
|
114
|
+
update: Partial<TableCertificate>,
|
|
102
115
|
trx?: sdk.TrxToken
|
|
103
116
|
): Promise<number>
|
|
104
117
|
abstract updateCertificateField(
|
|
105
118
|
certificateId: number,
|
|
106
119
|
fieldName: string,
|
|
107
|
-
update: Partial<
|
|
120
|
+
update: Partial<TableCertificateField>,
|
|
108
121
|
trx?: sdk.TrxToken
|
|
109
122
|
): Promise<number>
|
|
110
123
|
abstract updateCommission(
|
|
111
124
|
id: number,
|
|
112
|
-
update: Partial<
|
|
125
|
+
update: Partial<TableCommission>,
|
|
113
126
|
trx?: sdk.TrxToken
|
|
114
127
|
): Promise<number>
|
|
115
128
|
abstract updateMonitorEvent(
|
|
116
129
|
id: number,
|
|
117
|
-
update: Partial<
|
|
130
|
+
update: Partial<TableMonitorEvent>,
|
|
118
131
|
trx?: sdk.TrxToken
|
|
119
132
|
): Promise<number>
|
|
120
133
|
abstract updateOutput(
|
|
121
134
|
id: number,
|
|
122
|
-
update: Partial<
|
|
135
|
+
update: Partial<TableOutput>,
|
|
123
136
|
trx?: sdk.TrxToken
|
|
124
137
|
): Promise<number>
|
|
125
138
|
abstract updateOutputBasket(
|
|
126
139
|
id: number,
|
|
127
|
-
update: Partial<
|
|
140
|
+
update: Partial<TableOutputBasket>,
|
|
128
141
|
trx?: sdk.TrxToken
|
|
129
142
|
): Promise<number>
|
|
130
143
|
abstract updateOutputTag(
|
|
131
144
|
id: number,
|
|
132
|
-
update: Partial<
|
|
145
|
+
update: Partial<TableOutputTag>,
|
|
133
146
|
trx?: sdk.TrxToken
|
|
134
147
|
): Promise<number>
|
|
135
148
|
abstract updateOutputTagMap(
|
|
136
149
|
outputId: number,
|
|
137
150
|
tagId: number,
|
|
138
|
-
update: Partial<
|
|
151
|
+
update: Partial<TableOutputTagMap>,
|
|
139
152
|
trx?: sdk.TrxToken
|
|
140
153
|
): Promise<number>
|
|
141
154
|
abstract updateProvenTx(
|
|
142
155
|
id: number,
|
|
143
|
-
update: Partial<
|
|
156
|
+
update: Partial<TableProvenTx>,
|
|
144
157
|
trx?: sdk.TrxToken
|
|
145
158
|
): Promise<number>
|
|
146
159
|
abstract updateProvenTxReq(
|
|
147
160
|
id: number | number[],
|
|
148
|
-
update: Partial<
|
|
161
|
+
update: Partial<TableProvenTxReq>,
|
|
149
162
|
trx?: sdk.TrxToken
|
|
150
163
|
): Promise<number>
|
|
151
164
|
abstract updateSyncState(
|
|
152
165
|
id: number,
|
|
153
|
-
update: Partial<
|
|
166
|
+
update: Partial<TableSyncState>,
|
|
154
167
|
trx?: sdk.TrxToken
|
|
155
168
|
): Promise<number>
|
|
156
169
|
abstract updateTransaction(
|
|
157
170
|
id: number | number[],
|
|
158
|
-
update: Partial<
|
|
171
|
+
update: Partial<TableTransaction>,
|
|
159
172
|
trx?: sdk.TrxToken
|
|
160
173
|
): Promise<number>
|
|
161
174
|
abstract updateTxLabel(
|
|
162
175
|
id: number,
|
|
163
|
-
update: Partial<
|
|
176
|
+
update: Partial<TableTxLabel>,
|
|
164
177
|
trx?: sdk.TrxToken
|
|
165
178
|
): Promise<number>
|
|
166
179
|
abstract updateTxLabelMap(
|
|
167
180
|
transactionId: number,
|
|
168
181
|
txLabelId: number,
|
|
169
|
-
update: Partial<
|
|
182
|
+
update: Partial<TableTxLabelMap>,
|
|
170
183
|
trx?: sdk.TrxToken
|
|
171
184
|
): Promise<number>
|
|
172
185
|
abstract updateUser(
|
|
173
186
|
id: number,
|
|
174
|
-
update: Partial<
|
|
187
|
+
update: Partial<TableUser>,
|
|
175
188
|
trx?: sdk.TrxToken
|
|
176
189
|
): Promise<number>
|
|
177
190
|
|
|
@@ -187,7 +200,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
187
200
|
async findCertificateById(
|
|
188
201
|
id: number,
|
|
189
202
|
trx?: sdk.TrxToken
|
|
190
|
-
): Promise<
|
|
203
|
+
): Promise<TableCertificate | undefined> {
|
|
191
204
|
return verifyOneOrNone(
|
|
192
205
|
await this.findCertificates({ partial: { certificateId: id }, trx })
|
|
193
206
|
)
|
|
@@ -195,7 +208,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
195
208
|
async findCommissionById(
|
|
196
209
|
id: number,
|
|
197
210
|
trx?: sdk.TrxToken
|
|
198
|
-
): Promise<
|
|
211
|
+
): Promise<TableCommission | undefined> {
|
|
199
212
|
return verifyOneOrNone(
|
|
200
213
|
await this.findCommissions({ partial: { commissionId: id }, trx })
|
|
201
214
|
)
|
|
@@ -204,7 +217,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
204
217
|
id: number,
|
|
205
218
|
trx?: sdk.TrxToken,
|
|
206
219
|
noScript?: boolean
|
|
207
|
-
): Promise<
|
|
220
|
+
): Promise<TableOutput | undefined> {
|
|
208
221
|
return verifyOneOrNone(
|
|
209
222
|
await this.findOutputs({ partial: { outputId: id }, noScript, trx })
|
|
210
223
|
)
|
|
@@ -212,7 +225,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
212
225
|
async findOutputBasketById(
|
|
213
226
|
id: number,
|
|
214
227
|
trx?: sdk.TrxToken
|
|
215
|
-
): Promise<
|
|
228
|
+
): Promise<TableOutputBasket | undefined> {
|
|
216
229
|
return verifyOneOrNone(
|
|
217
230
|
await this.findOutputBaskets({ partial: { basketId: id }, trx })
|
|
218
231
|
)
|
|
@@ -220,7 +233,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
220
233
|
async findProvenTxById(
|
|
221
234
|
id: number,
|
|
222
235
|
trx?: sdk.TrxToken | undefined
|
|
223
|
-
): Promise<
|
|
236
|
+
): Promise<TableProvenTx | undefined> {
|
|
224
237
|
return verifyOneOrNone(
|
|
225
238
|
await this.findProvenTxs({ partial: { provenTxId: id }, trx })
|
|
226
239
|
)
|
|
@@ -228,7 +241,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
228
241
|
async findProvenTxReqById(
|
|
229
242
|
id: number,
|
|
230
243
|
trx?: sdk.TrxToken | undefined
|
|
231
|
-
): Promise<
|
|
244
|
+
): Promise<TableProvenTxReq | undefined> {
|
|
232
245
|
return verifyOneOrNone(
|
|
233
246
|
await this.findProvenTxReqs({ partial: { provenTxReqId: id }, trx })
|
|
234
247
|
)
|
|
@@ -236,7 +249,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
236
249
|
async findSyncStateById(
|
|
237
250
|
id: number,
|
|
238
251
|
trx?: sdk.TrxToken
|
|
239
|
-
): Promise<
|
|
252
|
+
): Promise<TableSyncState | undefined> {
|
|
240
253
|
return verifyOneOrNone(
|
|
241
254
|
await this.findSyncStates({ partial: { syncStateId: id }, trx })
|
|
242
255
|
)
|
|
@@ -245,7 +258,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
245
258
|
id: number,
|
|
246
259
|
trx?: sdk.TrxToken,
|
|
247
260
|
noRawTx?: boolean
|
|
248
|
-
): Promise<
|
|
261
|
+
): Promise<TableTransaction | undefined> {
|
|
249
262
|
return verifyOneOrNone(
|
|
250
263
|
await this.findTransactions({
|
|
251
264
|
partial: { transactionId: id },
|
|
@@ -257,7 +270,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
257
270
|
async findTxLabelById(
|
|
258
271
|
id: number,
|
|
259
272
|
trx?: sdk.TrxToken
|
|
260
|
-
): Promise<
|
|
273
|
+
): Promise<TableTxLabel | undefined> {
|
|
261
274
|
return verifyOneOrNone(
|
|
262
275
|
await this.findTxLabels({ partial: { txLabelId: id }, trx })
|
|
263
276
|
)
|
|
@@ -265,7 +278,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
265
278
|
async findOutputTagById(
|
|
266
279
|
id: number,
|
|
267
280
|
trx?: sdk.TrxToken
|
|
268
|
-
): Promise<
|
|
281
|
+
): Promise<TableOutputTag | undefined> {
|
|
269
282
|
return verifyOneOrNone(
|
|
270
283
|
await this.findOutputTags({ partial: { outputTagId: id }, trx })
|
|
271
284
|
)
|
|
@@ -273,7 +286,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
273
286
|
async findUserById(
|
|
274
287
|
id: number,
|
|
275
288
|
trx?: sdk.TrxToken
|
|
276
|
-
): Promise<
|
|
289
|
+
): Promise<TableUser | undefined> {
|
|
277
290
|
return verifyOneOrNone(
|
|
278
291
|
await this.findUsers({ partial: { userId: id }, trx })
|
|
279
292
|
)
|
|
@@ -282,8 +295,8 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
282
295
|
async findOrInsertUser(
|
|
283
296
|
identityKey: string,
|
|
284
297
|
trx?: sdk.TrxToken
|
|
285
|
-
): Promise<{ user:
|
|
286
|
-
let user:
|
|
298
|
+
): Promise<{ user: TableUser; isNew: boolean }> {
|
|
299
|
+
let user: TableUser | undefined
|
|
287
300
|
let isNew = false
|
|
288
301
|
for (let retry = 0; ; retry++) {
|
|
289
302
|
try {
|
|
@@ -324,10 +337,10 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
324
337
|
}
|
|
325
338
|
|
|
326
339
|
async findOrInsertTransaction(
|
|
327
|
-
newTx:
|
|
340
|
+
newTx: TableTransaction,
|
|
328
341
|
trx?: sdk.TrxToken
|
|
329
|
-
): Promise<{ tx:
|
|
330
|
-
let tx:
|
|
342
|
+
): Promise<{ tx: TableTransaction; isNew: boolean }> {
|
|
343
|
+
let tx: TableTransaction | undefined
|
|
331
344
|
let isNew = false
|
|
332
345
|
for (let retry = 0; ; retry++) {
|
|
333
346
|
try {
|
|
@@ -353,7 +366,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
353
366
|
userId: number,
|
|
354
367
|
name: string,
|
|
355
368
|
trx?: sdk.TrxToken
|
|
356
|
-
): Promise<
|
|
369
|
+
): Promise<TableOutputBasket> {
|
|
357
370
|
const partial = { name, userId }
|
|
358
371
|
for (let retry = 0; ; retry++) {
|
|
359
372
|
try {
|
|
@@ -389,7 +402,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
389
402
|
userId: number,
|
|
390
403
|
label: string,
|
|
391
404
|
trx?: sdk.TrxToken
|
|
392
|
-
): Promise<
|
|
405
|
+
): Promise<TableTxLabel> {
|
|
393
406
|
const partial = { label, userId }
|
|
394
407
|
for (let retry = 0; ; retry++) {
|
|
395
408
|
try {
|
|
@@ -421,7 +434,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
421
434
|
transactionId: number,
|
|
422
435
|
txLabelId: number,
|
|
423
436
|
trx?: sdk.TrxToken
|
|
424
|
-
): Promise<
|
|
437
|
+
): Promise<TableTxLabelMap> {
|
|
425
438
|
const partial = { transactionId, txLabelId }
|
|
426
439
|
for (let retry = 0; ; retry++) {
|
|
427
440
|
try {
|
|
@@ -454,7 +467,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
454
467
|
userId: number,
|
|
455
468
|
tag: string,
|
|
456
469
|
trx?: sdk.TrxToken
|
|
457
|
-
): Promise<
|
|
470
|
+
): Promise<TableOutputTag> {
|
|
458
471
|
const partial = { tag, userId }
|
|
459
472
|
for (let retry = 0; ; retry++) {
|
|
460
473
|
try {
|
|
@@ -488,7 +501,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
488
501
|
outputId: number,
|
|
489
502
|
outputTagId: number,
|
|
490
503
|
trx?: sdk.TrxToken
|
|
491
|
-
): Promise<
|
|
504
|
+
): Promise<TableOutputTagMap> {
|
|
492
505
|
const partial = { outputId, outputTagId }
|
|
493
506
|
for (let retry = 0; ; retry++) {
|
|
494
507
|
try {
|
|
@@ -521,7 +534,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
521
534
|
auth: sdk.AuthId,
|
|
522
535
|
storageIdentityKey: string,
|
|
523
536
|
storageName: string
|
|
524
|
-
): Promise<{ syncState:
|
|
537
|
+
): Promise<{ syncState: TableSyncState; isNew: boolean }> {
|
|
525
538
|
const partial = { userId: auth.userId!, storageIdentityKey, storageName }
|
|
526
539
|
for (let retry = 0; ; retry++) {
|
|
527
540
|
try {
|
|
@@ -549,10 +562,10 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
549
562
|
}
|
|
550
563
|
|
|
551
564
|
async findOrInsertProvenTxReq(
|
|
552
|
-
newReq:
|
|
565
|
+
newReq: TableProvenTxReq,
|
|
553
566
|
trx?: sdk.TrxToken
|
|
554
|
-
): Promise<{ req:
|
|
555
|
-
let req:
|
|
567
|
+
): Promise<{ req: TableProvenTxReq; isNew: boolean }> {
|
|
568
|
+
let req: TableProvenTxReq | undefined
|
|
556
569
|
let isNew = false
|
|
557
570
|
for (let retry = 0; ; retry++) {
|
|
558
571
|
try {
|
|
@@ -572,10 +585,10 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
572
585
|
}
|
|
573
586
|
|
|
574
587
|
async findOrInsertProvenTx(
|
|
575
|
-
newProven:
|
|
588
|
+
newProven: TableProvenTx,
|
|
576
589
|
trx?: sdk.TrxToken
|
|
577
|
-
): Promise<{ proven:
|
|
578
|
-
let proven:
|
|
590
|
+
): Promise<{ proven: TableProvenTx; isNew: boolean }> {
|
|
591
|
+
let proven: TableProvenTx | undefined
|
|
579
592
|
let isNew = false
|
|
580
593
|
for (let retry = 0; ; retry++) {
|
|
581
594
|
try {
|
|
@@ -600,7 +613,7 @@ export abstract class StorageReaderWriter extends StorageReader {
|
|
|
600
613
|
): Promise<sdk.ProcessSyncChunkResult>
|
|
601
614
|
|
|
602
615
|
async tagOutput(
|
|
603
|
-
partial: Partial<
|
|
616
|
+
partial: Partial<TableOutput>,
|
|
604
617
|
tag: string,
|
|
605
618
|
trx?: sdk.TrxToken
|
|
606
619
|
): Promise<void> {
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
sdk,
|
|
3
|
+
TableCertificate,
|
|
4
|
+
TableCertificateField,
|
|
5
|
+
TableCommission,
|
|
6
|
+
TableOutput,
|
|
7
|
+
TableOutputBasket,
|
|
8
|
+
TableOutputTag,
|
|
9
|
+
TableOutputTagMap,
|
|
10
|
+
TableProvenTx,
|
|
11
|
+
TableProvenTxReq,
|
|
12
|
+
TableSettings,
|
|
13
|
+
TableSyncState,
|
|
14
|
+
TableTransaction,
|
|
15
|
+
TableTxLabel,
|
|
16
|
+
TableTxLabelMap,
|
|
17
|
+
TableUser
|
|
18
|
+
} from '../index.client'
|
|
2
19
|
import { StorageReader } from './StorageReader'
|
|
3
20
|
|
|
4
21
|
/**
|
|
@@ -16,7 +33,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
16
33
|
isAvailable(): boolean {
|
|
17
34
|
return this.storage.isAvailable()
|
|
18
35
|
}
|
|
19
|
-
async makeAvailable(): Promise<
|
|
36
|
+
async makeAvailable(): Promise<TableSettings> {
|
|
20
37
|
await this.storage.makeAvailable()
|
|
21
38
|
if (this.auth.userId === undefined) {
|
|
22
39
|
const user = await this.storage.findUserByIdentityKey(
|
|
@@ -30,7 +47,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
30
47
|
destroy(): Promise<void> {
|
|
31
48
|
return this.storage.destroy()
|
|
32
49
|
}
|
|
33
|
-
getSettings():
|
|
50
|
+
getSettings(): TableSettings {
|
|
34
51
|
return this.storage.getSettings()
|
|
35
52
|
}
|
|
36
53
|
async getSyncChunk(args: sdk.RequestSyncChunkArgs): Promise<sdk.SyncChunk> {
|
|
@@ -39,14 +56,14 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
39
56
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
40
57
|
return await this.storage.getSyncChunk(args)
|
|
41
58
|
}
|
|
42
|
-
async findUserByIdentityKey(key: string): Promise<
|
|
59
|
+
async findUserByIdentityKey(key: string): Promise<TableUser | undefined> {
|
|
43
60
|
if (!this.auth.userId) await this.makeAvailable()
|
|
44
61
|
if (key !== this.auth.identityKey) throw new sdk.WERR_UNAUTHORIZED()
|
|
45
62
|
return await this.storage.findUserByIdentityKey(key)
|
|
46
63
|
}
|
|
47
64
|
async findSyncStates(
|
|
48
65
|
args: sdk.FindSyncStatesArgs
|
|
49
|
-
): Promise<
|
|
66
|
+
): Promise<TableSyncState[]> {
|
|
50
67
|
if (!this.auth.userId) await this.makeAvailable()
|
|
51
68
|
if (args.partial.userId !== this.auth.userId)
|
|
52
69
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -54,7 +71,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
54
71
|
}
|
|
55
72
|
async findCertificateFields(
|
|
56
73
|
args: sdk.FindCertificateFieldsArgs
|
|
57
|
-
): Promise<
|
|
74
|
+
): Promise<TableCertificateField[]> {
|
|
58
75
|
if (!this.auth.userId) await this.makeAvailable()
|
|
59
76
|
if (args.partial.userId !== this.auth.userId)
|
|
60
77
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -62,7 +79,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
62
79
|
}
|
|
63
80
|
async findCertificates(
|
|
64
81
|
args: sdk.FindCertificatesArgs
|
|
65
|
-
): Promise<
|
|
82
|
+
): Promise<TableCertificate[]> {
|
|
66
83
|
if (!this.auth.userId) await this.makeAvailable()
|
|
67
84
|
if (args.partial.userId !== this.auth.userId)
|
|
68
85
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -70,7 +87,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
70
87
|
}
|
|
71
88
|
async findCommissions(
|
|
72
89
|
args: sdk.FindCommissionsArgs
|
|
73
|
-
): Promise<
|
|
90
|
+
): Promise<TableCommission[]> {
|
|
74
91
|
if (!this.auth.userId) await this.makeAvailable()
|
|
75
92
|
if (args.partial.userId !== this.auth.userId)
|
|
76
93
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -78,13 +95,13 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
78
95
|
}
|
|
79
96
|
async findOutputBaskets(
|
|
80
97
|
args: sdk.FindOutputBasketsArgs
|
|
81
|
-
): Promise<
|
|
98
|
+
): Promise<TableOutputBasket[]> {
|
|
82
99
|
if (!this.auth.userId) await this.makeAvailable()
|
|
83
100
|
if (args.partial.userId !== this.auth.userId)
|
|
84
101
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
85
102
|
return await this.storage.findOutputBaskets(args)
|
|
86
103
|
}
|
|
87
|
-
async findOutputs(args: sdk.FindOutputsArgs): Promise<
|
|
104
|
+
async findOutputs(args: sdk.FindOutputsArgs): Promise<TableOutput[]> {
|
|
88
105
|
if (!this.auth.userId) await this.makeAvailable()
|
|
89
106
|
if (args.partial.userId !== this.auth.userId)
|
|
90
107
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -92,7 +109,7 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
92
109
|
}
|
|
93
110
|
async findOutputTags(
|
|
94
111
|
args: sdk.FindOutputTagsArgs
|
|
95
|
-
): Promise<
|
|
112
|
+
): Promise<TableOutputTag[]> {
|
|
96
113
|
if (!this.auth.userId) await this.makeAvailable()
|
|
97
114
|
if (args.partial.userId !== this.auth.userId)
|
|
98
115
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -100,13 +117,13 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
100
117
|
}
|
|
101
118
|
async findTransactions(
|
|
102
119
|
args: sdk.FindTransactionsArgs
|
|
103
|
-
): Promise<
|
|
120
|
+
): Promise<TableTransaction[]> {
|
|
104
121
|
if (!this.auth.userId) await this.makeAvailable()
|
|
105
122
|
if (args.partial.userId !== this.auth.userId)
|
|
106
123
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
107
124
|
return await this.storage.findTransactions(args)
|
|
108
125
|
}
|
|
109
|
-
async findTxLabels(args: sdk.FindTxLabelsArgs): Promise<
|
|
126
|
+
async findTxLabels(args: sdk.FindTxLabelsArgs): Promise<TableTxLabel[]> {
|
|
110
127
|
if (!this.auth.userId) await this.makeAvailable()
|
|
111
128
|
if (args.partial.userId !== this.auth.userId)
|
|
112
129
|
throw new sdk.WERR_UNAUTHORIZED()
|
|
@@ -114,28 +131,28 @@ export class StorageSyncReader implements sdk.StorageSyncReader {
|
|
|
114
131
|
}
|
|
115
132
|
async getProvenTxsForUser(
|
|
116
133
|
args: sdk.FindForUserSincePagedArgs
|
|
117
|
-
): Promise<
|
|
134
|
+
): Promise<TableProvenTx[]> {
|
|
118
135
|
if (!this.auth.userId) await this.makeAvailable()
|
|
119
136
|
if (args.userId !== this.auth.userId) throw new sdk.WERR_UNAUTHORIZED()
|
|
120
137
|
return await this.storage.getProvenTxsForUser(args)
|
|
121
138
|
}
|
|
122
139
|
async getProvenTxReqsForUser(
|
|
123
140
|
args: sdk.FindForUserSincePagedArgs
|
|
124
|
-
): Promise<
|
|
141
|
+
): Promise<TableProvenTxReq[]> {
|
|
125
142
|
if (!this.auth.userId) await this.makeAvailable()
|
|
126
143
|
if (args.userId !== this.auth.userId) throw new sdk.WERR_UNAUTHORIZED()
|
|
127
144
|
return await this.storage.getProvenTxReqsForUser(args)
|
|
128
145
|
}
|
|
129
146
|
async getTxLabelMapsForUser(
|
|
130
147
|
args: sdk.FindForUserSincePagedArgs
|
|
131
|
-
): Promise<
|
|
148
|
+
): Promise<TableTxLabelMap[]> {
|
|
132
149
|
if (!this.auth.userId) await this.makeAvailable()
|
|
133
150
|
if (args.userId !== this.auth.userId) throw new sdk.WERR_UNAUTHORIZED()
|
|
134
151
|
return await this.storage.getTxLabelMapsForUser(args)
|
|
135
152
|
}
|
|
136
153
|
async getOutputTagMapsForUser(
|
|
137
154
|
args: sdk.FindForUserSincePagedArgs
|
|
138
|
-
): Promise<
|
|
155
|
+
): Promise<TableOutputTagMap[]> {
|
|
139
156
|
if (!this.auth.userId) await this.makeAvailable()
|
|
140
157
|
if (args.userId !== this.auth.userId) throw new sdk.WERR_UNAUTHORIZED()
|
|
141
158
|
return await this.storage.getOutputTagMapsForUser(args)
|
|
@@ -12,11 +12,16 @@ import {
|
|
|
12
12
|
RelinquishOutputArgs
|
|
13
13
|
} from '@bsv/sdk'
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
EntitySyncState,
|
|
16
16
|
sdk,
|
|
17
17
|
StorageProvider,
|
|
18
18
|
StorageSyncReader,
|
|
19
|
-
|
|
19
|
+
TableCertificate,
|
|
20
|
+
TableOutput,
|
|
21
|
+
TableOutputBasket,
|
|
22
|
+
TableProvenTxReq,
|
|
23
|
+
TableSettings,
|
|
24
|
+
TableUser,
|
|
20
25
|
wait
|
|
21
26
|
} from '../index.client'
|
|
22
27
|
|
|
@@ -250,11 +255,11 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
250
255
|
return this._services
|
|
251
256
|
}
|
|
252
257
|
|
|
253
|
-
getSettings():
|
|
258
|
+
getSettings(): TableSettings {
|
|
254
259
|
return this.getActive().getSettings()
|
|
255
260
|
}
|
|
256
261
|
|
|
257
|
-
async makeAvailable(): Promise<
|
|
262
|
+
async makeAvailable(): Promise<TableSettings> {
|
|
258
263
|
return await this.runAsWriter(async writer => {
|
|
259
264
|
writer.makeAvailable()
|
|
260
265
|
return writer.getSettings()
|
|
@@ -278,7 +283,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
278
283
|
|
|
279
284
|
async findOrInsertUser(
|
|
280
285
|
identityKey: string
|
|
281
|
-
): Promise<{ user:
|
|
286
|
+
): Promise<{ user: TableUser; isNew: boolean }> {
|
|
282
287
|
const auth = await this.getAuth()
|
|
283
288
|
if (identityKey != auth.identityKey) throw new sdk.WERR_UNAUTHORIZED()
|
|
284
289
|
|
|
@@ -344,7 +349,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
344
349
|
return await writer.processAction(auth, args)
|
|
345
350
|
})
|
|
346
351
|
}
|
|
347
|
-
async insertCertificate(certificate:
|
|
352
|
+
async insertCertificate(certificate: TableCertificate): Promise<number> {
|
|
348
353
|
return await this.runAsWriter(async writer => {
|
|
349
354
|
const auth = await this.getAuth(true)
|
|
350
355
|
return await writer.insertCertificateAuth(auth, certificate)
|
|
@@ -377,7 +382,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
377
382
|
}
|
|
378
383
|
async findCertificates(
|
|
379
384
|
args: sdk.FindCertificatesArgs
|
|
380
|
-
): Promise<
|
|
385
|
+
): Promise<TableCertificate[]> {
|
|
381
386
|
const auth = await this.getAuth()
|
|
382
387
|
return await this.runAsReader(async reader => {
|
|
383
388
|
return await reader.findCertificatesAuth(auth, args)
|
|
@@ -385,13 +390,13 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
385
390
|
}
|
|
386
391
|
async findOutputBaskets(
|
|
387
392
|
args: sdk.FindOutputBasketsArgs
|
|
388
|
-
): Promise<
|
|
393
|
+
): Promise<TableOutputBasket[]> {
|
|
389
394
|
const auth = await this.getAuth()
|
|
390
395
|
return await this.runAsReader(async reader => {
|
|
391
396
|
return await reader.findOutputBasketsAuth(auth, args)
|
|
392
397
|
})
|
|
393
398
|
}
|
|
394
|
-
async findOutputs(args: sdk.FindOutputsArgs): Promise<
|
|
399
|
+
async findOutputs(args: sdk.FindOutputsArgs): Promise<TableOutput[]> {
|
|
395
400
|
const auth = await this.getAuth()
|
|
396
401
|
return await this.runAsReader(async reader => {
|
|
397
402
|
return await reader.findOutputsAuth(auth, args)
|
|
@@ -400,7 +405,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
400
405
|
|
|
401
406
|
async findProvenTxReqs(
|
|
402
407
|
args: sdk.FindProvenTxReqsArgs
|
|
403
|
-
): Promise<
|
|
408
|
+
): Promise<TableProvenTxReq[]> {
|
|
404
409
|
return await this.runAsReader(async reader => {
|
|
405
410
|
return await reader.findProvenTxReqs(args)
|
|
406
411
|
})
|
|
@@ -423,7 +428,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
423
428
|
let inserts = 0,
|
|
424
429
|
updates = 0
|
|
425
430
|
for (;;) {
|
|
426
|
-
const ss = await
|
|
431
|
+
const ss = await EntitySyncState.fromStorage(
|
|
427
432
|
writer,
|
|
428
433
|
identityKey,
|
|
429
434
|
readerSettings
|
|
@@ -470,7 +475,7 @@ export class WalletStorageManager implements sdk.WalletStorage {
|
|
|
470
475
|
let inserts = 0,
|
|
471
476
|
updates = 0
|
|
472
477
|
for (;;) {
|
|
473
|
-
const ss = await
|
|
478
|
+
const ss = await EntitySyncState.fromStorage(
|
|
474
479
|
writer,
|
|
475
480
|
identityKey,
|
|
476
481
|
readerSettings
|
package/src/storage/index.all.ts
CHANGED
|
@@ -5,6 +5,6 @@ export * from './remoting/StorageClient'
|
|
|
5
5
|
export * from './remoting/StorageServer'
|
|
6
6
|
export * from './schema/KnexMigrations'
|
|
7
7
|
export * from './StorageKnex'
|
|
8
|
-
export *
|
|
9
|
-
export *
|
|
8
|
+
export * from './schema/tables/index'
|
|
9
|
+
export * from './schema/entities/index'
|
|
10
10
|
export * as sync from './sync'
|