@bsv/wallet-toolbox 1.1.7 → 1.1.9
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 +3872 -1555
- package/docs/monitor.md +29 -27
- package/docs/services.md +22 -22
- package/docs/setup.md +23 -23
- package/docs/storage.md +2747 -438
- package/docs/wallet.md +3872 -1555
- 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 +13 -4
- 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.map +1 -1
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +230 -15
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +222 -7
- 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.js +1 -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 +48 -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 +137 -106
- package/src/storage/StorageProvider.ts +43 -30
- package/src/storage/StorageReader.ts +37 -21
- package/src/storage/StorageReaderWriter.ts +78 -65
- package/src/storage/StorageSyncReader.ts +35 -17
- package/src/storage/WalletStorageManager.ts +18 -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 +17 -11
- package/src/storage/methods/reviewStatus.ts +4 -4
- package/src/storage/remoting/StorageClient.ts +250 -26
- 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 +68 -50
- package/test/Wallet/certificate/listCertificates.test.ts +12 -8
- package/test/Wallet/live/walletLive.man.test.ts +6 -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 +1 -1
- 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
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
import { MerklePath } from '@bsv/sdk'
|
|
3
3
|
import {
|
|
4
4
|
arraysEqual,
|
|
5
|
-
entity,
|
|
6
5
|
sdk,
|
|
7
|
-
|
|
6
|
+
TableTxLabel,
|
|
8
7
|
verifyId,
|
|
9
8
|
verifyOneOrNone
|
|
10
9
|
} from '../../../index.client'
|
|
11
|
-
import { EntityBase } from '.'
|
|
10
|
+
import { EntityBase, EntityStorage, SyncMap } from '.'
|
|
12
11
|
|
|
13
|
-
export class
|
|
14
|
-
constructor(api?:
|
|
12
|
+
export class EntityTxLabel extends EntityBase<TableTxLabel> {
|
|
13
|
+
constructor(api?: TableTxLabel) {
|
|
15
14
|
const now = new Date()
|
|
16
15
|
super(
|
|
17
16
|
api || {
|
|
@@ -73,13 +72,13 @@ export class TxLabel extends EntityBase<table.TxLabel> {
|
|
|
73
72
|
this.api.txLabelId = v
|
|
74
73
|
}
|
|
75
74
|
override get entityName(): string {
|
|
76
|
-
return '
|
|
75
|
+
return 'txLabel'
|
|
77
76
|
}
|
|
78
77
|
override get entityTable(): string {
|
|
79
78
|
return 'tx_labels'
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
override equals(ei:
|
|
81
|
+
override equals(ei: TableTxLabel, syncMap?: SyncMap): boolean {
|
|
83
82
|
const eo = this.toApi()
|
|
84
83
|
if (eo.label != ei.label || eo.isDeleted != ei.isDeleted) return false
|
|
85
84
|
if (!syncMap) {
|
|
@@ -89,26 +88,26 @@ export class TxLabel extends EntityBase<table.TxLabel> {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
static async mergeFind(
|
|
92
|
-
storage:
|
|
91
|
+
storage: EntityStorage,
|
|
93
92
|
userId: number,
|
|
94
|
-
ei:
|
|
95
|
-
syncMap:
|
|
93
|
+
ei: TableTxLabel,
|
|
94
|
+
syncMap: SyncMap,
|
|
96
95
|
trx?: sdk.TrxToken
|
|
97
|
-
): Promise<{ found: boolean; eo:
|
|
96
|
+
): Promise<{ found: boolean; eo: EntityTxLabel; eiId: number }> {
|
|
98
97
|
const ef = verifyOneOrNone(
|
|
99
98
|
await storage.findTxLabels({ partial: { label: ei.label, userId }, trx })
|
|
100
99
|
)
|
|
101
100
|
return {
|
|
102
101
|
found: !!ef,
|
|
103
|
-
eo: new
|
|
102
|
+
eo: new EntityTxLabel(ef || { ...ei }),
|
|
104
103
|
eiId: verifyId(ei.txLabelId)
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
override async mergeNew(
|
|
109
|
-
storage:
|
|
108
|
+
storage: EntityStorage,
|
|
110
109
|
userId: number,
|
|
111
|
-
syncMap:
|
|
110
|
+
syncMap: SyncMap,
|
|
112
111
|
trx?: sdk.TrxToken
|
|
113
112
|
): Promise<void> {
|
|
114
113
|
this.userId = userId
|
|
@@ -117,10 +116,10 @@ export class TxLabel extends EntityBase<table.TxLabel> {
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
override async mergeExisting(
|
|
120
|
-
storage:
|
|
119
|
+
storage: EntityStorage,
|
|
121
120
|
since: Date | undefined,
|
|
122
|
-
ei:
|
|
123
|
-
syncMap:
|
|
121
|
+
ei: TableTxLabel,
|
|
122
|
+
syncMap: SyncMap,
|
|
124
123
|
trx?: sdk.TrxToken
|
|
125
124
|
): Promise<boolean> {
|
|
126
125
|
let wasMerged = false
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
import { MerklePath } from '@bsv/sdk'
|
|
3
3
|
import {
|
|
4
4
|
arraysEqual,
|
|
5
|
-
entity,
|
|
6
5
|
sdk,
|
|
7
|
-
|
|
6
|
+
TableTxLabelMap,
|
|
8
7
|
verifyId,
|
|
9
8
|
verifyOneOrNone
|
|
10
9
|
} from '../../../index.client'
|
|
11
|
-
import { EntityBase } from '.'
|
|
10
|
+
import { EntityBase, EntityStorage, SyncMap } from '.'
|
|
12
11
|
|
|
13
|
-
export class
|
|
14
|
-
constructor(api?:
|
|
12
|
+
export class EntityTxLabelMap extends EntityBase<TableTxLabelMap> {
|
|
13
|
+
constructor(api?: TableTxLabelMap) {
|
|
15
14
|
const now = new Date()
|
|
16
15
|
super(
|
|
17
16
|
api || {
|
|
@@ -63,16 +62,13 @@ export class TxLabelMap extends EntityBase<table.TxLabelMap> {
|
|
|
63
62
|
throw new sdk.WERR_INVALID_OPERATION('entity has no "id" value')
|
|
64
63
|
} // entity does not have its own id.
|
|
65
64
|
override get entityName(): string {
|
|
66
|
-
return '
|
|
65
|
+
return 'txLabelMap'
|
|
67
66
|
}
|
|
68
67
|
override get entityTable(): string {
|
|
69
68
|
return 'tx_labels_map'
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
override equals(
|
|
73
|
-
ei: table.TxLabelMap,
|
|
74
|
-
syncMap?: entity.SyncMap | undefined
|
|
75
|
-
): boolean {
|
|
71
|
+
override equals(ei: TableTxLabelMap, syncMap?: SyncMap | undefined): boolean {
|
|
76
72
|
const eo = this.toApi()
|
|
77
73
|
|
|
78
74
|
if (
|
|
@@ -92,12 +88,12 @@ export class TxLabelMap extends EntityBase<table.TxLabelMap> {
|
|
|
92
88
|
}
|
|
93
89
|
|
|
94
90
|
static async mergeFind(
|
|
95
|
-
storage:
|
|
91
|
+
storage: EntityStorage,
|
|
96
92
|
userId: number,
|
|
97
|
-
ei:
|
|
98
|
-
syncMap:
|
|
93
|
+
ei: TableTxLabelMap,
|
|
94
|
+
syncMap: SyncMap,
|
|
99
95
|
trx?: sdk.TrxToken
|
|
100
|
-
): Promise<{ found: boolean; eo:
|
|
96
|
+
): Promise<{ found: boolean; eo: EntityTxLabelMap; eiId: number }> {
|
|
101
97
|
const transactionId = syncMap.transaction.idMap[ei.transactionId]
|
|
102
98
|
const txLabelId = syncMap.txLabel.idMap[ei.txLabelId]
|
|
103
99
|
const ef = verifyOneOrNone(
|
|
@@ -108,15 +104,15 @@ export class TxLabelMap extends EntityBase<table.TxLabelMap> {
|
|
|
108
104
|
)
|
|
109
105
|
return {
|
|
110
106
|
found: !!ef,
|
|
111
|
-
eo: new
|
|
107
|
+
eo: new EntityTxLabelMap(ef || { ...ei }),
|
|
112
108
|
eiId: -1
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
111
|
|
|
116
112
|
override async mergeNew(
|
|
117
|
-
storage:
|
|
113
|
+
storage: EntityStorage,
|
|
118
114
|
userId: number,
|
|
119
|
-
syncMap:
|
|
115
|
+
syncMap: SyncMap,
|
|
120
116
|
trx?: sdk.TrxToken
|
|
121
117
|
): Promise<void> {
|
|
122
118
|
this.transactionId = syncMap.transaction.idMap[this.transactionId]
|
|
@@ -125,10 +121,10 @@ export class TxLabelMap extends EntityBase<table.TxLabelMap> {
|
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
override async mergeExisting(
|
|
128
|
-
storage:
|
|
124
|
+
storage: EntityStorage,
|
|
129
125
|
since: Date | undefined,
|
|
130
|
-
ei:
|
|
131
|
-
syncMap:
|
|
126
|
+
ei: TableTxLabelMap,
|
|
127
|
+
syncMap: SyncMap,
|
|
132
128
|
trx?: sdk.TrxToken
|
|
133
129
|
): Promise<boolean> {
|
|
134
130
|
let wasMerged = false
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
import { MerklePath } from '@bsv/sdk'
|
|
3
3
|
import {
|
|
4
4
|
arraysEqual,
|
|
5
|
-
entity,
|
|
6
5
|
sdk,
|
|
7
|
-
|
|
6
|
+
TableUser,
|
|
8
7
|
verifyId,
|
|
9
8
|
verifyOneOrNone
|
|
10
9
|
} from '../../../index.client'
|
|
11
|
-
import { EntityBase } from '.'
|
|
10
|
+
import { EntityBase, EntityStorage, SyncMap } from '.'
|
|
12
11
|
|
|
13
|
-
export class
|
|
14
|
-
constructor(api?:
|
|
12
|
+
export class EntityUser extends EntityBase<TableUser> {
|
|
13
|
+
constructor(api?: TableUser) {
|
|
15
14
|
const now = new Date()
|
|
16
15
|
super(
|
|
17
16
|
api || {
|
|
@@ -66,16 +65,13 @@ export class User extends EntityBase<table.User> {
|
|
|
66
65
|
this.api.userId = v
|
|
67
66
|
}
|
|
68
67
|
override get entityName(): string {
|
|
69
|
-
return '
|
|
68
|
+
return 'user'
|
|
70
69
|
}
|
|
71
70
|
override get entityTable(): string {
|
|
72
71
|
return 'users'
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
override equals(
|
|
76
|
-
ei: table.User,
|
|
77
|
-
syncMap?: entity.SyncMap | undefined
|
|
78
|
-
): boolean {
|
|
74
|
+
override equals(ei: TableUser, syncMap?: SyncMap | undefined): boolean {
|
|
79
75
|
const eo = this.toApi()
|
|
80
76
|
if (
|
|
81
77
|
eo.identityKey != ei.identityKey ||
|
|
@@ -88,11 +84,11 @@ export class User extends EntityBase<table.User> {
|
|
|
88
84
|
return true
|
|
89
85
|
}
|
|
90
86
|
static async mergeFind(
|
|
91
|
-
storage:
|
|
87
|
+
storage: EntityStorage,
|
|
92
88
|
userId: number,
|
|
93
|
-
ei:
|
|
89
|
+
ei: TableUser,
|
|
94
90
|
trx?: sdk.TrxToken
|
|
95
|
-
): Promise<{ found: boolean; eo:
|
|
91
|
+
): Promise<{ found: boolean; eo: EntityUser; eiId: number }> {
|
|
96
92
|
const ef = verifyOneOrNone(
|
|
97
93
|
await storage.findUsers({ partial: { identityKey: ei.identityKey }, trx })
|
|
98
94
|
)
|
|
@@ -100,14 +96,14 @@ export class User extends EntityBase<table.User> {
|
|
|
100
96
|
throw new sdk.WERR_INTERNAL('logic error, userIds don not match.')
|
|
101
97
|
return {
|
|
102
98
|
found: !!ef,
|
|
103
|
-
eo: new
|
|
99
|
+
eo: new EntityUser(ef || { ...ei }),
|
|
104
100
|
eiId: verifyId(ei.userId)
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
103
|
override async mergeNew(
|
|
108
|
-
storage:
|
|
104
|
+
storage: EntityStorage,
|
|
109
105
|
userId: number,
|
|
110
|
-
syncMap:
|
|
106
|
+
syncMap: SyncMap,
|
|
111
107
|
trx?: sdk.TrxToken
|
|
112
108
|
): Promise<void> {
|
|
113
109
|
throw new sdk.WERR_INTERNAL(
|
|
@@ -115,10 +111,10 @@ export class User extends EntityBase<table.User> {
|
|
|
115
111
|
)
|
|
116
112
|
}
|
|
117
113
|
override async mergeExisting(
|
|
118
|
-
storage:
|
|
114
|
+
storage: EntityStorage,
|
|
119
115
|
since: Date | undefined,
|
|
120
|
-
ei:
|
|
121
|
-
syncMap?:
|
|
116
|
+
ei: TableUser,
|
|
117
|
+
syncMap?: SyncMap,
|
|
122
118
|
trx?: sdk.TrxToken
|
|
123
119
|
): Promise<boolean> {
|
|
124
120
|
let wasMerged = false
|