@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,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createSyncMap,
|
|
3
|
+
sdk,
|
|
4
|
+
SyncMap,
|
|
5
|
+
TableCertificate,
|
|
6
|
+
TableCertificateField
|
|
7
|
+
} from '../../../../../src'
|
|
2
8
|
import {
|
|
3
9
|
TestUtilsWalletStorage as _tu,
|
|
4
10
|
TestWalletNoSetup
|
|
5
11
|
} from '../../../../../test/utils/TestUtilsWalletStorage'
|
|
6
|
-
import {
|
|
12
|
+
import { EntityCertificateField } from '../../../../../src/storage/schema/entities/CertificateField'
|
|
7
13
|
|
|
8
14
|
describe('CertificateField class method tests', () => {
|
|
9
15
|
jest.setTimeout(99999999)
|
|
@@ -37,7 +43,7 @@ describe('CertificateField class method tests', () => {
|
|
|
37
43
|
// Insert a valid Certificate to satisfy foreign key constraints
|
|
38
44
|
const now = new Date()
|
|
39
45
|
const certificateId = 300 // Ensure this ID is unique in the `certificates` table
|
|
40
|
-
const certificateData:
|
|
46
|
+
const certificateData: TableCertificate = {
|
|
41
47
|
certificateId,
|
|
42
48
|
created_at: now,
|
|
43
49
|
updated_at: now,
|
|
@@ -58,7 +64,7 @@ describe('CertificateField class method tests', () => {
|
|
|
58
64
|
await activeStorage.insertCertificate(certificateData)
|
|
59
65
|
|
|
60
66
|
// Insert initial CertificateField record
|
|
61
|
-
const initialData:
|
|
67
|
+
const initialData: TableCertificateField = {
|
|
62
68
|
certificateId,
|
|
63
69
|
created_at: now,
|
|
64
70
|
updated_at: now,
|
|
@@ -70,84 +76,12 @@ describe('CertificateField class method tests', () => {
|
|
|
70
76
|
await activeStorage.insertCertificateField(initialData)
|
|
71
77
|
|
|
72
78
|
// Create two CertificateField entities from the same data
|
|
73
|
-
const entity1 = new
|
|
74
|
-
const entity2 = new
|
|
79
|
+
const entity1 = new EntityCertificateField(initialData)
|
|
80
|
+
const entity2 = new EntityCertificateField(initialData)
|
|
75
81
|
|
|
76
82
|
// Create a valid SyncMap
|
|
77
|
-
const syncMap
|
|
78
|
-
|
|
79
|
-
idMap: { [certificateId]: certificateId },
|
|
80
|
-
entityName: 'Certificate',
|
|
81
|
-
maxUpdated_at: undefined,
|
|
82
|
-
count: 0
|
|
83
|
-
},
|
|
84
|
-
outputBasket: {
|
|
85
|
-
idMap: {},
|
|
86
|
-
entityName: 'OutputBasket',
|
|
87
|
-
maxUpdated_at: undefined,
|
|
88
|
-
count: 0
|
|
89
|
-
},
|
|
90
|
-
transaction: {
|
|
91
|
-
idMap: {},
|
|
92
|
-
entityName: 'Transaction',
|
|
93
|
-
maxUpdated_at: undefined,
|
|
94
|
-
count: 0
|
|
95
|
-
},
|
|
96
|
-
output: {
|
|
97
|
-
idMap: {},
|
|
98
|
-
entityName: 'Output',
|
|
99
|
-
maxUpdated_at: undefined,
|
|
100
|
-
count: 0
|
|
101
|
-
},
|
|
102
|
-
provenTx: {
|
|
103
|
-
idMap: {},
|
|
104
|
-
entityName: 'ProvenTx',
|
|
105
|
-
maxUpdated_at: undefined,
|
|
106
|
-
count: 0
|
|
107
|
-
},
|
|
108
|
-
outputTag: {
|
|
109
|
-
idMap: {},
|
|
110
|
-
entityName: 'OutputTag',
|
|
111
|
-
maxUpdated_at: undefined,
|
|
112
|
-
count: 0
|
|
113
|
-
},
|
|
114
|
-
provenTxReq: {
|
|
115
|
-
idMap: {},
|
|
116
|
-
entityName: 'ProvenTxReq',
|
|
117
|
-
maxUpdated_at: undefined,
|
|
118
|
-
count: 0
|
|
119
|
-
},
|
|
120
|
-
txLabel: {
|
|
121
|
-
idMap: {},
|
|
122
|
-
entityName: 'TxLabel',
|
|
123
|
-
maxUpdated_at: undefined,
|
|
124
|
-
count: 0
|
|
125
|
-
},
|
|
126
|
-
txLabelMap: {
|
|
127
|
-
idMap: {},
|
|
128
|
-
entityName: 'TxLabelMap',
|
|
129
|
-
maxUpdated_at: undefined,
|
|
130
|
-
count: 0
|
|
131
|
-
},
|
|
132
|
-
outputTagMap: {
|
|
133
|
-
idMap: {},
|
|
134
|
-
entityName: 'OutputTagMap',
|
|
135
|
-
maxUpdated_at: undefined,
|
|
136
|
-
count: 0
|
|
137
|
-
},
|
|
138
|
-
certificateField: {
|
|
139
|
-
idMap: {},
|
|
140
|
-
entityName: 'CertificateField',
|
|
141
|
-
maxUpdated_at: undefined,
|
|
142
|
-
count: 0
|
|
143
|
-
},
|
|
144
|
-
commission: {
|
|
145
|
-
idMap: {},
|
|
146
|
-
entityName: 'Commission',
|
|
147
|
-
maxUpdated_at: undefined,
|
|
148
|
-
count: 0
|
|
149
|
-
}
|
|
150
|
-
}
|
|
83
|
+
const syncMap = createSyncMap()
|
|
84
|
+
syncMap.certificate.idMap[certificateId] = certificateId
|
|
151
85
|
|
|
152
86
|
// Test: equals returns true for identical entities without SyncMap
|
|
153
87
|
expect(entity1.equals(entity2.toApi())).toBe(true)
|
|
@@ -202,7 +136,7 @@ describe('CertificateField class method tests', () => {
|
|
|
202
136
|
})
|
|
203
137
|
|
|
204
138
|
// Insert initial CertificateField record
|
|
205
|
-
const initialData:
|
|
139
|
+
const initialData: TableCertificateField = {
|
|
206
140
|
certificateId: certificateId1,
|
|
207
141
|
created_at: now,
|
|
208
142
|
updated_at: now,
|
|
@@ -214,10 +148,10 @@ describe('CertificateField class method tests', () => {
|
|
|
214
148
|
await activeStorage.insertCertificateField(initialData)
|
|
215
149
|
|
|
216
150
|
// Create a CertificateField entity from the initial data
|
|
217
|
-
const entity1 = new
|
|
151
|
+
const entity1 = new EntityCertificateField(initialData)
|
|
218
152
|
|
|
219
153
|
// Create mismatched entities and test each condition
|
|
220
|
-
const mismatchedEntities: Partial<
|
|
154
|
+
const mismatchedEntities: Partial<TableCertificateField>[] = [
|
|
221
155
|
{ certificateId: certificateId2 }, // Requires valid certificate
|
|
222
156
|
{ fieldName: 'field2' },
|
|
223
157
|
{ fieldValue: 'value2' },
|
|
@@ -225,90 +159,17 @@ describe('CertificateField class method tests', () => {
|
|
|
225
159
|
]
|
|
226
160
|
|
|
227
161
|
for (const mismatch of mismatchedEntities) {
|
|
228
|
-
const mismatchedEntity = new
|
|
162
|
+
const mismatchedEntity = new EntityCertificateField({
|
|
229
163
|
...initialData,
|
|
230
164
|
...mismatch
|
|
231
165
|
})
|
|
232
166
|
expect(entity1.equals(mismatchedEntity.toApi())).toBe(false)
|
|
233
167
|
|
|
234
168
|
// Test with SyncMap, where certificateId is resolved
|
|
235
|
-
const syncMap
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
[certificateId2]: certificateId2
|
|
240
|
-
},
|
|
241
|
-
entityName: 'Certificate',
|
|
242
|
-
maxUpdated_at: undefined,
|
|
243
|
-
count: 0
|
|
244
|
-
},
|
|
245
|
-
outputBasket: {
|
|
246
|
-
idMap: {},
|
|
247
|
-
entityName: 'OutputBasket',
|
|
248
|
-
maxUpdated_at: undefined,
|
|
249
|
-
count: 0
|
|
250
|
-
},
|
|
251
|
-
transaction: {
|
|
252
|
-
idMap: {},
|
|
253
|
-
entityName: 'Transaction',
|
|
254
|
-
maxUpdated_at: undefined,
|
|
255
|
-
count: 0
|
|
256
|
-
},
|
|
257
|
-
output: {
|
|
258
|
-
idMap: {},
|
|
259
|
-
entityName: 'Output',
|
|
260
|
-
maxUpdated_at: undefined,
|
|
261
|
-
count: 0
|
|
262
|
-
},
|
|
263
|
-
provenTx: {
|
|
264
|
-
idMap: {},
|
|
265
|
-
entityName: 'ProvenTx',
|
|
266
|
-
maxUpdated_at: undefined,
|
|
267
|
-
count: 0
|
|
268
|
-
},
|
|
269
|
-
outputTag: {
|
|
270
|
-
idMap: {},
|
|
271
|
-
entityName: 'OutputTag',
|
|
272
|
-
maxUpdated_at: undefined,
|
|
273
|
-
count: 0
|
|
274
|
-
},
|
|
275
|
-
provenTxReq: {
|
|
276
|
-
idMap: {},
|
|
277
|
-
entityName: 'ProvenTxReq',
|
|
278
|
-
maxUpdated_at: undefined,
|
|
279
|
-
count: 0
|
|
280
|
-
},
|
|
281
|
-
txLabel: {
|
|
282
|
-
idMap: {},
|
|
283
|
-
entityName: 'TxLabel',
|
|
284
|
-
maxUpdated_at: undefined,
|
|
285
|
-
count: 0
|
|
286
|
-
},
|
|
287
|
-
txLabelMap: {
|
|
288
|
-
idMap: {},
|
|
289
|
-
entityName: 'TxLabelMap',
|
|
290
|
-
maxUpdated_at: undefined,
|
|
291
|
-
count: 0
|
|
292
|
-
},
|
|
293
|
-
outputTagMap: {
|
|
294
|
-
idMap: {},
|
|
295
|
-
entityName: 'OutputTagMap',
|
|
296
|
-
maxUpdated_at: undefined,
|
|
297
|
-
count: 0
|
|
298
|
-
},
|
|
299
|
-
certificateField: {
|
|
300
|
-
idMap: {},
|
|
301
|
-
entityName: 'CertificateField',
|
|
302
|
-
maxUpdated_at: undefined,
|
|
303
|
-
count: 0
|
|
304
|
-
},
|
|
305
|
-
commission: {
|
|
306
|
-
idMap: {},
|
|
307
|
-
entityName: 'Commission',
|
|
308
|
-
maxUpdated_at: undefined,
|
|
309
|
-
count: 0
|
|
310
|
-
}
|
|
311
|
-
}
|
|
169
|
+
const syncMap = createSyncMap()
|
|
170
|
+
syncMap.certificate.idMap[certificateId1] = certificateId1
|
|
171
|
+
syncMap.certificate.idMap[certificateId2] = certificateId2
|
|
172
|
+
|
|
312
173
|
expect(entity1.equals(mismatchedEntity.toApi(), syncMap)).toBe(false)
|
|
313
174
|
}
|
|
314
175
|
}
|
|
@@ -338,7 +199,7 @@ describe('CertificateField class method tests', () => {
|
|
|
338
199
|
})
|
|
339
200
|
|
|
340
201
|
// Insert the initial CertificateField record
|
|
341
|
-
const initialData:
|
|
202
|
+
const initialData: TableCertificateField = {
|
|
342
203
|
certificateId,
|
|
343
204
|
created_at: now,
|
|
344
205
|
updated_at: now,
|
|
@@ -350,95 +211,25 @@ describe('CertificateField class method tests', () => {
|
|
|
350
211
|
await activeStorage.insertCertificateField(initialData)
|
|
351
212
|
|
|
352
213
|
// Create a CertificateField entity from the initial data
|
|
353
|
-
const entity = new
|
|
214
|
+
const entity = new EntityCertificateField(initialData)
|
|
354
215
|
|
|
355
216
|
// Simulate the `ei` argument with a later `updated_at`
|
|
356
|
-
const updatedData:
|
|
217
|
+
const updatedData: TableCertificateField = {
|
|
357
218
|
...initialData,
|
|
358
219
|
updated_at: new Date(now.getTime() + 1000), // Later timestamp
|
|
359
220
|
fieldValue: 'updatedValue',
|
|
360
221
|
masterKey: 'updatedMasterKey'
|
|
361
222
|
}
|
|
362
223
|
|
|
224
|
+
const syncMap = createSyncMap()
|
|
225
|
+
syncMap.certificate.idMap[certificateId] = certificateId
|
|
226
|
+
|
|
363
227
|
// Call mergeExisting
|
|
364
228
|
const wasMergedRaw = await entity.mergeExisting(
|
|
365
229
|
activeStorage,
|
|
366
230
|
undefined, // `since` is not used in this method
|
|
367
231
|
updatedData,
|
|
368
|
-
|
|
369
|
-
certificate: {
|
|
370
|
-
idMap: { [certificateId]: certificateId },
|
|
371
|
-
entityName: 'Certificate',
|
|
372
|
-
maxUpdated_at: undefined,
|
|
373
|
-
count: 0
|
|
374
|
-
},
|
|
375
|
-
outputBasket: {
|
|
376
|
-
idMap: {},
|
|
377
|
-
entityName: 'OutputBasket',
|
|
378
|
-
maxUpdated_at: undefined,
|
|
379
|
-
count: 0
|
|
380
|
-
},
|
|
381
|
-
transaction: {
|
|
382
|
-
idMap: {},
|
|
383
|
-
entityName: 'Transaction',
|
|
384
|
-
maxUpdated_at: undefined,
|
|
385
|
-
count: 0
|
|
386
|
-
},
|
|
387
|
-
output: {
|
|
388
|
-
idMap: {},
|
|
389
|
-
entityName: 'Output',
|
|
390
|
-
maxUpdated_at: undefined,
|
|
391
|
-
count: 0
|
|
392
|
-
},
|
|
393
|
-
provenTx: {
|
|
394
|
-
idMap: {},
|
|
395
|
-
entityName: 'ProvenTx',
|
|
396
|
-
maxUpdated_at: undefined,
|
|
397
|
-
count: 0
|
|
398
|
-
},
|
|
399
|
-
outputTag: {
|
|
400
|
-
idMap: {},
|
|
401
|
-
entityName: 'OutputTag',
|
|
402
|
-
maxUpdated_at: undefined,
|
|
403
|
-
count: 0
|
|
404
|
-
},
|
|
405
|
-
provenTxReq: {
|
|
406
|
-
idMap: {},
|
|
407
|
-
entityName: 'ProvenTxReq',
|
|
408
|
-
maxUpdated_at: undefined,
|
|
409
|
-
count: 0
|
|
410
|
-
},
|
|
411
|
-
txLabel: {
|
|
412
|
-
idMap: {},
|
|
413
|
-
entityName: 'TxLabel',
|
|
414
|
-
maxUpdated_at: undefined,
|
|
415
|
-
count: 0
|
|
416
|
-
},
|
|
417
|
-
txLabelMap: {
|
|
418
|
-
idMap: {},
|
|
419
|
-
entityName: 'TxLabelMap',
|
|
420
|
-
maxUpdated_at: undefined,
|
|
421
|
-
count: 0
|
|
422
|
-
},
|
|
423
|
-
outputTagMap: {
|
|
424
|
-
idMap: {},
|
|
425
|
-
entityName: 'OutputTagMap',
|
|
426
|
-
maxUpdated_at: undefined,
|
|
427
|
-
count: 0
|
|
428
|
-
},
|
|
429
|
-
certificateField: {
|
|
430
|
-
idMap: {},
|
|
431
|
-
entityName: 'CertificateField',
|
|
432
|
-
maxUpdated_at: undefined,
|
|
433
|
-
count: 0
|
|
434
|
-
},
|
|
435
|
-
commission: {
|
|
436
|
-
idMap: {},
|
|
437
|
-
entityName: 'Commission',
|
|
438
|
-
maxUpdated_at: undefined,
|
|
439
|
-
count: 0
|
|
440
|
-
}
|
|
441
|
-
},
|
|
232
|
+
syncMap,
|
|
442
233
|
undefined // `trx` is not used
|
|
443
234
|
)
|
|
444
235
|
|
|
@@ -486,7 +277,7 @@ describe('CertificateField class method tests', () => {
|
|
|
486
277
|
})
|
|
487
278
|
|
|
488
279
|
// Insert the initial CertificateField record
|
|
489
|
-
const initialData:
|
|
280
|
+
const initialData: TableCertificateField = {
|
|
490
281
|
certificateId,
|
|
491
282
|
created_at: now,
|
|
492
283
|
updated_at: now,
|
|
@@ -498,95 +289,25 @@ describe('CertificateField class method tests', () => {
|
|
|
498
289
|
await activeStorage.insertCertificateField(initialData)
|
|
499
290
|
|
|
500
291
|
// Create a CertificateField entity from the initial data
|
|
501
|
-
const entity = new
|
|
292
|
+
const entity = new EntityCertificateField(initialData)
|
|
502
293
|
|
|
503
294
|
// Simulate the `ei` argument with the same `updated_at`
|
|
504
|
-
const sameUpdatedData:
|
|
295
|
+
const sameUpdatedData: TableCertificateField = {
|
|
505
296
|
...initialData,
|
|
506
297
|
updated_at: now, // Same timestamp
|
|
507
298
|
fieldValue: 'unchangedValue',
|
|
508
299
|
masterKey: 'unchangedMasterKey'
|
|
509
300
|
}
|
|
510
301
|
|
|
302
|
+
const syncMap = createSyncMap()
|
|
303
|
+
syncMap.certificate.idMap[certificateId] = certificateId
|
|
304
|
+
|
|
511
305
|
// Call mergeExisting
|
|
512
306
|
const wasMergedRaw = await entity.mergeExisting(
|
|
513
307
|
activeStorage,
|
|
514
308
|
undefined, // `since` is not used
|
|
515
309
|
sameUpdatedData,
|
|
516
|
-
|
|
517
|
-
certificate: {
|
|
518
|
-
idMap: { [certificateId]: certificateId },
|
|
519
|
-
entityName: 'Certificate',
|
|
520
|
-
maxUpdated_at: undefined,
|
|
521
|
-
count: 0
|
|
522
|
-
},
|
|
523
|
-
outputBasket: {
|
|
524
|
-
idMap: {},
|
|
525
|
-
entityName: 'OutputBasket',
|
|
526
|
-
maxUpdated_at: undefined,
|
|
527
|
-
count: 0
|
|
528
|
-
},
|
|
529
|
-
transaction: {
|
|
530
|
-
idMap: {},
|
|
531
|
-
entityName: 'Transaction',
|
|
532
|
-
maxUpdated_at: undefined,
|
|
533
|
-
count: 0
|
|
534
|
-
},
|
|
535
|
-
output: {
|
|
536
|
-
idMap: {},
|
|
537
|
-
entityName: 'Output',
|
|
538
|
-
maxUpdated_at: undefined,
|
|
539
|
-
count: 0
|
|
540
|
-
},
|
|
541
|
-
provenTx: {
|
|
542
|
-
idMap: {},
|
|
543
|
-
entityName: 'ProvenTx',
|
|
544
|
-
maxUpdated_at: undefined,
|
|
545
|
-
count: 0
|
|
546
|
-
},
|
|
547
|
-
outputTag: {
|
|
548
|
-
idMap: {},
|
|
549
|
-
entityName: 'OutputTag',
|
|
550
|
-
maxUpdated_at: undefined,
|
|
551
|
-
count: 0
|
|
552
|
-
},
|
|
553
|
-
provenTxReq: {
|
|
554
|
-
idMap: {},
|
|
555
|
-
entityName: 'ProvenTxReq',
|
|
556
|
-
maxUpdated_at: undefined,
|
|
557
|
-
count: 0
|
|
558
|
-
},
|
|
559
|
-
txLabel: {
|
|
560
|
-
idMap: {},
|
|
561
|
-
entityName: 'TxLabel',
|
|
562
|
-
maxUpdated_at: undefined,
|
|
563
|
-
count: 0
|
|
564
|
-
},
|
|
565
|
-
txLabelMap: {
|
|
566
|
-
idMap: {},
|
|
567
|
-
entityName: 'TxLabelMap',
|
|
568
|
-
maxUpdated_at: undefined,
|
|
569
|
-
count: 0
|
|
570
|
-
},
|
|
571
|
-
outputTagMap: {
|
|
572
|
-
idMap: {},
|
|
573
|
-
entityName: 'OutputTagMap',
|
|
574
|
-
maxUpdated_at: undefined,
|
|
575
|
-
count: 0
|
|
576
|
-
},
|
|
577
|
-
certificateField: {
|
|
578
|
-
idMap: {},
|
|
579
|
-
entityName: 'CertificateField',
|
|
580
|
-
maxUpdated_at: undefined,
|
|
581
|
-
count: 0
|
|
582
|
-
},
|
|
583
|
-
commission: {
|
|
584
|
-
idMap: {},
|
|
585
|
-
entityName: 'Commission',
|
|
586
|
-
maxUpdated_at: undefined,
|
|
587
|
-
count: 0
|
|
588
|
-
}
|
|
589
|
-
},
|
|
310
|
+
syncMap,
|
|
590
311
|
undefined // `trx` is not used
|
|
591
312
|
)
|
|
592
313
|
|
|
@@ -614,7 +335,7 @@ describe('CertificateField class method tests', () => {
|
|
|
614
335
|
const now = new Date()
|
|
615
336
|
|
|
616
337
|
// Initial data for the test
|
|
617
|
-
const initialData:
|
|
338
|
+
const initialData: TableCertificateField = {
|
|
618
339
|
userId: 1,
|
|
619
340
|
certificateId: 500,
|
|
620
341
|
created_at: now,
|
|
@@ -625,7 +346,7 @@ describe('CertificateField class method tests', () => {
|
|
|
625
346
|
}
|
|
626
347
|
|
|
627
348
|
// Create a CertificateField entity
|
|
628
|
-
const entity = new
|
|
349
|
+
const entity = new EntityCertificateField(initialData)
|
|
629
350
|
|
|
630
351
|
// Validate getters
|
|
631
352
|
expect(entity.userId).toBe(1)
|
|
@@ -638,7 +359,7 @@ describe('CertificateField class method tests', () => {
|
|
|
638
359
|
|
|
639
360
|
// Validate overridden properties
|
|
640
361
|
expect(() => entity.id).toThrowError('entity has no "id" value')
|
|
641
|
-
expect(entity.entityName).toBe('
|
|
362
|
+
expect(entity.entityName).toBe('certificateField')
|
|
642
363
|
expect(entity.entityTable).toBe('certificate_fields')
|
|
643
364
|
|
|
644
365
|
// Validate setters
|