@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,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EntityTxLabelMap } from '../../../../../src/storage/schema/entities/TxLabelMap'
|
|
2
|
+
import {
|
|
3
|
+
createSyncMap,
|
|
4
|
+
sdk,
|
|
5
|
+
SyncMap,
|
|
6
|
+
TableTxLabelMap
|
|
7
|
+
} from '../../../../../src'
|
|
3
8
|
import {
|
|
4
9
|
TestUtilsWalletStorage as _tu,
|
|
5
10
|
TestWalletNoSetup
|
|
6
11
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
12
|
+
import { EntityTransaction } from '../../../../../src/storage/schema/entities/Transaction'
|
|
13
|
+
import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
|
|
9
14
|
|
|
10
15
|
describe('TxLabelMap Class Tests', () => {
|
|
11
16
|
jest.setTimeout(99999999) // Extend timeout for database operations
|
|
@@ -37,7 +42,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
37
42
|
|
|
38
43
|
// Test: Constructor with default values
|
|
39
44
|
test('1_creates_instance_with_default_values', () => {
|
|
40
|
-
const txLabelMap = new
|
|
45
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
41
46
|
|
|
42
47
|
const now = new Date()
|
|
43
48
|
expect(txLabelMap.transactionId).toBe(0)
|
|
@@ -52,14 +57,14 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
52
57
|
// Test: Constructor with provided API object
|
|
53
58
|
test('2_creates_instance_with_provided_api_object', () => {
|
|
54
59
|
const now = new Date()
|
|
55
|
-
const apiObject:
|
|
60
|
+
const apiObject: TableTxLabelMap = {
|
|
56
61
|
transactionId: 123,
|
|
57
62
|
txLabelId: 456,
|
|
58
63
|
created_at: now,
|
|
59
64
|
updated_at: now,
|
|
60
65
|
isDeleted: true
|
|
61
66
|
}
|
|
62
|
-
const txLabelMap = new
|
|
67
|
+
const txLabelMap = new EntityTxLabelMap(apiObject)
|
|
63
68
|
|
|
64
69
|
expect(txLabelMap.transactionId).toBe(123)
|
|
65
70
|
expect(txLabelMap.txLabelId).toBe(456)
|
|
@@ -70,7 +75,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
70
75
|
|
|
71
76
|
// Test: Getters and setters
|
|
72
77
|
test('3_getters_and_setters_work_correctly', () => {
|
|
73
|
-
const txLabelMap = new
|
|
78
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
74
79
|
|
|
75
80
|
const now = new Date()
|
|
76
81
|
txLabelMap.transactionId = 1001
|
|
@@ -88,13 +93,13 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
88
93
|
|
|
89
94
|
// Test: `updateApi` does nothing
|
|
90
95
|
test('4_updateApi_does_nothing', () => {
|
|
91
|
-
const txLabelMap = new
|
|
96
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
92
97
|
expect(() => txLabelMap.updateApi()).not.toThrow() // Method does nothing, so no errors should occur
|
|
93
98
|
})
|
|
94
99
|
|
|
95
100
|
// Test: `id` getter throws an error
|
|
96
101
|
test('5_get_id_throws_error', () => {
|
|
97
|
-
const txLabelMap = new
|
|
102
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
98
103
|
expect(() => txLabelMap.id).toThrow(sdk.WERR_INVALID_OPERATION) // Entity has no "id"
|
|
99
104
|
})
|
|
100
105
|
|
|
@@ -105,7 +110,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
105
110
|
txLabel: { idMap: { 456: 456 } }
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
const txLabelMap = new
|
|
113
|
+
const txLabelMap = new EntityTxLabelMap({
|
|
109
114
|
transactionId: 123,
|
|
110
115
|
txLabelId: 456,
|
|
111
116
|
isDeleted: false,
|
|
@@ -119,7 +124,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
119
124
|
isDeleted: false
|
|
120
125
|
}
|
|
121
126
|
|
|
122
|
-
const result = txLabelMap.equals(other as
|
|
127
|
+
const result = txLabelMap.equals(other as TableTxLabelMap, syncMap)
|
|
123
128
|
expect(result).toBe(true)
|
|
124
129
|
})
|
|
125
130
|
|
|
@@ -138,10 +143,10 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
138
143
|
txLabelId: 456
|
|
139
144
|
}
|
|
140
145
|
|
|
141
|
-
const result = await
|
|
146
|
+
const result = await EntityTxLabelMap.mergeFind(
|
|
142
147
|
storage,
|
|
143
148
|
1,
|
|
144
|
-
ei as
|
|
149
|
+
ei as TableTxLabelMap,
|
|
145
150
|
syncMap
|
|
146
151
|
)
|
|
147
152
|
expect(result.found).toBe(true)
|
|
@@ -159,7 +164,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
159
164
|
txLabel: { idMap: { 456: 888 } }
|
|
160
165
|
}
|
|
161
166
|
|
|
162
|
-
const txLabelMap = new
|
|
167
|
+
const txLabelMap = new EntityTxLabelMap({
|
|
163
168
|
transactionId: 123,
|
|
164
169
|
txLabelId: 456,
|
|
165
170
|
created_at: new Date(2022, 1, 1),
|
|
@@ -183,7 +188,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
183
188
|
updateTxLabelMap: jest.fn()
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
const txLabelMap = new
|
|
191
|
+
const txLabelMap = new EntityTxLabelMap({
|
|
187
192
|
transactionId: 123,
|
|
188
193
|
txLabelId: 456,
|
|
189
194
|
created_at: new Date(2022, 1, 1),
|
|
@@ -191,7 +196,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
191
196
|
isDeleted: false
|
|
192
197
|
})
|
|
193
198
|
|
|
194
|
-
const ei:
|
|
199
|
+
const ei: TableTxLabelMap = {
|
|
195
200
|
transactionId: 123,
|
|
196
201
|
txLabelId: 456,
|
|
197
202
|
isDeleted: true,
|
|
@@ -223,13 +228,13 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
223
228
|
|
|
224
229
|
// Test: `entityName` getter
|
|
225
230
|
test('10_entityName_returns_correct_value', () => {
|
|
226
|
-
const txLabelMap = new
|
|
227
|
-
expect(txLabelMap.entityName).toBe('
|
|
231
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
232
|
+
expect(txLabelMap.entityName).toBe('txLabelMap') // Ensure entityName returns the correct string
|
|
228
233
|
})
|
|
229
234
|
|
|
230
235
|
// Test: `entityTable` getter
|
|
231
236
|
test('11_entityTable_returns_correct_value', () => {
|
|
232
|
-
const txLabelMap = new
|
|
237
|
+
const txLabelMap = new EntityTxLabelMap()
|
|
233
238
|
expect(txLabelMap.entityTable).toBe('tx_labels_map') // Ensure entityTable returns the correct table name
|
|
234
239
|
})
|
|
235
240
|
|
|
@@ -238,7 +243,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
238
243
|
const ctx2 = ctxs2[0]
|
|
239
244
|
|
|
240
245
|
// Insert necessary foreign key references into the first database
|
|
241
|
-
const tx1 = new
|
|
246
|
+
const tx1 = new EntityTransaction({
|
|
242
247
|
transactionId: 405,
|
|
243
248
|
userId: 1,
|
|
244
249
|
txid: 'txid1',
|
|
@@ -258,7 +263,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
258
263
|
await ctx1.activeStorage.insertTransaction(tx1.toApi())
|
|
259
264
|
|
|
260
265
|
// Insert necessary foreign key references into the second database
|
|
261
|
-
const tx2 = new
|
|
266
|
+
const tx2 = new EntityTransaction({
|
|
262
267
|
transactionId: 406,
|
|
263
268
|
userId: 1,
|
|
264
269
|
txid: 'txid1',
|
|
@@ -278,7 +283,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
278
283
|
await ctx2.activeStorage.insertTransaction(tx2.toApi())
|
|
279
284
|
|
|
280
285
|
// Insert a TxLabel into the first database
|
|
281
|
-
const txLabel1 = new
|
|
286
|
+
const txLabel1 = new EntityTxLabel({
|
|
282
287
|
txLabelId: 306,
|
|
283
288
|
userId: 1,
|
|
284
289
|
label: 'Label B',
|
|
@@ -290,7 +295,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
290
295
|
await ctx1.activeStorage.insertTxLabel(txLabel1.toApi())
|
|
291
296
|
|
|
292
297
|
// Insert a matching TxLabel into the second database
|
|
293
|
-
const txLabel2 = new
|
|
298
|
+
const txLabel2 = new EntityTxLabel({
|
|
294
299
|
txLabelId: 307,
|
|
295
300
|
userId: 1,
|
|
296
301
|
label: 'Label B',
|
|
@@ -302,7 +307,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
302
307
|
await ctx2.activeStorage.insertTxLabel(txLabel2.toApi())
|
|
303
308
|
|
|
304
309
|
// Insert a TxLabelMap into the first database
|
|
305
|
-
const txLabelMap1 = new
|
|
310
|
+
const txLabelMap1 = new EntityTxLabelMap({
|
|
306
311
|
transactionId: 405,
|
|
307
312
|
txLabelId: 306,
|
|
308
313
|
isDeleted: false,
|
|
@@ -313,7 +318,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
313
318
|
await ctx1.activeStorage.insertTxLabelMap(txLabelMap1.toApi())
|
|
314
319
|
|
|
315
320
|
// Insert a matching TxLabelMap into the second database
|
|
316
|
-
const txLabelMap2 = new
|
|
321
|
+
const txLabelMap2 = new EntityTxLabelMap({
|
|
317
322
|
transactionId: 406, // Different transaction ID mapped in syncMap
|
|
318
323
|
txLabelId: 307, // Different label ID mapped in syncMap
|
|
319
324
|
isDeleted: false,
|
|
@@ -323,81 +328,11 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
323
328
|
|
|
324
329
|
await ctx2.activeStorage.insertTxLabelMap(txLabelMap2.toApi())
|
|
325
330
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
maxUpdated_at: undefined,
|
|
332
|
-
count: 1
|
|
333
|
-
},
|
|
334
|
-
txLabel: {
|
|
335
|
-
idMap: { 307: 306 },
|
|
336
|
-
entityName: 'TxLabel',
|
|
337
|
-
maxUpdated_at: undefined,
|
|
338
|
-
count: 1
|
|
339
|
-
},
|
|
340
|
-
provenTx: {
|
|
341
|
-
idMap: {},
|
|
342
|
-
entityName: 'ProvenTx',
|
|
343
|
-
maxUpdated_at: undefined,
|
|
344
|
-
count: 0
|
|
345
|
-
},
|
|
346
|
-
outputBasket: {
|
|
347
|
-
idMap: {},
|
|
348
|
-
entityName: 'OutputBasket',
|
|
349
|
-
maxUpdated_at: undefined,
|
|
350
|
-
count: 0
|
|
351
|
-
},
|
|
352
|
-
provenTxReq: {
|
|
353
|
-
idMap: {},
|
|
354
|
-
entityName: 'ProvenTxReq',
|
|
355
|
-
maxUpdated_at: undefined,
|
|
356
|
-
count: 0
|
|
357
|
-
},
|
|
358
|
-
txLabelMap: {
|
|
359
|
-
idMap: {},
|
|
360
|
-
entityName: 'TxLabelMap',
|
|
361
|
-
maxUpdated_at: undefined,
|
|
362
|
-
count: 0
|
|
363
|
-
},
|
|
364
|
-
output: {
|
|
365
|
-
idMap: {},
|
|
366
|
-
entityName: 'Output',
|
|
367
|
-
maxUpdated_at: undefined,
|
|
368
|
-
count: 0
|
|
369
|
-
},
|
|
370
|
-
outputTag: {
|
|
371
|
-
idMap: {},
|
|
372
|
-
entityName: 'OutputTag',
|
|
373
|
-
maxUpdated_at: undefined,
|
|
374
|
-
count: 0
|
|
375
|
-
},
|
|
376
|
-
outputTagMap: {
|
|
377
|
-
idMap: {},
|
|
378
|
-
entityName: 'OutputTagMap',
|
|
379
|
-
maxUpdated_at: undefined,
|
|
380
|
-
count: 0
|
|
381
|
-
},
|
|
382
|
-
certificate: {
|
|
383
|
-
idMap: {},
|
|
384
|
-
entityName: 'Certificate',
|
|
385
|
-
maxUpdated_at: undefined,
|
|
386
|
-
count: 0
|
|
387
|
-
},
|
|
388
|
-
certificateField: {
|
|
389
|
-
idMap: {},
|
|
390
|
-
entityName: 'CertificateField',
|
|
391
|
-
maxUpdated_at: undefined,
|
|
392
|
-
count: 0
|
|
393
|
-
},
|
|
394
|
-
commission: {
|
|
395
|
-
idMap: {},
|
|
396
|
-
entityName: 'Commission',
|
|
397
|
-
maxUpdated_at: undefined,
|
|
398
|
-
count: 0
|
|
399
|
-
}
|
|
400
|
-
}
|
|
331
|
+
const syncMap = createSyncMap()
|
|
332
|
+
syncMap.transaction.idMap = { 406: 405 }
|
|
333
|
+
syncMap.transaction.count = 1
|
|
334
|
+
syncMap.txLabel.idMap = { 307: 306 }
|
|
335
|
+
syncMap.txLabel.count = 1
|
|
401
336
|
|
|
402
337
|
// Verify the entities match
|
|
403
338
|
expect(txLabelMap1.equals(txLabelMap2.toApi(), syncMap)).toBe(true)
|
|
@@ -409,7 +344,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
409
344
|
const ctx2 = ctxs2[0]
|
|
410
345
|
|
|
411
346
|
// Insert a TxLabelMap into the first database
|
|
412
|
-
const txLabelMap1 = new
|
|
347
|
+
const txLabelMap1 = new EntityTxLabelMap({
|
|
413
348
|
transactionId: 103,
|
|
414
349
|
txLabelId: 1,
|
|
415
350
|
isDeleted: false,
|
|
@@ -420,7 +355,7 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
420
355
|
await ctx1.activeStorage.insertTxLabelMap(txLabelMap1.toApi())
|
|
421
356
|
|
|
422
357
|
// Insert a non-matching TxLabelMap into the second database
|
|
423
|
-
const txLabelMap2 = new
|
|
358
|
+
const txLabelMap2 = new EntityTxLabelMap({
|
|
424
359
|
transactionId: 104, // Different transaction ID not mapped in syncMap
|
|
425
360
|
txLabelId: 1, // Different label ID not mapped in syncMap
|
|
426
361
|
isDeleted: true, // Different isDeleted value
|
|
@@ -430,81 +365,13 @@ describe('TxLabelMap Class Tests', () => {
|
|
|
430
365
|
|
|
431
366
|
await ctx2.activeStorage.insertTxLabelMap(txLabelMap2.toApi())
|
|
432
367
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
idMap: { [txLabelMap1.transactionId]: txLabelMap2.transactionId },
|
|
437
|
-
entityName: 'Transaction',
|
|
438
|
-
maxUpdated_at: undefined,
|
|
439
|
-
count: 1
|
|
440
|
-
},
|
|
441
|
-
txLabel: {
|
|
442
|
-
idMap: { [txLabelMap1.txLabelId]: txLabelMap2.txLabelId },
|
|
443
|
-
entityName: 'TxLabel',
|
|
444
|
-
maxUpdated_at: undefined,
|
|
445
|
-
count: 1
|
|
446
|
-
},
|
|
447
|
-
provenTx: {
|
|
448
|
-
idMap: {},
|
|
449
|
-
entityName: 'ProvenTx',
|
|
450
|
-
maxUpdated_at: undefined,
|
|
451
|
-
count: 0
|
|
452
|
-
},
|
|
453
|
-
outputBasket: {
|
|
454
|
-
idMap: {},
|
|
455
|
-
entityName: 'OutputBasket',
|
|
456
|
-
maxUpdated_at: undefined,
|
|
457
|
-
count: 0
|
|
458
|
-
},
|
|
459
|
-
provenTxReq: {
|
|
460
|
-
idMap: {},
|
|
461
|
-
entityName: 'ProvenTxReq',
|
|
462
|
-
maxUpdated_at: undefined,
|
|
463
|
-
count: 0
|
|
464
|
-
},
|
|
465
|
-
txLabelMap: {
|
|
466
|
-
idMap: {},
|
|
467
|
-
entityName: 'TxLabelMap',
|
|
468
|
-
maxUpdated_at: undefined,
|
|
469
|
-
count: 0
|
|
470
|
-
},
|
|
471
|
-
output: {
|
|
472
|
-
idMap: {},
|
|
473
|
-
entityName: 'Output',
|
|
474
|
-
maxUpdated_at: undefined,
|
|
475
|
-
count: 0
|
|
476
|
-
},
|
|
477
|
-
outputTag: {
|
|
478
|
-
idMap: {},
|
|
479
|
-
entityName: 'OutputTag',
|
|
480
|
-
maxUpdated_at: undefined,
|
|
481
|
-
count: 0
|
|
482
|
-
},
|
|
483
|
-
outputTagMap: {
|
|
484
|
-
idMap: {},
|
|
485
|
-
entityName: 'OutputTagMap',
|
|
486
|
-
maxUpdated_at: undefined,
|
|
487
|
-
count: 0
|
|
488
|
-
},
|
|
489
|
-
certificate: {
|
|
490
|
-
idMap: {},
|
|
491
|
-
entityName: 'Certificate',
|
|
492
|
-
maxUpdated_at: undefined,
|
|
493
|
-
count: 0
|
|
494
|
-
},
|
|
495
|
-
certificateField: {
|
|
496
|
-
idMap: {},
|
|
497
|
-
entityName: 'CertificateField',
|
|
498
|
-
maxUpdated_at: undefined,
|
|
499
|
-
count: 0
|
|
500
|
-
},
|
|
501
|
-
commission: {
|
|
502
|
-
idMap: {},
|
|
503
|
-
entityName: 'Commission',
|
|
504
|
-
maxUpdated_at: undefined,
|
|
505
|
-
count: 0
|
|
506
|
-
}
|
|
368
|
+
const syncMap = createSyncMap()
|
|
369
|
+
syncMap.transaction.idMap = {
|
|
370
|
+
[txLabelMap1.transactionId]: txLabelMap2.transactionId
|
|
507
371
|
}
|
|
372
|
+
syncMap.transaction.count = 1
|
|
373
|
+
syncMap.txLabel.idMap = { [txLabelMap1.txLabelId]: txLabelMap2.txLabelId }
|
|
374
|
+
syncMap.txLabel.count = 1
|
|
508
375
|
|
|
509
376
|
// Verify the entities do not match
|
|
510
377
|
expect(txLabelMap1.equals(txLabelMap2.toApi(), syncMap)).toBe(false)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EntityTxLabel } from '../../../../../src/storage/schema/entities/TxLabel'
|
|
2
|
+
import { createSyncMap, sdk, SyncMap, TableTxLabel } from '../../../../../src'
|
|
3
3
|
import {
|
|
4
4
|
TestUtilsWalletStorage as _tu,
|
|
5
5
|
TestWalletNoSetup
|
|
@@ -35,7 +35,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
35
35
|
|
|
36
36
|
// Test: Default constructor behavior
|
|
37
37
|
test('1_creates_txLabel_with_default_values', () => {
|
|
38
|
-
const txLabel = new
|
|
38
|
+
const txLabel = new EntityTxLabel()
|
|
39
39
|
|
|
40
40
|
// Default values
|
|
41
41
|
expect(txLabel.txLabelId).toBe(0)
|
|
@@ -50,7 +50,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
50
50
|
// Test: Constructor with provided API object
|
|
51
51
|
test('2_creates_txLabel_with_provided_api_object', () => {
|
|
52
52
|
const now = new Date()
|
|
53
|
-
const apiObject:
|
|
53
|
+
const apiObject: TableTxLabel = {
|
|
54
54
|
txLabelId: 42,
|
|
55
55
|
label: 'Test Label',
|
|
56
56
|
userId: 101,
|
|
@@ -58,7 +58,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
58
58
|
created_at: now,
|
|
59
59
|
updated_at: now
|
|
60
60
|
}
|
|
61
|
-
const txLabel = new
|
|
61
|
+
const txLabel = new EntityTxLabel(apiObject)
|
|
62
62
|
|
|
63
63
|
// Verify all properties match the API object
|
|
64
64
|
expect(txLabel.txLabelId).toBe(42)
|
|
@@ -71,7 +71,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
71
71
|
|
|
72
72
|
// Test: Getters and setters behavior
|
|
73
73
|
test('3_getters_and_setters_work_correctly', () => {
|
|
74
|
-
const txLabel = new
|
|
74
|
+
const txLabel = new EntityTxLabel()
|
|
75
75
|
|
|
76
76
|
const now = new Date()
|
|
77
77
|
txLabel.txLabelId = 1
|
|
@@ -83,7 +83,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
83
83
|
txLabel.id = 2
|
|
84
84
|
|
|
85
85
|
expect(txLabel.id).toBe(2)
|
|
86
|
-
expect(txLabel.entityName).toBe('
|
|
86
|
+
expect(txLabel.entityName).toBe('txLabel')
|
|
87
87
|
expect(txLabel.entityTable).toBe('tx_labels')
|
|
88
88
|
expect(txLabel.txLabelId).toBe(2)
|
|
89
89
|
expect(txLabel.label).toBe('New Label')
|
|
@@ -96,7 +96,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
96
96
|
// Test: mergeExisting does not update TxLabel when `ei.updated_at` is older
|
|
97
97
|
test('5_mergeExisting_does_not_update_txLabel_when_ei_updated_at_is_older', async () => {
|
|
98
98
|
for (const { activeStorage } of ctxs) {
|
|
99
|
-
const txLabel = new
|
|
99
|
+
const txLabel = new EntityTxLabel({
|
|
100
100
|
txLabelId: 302,
|
|
101
101
|
label: 'Original Label',
|
|
102
102
|
userId: 1,
|
|
@@ -107,7 +107,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
107
107
|
|
|
108
108
|
await activeStorage.insertTxLabel(txLabel.toApi())
|
|
109
109
|
|
|
110
|
-
const olderEi:
|
|
110
|
+
const olderEi: TableTxLabel = {
|
|
111
111
|
txLabelId: 302,
|
|
112
112
|
label: 'Outdated Label',
|
|
113
113
|
userId: 1,
|
|
@@ -137,7 +137,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
137
137
|
const ctx2 = ctxs2[0]
|
|
138
138
|
|
|
139
139
|
// Insert a TxLabel into the first database
|
|
140
|
-
const txLabel1 = new
|
|
140
|
+
const txLabel1 = new EntityTxLabel({
|
|
141
141
|
txLabelId: 303,
|
|
142
142
|
userId: 1,
|
|
143
143
|
label: 'Test Label',
|
|
@@ -149,7 +149,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
149
149
|
await ctx1.activeStorage.insertTxLabel(txLabel1.toApi())
|
|
150
150
|
|
|
151
151
|
// Insert a matching TxLabel into the second database
|
|
152
|
-
const txLabel2 = new
|
|
152
|
+
const txLabel2 = new EntityTxLabel({
|
|
153
153
|
txLabelId: 304,
|
|
154
154
|
userId: 1, // Different userId to simulate syncMap usage
|
|
155
155
|
label: 'Test Label',
|
|
@@ -160,81 +160,9 @@ describe('TxLabel Class Tests', () => {
|
|
|
160
160
|
|
|
161
161
|
await ctx2.activeStorage.insertTxLabel(txLabel2.toApi())
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
idMap: { [txLabel2.userId]: txLabel1.userId },
|
|
167
|
-
entityName: 'TxLabel',
|
|
168
|
-
maxUpdated_at: undefined,
|
|
169
|
-
count: 1
|
|
170
|
-
},
|
|
171
|
-
transaction: {
|
|
172
|
-
idMap: {},
|
|
173
|
-
entityName: 'Transaction',
|
|
174
|
-
maxUpdated_at: undefined,
|
|
175
|
-
count: 0
|
|
176
|
-
},
|
|
177
|
-
provenTx: {
|
|
178
|
-
idMap: {},
|
|
179
|
-
entityName: 'ProvenTx',
|
|
180
|
-
maxUpdated_at: undefined,
|
|
181
|
-
count: 0
|
|
182
|
-
},
|
|
183
|
-
outputBasket: {
|
|
184
|
-
idMap: {},
|
|
185
|
-
entityName: 'OutputBasket',
|
|
186
|
-
maxUpdated_at: undefined,
|
|
187
|
-
count: 0
|
|
188
|
-
},
|
|
189
|
-
provenTxReq: {
|
|
190
|
-
idMap: {},
|
|
191
|
-
entityName: 'ProvenTxReq',
|
|
192
|
-
maxUpdated_at: undefined,
|
|
193
|
-
count: 0
|
|
194
|
-
},
|
|
195
|
-
txLabelMap: {
|
|
196
|
-
idMap: {},
|
|
197
|
-
entityName: 'TxLabelMap',
|
|
198
|
-
maxUpdated_at: undefined,
|
|
199
|
-
count: 0
|
|
200
|
-
},
|
|
201
|
-
output: {
|
|
202
|
-
idMap: {},
|
|
203
|
-
entityName: 'Output',
|
|
204
|
-
maxUpdated_at: undefined,
|
|
205
|
-
count: 0
|
|
206
|
-
},
|
|
207
|
-
outputTag: {
|
|
208
|
-
idMap: {},
|
|
209
|
-
entityName: 'OutputTag',
|
|
210
|
-
maxUpdated_at: undefined,
|
|
211
|
-
count: 0
|
|
212
|
-
},
|
|
213
|
-
outputTagMap: {
|
|
214
|
-
idMap: {},
|
|
215
|
-
entityName: 'OutputTagMap',
|
|
216
|
-
maxUpdated_at: undefined,
|
|
217
|
-
count: 0
|
|
218
|
-
},
|
|
219
|
-
certificate: {
|
|
220
|
-
idMap: {},
|
|
221
|
-
entityName: 'Certificate',
|
|
222
|
-
maxUpdated_at: undefined,
|
|
223
|
-
count: 0
|
|
224
|
-
},
|
|
225
|
-
certificateField: {
|
|
226
|
-
idMap: {},
|
|
227
|
-
entityName: 'CertificateField',
|
|
228
|
-
maxUpdated_at: undefined,
|
|
229
|
-
count: 0
|
|
230
|
-
},
|
|
231
|
-
commission: {
|
|
232
|
-
idMap: {},
|
|
233
|
-
entityName: 'Commission',
|
|
234
|
-
maxUpdated_at: undefined,
|
|
235
|
-
count: 0
|
|
236
|
-
}
|
|
237
|
-
}
|
|
163
|
+
const syncMap = createSyncMap()
|
|
164
|
+
syncMap.txLabel.idMap = { [txLabel2.userId]: txLabel1.userId }
|
|
165
|
+
syncMap.txLabel.count = 1
|
|
238
166
|
|
|
239
167
|
// Verify the entities match
|
|
240
168
|
expect(txLabel1.equals(txLabel2.toApi(), syncMap)).toBe(true)
|
|
@@ -245,7 +173,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
245
173
|
const ctx2 = ctxs2[0]
|
|
246
174
|
|
|
247
175
|
// Insert a TxLabel into the first database
|
|
248
|
-
const txLabel1 = new
|
|
176
|
+
const txLabel1 = new EntityTxLabel({
|
|
249
177
|
txLabelId: 305,
|
|
250
178
|
userId: 1,
|
|
251
179
|
label: 'Label A',
|
|
@@ -257,7 +185,7 @@ describe('TxLabel Class Tests', () => {
|
|
|
257
185
|
await ctx1.activeStorage.insertTxLabel(txLabel1.toApi())
|
|
258
186
|
|
|
259
187
|
// Insert a non-matching TxLabel into the second database
|
|
260
|
-
const txLabel2 = new
|
|
188
|
+
const txLabel2 = new EntityTxLabel({
|
|
261
189
|
txLabelId: 306, // Different txLabelId
|
|
262
190
|
userId: 1, // Different userId
|
|
263
191
|
label: 'Label B', // Different label
|
|
@@ -268,81 +196,9 @@ describe('TxLabel Class Tests', () => {
|
|
|
268
196
|
|
|
269
197
|
await ctx2.activeStorage.insertTxLabel(txLabel2.toApi())
|
|
270
198
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
idMap: { [txLabel2.userId]: txLabel1.userId },
|
|
275
|
-
entityName: 'TxLabel',
|
|
276
|
-
maxUpdated_at: undefined,
|
|
277
|
-
count: 1
|
|
278
|
-
},
|
|
279
|
-
transaction: {
|
|
280
|
-
idMap: {},
|
|
281
|
-
entityName: 'Transaction',
|
|
282
|
-
maxUpdated_at: undefined,
|
|
283
|
-
count: 0
|
|
284
|
-
},
|
|
285
|
-
provenTx: {
|
|
286
|
-
idMap: {},
|
|
287
|
-
entityName: 'ProvenTx',
|
|
288
|
-
maxUpdated_at: undefined,
|
|
289
|
-
count: 0
|
|
290
|
-
},
|
|
291
|
-
outputBasket: {
|
|
292
|
-
idMap: {},
|
|
293
|
-
entityName: 'OutputBasket',
|
|
294
|
-
maxUpdated_at: undefined,
|
|
295
|
-
count: 0
|
|
296
|
-
},
|
|
297
|
-
provenTxReq: {
|
|
298
|
-
idMap: {},
|
|
299
|
-
entityName: 'ProvenTxReq',
|
|
300
|
-
maxUpdated_at: undefined,
|
|
301
|
-
count: 0
|
|
302
|
-
},
|
|
303
|
-
txLabelMap: {
|
|
304
|
-
idMap: {},
|
|
305
|
-
entityName: 'TxLabelMap',
|
|
306
|
-
maxUpdated_at: undefined,
|
|
307
|
-
count: 0
|
|
308
|
-
},
|
|
309
|
-
output: {
|
|
310
|
-
idMap: {},
|
|
311
|
-
entityName: 'Output',
|
|
312
|
-
maxUpdated_at: undefined,
|
|
313
|
-
count: 0
|
|
314
|
-
},
|
|
315
|
-
outputTag: {
|
|
316
|
-
idMap: {},
|
|
317
|
-
entityName: 'OutputTag',
|
|
318
|
-
maxUpdated_at: undefined,
|
|
319
|
-
count: 0
|
|
320
|
-
},
|
|
321
|
-
outputTagMap: {
|
|
322
|
-
idMap: {},
|
|
323
|
-
entityName: 'OutputTagMap',
|
|
324
|
-
maxUpdated_at: undefined,
|
|
325
|
-
count: 0
|
|
326
|
-
},
|
|
327
|
-
certificate: {
|
|
328
|
-
idMap: {},
|
|
329
|
-
entityName: 'Certificate',
|
|
330
|
-
maxUpdated_at: undefined,
|
|
331
|
-
count: 0
|
|
332
|
-
},
|
|
333
|
-
certificateField: {
|
|
334
|
-
idMap: {},
|
|
335
|
-
entityName: 'CertificateField',
|
|
336
|
-
maxUpdated_at: undefined,
|
|
337
|
-
count: 0
|
|
338
|
-
},
|
|
339
|
-
commission: {
|
|
340
|
-
idMap: {},
|
|
341
|
-
entityName: 'Commission',
|
|
342
|
-
maxUpdated_at: undefined,
|
|
343
|
-
count: 0
|
|
344
|
-
}
|
|
345
|
-
}
|
|
199
|
+
const syncMap = createSyncMap()
|
|
200
|
+
syncMap.txLabel.idMap = { [txLabel2.userId]: txLabel1.userId }
|
|
201
|
+
syncMap.txLabel.count = 1
|
|
346
202
|
|
|
347
203
|
// Verify the entities do not match
|
|
348
204
|
expect(txLabel1.equals(txLabel2.toApi(), syncMap)).toBe(false)
|