@bsv/wallet-toolbox 1.1.7 → 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 -486
- package/docs/monitor.md +29 -27
- package/docs/services.md +22 -22
- package/docs/setup.md +23 -23
- package/docs/storage.md +2177 -419
- package/docs/wallet.md +499 -486
- 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.map +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.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 +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 +17 -11
- package/src/storage/methods/reviewStatus.ts +4 -4
- 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 +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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSyncMap, sdk, SyncMap, TableOutput } from '../../../../../src'
|
|
2
2
|
import {
|
|
3
3
|
TestUtilsWalletStorage as _tu,
|
|
4
4
|
TestWalletNoSetup
|
|
5
5
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
|
-
import {
|
|
6
|
+
import { EntityOutput } from '../../../../../src/storage/schema/entities/Output'
|
|
7
7
|
|
|
8
8
|
describe('Output class method tests', () => {
|
|
9
9
|
jest.setTimeout(99999999)
|
|
@@ -35,7 +35,7 @@ describe('Output class method tests', () => {
|
|
|
35
35
|
const ctx = ctxs[0]
|
|
36
36
|
|
|
37
37
|
// Insert initial record into the database
|
|
38
|
-
const initialData:
|
|
38
|
+
const initialData: TableOutput = {
|
|
39
39
|
outputId: 601,
|
|
40
40
|
created_at: new Date('2023-01-01'),
|
|
41
41
|
updated_at: new Date('2023-01-02'),
|
|
@@ -64,84 +64,12 @@ describe('Output class method tests', () => {
|
|
|
64
64
|
await ctx.activeStorage.insertOutput(initialData)
|
|
65
65
|
|
|
66
66
|
// Create two Output entities from the same data
|
|
67
|
-
const entity1 = new
|
|
68
|
-
const entity2 = new
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
idMap: { 100: 100 },
|
|
74
|
-
entityName: 'Transaction',
|
|
75
|
-
maxUpdated_at: undefined,
|
|
76
|
-
count: 0
|
|
77
|
-
},
|
|
78
|
-
outputBasket: {
|
|
79
|
-
idMap: { 1: 1 },
|
|
80
|
-
entityName: 'OutputBasket',
|
|
81
|
-
maxUpdated_at: undefined,
|
|
82
|
-
count: 0
|
|
83
|
-
},
|
|
84
|
-
provenTx: {
|
|
85
|
-
idMap: {},
|
|
86
|
-
entityName: 'ProvenTx',
|
|
87
|
-
maxUpdated_at: undefined,
|
|
88
|
-
count: 0
|
|
89
|
-
},
|
|
90
|
-
output: {
|
|
91
|
-
idMap: {},
|
|
92
|
-
entityName: 'Output',
|
|
93
|
-
maxUpdated_at: undefined,
|
|
94
|
-
count: 0
|
|
95
|
-
},
|
|
96
|
-
outputTag: {
|
|
97
|
-
idMap: {},
|
|
98
|
-
entityName: 'OutputTag',
|
|
99
|
-
maxUpdated_at: undefined,
|
|
100
|
-
count: 0
|
|
101
|
-
},
|
|
102
|
-
provenTxReq: {
|
|
103
|
-
idMap: {},
|
|
104
|
-
entityName: 'ProvenTxReq',
|
|
105
|
-
maxUpdated_at: undefined,
|
|
106
|
-
count: 0
|
|
107
|
-
},
|
|
108
|
-
txLabel: {
|
|
109
|
-
idMap: {},
|
|
110
|
-
entityName: 'TxLabel',
|
|
111
|
-
maxUpdated_at: undefined,
|
|
112
|
-
count: 0
|
|
113
|
-
},
|
|
114
|
-
txLabelMap: {
|
|
115
|
-
idMap: {},
|
|
116
|
-
entityName: 'TxLabelMap',
|
|
117
|
-
maxUpdated_at: undefined,
|
|
118
|
-
count: 0
|
|
119
|
-
},
|
|
120
|
-
outputTagMap: {
|
|
121
|
-
idMap: {},
|
|
122
|
-
entityName: 'OutputTagMap',
|
|
123
|
-
maxUpdated_at: undefined,
|
|
124
|
-
count: 0
|
|
125
|
-
},
|
|
126
|
-
certificate: {
|
|
127
|
-
idMap: {},
|
|
128
|
-
entityName: 'Certificate',
|
|
129
|
-
maxUpdated_at: undefined,
|
|
130
|
-
count: 0
|
|
131
|
-
},
|
|
132
|
-
certificateField: {
|
|
133
|
-
idMap: {},
|
|
134
|
-
entityName: 'CertificateField',
|
|
135
|
-
maxUpdated_at: undefined,
|
|
136
|
-
count: 0
|
|
137
|
-
},
|
|
138
|
-
commission: {
|
|
139
|
-
idMap: {},
|
|
140
|
-
entityName: 'Commission',
|
|
141
|
-
maxUpdated_at: undefined,
|
|
142
|
-
count: 0
|
|
143
|
-
}
|
|
144
|
-
}
|
|
67
|
+
const entity1 = new EntityOutput(initialData)
|
|
68
|
+
const entity2 = new EntityOutput(initialData)
|
|
69
|
+
|
|
70
|
+
const syncMap = createSyncMap()
|
|
71
|
+
syncMap.transaction.idMap[100] = 100
|
|
72
|
+
syncMap.outputBasket.idMap[1] = 1
|
|
145
73
|
|
|
146
74
|
// Verify equals with and without SyncMap
|
|
147
75
|
expect(entity1.equals(entity2.toApi())).toBe(true)
|
|
@@ -153,7 +81,7 @@ describe('Output class method tests', () => {
|
|
|
153
81
|
const ctx = ctxs[0]
|
|
154
82
|
|
|
155
83
|
// Insert initial record into the database
|
|
156
|
-
const initialData:
|
|
84
|
+
const initialData: TableOutput = {
|
|
157
85
|
outputId: 602,
|
|
158
86
|
created_at: new Date('2023-01-01'),
|
|
159
87
|
updated_at: new Date('2023-01-02'),
|
|
@@ -182,8 +110,8 @@ describe('Output class method tests', () => {
|
|
|
182
110
|
await ctx.activeStorage.insertOutput(initialData)
|
|
183
111
|
|
|
184
112
|
// Create two Output entities with differing data
|
|
185
|
-
const entity1 = new
|
|
186
|
-
const entity2 = new
|
|
113
|
+
const entity1 = new EntityOutput(initialData)
|
|
114
|
+
const entity2 = new EntityOutput({
|
|
187
115
|
...initialData,
|
|
188
116
|
satoshis: 2000
|
|
189
117
|
})
|
|
@@ -197,7 +125,7 @@ describe('Output class method tests', () => {
|
|
|
197
125
|
const ctx = ctxs[0]
|
|
198
126
|
|
|
199
127
|
// Insert initial record into the database
|
|
200
|
-
const initialData:
|
|
128
|
+
const initialData: TableOutput = {
|
|
201
129
|
outputId: 603,
|
|
202
130
|
created_at: new Date('2023-01-01'),
|
|
203
131
|
updated_at: new Date('2023-01-02'),
|
|
@@ -226,8 +154,8 @@ describe('Output class method tests', () => {
|
|
|
226
154
|
await ctx.activeStorage.insertOutput(initialData)
|
|
227
155
|
|
|
228
156
|
// Create two Output entities with differing array data
|
|
229
|
-
const entity1 = new
|
|
230
|
-
const entity2 = new
|
|
157
|
+
const entity1 = new EntityOutput(initialData)
|
|
158
|
+
const entity2 = new EntityOutput({
|
|
231
159
|
...initialData,
|
|
232
160
|
lockingScript: [1, 2, 4]
|
|
233
161
|
})
|
|
@@ -241,7 +169,7 @@ describe('Output class method tests', () => {
|
|
|
241
169
|
const ctx = ctxs[0]
|
|
242
170
|
|
|
243
171
|
// Insert initial Output record
|
|
244
|
-
const initialData:
|
|
172
|
+
const initialData: TableOutput = {
|
|
245
173
|
outputId: 701,
|
|
246
174
|
created_at: new Date('2023-01-01'),
|
|
247
175
|
updated_at: new Date('2023-01-02'),
|
|
@@ -271,10 +199,10 @@ describe('Output class method tests', () => {
|
|
|
271
199
|
await ctx.activeStorage.insertOutput(initialData)
|
|
272
200
|
|
|
273
201
|
// Create an Output entity from the initial data
|
|
274
|
-
const entity = new
|
|
202
|
+
const entity = new EntityOutput(initialData)
|
|
275
203
|
|
|
276
204
|
// Simulate the `ei` argument with a later `updated_at`
|
|
277
|
-
const updatedData:
|
|
205
|
+
const updatedData: TableOutput = {
|
|
278
206
|
...initialData,
|
|
279
207
|
updated_at: new Date('2023-01-03'), // Later timestamp
|
|
280
208
|
spendable: false,
|
|
@@ -292,80 +220,9 @@ describe('Output class method tests', () => {
|
|
|
292
220
|
spentBy: 105
|
|
293
221
|
}
|
|
294
222
|
|
|
295
|
-
const syncMap
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
entityName: 'Transaction',
|
|
299
|
-
maxUpdated_at: undefined,
|
|
300
|
-
count: 0
|
|
301
|
-
},
|
|
302
|
-
outputBasket: {
|
|
303
|
-
idMap: { 1: 1 },
|
|
304
|
-
entityName: 'OutputBasket',
|
|
305
|
-
maxUpdated_at: undefined,
|
|
306
|
-
count: 0
|
|
307
|
-
},
|
|
308
|
-
provenTx: {
|
|
309
|
-
idMap: {},
|
|
310
|
-
entityName: 'ProvenTx',
|
|
311
|
-
maxUpdated_at: undefined,
|
|
312
|
-
count: 0
|
|
313
|
-
},
|
|
314
|
-
output: {
|
|
315
|
-
idMap: {},
|
|
316
|
-
entityName: 'Output',
|
|
317
|
-
maxUpdated_at: undefined,
|
|
318
|
-
count: 0
|
|
319
|
-
},
|
|
320
|
-
outputTag: {
|
|
321
|
-
idMap: {},
|
|
322
|
-
entityName: 'OutputTag',
|
|
323
|
-
maxUpdated_at: undefined,
|
|
324
|
-
count: 0
|
|
325
|
-
},
|
|
326
|
-
provenTxReq: {
|
|
327
|
-
idMap: {},
|
|
328
|
-
entityName: 'ProvenTxReq',
|
|
329
|
-
maxUpdated_at: undefined,
|
|
330
|
-
count: 0
|
|
331
|
-
},
|
|
332
|
-
txLabel: {
|
|
333
|
-
idMap: {},
|
|
334
|
-
entityName: 'TxLabel',
|
|
335
|
-
maxUpdated_at: undefined,
|
|
336
|
-
count: 0
|
|
337
|
-
},
|
|
338
|
-
txLabelMap: {
|
|
339
|
-
idMap: {},
|
|
340
|
-
entityName: 'TxLabelMap',
|
|
341
|
-
maxUpdated_at: undefined,
|
|
342
|
-
count: 0
|
|
343
|
-
},
|
|
344
|
-
outputTagMap: {
|
|
345
|
-
idMap: {},
|
|
346
|
-
entityName: 'OutputTagMap',
|
|
347
|
-
maxUpdated_at: undefined,
|
|
348
|
-
count: 0
|
|
349
|
-
},
|
|
350
|
-
certificate: {
|
|
351
|
-
idMap: {},
|
|
352
|
-
entityName: 'Certificate',
|
|
353
|
-
maxUpdated_at: undefined,
|
|
354
|
-
count: 0
|
|
355
|
-
},
|
|
356
|
-
certificateField: {
|
|
357
|
-
idMap: {},
|
|
358
|
-
entityName: 'CertificateField',
|
|
359
|
-
maxUpdated_at: undefined,
|
|
360
|
-
count: 0
|
|
361
|
-
},
|
|
362
|
-
commission: {
|
|
363
|
-
idMap: {},
|
|
364
|
-
entityName: 'Commission',
|
|
365
|
-
maxUpdated_at: undefined,
|
|
366
|
-
count: 0
|
|
367
|
-
}
|
|
368
|
-
}
|
|
223
|
+
const syncMap = createSyncMap()
|
|
224
|
+
syncMap.transaction.idMap = { 103: 103, 105: 105 }
|
|
225
|
+
syncMap.outputBasket.idMap[1] = 1
|
|
369
226
|
|
|
370
227
|
// Call mergeExisting
|
|
371
228
|
const wasMergedRaw = await entity.mergeExisting(
|
|
@@ -426,7 +283,7 @@ describe('Output class method tests', () => {
|
|
|
426
283
|
const ctx = ctxs[0]
|
|
427
284
|
|
|
428
285
|
// Use the same initialData as before
|
|
429
|
-
const initialData:
|
|
286
|
+
const initialData: TableOutput = {
|
|
430
287
|
outputId: 702,
|
|
431
288
|
created_at: new Date('2023-01-01'),
|
|
432
289
|
updated_at: new Date('2023-01-02'),
|
|
@@ -456,89 +313,18 @@ describe('Output class method tests', () => {
|
|
|
456
313
|
await ctx.activeStorage.insertOutput(initialData)
|
|
457
314
|
|
|
458
315
|
// Create an Output entity from the initial data
|
|
459
|
-
const entity = new
|
|
316
|
+
const entity = new EntityOutput(initialData)
|
|
460
317
|
|
|
461
318
|
// Simulate the `ei` argument with an earlier `updated_at`
|
|
462
|
-
const earlierData:
|
|
319
|
+
const earlierData: TableOutput = {
|
|
463
320
|
...initialData,
|
|
464
321
|
updated_at: new Date('2023-01-01'), // Earlier timestamp
|
|
465
322
|
spendable: false
|
|
466
323
|
}
|
|
467
324
|
|
|
468
|
-
const syncMap
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
entityName: 'Transaction',
|
|
472
|
-
maxUpdated_at: undefined,
|
|
473
|
-
count: 0
|
|
474
|
-
},
|
|
475
|
-
outputBasket: {
|
|
476
|
-
idMap: { 1: 1 },
|
|
477
|
-
entityName: 'OutputBasket',
|
|
478
|
-
maxUpdated_at: undefined,
|
|
479
|
-
count: 0
|
|
480
|
-
},
|
|
481
|
-
provenTx: {
|
|
482
|
-
idMap: {},
|
|
483
|
-
entityName: 'ProvenTx',
|
|
484
|
-
maxUpdated_at: undefined,
|
|
485
|
-
count: 0
|
|
486
|
-
},
|
|
487
|
-
output: {
|
|
488
|
-
idMap: {},
|
|
489
|
-
entityName: 'Output',
|
|
490
|
-
maxUpdated_at: undefined,
|
|
491
|
-
count: 0
|
|
492
|
-
},
|
|
493
|
-
outputTag: {
|
|
494
|
-
idMap: {},
|
|
495
|
-
entityName: 'OutputTag',
|
|
496
|
-
maxUpdated_at: undefined,
|
|
497
|
-
count: 0
|
|
498
|
-
},
|
|
499
|
-
provenTxReq: {
|
|
500
|
-
idMap: {},
|
|
501
|
-
entityName: 'ProvenTxReq',
|
|
502
|
-
maxUpdated_at: undefined,
|
|
503
|
-
count: 0
|
|
504
|
-
},
|
|
505
|
-
txLabel: {
|
|
506
|
-
idMap: {},
|
|
507
|
-
entityName: 'TxLabel',
|
|
508
|
-
maxUpdated_at: undefined,
|
|
509
|
-
count: 0
|
|
510
|
-
},
|
|
511
|
-
txLabelMap: {
|
|
512
|
-
idMap: {},
|
|
513
|
-
entityName: 'TxLabelMap',
|
|
514
|
-
maxUpdated_at: undefined,
|
|
515
|
-
count: 0
|
|
516
|
-
},
|
|
517
|
-
outputTagMap: {
|
|
518
|
-
idMap: {},
|
|
519
|
-
entityName: 'OutputTagMap',
|
|
520
|
-
maxUpdated_at: undefined,
|
|
521
|
-
count: 0
|
|
522
|
-
},
|
|
523
|
-
certificate: {
|
|
524
|
-
idMap: {},
|
|
525
|
-
entityName: 'Certificate',
|
|
526
|
-
maxUpdated_at: undefined,
|
|
527
|
-
count: 0
|
|
528
|
-
},
|
|
529
|
-
certificateField: {
|
|
530
|
-
idMap: {},
|
|
531
|
-
entityName: 'CertificateField',
|
|
532
|
-
maxUpdated_at: undefined,
|
|
533
|
-
count: 0
|
|
534
|
-
},
|
|
535
|
-
commission: {
|
|
536
|
-
idMap: {},
|
|
537
|
-
entityName: 'Commission',
|
|
538
|
-
maxUpdated_at: undefined,
|
|
539
|
-
count: 0
|
|
540
|
-
}
|
|
541
|
-
}
|
|
325
|
+
const syncMap = createSyncMap()
|
|
326
|
+
syncMap.transaction.idMap = { 104: 104 }
|
|
327
|
+
syncMap.outputBasket.idMap[1] = 1
|
|
542
328
|
|
|
543
329
|
// Call mergeExisting
|
|
544
330
|
const wasMergedRaw = await entity.mergeExisting(
|
|
@@ -570,7 +356,7 @@ describe('Output class method tests', () => {
|
|
|
570
356
|
const now = new Date()
|
|
571
357
|
|
|
572
358
|
// Initial test data
|
|
573
|
-
const initialData:
|
|
359
|
+
const initialData: TableOutput = {
|
|
574
360
|
outputId: 701,
|
|
575
361
|
created_at: now,
|
|
576
362
|
updated_at: now,
|
|
@@ -598,7 +384,7 @@ describe('Output class method tests', () => {
|
|
|
598
384
|
}
|
|
599
385
|
|
|
600
386
|
// Create the Output entity
|
|
601
|
-
const entity = new
|
|
387
|
+
const entity = new EntityOutput(initialData)
|
|
602
388
|
|
|
603
389
|
// Validate getters
|
|
604
390
|
expect(entity.outputId).toBe(initialData.outputId)
|
|
@@ -683,7 +469,7 @@ describe('Output class method tests', () => {
|
|
|
683
469
|
expect(entity.outputId).toBe(900)
|
|
684
470
|
|
|
685
471
|
// Validate `entityName` and `entityTable`
|
|
686
|
-
expect(entity.entityName).toBe('
|
|
472
|
+
expect(entity.entityName).toBe('output')
|
|
687
473
|
expect(entity.entityTable).toBe('outputs')
|
|
688
474
|
})
|
|
689
475
|
})
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import * as bsv from '@bsv/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createSyncMap,
|
|
4
|
+
sdk,
|
|
5
|
+
SyncMap,
|
|
6
|
+
TableProvenTxReq
|
|
7
|
+
} from '../../../../../src'
|
|
3
8
|
import {
|
|
4
9
|
TestUtilsWalletStorage as _tu,
|
|
5
10
|
TestWalletNoSetup
|
|
6
11
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
7
12
|
import {
|
|
8
|
-
|
|
13
|
+
EntityProvenTxReq,
|
|
9
14
|
ProvenTxReqHistorySummaryApi
|
|
10
15
|
} from '../../../../../src/storage/schema/entities/ProvenTxReq'
|
|
11
16
|
|
|
@@ -36,7 +41,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
36
41
|
|
|
37
42
|
// Test: apiNotify getter and setter
|
|
38
43
|
test('0_apiNotify_getter_and_setter', () => {
|
|
39
|
-
const provenTxReq = new
|
|
44
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
40
45
|
provenTxReqId: 0,
|
|
41
46
|
created_at: new Date(),
|
|
42
47
|
updated_at: new Date(),
|
|
@@ -58,7 +63,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
58
63
|
|
|
59
64
|
// Test: getHistorySummary method
|
|
60
65
|
test('1_getHistorySummary', () => {
|
|
61
|
-
const provenTxReq = new
|
|
66
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
62
67
|
provenTxReqId: 0,
|
|
63
68
|
created_at: new Date(),
|
|
64
69
|
updated_at: new Date(),
|
|
@@ -92,7 +97,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
92
97
|
|
|
93
98
|
// Test: parseHistoryNote method
|
|
94
99
|
test('2_parseHistoryNote', () => {
|
|
95
|
-
const provenTxReq = new
|
|
100
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
96
101
|
provenTxReqId: 0,
|
|
97
102
|
created_at: new Date(),
|
|
98
103
|
updated_at: new Date(),
|
|
@@ -118,7 +123,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
118
123
|
// Test: updateStorage method
|
|
119
124
|
test('3_updateStorage', async () => {
|
|
120
125
|
const ctx = ctxs[0]
|
|
121
|
-
const provenTxReq = new
|
|
126
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
122
127
|
provenTxReqId: 0,
|
|
123
128
|
created_at: new Date(),
|
|
124
129
|
updated_at: new Date(),
|
|
@@ -143,7 +148,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
143
148
|
// Test: insertOrMerge method
|
|
144
149
|
test('4_insertOrMerge', async () => {
|
|
145
150
|
const ctx = ctxs[0]
|
|
146
|
-
const provenTxReq = new
|
|
151
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
147
152
|
provenTxReqId: 0,
|
|
148
153
|
created_at: new Date(),
|
|
149
154
|
updated_at: new Date(),
|
|
@@ -170,7 +175,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
170
175
|
const currentTime = new Date()
|
|
171
176
|
|
|
172
177
|
// ProvenTxReq in the first database
|
|
173
|
-
const provenTxReq1 = new
|
|
178
|
+
const provenTxReq1 = new EntityProvenTxReq({
|
|
174
179
|
provenTxReqId: 405,
|
|
175
180
|
created_at: currentTime,
|
|
176
181
|
updated_at: currentTime,
|
|
@@ -187,7 +192,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
187
192
|
await ctx1.activeStorage.insertProvenTxReq(provenTxReq1.toApi())
|
|
188
193
|
|
|
189
194
|
// ProvenTxReq in the second database
|
|
190
|
-
const provenTxReq2 = new
|
|
195
|
+
const provenTxReq2 = new EntityProvenTxReq({
|
|
191
196
|
provenTxReqId: 406,
|
|
192
197
|
created_at: currentTime,
|
|
193
198
|
updated_at: currentTime,
|
|
@@ -203,31 +208,8 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
203
208
|
})
|
|
204
209
|
await ctx2.activeStorage.insertProvenTxReq(provenTxReq2.toApi())
|
|
205
210
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
provenTx: {
|
|
209
|
-
idMap: {},
|
|
210
|
-
entityName: 'ProvenTx',
|
|
211
|
-
maxUpdated_at: undefined,
|
|
212
|
-
count: 0
|
|
213
|
-
},
|
|
214
|
-
provenTxReq: {
|
|
215
|
-
idMap: { 406: 405 },
|
|
216
|
-
entityName: 'ProvenTxReq',
|
|
217
|
-
maxUpdated_at: undefined,
|
|
218
|
-
count: 1
|
|
219
|
-
},
|
|
220
|
-
transaction: { idMap: {}, entityName: 'Transaction', count: 0 },
|
|
221
|
-
outputBasket: { idMap: {}, entityName: 'OutputBasket', count: 0 },
|
|
222
|
-
txLabel: { idMap: {}, entityName: 'TxLabel', count: 0 },
|
|
223
|
-
txLabelMap: { idMap: {}, entityName: 'TxLabelMap', count: 0 },
|
|
224
|
-
output: { idMap: {}, entityName: 'Output', count: 0 },
|
|
225
|
-
outputTag: { idMap: {}, entityName: 'OutputTag', count: 0 },
|
|
226
|
-
outputTagMap: { idMap: {}, entityName: 'OutputTagMap', count: 0 },
|
|
227
|
-
certificate: { idMap: {}, entityName: 'Certificate', count: 0 },
|
|
228
|
-
certificateField: { idMap: {}, entityName: 'CertificateField', count: 0 },
|
|
229
|
-
commission: { idMap: {}, entityName: 'Commission', count: 0 }
|
|
230
|
-
}
|
|
211
|
+
const syncMap = createSyncMap()
|
|
212
|
+
syncMap.provenTxReq.idMap = { 406: 405 }
|
|
231
213
|
|
|
232
214
|
// Assert entities are equal
|
|
233
215
|
expect(provenTxReq1.equals(provenTxReq2.toApi(), syncMap)).toBe(true)
|
|
@@ -241,7 +223,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
241
223
|
const currentTime = new Date()
|
|
242
224
|
|
|
243
225
|
// ProvenTxReq in the first database
|
|
244
|
-
const provenTxReq1 = new
|
|
226
|
+
const provenTxReq1 = new EntityProvenTxReq({
|
|
245
227
|
provenTxReqId: 407,
|
|
246
228
|
created_at: currentTime,
|
|
247
229
|
updated_at: currentTime,
|
|
@@ -258,7 +240,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
258
240
|
await ctx1.activeStorage.insertProvenTxReq(provenTxReq1.toApi())
|
|
259
241
|
|
|
260
242
|
// ProvenTxReq in the second database
|
|
261
|
-
const provenTxReq2 = new
|
|
243
|
+
const provenTxReq2 = new EntityProvenTxReq({
|
|
262
244
|
provenTxReqId: 408,
|
|
263
245
|
created_at: currentTime,
|
|
264
246
|
updated_at: currentTime,
|
|
@@ -274,31 +256,8 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
274
256
|
})
|
|
275
257
|
await ctx2.activeStorage.insertProvenTxReq(provenTxReq2.toApi())
|
|
276
258
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
provenTx: {
|
|
280
|
-
idMap: {},
|
|
281
|
-
entityName: 'ProvenTx',
|
|
282
|
-
maxUpdated_at: undefined,
|
|
283
|
-
count: 0
|
|
284
|
-
},
|
|
285
|
-
provenTxReq: {
|
|
286
|
-
idMap: { 406: 405 },
|
|
287
|
-
entityName: 'ProvenTxReq',
|
|
288
|
-
maxUpdated_at: undefined,
|
|
289
|
-
count: 1
|
|
290
|
-
},
|
|
291
|
-
transaction: { idMap: {}, entityName: 'Transaction', count: 0 },
|
|
292
|
-
outputBasket: { idMap: {}, entityName: 'OutputBasket', count: 0 },
|
|
293
|
-
txLabel: { idMap: {}, entityName: 'TxLabel', count: 0 },
|
|
294
|
-
txLabelMap: { idMap: {}, entityName: 'TxLabelMap', count: 0 },
|
|
295
|
-
output: { idMap: {}, entityName: 'Output', count: 0 },
|
|
296
|
-
outputTag: { idMap: {}, entityName: 'OutputTag', count: 0 },
|
|
297
|
-
outputTagMap: { idMap: {}, entityName: 'OutputTagMap', count: 0 },
|
|
298
|
-
certificate: { idMap: {}, entityName: 'Certificate', count: 0 },
|
|
299
|
-
certificateField: { idMap: {}, entityName: 'CertificateField', count: 0 },
|
|
300
|
-
commission: { idMap: {}, entityName: 'Commission', count: 0 }
|
|
301
|
-
}
|
|
259
|
+
const syncMap = createSyncMap()
|
|
260
|
+
syncMap.provenTxReq.idMap = { 406: 405 }
|
|
302
261
|
|
|
303
262
|
// Assert entities are not equal
|
|
304
263
|
expect(provenTxReq1.equals(provenTxReq2.toApi(), syncMap)).toBe(false)
|
|
@@ -306,7 +265,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
306
265
|
|
|
307
266
|
// Test: mergeNotifyTransactionIds method
|
|
308
267
|
test('7_mergeNotifyTransactionIds', () => {
|
|
309
|
-
const provenTxReq = new
|
|
268
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
310
269
|
provenTxReqId: 0,
|
|
311
270
|
created_at: new Date(),
|
|
312
271
|
updated_at: new Date(),
|
|
@@ -319,22 +278,10 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
319
278
|
notified: false
|
|
320
279
|
})
|
|
321
280
|
|
|
322
|
-
const syncMap
|
|
323
|
-
|
|
324
|
-
transaction: { idMap: { 100: 200 }, entityName: 'transaction', count: 1 },
|
|
325
|
-
outputBasket: { idMap: {}, entityName: 'outputBasket', count: 0 },
|
|
326
|
-
provenTxReq: { idMap: {}, entityName: 'provenTxReq', count: 0 },
|
|
327
|
-
txLabel: { idMap: {}, entityName: 'txLabel', count: 0 },
|
|
328
|
-
txLabelMap: { idMap: {}, entityName: 'txLabelMap', count: 0 },
|
|
329
|
-
output: { idMap: {}, entityName: 'output', count: 0 },
|
|
330
|
-
outputTag: { idMap: {}, entityName: 'outputTag', count: 0 },
|
|
331
|
-
outputTagMap: { idMap: {}, entityName: 'outputTagMap', count: 0 },
|
|
332
|
-
certificate: { idMap: {}, entityName: 'certificate', count: 0 },
|
|
333
|
-
certificateField: { idMap: {}, entityName: 'certificateField', count: 0 },
|
|
334
|
-
commission: { idMap: {}, entityName: 'commission', count: 0 }
|
|
335
|
-
}
|
|
281
|
+
const syncMap = createSyncMap()
|
|
282
|
+
syncMap.transaction.idMap = { 100: 200 }
|
|
336
283
|
|
|
337
|
-
const inputProvenTxReq:
|
|
284
|
+
const inputProvenTxReq: TableProvenTxReq = {
|
|
338
285
|
provenTxReqId: 0,
|
|
339
286
|
created_at: new Date(),
|
|
340
287
|
updated_at: new Date(),
|
|
@@ -357,7 +304,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
357
304
|
// Test: Getters and Setters
|
|
358
305
|
test('8_getters_and_setters', () => {
|
|
359
306
|
const currentTime = new Date()
|
|
360
|
-
const provenTxReq = new
|
|
307
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
361
308
|
provenTxReqId: 123,
|
|
362
309
|
created_at: currentTime,
|
|
363
310
|
updated_at: currentTime,
|
|
@@ -385,7 +332,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
385
332
|
expect(provenTxReq.notified).toBe(true)
|
|
386
333
|
expect(provenTxReq.batch).toBe('test-batch')
|
|
387
334
|
expect(provenTxReq.id).toBe(123)
|
|
388
|
-
expect(provenTxReq.entityName).toBe('
|
|
335
|
+
expect(provenTxReq.entityName).toBe('provenTxReq')
|
|
389
336
|
expect(provenTxReq.entityTable).toBe('proven_tx_reqs')
|
|
390
337
|
|
|
391
338
|
// Verify setters
|
|
@@ -417,7 +364,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
417
364
|
|
|
418
365
|
// Test: parseHistoryNote method
|
|
419
366
|
test('9_parseHistoryNote', () => {
|
|
420
|
-
const provenTxReq = new
|
|
367
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
421
368
|
provenTxReqId: 0,
|
|
422
369
|
created_at: new Date(),
|
|
423
370
|
updated_at: new Date(),
|
|
@@ -500,7 +447,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
500
447
|
// Test: mergeHistory method
|
|
501
448
|
test('10_mergeHistory', () => {
|
|
502
449
|
// Create the current ProvenTxReq with some initial history
|
|
503
|
-
const provenTxReq = new
|
|
450
|
+
const provenTxReq = new EntityProvenTxReq({
|
|
504
451
|
provenTxReqId: 409,
|
|
505
452
|
created_at: new Date(),
|
|
506
453
|
updated_at: new Date(),
|
|
@@ -516,7 +463,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
516
463
|
})
|
|
517
464
|
|
|
518
465
|
// Create another ProvenTxReq to merge with
|
|
519
|
-
const otherProvenTxReq = new
|
|
466
|
+
const otherProvenTxReq = new EntityProvenTxReq({
|
|
520
467
|
provenTxReqId: 410,
|
|
521
468
|
created_at: new Date(),
|
|
522
469
|
updated_at: new Date(),
|
|
@@ -569,7 +516,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
569
516
|
]
|
|
570
517
|
|
|
571
518
|
for (const { status, expected } of testCases) {
|
|
572
|
-
expect(
|
|
519
|
+
expect(EntityProvenTxReq.isTerminalStatus(status)).toBe(expected)
|
|
573
520
|
}
|
|
574
521
|
})
|
|
575
522
|
|
|
@@ -577,7 +524,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
577
524
|
const ctx = ctxs[0]
|
|
578
525
|
|
|
579
526
|
// Insert initial ProvenTxReq into the database
|
|
580
|
-
const existingProvenTxReq = new
|
|
527
|
+
const existingProvenTxReq = new EntityProvenTxReq({
|
|
581
528
|
provenTxReqId: 409,
|
|
582
529
|
created_at: new Date('2025-01-01T00:00:00.000Z'),
|
|
583
530
|
updated_at: new Date('2025-01-01T00:00:00.000Z'),
|
|
@@ -596,7 +543,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
596
543
|
await ctx.activeStorage.insertProvenTxReq(existingProvenTxReq.toApi())
|
|
597
544
|
|
|
598
545
|
// Create the ProvenTxReq to be merged
|
|
599
|
-
const incomingProvenTxReq = new
|
|
546
|
+
const incomingProvenTxReq = new EntityProvenTxReq({
|
|
600
547
|
provenTxReqId: 410, // Different ID, simulating another entity
|
|
601
548
|
created_at: new Date('2025-01-02T00:00:00.000Z'),
|
|
602
549
|
updated_at: new Date('2025-01-02T00:00:00.000Z'),
|
|
@@ -612,21 +559,8 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
612
559
|
batch: 'batch1'
|
|
613
560
|
})
|
|
614
561
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
provenTx: { idMap: {}, entityName: 'provenTx', count: 0 },
|
|
618
|
-
transaction: { idMap: { 200: 100 }, entityName: 'transaction', count: 1 },
|
|
619
|
-
outputBasket: { idMap: {}, entityName: 'outputBasket', count: 0 },
|
|
620
|
-
provenTxReq: { idMap: {}, entityName: 'provenTxReq', count: 0 },
|
|
621
|
-
txLabel: { idMap: {}, entityName: 'txLabel', count: 0 },
|
|
622
|
-
txLabelMap: { idMap: {}, entityName: 'txLabelMap', count: 0 },
|
|
623
|
-
output: { idMap: {}, entityName: 'output', count: 0 },
|
|
624
|
-
outputTag: { idMap: {}, entityName: 'outputTag', count: 0 },
|
|
625
|
-
outputTagMap: { idMap: {}, entityName: 'outputTagMap', count: 0 },
|
|
626
|
-
certificate: { idMap: {}, entityName: 'certificate', count: 0 },
|
|
627
|
-
certificateField: { idMap: {}, entityName: 'certificateField', count: 0 },
|
|
628
|
-
commission: { idMap: {}, entityName: 'commission', count: 0 }
|
|
629
|
-
}
|
|
562
|
+
const syncMap = createSyncMap()
|
|
563
|
+
syncMap.transaction.idMap = { 200: 100 }
|
|
630
564
|
|
|
631
565
|
// Call mergeExisting
|
|
632
566
|
const result = await existingProvenTxReq.mergeExisting(
|
|
@@ -645,7 +579,7 @@ describe('ProvenTxReq class method tests', () => {
|
|
|
645
579
|
})
|
|
646
580
|
expect(mergedProvenTxReqs.length).toBe(1)
|
|
647
581
|
|
|
648
|
-
const mergedProvenTxReq = new
|
|
582
|
+
const mergedProvenTxReq = new EntityProvenTxReq(mergedProvenTxReqs[0])
|
|
649
583
|
|
|
650
584
|
// Ensure history.notes is initialized if undefined
|
|
651
585
|
const mergedNotes = mergedProvenTxReq.history.notes || {}
|