@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,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSyncMap, sdk, TableCertificate } from '../../../../../src'
|
|
2
2
|
import {
|
|
3
3
|
TestUtilsWalletStorage as _tu,
|
|
4
4
|
TestWalletNoSetup
|
|
5
5
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
|
-
import {
|
|
6
|
+
import { EntityCertificate } from '../../../../../src/storage/schema/entities/Certificate'
|
|
7
7
|
|
|
8
8
|
describe('Certificate class method tests', () => {
|
|
9
9
|
jest.setTimeout(99999999)
|
|
@@ -34,7 +34,7 @@ describe('Certificate class method tests', () => {
|
|
|
34
34
|
// Insert initial Certificate record
|
|
35
35
|
const now = new Date()
|
|
36
36
|
const certificateId = 500 // Unique ID for this test
|
|
37
|
-
const certificateData:
|
|
37
|
+
const certificateData: TableCertificate = {
|
|
38
38
|
certificateId,
|
|
39
39
|
created_at: now,
|
|
40
40
|
updated_at: now,
|
|
@@ -55,8 +55,8 @@ describe('Certificate class method tests', () => {
|
|
|
55
55
|
await activeStorage.insertCertificate(certificateData)
|
|
56
56
|
|
|
57
57
|
// Create two Certificate entities from the same data
|
|
58
|
-
const entity1 = new
|
|
59
|
-
const entity2 = new
|
|
58
|
+
const entity1 = new EntityCertificate(certificateData)
|
|
59
|
+
const entity2 = new EntityCertificate(certificateData)
|
|
60
60
|
|
|
61
61
|
// Validate equals returns true for identical entities
|
|
62
62
|
expect(entity1.equals(entity2.toApi())).toBe(true)
|
|
@@ -69,7 +69,7 @@ describe('Certificate class method tests', () => {
|
|
|
69
69
|
const now = new Date()
|
|
70
70
|
const certificateId1 = 501
|
|
71
71
|
const certificateId2 = 502
|
|
72
|
-
const certificateData1:
|
|
72
|
+
const certificateData1: TableCertificate = {
|
|
73
73
|
certificateId: certificateId1,
|
|
74
74
|
created_at: now,
|
|
75
75
|
updated_at: now,
|
|
@@ -86,7 +86,7 @@ describe('Certificate class method tests', () => {
|
|
|
86
86
|
'abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890', // Same HexString
|
|
87
87
|
isDeleted: false
|
|
88
88
|
}
|
|
89
|
-
const certificateData2:
|
|
89
|
+
const certificateData2: TableCertificate = {
|
|
90
90
|
certificateId: certificateId2,
|
|
91
91
|
created_at: now,
|
|
92
92
|
updated_at: now,
|
|
@@ -108,14 +108,14 @@ describe('Certificate class method tests', () => {
|
|
|
108
108
|
await activeStorage.insertCertificate(certificateData2)
|
|
109
109
|
|
|
110
110
|
// Create Certificate entities with mismatched data
|
|
111
|
-
const entity1 = new
|
|
112
|
-
const entity2 = new
|
|
111
|
+
const entity1 = new EntityCertificate(certificateData1)
|
|
112
|
+
const entity2 = new EntityCertificate(certificateData2)
|
|
113
113
|
|
|
114
114
|
// Validate equals returns false for mismatched entities
|
|
115
115
|
expect(entity1.equals(entity2.toApi())).toBe(false)
|
|
116
116
|
|
|
117
117
|
// Test each mismatched field individually
|
|
118
|
-
const mismatchedEntities: Partial<
|
|
118
|
+
const mismatchedEntities: Partial<TableCertificate>[] = [
|
|
119
119
|
{ type: 'differentType' },
|
|
120
120
|
{ subject: 'differentSubject' },
|
|
121
121
|
{ serialNumber: 'differentSerialNumber' },
|
|
@@ -126,7 +126,7 @@ describe('Certificate class method tests', () => {
|
|
|
126
126
|
]
|
|
127
127
|
|
|
128
128
|
for (const mismatch of mismatchedEntities) {
|
|
129
|
-
const mismatchedEntity = new
|
|
129
|
+
const mismatchedEntity = new EntityCertificate({
|
|
130
130
|
...certificateData1,
|
|
131
131
|
...mismatch
|
|
132
132
|
})
|
|
@@ -140,7 +140,7 @@ describe('Certificate class method tests', () => {
|
|
|
140
140
|
// Insert a valid Certificate to satisfy foreign key constraints
|
|
141
141
|
const now = new Date()
|
|
142
142
|
const certificateId = 600
|
|
143
|
-
const certificateData:
|
|
143
|
+
const certificateData: TableCertificate = {
|
|
144
144
|
certificateId,
|
|
145
145
|
created_at: now,
|
|
146
146
|
updated_at: now,
|
|
@@ -161,10 +161,10 @@ describe('Certificate class method tests', () => {
|
|
|
161
161
|
await activeStorage.insertCertificate(certificateData)
|
|
162
162
|
|
|
163
163
|
// Create a Certificate entity from the initial data
|
|
164
|
-
const entity = new
|
|
164
|
+
const entity = new EntityCertificate(certificateData)
|
|
165
165
|
|
|
166
166
|
// Simulate the `ei` argument with a later `updated_at`
|
|
167
|
-
const updatedData:
|
|
167
|
+
const updatedData: TableCertificate = {
|
|
168
168
|
...certificateData,
|
|
169
169
|
updated_at: new Date(now.getTime() + 1000), // Later timestamp
|
|
170
170
|
type: 'updatedType',
|
|
@@ -176,85 +176,15 @@ describe('Certificate class method tests', () => {
|
|
|
176
176
|
isDeleted: true
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
const syncMap = createSyncMap()
|
|
180
|
+
syncMap.certificate.idMap[certificateId] = certificateId
|
|
181
|
+
|
|
179
182
|
// Call mergeExisting
|
|
180
183
|
const wasMergedRaw = await entity.mergeExisting(
|
|
181
184
|
activeStorage,
|
|
182
185
|
undefined, // `since` is not used in this method
|
|
183
186
|
updatedData,
|
|
184
|
-
|
|
185
|
-
certificate: {
|
|
186
|
-
idMap: { [certificateId]: certificateId },
|
|
187
|
-
entityName: 'Certificate',
|
|
188
|
-
maxUpdated_at: undefined,
|
|
189
|
-
count: 0
|
|
190
|
-
},
|
|
191
|
-
outputBasket: {
|
|
192
|
-
idMap: {},
|
|
193
|
-
entityName: 'OutputBasket',
|
|
194
|
-
maxUpdated_at: undefined,
|
|
195
|
-
count: 0
|
|
196
|
-
},
|
|
197
|
-
transaction: {
|
|
198
|
-
idMap: {},
|
|
199
|
-
entityName: 'Transaction',
|
|
200
|
-
maxUpdated_at: undefined,
|
|
201
|
-
count: 0
|
|
202
|
-
},
|
|
203
|
-
output: {
|
|
204
|
-
idMap: {},
|
|
205
|
-
entityName: 'Output',
|
|
206
|
-
maxUpdated_at: undefined,
|
|
207
|
-
count: 0
|
|
208
|
-
},
|
|
209
|
-
provenTx: {
|
|
210
|
-
idMap: {},
|
|
211
|
-
entityName: 'ProvenTx',
|
|
212
|
-
maxUpdated_at: undefined,
|
|
213
|
-
count: 0
|
|
214
|
-
},
|
|
215
|
-
outputTag: {
|
|
216
|
-
idMap: {},
|
|
217
|
-
entityName: 'OutputTag',
|
|
218
|
-
maxUpdated_at: undefined,
|
|
219
|
-
count: 0
|
|
220
|
-
},
|
|
221
|
-
provenTxReq: {
|
|
222
|
-
idMap: {},
|
|
223
|
-
entityName: 'ProvenTxReq',
|
|
224
|
-
maxUpdated_at: undefined,
|
|
225
|
-
count: 0
|
|
226
|
-
},
|
|
227
|
-
txLabel: {
|
|
228
|
-
idMap: {},
|
|
229
|
-
entityName: 'TxLabel',
|
|
230
|
-
maxUpdated_at: undefined,
|
|
231
|
-
count: 0
|
|
232
|
-
},
|
|
233
|
-
txLabelMap: {
|
|
234
|
-
idMap: {},
|
|
235
|
-
entityName: 'TxLabelMap',
|
|
236
|
-
maxUpdated_at: undefined,
|
|
237
|
-
count: 0
|
|
238
|
-
},
|
|
239
|
-
outputTagMap: {
|
|
240
|
-
idMap: {},
|
|
241
|
-
entityName: 'OutputTagMap',
|
|
242
|
-
maxUpdated_at: undefined,
|
|
243
|
-
count: 0
|
|
244
|
-
},
|
|
245
|
-
certificateField: {
|
|
246
|
-
idMap: {},
|
|
247
|
-
entityName: 'CertificateField',
|
|
248
|
-
maxUpdated_at: undefined,
|
|
249
|
-
count: 0
|
|
250
|
-
},
|
|
251
|
-
commission: {
|
|
252
|
-
idMap: {},
|
|
253
|
-
entityName: 'Commission',
|
|
254
|
-
maxUpdated_at: undefined,
|
|
255
|
-
count: 0
|
|
256
|
-
}
|
|
257
|
-
},
|
|
187
|
+
syncMap,
|
|
258
188
|
undefined // `trx` is not used
|
|
259
189
|
)
|
|
260
190
|
|
|
@@ -293,7 +223,7 @@ describe('Certificate class method tests', () => {
|
|
|
293
223
|
// Insert a valid Certificate to satisfy foreign key constraints
|
|
294
224
|
const now = new Date()
|
|
295
225
|
const certificateId = 601
|
|
296
|
-
const certificateData:
|
|
226
|
+
const certificateData: TableCertificate = {
|
|
297
227
|
certificateId,
|
|
298
228
|
created_at: now,
|
|
299
229
|
updated_at: now,
|
|
@@ -314,10 +244,10 @@ describe('Certificate class method tests', () => {
|
|
|
314
244
|
await activeStorage.insertCertificate(certificateData)
|
|
315
245
|
|
|
316
246
|
// Create a Certificate entity from the initial data
|
|
317
|
-
const entity = new
|
|
247
|
+
const entity = new EntityCertificate(certificateData)
|
|
318
248
|
|
|
319
249
|
// Simulate the `ei` argument with the same or earlier `updated_at`
|
|
320
|
-
const sameUpdatedData:
|
|
250
|
+
const sameUpdatedData: TableCertificate = {
|
|
321
251
|
...certificateData,
|
|
322
252
|
updated_at: now, // Same timestamp
|
|
323
253
|
type: 'unchangedType',
|
|
@@ -329,85 +259,15 @@ describe('Certificate class method tests', () => {
|
|
|
329
259
|
isDeleted: false
|
|
330
260
|
}
|
|
331
261
|
|
|
262
|
+
const syncMap = createSyncMap()
|
|
263
|
+
syncMap.certificate.idMap[certificateId] = certificateId
|
|
264
|
+
|
|
332
265
|
// Call mergeExisting
|
|
333
266
|
const wasMergedRaw = await entity.mergeExisting(
|
|
334
267
|
activeStorage,
|
|
335
268
|
undefined, // `since` is not used
|
|
336
269
|
sameUpdatedData,
|
|
337
|
-
|
|
338
|
-
certificate: {
|
|
339
|
-
idMap: { [certificateId]: certificateId },
|
|
340
|
-
entityName: 'Certificate',
|
|
341
|
-
maxUpdated_at: undefined,
|
|
342
|
-
count: 0
|
|
343
|
-
},
|
|
344
|
-
outputBasket: {
|
|
345
|
-
idMap: {},
|
|
346
|
-
entityName: 'OutputBasket',
|
|
347
|
-
maxUpdated_at: undefined,
|
|
348
|
-
count: 0
|
|
349
|
-
},
|
|
350
|
-
transaction: {
|
|
351
|
-
idMap: {},
|
|
352
|
-
entityName: 'Transaction',
|
|
353
|
-
maxUpdated_at: undefined,
|
|
354
|
-
count: 0
|
|
355
|
-
},
|
|
356
|
-
output: {
|
|
357
|
-
idMap: {},
|
|
358
|
-
entityName: 'Output',
|
|
359
|
-
maxUpdated_at: undefined,
|
|
360
|
-
count: 0
|
|
361
|
-
},
|
|
362
|
-
provenTx: {
|
|
363
|
-
idMap: {},
|
|
364
|
-
entityName: 'ProvenTx',
|
|
365
|
-
maxUpdated_at: undefined,
|
|
366
|
-
count: 0
|
|
367
|
-
},
|
|
368
|
-
outputTag: {
|
|
369
|
-
idMap: {},
|
|
370
|
-
entityName: 'OutputTag',
|
|
371
|
-
maxUpdated_at: undefined,
|
|
372
|
-
count: 0
|
|
373
|
-
},
|
|
374
|
-
provenTxReq: {
|
|
375
|
-
idMap: {},
|
|
376
|
-
entityName: 'ProvenTxReq',
|
|
377
|
-
maxUpdated_at: undefined,
|
|
378
|
-
count: 0
|
|
379
|
-
},
|
|
380
|
-
txLabel: {
|
|
381
|
-
idMap: {},
|
|
382
|
-
entityName: 'TxLabel',
|
|
383
|
-
maxUpdated_at: undefined,
|
|
384
|
-
count: 0
|
|
385
|
-
},
|
|
386
|
-
txLabelMap: {
|
|
387
|
-
idMap: {},
|
|
388
|
-
entityName: 'TxLabelMap',
|
|
389
|
-
maxUpdated_at: undefined,
|
|
390
|
-
count: 0
|
|
391
|
-
},
|
|
392
|
-
outputTagMap: {
|
|
393
|
-
idMap: {},
|
|
394
|
-
entityName: 'OutputTagMap',
|
|
395
|
-
maxUpdated_at: undefined,
|
|
396
|
-
count: 0
|
|
397
|
-
},
|
|
398
|
-
certificateField: {
|
|
399
|
-
idMap: {},
|
|
400
|
-
entityName: 'CertificateField',
|
|
401
|
-
maxUpdated_at: undefined,
|
|
402
|
-
count: 0
|
|
403
|
-
},
|
|
404
|
-
commission: {
|
|
405
|
-
idMap: {},
|
|
406
|
-
entityName: 'Commission',
|
|
407
|
-
maxUpdated_at: undefined,
|
|
408
|
-
count: 0
|
|
409
|
-
}
|
|
410
|
-
},
|
|
270
|
+
syncMap,
|
|
411
271
|
undefined // `trx` is not used
|
|
412
272
|
)
|
|
413
273
|
|
|
@@ -456,7 +316,7 @@ describe('Certificate class method tests', () => {
|
|
|
456
316
|
const now = new Date()
|
|
457
317
|
|
|
458
318
|
// Initial test data
|
|
459
|
-
const initialData:
|
|
319
|
+
const initialData: TableCertificate = {
|
|
460
320
|
certificateId: 701,
|
|
461
321
|
created_at: now,
|
|
462
322
|
updated_at: now,
|
|
@@ -472,7 +332,7 @@ describe('Certificate class method tests', () => {
|
|
|
472
332
|
}
|
|
473
333
|
|
|
474
334
|
// Create the Certificate entity
|
|
475
|
-
const entity = new
|
|
335
|
+
const entity = new EntityCertificate(initialData)
|
|
476
336
|
|
|
477
337
|
// Validate getters
|
|
478
338
|
expect(entity.certificateId).toBe(initialData.certificateId)
|
|
@@ -488,7 +348,7 @@ describe('Certificate class method tests', () => {
|
|
|
488
348
|
expect(entity.signature).toBe(initialData.signature)
|
|
489
349
|
expect(entity.isDeleted).toBe(initialData.isDeleted)
|
|
490
350
|
expect(entity.id).toBe(initialData.certificateId)
|
|
491
|
-
expect(entity.entityName).toBe('
|
|
351
|
+
expect(entity.entityName).toBe('certificate')
|
|
492
352
|
expect(entity.entityTable).toBe('certificates')
|
|
493
353
|
|
|
494
354
|
// Validate setters
|
|
@@ -520,7 +380,7 @@ describe('Certificate class method tests', () => {
|
|
|
520
380
|
expect(entity.signature).toBe('updatedSignature')
|
|
521
381
|
expect(entity.isDeleted).toBe(true)
|
|
522
382
|
expect(entity.id).toBe(900)
|
|
523
|
-
expect(entity.entityName).toBe('
|
|
383
|
+
expect(entity.entityName).toBe('certificate')
|
|
524
384
|
expect(entity.entityTable).toBe('certificates')
|
|
525
385
|
}
|
|
526
386
|
})
|