@bsv/wallet-toolbox 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/client.md +3872 -1555
- package/docs/monitor.md +29 -27
- package/docs/services.md +22 -22
- package/docs/setup.md +23 -23
- package/docs/storage.md +2747 -438
- package/docs/wallet.md +3872 -1555
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +4 -4
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +2 -2
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +2 -2
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/sdk/StorageSyncReader.d.ts +30 -30
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -1
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +60 -60
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +36 -36
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/storage/StorageKnex.d.ts +61 -61
- package/out/src/storage/StorageKnex.d.ts.map +1 -1
- package/out/src/storage/StorageKnex.js +13 -4
- package/out/src/storage/StorageKnex.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +16 -15
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +8 -8
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts +21 -21
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/StorageReaderWriter.d.ts +60 -60
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
- package/out/src/storage/StorageReaderWriter.js.map +1 -1
- package/out/src/storage/StorageSyncReader.d.ts +17 -17
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
- package/out/src/storage/StorageSyncReader.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +9 -9
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +2 -2
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/index.all.d.ts +2 -2
- package/out/src/storage/index.all.d.ts.map +1 -1
- package/out/src/storage/index.all.js +3 -3
- package/out/src/storage/index.all.js.map +1 -1
- package/out/src/storage/index.client.d.ts +2 -2
- package/out/src/storage/index.client.d.ts.map +1 -1
- package/out/src/storage/index.client.js +2 -25
- package/out/src/storage/index.client.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +3 -3
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +1 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +2 -2
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
- package/out/src/storage/methods/getSyncChunk.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +1 -1
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActions.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/out/src/storage/methods/listCertificates.js.map +1 -1
- package/out/src/storage/methods/listOutputs.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +4 -4
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +2 -2
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeData.d.ts.map +1 -1
- package/out/src/storage/methods/purgeData.js.map +1 -1
- package/out/src/storage/methods/reviewStatus.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +230 -15
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +222 -7
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/schema/entities/Certificate.d.ts +9 -9
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Certificate.js +5 -5
- package/out/src/storage/schema/entities/Certificate.js.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.d.ts +9 -9
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/CertificateField.js +5 -5
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/Commission.d.ts +9 -9
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Commission.js +5 -5
- package/out/src/storage/schema/entities/Commission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts +6 -7
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/entities/Output.d.ts +9 -9
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Output.js +5 -5
- package/out/src/storage/schema/entities/Output.js.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputBasket.js +5 -5
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTag.js +5 -5
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +9 -9
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/OutputTagMap.js +5 -5
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.d.ts +11 -11
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTx.js +11 -11
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +19 -19
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/ProvenTxReq.js +13 -13
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/SyncState.d.ts +11 -11
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/SyncState.js +27 -27
- package/out/src/storage/schema/entities/SyncState.js.map +1 -1
- package/out/src/storage/schema/entities/Transaction.d.ts +11 -11
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/Transaction.js +6 -6
- package/out/src/storage/schema/entities/Transaction.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabel.js +5 -5
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +9 -9
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/TxLabelMap.js +5 -5
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/User.d.ts +9 -9
- package/out/src/storage/schema/entities/User.d.ts.map +1 -1
- package/out/src/storage/schema/entities/User.js +5 -5
- package/out/src/storage/schema/entities/User.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +20 -307
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +17 -158
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +23 -309
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +19 -306
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +23 -237
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +20 -233
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +27 -98
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +25 -241
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +38 -112
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +39 -323
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +31 -169
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +16 -159
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -1
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +21 -168
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -1
- package/out/src/storage/schema/tables/Certificate.d.ts +4 -4
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts +1 -1
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts +1 -1
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +1 -1
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -1
- package/out/src/storage/schema/tables/Output.d.ts +5 -5
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +1 -1
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts +1 -1
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +2 -2
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts +1 -1
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -1
- package/out/src/storage/schema/tables/{Settings.d.ts → TableSettings.d.ts} +2 -2
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/{Settings.js → TableSettings.js} +1 -1
- package/out/src/storage/schema/tables/TableSettings.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +1 -1
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/User.d.ts +1 -1
- package/out/src/storage/schema/tables/User.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.d.ts +1 -1
- package/out/src/storage/schema/tables/index.d.ts.map +1 -1
- package/out/src/storage/schema/tables/index.js +1 -1
- package/out/src/storage/schema/tables/index.js.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +17 -17
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -1
- package/out/src/storage/sync/StorageMySQLDojoReader.js +2 -2
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -1
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js +1 -1
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -1
- package/out/test/monitor/Monitor.test.js +7 -7
- package/out/test/monitor/Monitor.test.js.map +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +1 -1
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -1
- package/out/test/storage/insert.test.js.map +1 -1
- package/out/test/storage/update.test.js.map +1 -1
- package/out/test/storage/update2.test.js.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.d.ts +56 -56
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -1
- package/out/test/utils/TestUtilsWalletStorage.js +11 -4
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -1
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/monitor/tasks/TaskCheckForProofs.ts +11 -10
- package/src/monitor/tasks/TaskSendWaiting.ts +5 -5
- package/src/sdk/StorageSyncReader.ts +48 -30
- package/src/sdk/StorageSyncReaderWriter.ts +77 -63
- package/src/sdk/WalletStorage.interfaces.ts +55 -36
- package/src/signer/methods/acquireDirectCertificate.ts +2 -2
- package/src/storage/StorageKnex.ts +137 -106
- package/src/storage/StorageProvider.ts +43 -30
- package/src/storage/StorageReader.ts +37 -21
- package/src/storage/StorageReaderWriter.ts +78 -65
- package/src/storage/StorageSyncReader.ts +35 -17
- package/src/storage/WalletStorageManager.ts +18 -12
- package/src/storage/index.all.ts +2 -2
- package/src/storage/index.client.ts +2 -2
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +3 -3
- package/src/storage/methods/createAction.ts +29 -26
- package/src/storage/methods/getBeefForTransaction.ts +3 -3
- package/src/storage/methods/getSyncChunk.ts +28 -13
- package/src/storage/methods/internalizeAction.ts +19 -17
- package/src/storage/methods/listActions.ts +5 -5
- package/src/storage/methods/listCertificates.ts +2 -2
- package/src/storage/methods/listOutputs.ts +5 -5
- package/src/storage/methods/processAction.ts +21 -17
- package/src/storage/methods/purgeData.ts +17 -11
- package/src/storage/methods/reviewStatus.ts +4 -4
- package/src/storage/remoting/StorageClient.ts +250 -26
- package/src/storage/schema/entities/Certificate.ts +16 -17
- package/src/storage/schema/entities/CertificateField.ts +17 -18
- package/src/storage/schema/entities/Commission.ts +16 -20
- package/src/storage/schema/entities/EntityBase.ts +1 -1
- package/src/storage/schema/entities/MergeEntity.ts +7 -7
- package/src/storage/schema/entities/Output.ts +16 -20
- package/src/storage/schema/entities/OutputBasket.ts +16 -17
- package/src/storage/schema/entities/OutputTag.ts +16 -20
- package/src/storage/schema/entities/OutputTagMap.ts +17 -18
- package/src/storage/schema/entities/ProvenTx.ts +24 -28
- package/src/storage/schema/entities/ProvenTxReq.ts +42 -45
- package/src/storage/schema/entities/SyncState.ts +61 -38
- package/src/storage/schema/entities/Transaction.ts +23 -23
- package/src/storage/schema/entities/TxLabel.ts +16 -17
- package/src/storage/schema/entities/TxLabelMap.ts +16 -20
- package/src/storage/schema/entities/User.ts +15 -19
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +39 -318
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +29 -169
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +47 -325
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +35 -316
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +38 -318
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +36 -249
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +30 -244
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +35 -101
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +27 -243
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +54 -122
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +53 -333
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +44 -177
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +19 -163
- package/src/storage/schema/entities/__tests/usersTests.test.ts +31 -179
- package/src/storage/schema/tables/Certificate.ts +4 -4
- package/src/storage/schema/tables/CertificateField.ts +1 -1
- package/src/storage/schema/tables/Commission.ts +1 -1
- package/src/storage/schema/tables/MonitorEvent.ts +1 -1
- package/src/storage/schema/tables/Output.ts +5 -5
- package/src/storage/schema/tables/OutputBasket.ts +1 -1
- package/src/storage/schema/tables/OutputTag.ts +1 -1
- package/src/storage/schema/tables/OutputTagMap.ts +1 -1
- package/src/storage/schema/tables/ProvenTx.ts +1 -1
- package/src/storage/schema/tables/ProvenTxReq.ts +2 -2
- package/src/storage/schema/tables/SyncState.ts +1 -1
- package/src/storage/schema/tables/{Settings.ts → TableSettings.ts} +3 -1
- package/src/storage/schema/tables/Transaction.ts +1 -1
- package/src/storage/schema/tables/TxLabel.ts +1 -1
- package/src/storage/schema/tables/TxLabelMap.ts +1 -1
- package/src/storage/schema/tables/User.ts +1 -1
- package/src/storage/schema/tables/index.ts +1 -1
- package/src/storage/sync/StorageMySQLDojoReader.ts +68 -50
- package/test/Wallet/certificate/listCertificates.test.ts +12 -8
- package/test/Wallet/live/walletLive.man.test.ts +6 -6
- package/test/monitor/Monitor.test.ts +8 -8
- package/test/storage/StorageMySQLDojoReader.man.test.ts +1 -1
- package/test/storage/insert.test.ts +2 -2
- package/test/storage/update.test.ts +30 -30
- package/test/storage/update2.test.ts +23 -24
- package/test/utils/TestUtilsWalletStorage.ts +103 -82
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +1 -2
- package/ts2md.json +1 -1
- package/out/src/storage/index.db.d.ts +0 -1
- package/out/src/storage/index.db.d.ts.map +0 -1
- package/out/src/storage/index.db.js +0 -2
- package/out/src/storage/index.db.js.map +0 -1
- package/out/src/storage/schema/tables/Settings.d.ts.map +0 -1
- package/out/src/storage/schema/tables/Settings.js.map +0 -1
- package/src/storage/index.db.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EntityUser } from '../../../../../src/storage/schema/entities/User'
|
|
2
|
+
import { createSyncMap, sdk, SyncMap, TableUser } from '../../../../../src'
|
|
3
3
|
import {
|
|
4
4
|
TestUtilsWalletStorage as _tu,
|
|
5
5
|
TestWalletNoSetup
|
|
@@ -34,7 +34,7 @@ describe('User class method tests', () => {
|
|
|
34
34
|
|
|
35
35
|
// Test: Default constructor behavior
|
|
36
36
|
test('1_creates_user_with_default_values', () => {
|
|
37
|
-
const user = new
|
|
37
|
+
const user = new EntityUser()
|
|
38
38
|
|
|
39
39
|
// Default values
|
|
40
40
|
expect(user.userId).toBe(0)
|
|
@@ -47,13 +47,13 @@ describe('User class method tests', () => {
|
|
|
47
47
|
// Test: Constructor with provided API object
|
|
48
48
|
test('2_creates_user_with_provided_api_object', () => {
|
|
49
49
|
const now = new Date()
|
|
50
|
-
const apiObject:
|
|
50
|
+
const apiObject: TableUser = {
|
|
51
51
|
userId: 42,
|
|
52
52
|
created_at: now,
|
|
53
53
|
updated_at: now,
|
|
54
54
|
identityKey: 'testIdentityKey'
|
|
55
55
|
}
|
|
56
|
-
const user = new
|
|
56
|
+
const user = new EntityUser(apiObject)
|
|
57
57
|
|
|
58
58
|
// Verify all properties match the API object
|
|
59
59
|
expect(user.userId).toBe(42)
|
|
@@ -64,7 +64,7 @@ describe('User class method tests', () => {
|
|
|
64
64
|
|
|
65
65
|
// Test: Getters and setters behavior
|
|
66
66
|
test('3_getters_and_setters_work_correctly', () => {
|
|
67
|
-
const user = new
|
|
67
|
+
const user = new EntityUser()
|
|
68
68
|
|
|
69
69
|
// Test setting values
|
|
70
70
|
const now = new Date()
|
|
@@ -87,7 +87,7 @@ describe('User class method tests', () => {
|
|
|
87
87
|
for (const ctx1 of ctxs) {
|
|
88
88
|
for (const ctx2 of ctxs2) {
|
|
89
89
|
// Insert the first user into the first database
|
|
90
|
-
const user1 = new
|
|
90
|
+
const user1 = new EntityUser({
|
|
91
91
|
userId: 2,
|
|
92
92
|
identityKey: 'key1',
|
|
93
93
|
created_at: new Date('2023-01-01'),
|
|
@@ -96,7 +96,7 @@ describe('User class method tests', () => {
|
|
|
96
96
|
await ctx1.activeStorage.insertUser(user1.toApi())
|
|
97
97
|
|
|
98
98
|
// Insert a matching user into the second database
|
|
99
|
-
const user2 = new
|
|
99
|
+
const user2 = new EntityUser({
|
|
100
100
|
userId: 3, // Different ID
|
|
101
101
|
identityKey: 'key1', // Same key
|
|
102
102
|
created_at: new Date('2023-01-01'),
|
|
@@ -104,81 +104,7 @@ describe('User class method tests', () => {
|
|
|
104
104
|
})
|
|
105
105
|
await ctx2.activeStorage.insertUser(user2.toApi())
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
const syncMap: entity.SyncMap = {
|
|
109
|
-
transaction: {
|
|
110
|
-
idMap: { [user1.userId]: user2.userId },
|
|
111
|
-
entityName: 'Transaction',
|
|
112
|
-
maxUpdated_at: undefined,
|
|
113
|
-
count: 1
|
|
114
|
-
},
|
|
115
|
-
provenTx: {
|
|
116
|
-
idMap: {},
|
|
117
|
-
entityName: 'ProvenTx',
|
|
118
|
-
maxUpdated_at: undefined,
|
|
119
|
-
count: 0
|
|
120
|
-
},
|
|
121
|
-
outputBasket: {
|
|
122
|
-
idMap: {},
|
|
123
|
-
entityName: 'OutputBasket',
|
|
124
|
-
maxUpdated_at: undefined,
|
|
125
|
-
count: 0
|
|
126
|
-
},
|
|
127
|
-
provenTxReq: {
|
|
128
|
-
idMap: {},
|
|
129
|
-
entityName: 'ProvenTxReq',
|
|
130
|
-
maxUpdated_at: undefined,
|
|
131
|
-
count: 0
|
|
132
|
-
},
|
|
133
|
-
txLabel: {
|
|
134
|
-
idMap: {},
|
|
135
|
-
entityName: 'TxLabel',
|
|
136
|
-
maxUpdated_at: undefined,
|
|
137
|
-
count: 0
|
|
138
|
-
},
|
|
139
|
-
txLabelMap: {
|
|
140
|
-
idMap: {},
|
|
141
|
-
entityName: 'TxLabelMap',
|
|
142
|
-
maxUpdated_at: undefined,
|
|
143
|
-
count: 0
|
|
144
|
-
},
|
|
145
|
-
output: {
|
|
146
|
-
idMap: {},
|
|
147
|
-
entityName: 'Output',
|
|
148
|
-
maxUpdated_at: undefined,
|
|
149
|
-
count: 0
|
|
150
|
-
},
|
|
151
|
-
outputTag: {
|
|
152
|
-
idMap: {},
|
|
153
|
-
entityName: 'OutputTag',
|
|
154
|
-
maxUpdated_at: undefined,
|
|
155
|
-
count: 0
|
|
156
|
-
},
|
|
157
|
-
outputTagMap: {
|
|
158
|
-
idMap: {},
|
|
159
|
-
entityName: 'OutputTagMap',
|
|
160
|
-
maxUpdated_at: undefined,
|
|
161
|
-
count: 0
|
|
162
|
-
},
|
|
163
|
-
certificate: {
|
|
164
|
-
idMap: {},
|
|
165
|
-
entityName: 'Certificate',
|
|
166
|
-
maxUpdated_at: undefined,
|
|
167
|
-
count: 0
|
|
168
|
-
},
|
|
169
|
-
certificateField: {
|
|
170
|
-
idMap: {},
|
|
171
|
-
entityName: 'CertificateField',
|
|
172
|
-
maxUpdated_at: undefined,
|
|
173
|
-
count: 0
|
|
174
|
-
},
|
|
175
|
-
commission: {
|
|
176
|
-
idMap: {},
|
|
177
|
-
entityName: 'Commission',
|
|
178
|
-
maxUpdated_at: undefined,
|
|
179
|
-
count: 0
|
|
180
|
-
}
|
|
181
|
-
}
|
|
107
|
+
const syncMap = createSyncMap()
|
|
182
108
|
|
|
183
109
|
// Verify the entities match across databases
|
|
184
110
|
expect(user1.equals(user2.toApi(), syncMap)).toBe(true) // Should match
|
|
@@ -191,7 +117,7 @@ describe('User class method tests', () => {
|
|
|
191
117
|
for (const ctx1 of ctxs) {
|
|
192
118
|
for (const ctx2 of ctxs2) {
|
|
193
119
|
// Insert the first user into the first database
|
|
194
|
-
const user1 = new
|
|
120
|
+
const user1 = new EntityUser({
|
|
195
121
|
userId: 4,
|
|
196
122
|
identityKey: 'key2',
|
|
197
123
|
created_at: new Date('2023-01-01'),
|
|
@@ -200,7 +126,7 @@ describe('User class method tests', () => {
|
|
|
200
126
|
await ctx1.activeStorage.insertUser(user1.toApi())
|
|
201
127
|
|
|
202
128
|
// Insert a user with a different key into the second database
|
|
203
|
-
const user2 = new
|
|
129
|
+
const user2 = new EntityUser({
|
|
204
130
|
userId: 5, // Different ID
|
|
205
131
|
identityKey: 'key3', // Different key
|
|
206
132
|
created_at: new Date('2023-01-01'),
|
|
@@ -208,81 +134,7 @@ describe('User class method tests', () => {
|
|
|
208
134
|
})
|
|
209
135
|
await ctx2.activeStorage.insertUser(user2.toApi())
|
|
210
136
|
|
|
211
|
-
|
|
212
|
-
const syncMap: entity.SyncMap = {
|
|
213
|
-
transaction: {
|
|
214
|
-
idMap: { [user1.userId]: user2.userId },
|
|
215
|
-
entityName: 'Transaction',
|
|
216
|
-
maxUpdated_at: undefined,
|
|
217
|
-
count: 1
|
|
218
|
-
},
|
|
219
|
-
provenTx: {
|
|
220
|
-
idMap: {},
|
|
221
|
-
entityName: 'ProvenTx',
|
|
222
|
-
maxUpdated_at: undefined,
|
|
223
|
-
count: 0
|
|
224
|
-
},
|
|
225
|
-
outputBasket: {
|
|
226
|
-
idMap: {},
|
|
227
|
-
entityName: 'OutputBasket',
|
|
228
|
-
maxUpdated_at: undefined,
|
|
229
|
-
count: 0
|
|
230
|
-
},
|
|
231
|
-
provenTxReq: {
|
|
232
|
-
idMap: {},
|
|
233
|
-
entityName: 'ProvenTxReq',
|
|
234
|
-
maxUpdated_at: undefined,
|
|
235
|
-
count: 0
|
|
236
|
-
},
|
|
237
|
-
txLabel: {
|
|
238
|
-
idMap: {},
|
|
239
|
-
entityName: 'TxLabel',
|
|
240
|
-
maxUpdated_at: undefined,
|
|
241
|
-
count: 0
|
|
242
|
-
},
|
|
243
|
-
txLabelMap: {
|
|
244
|
-
idMap: {},
|
|
245
|
-
entityName: 'TxLabelMap',
|
|
246
|
-
maxUpdated_at: undefined,
|
|
247
|
-
count: 0
|
|
248
|
-
},
|
|
249
|
-
output: {
|
|
250
|
-
idMap: {},
|
|
251
|
-
entityName: 'Output',
|
|
252
|
-
maxUpdated_at: undefined,
|
|
253
|
-
count: 0
|
|
254
|
-
},
|
|
255
|
-
outputTag: {
|
|
256
|
-
idMap: {},
|
|
257
|
-
entityName: 'OutputTag',
|
|
258
|
-
maxUpdated_at: undefined,
|
|
259
|
-
count: 0
|
|
260
|
-
},
|
|
261
|
-
outputTagMap: {
|
|
262
|
-
idMap: {},
|
|
263
|
-
entityName: 'OutputTagMap',
|
|
264
|
-
maxUpdated_at: undefined,
|
|
265
|
-
count: 0
|
|
266
|
-
},
|
|
267
|
-
certificate: {
|
|
268
|
-
idMap: {},
|
|
269
|
-
entityName: 'Certificate',
|
|
270
|
-
maxUpdated_at: undefined,
|
|
271
|
-
count: 0
|
|
272
|
-
},
|
|
273
|
-
certificateField: {
|
|
274
|
-
idMap: {},
|
|
275
|
-
entityName: 'CertificateField',
|
|
276
|
-
maxUpdated_at: undefined,
|
|
277
|
-
count: 0
|
|
278
|
-
},
|
|
279
|
-
commission: {
|
|
280
|
-
idMap: {},
|
|
281
|
-
entityName: 'Commission',
|
|
282
|
-
maxUpdated_at: undefined,
|
|
283
|
-
count: 0
|
|
284
|
-
}
|
|
285
|
-
}
|
|
137
|
+
const syncMap = createSyncMap()
|
|
286
138
|
|
|
287
139
|
// Verify the entities do not match across databases
|
|
288
140
|
expect(user1.equals(user2.toApi(), syncMap)).toBe(false) // Should not match
|
|
@@ -296,12 +148,12 @@ describe('User class method tests', () => {
|
|
|
296
148
|
const pastDate = new Date(now.getTime() - 1000000)
|
|
297
149
|
|
|
298
150
|
// Provide incomplete API object
|
|
299
|
-
const partialApiObject: Partial<
|
|
151
|
+
const partialApiObject: Partial<TableUser> = {
|
|
300
152
|
userId: 123,
|
|
301
153
|
created_at: pastDate
|
|
302
154
|
}
|
|
303
155
|
|
|
304
|
-
const user = new
|
|
156
|
+
const user = new EntityUser(partialApiObject as TableUser)
|
|
305
157
|
|
|
306
158
|
// Default values should fill in missing fields
|
|
307
159
|
expect(user.userId).toBe(123)
|
|
@@ -316,13 +168,13 @@ describe('User class method tests', () => {
|
|
|
316
168
|
const largeUserId = Number.MAX_SAFE_INTEGER
|
|
317
169
|
const longIdentityKey = 'x'.repeat(1000)
|
|
318
170
|
|
|
319
|
-
const apiObject:
|
|
171
|
+
const apiObject: TableUser = {
|
|
320
172
|
userId: largeUserId,
|
|
321
173
|
created_at: now,
|
|
322
174
|
updated_at: now,
|
|
323
175
|
identityKey: longIdentityKey
|
|
324
176
|
}
|
|
325
|
-
const user = new
|
|
177
|
+
const user = new EntityUser(apiObject)
|
|
326
178
|
|
|
327
179
|
expect(user.userId).toBe(largeUserId)
|
|
328
180
|
expect(user.identityKey).toBe(longIdentityKey)
|
|
@@ -330,8 +182,8 @@ describe('User class method tests', () => {
|
|
|
330
182
|
|
|
331
183
|
// Test: Handles empty API object
|
|
332
184
|
test('10_handles_empty_api_object', () => {
|
|
333
|
-
const emptyApiObject:
|
|
334
|
-
const user = new
|
|
185
|
+
const emptyApiObject: TableUser = {} as TableUser
|
|
186
|
+
const user = new EntityUser(emptyApiObject)
|
|
335
187
|
|
|
336
188
|
// Default values should be applied but constructor does not set default values for empty object
|
|
337
189
|
expect(user.userId).toBeUndefined()
|
|
@@ -342,7 +194,7 @@ describe('User class method tests', () => {
|
|
|
342
194
|
|
|
343
195
|
// Test: `id` getter and setter
|
|
344
196
|
test('11_id_getter_and_setter_work_correctly', () => {
|
|
345
|
-
const user = new
|
|
197
|
+
const user = new EntityUser()
|
|
346
198
|
|
|
347
199
|
user.id = 123 // Test setter
|
|
348
200
|
expect(user.id).toBe(123) // Test getter
|
|
@@ -350,21 +202,21 @@ describe('User class method tests', () => {
|
|
|
350
202
|
|
|
351
203
|
// Test: `entityName` getter
|
|
352
204
|
test('12_entityName_returns_User', () => {
|
|
353
|
-
const user = new
|
|
205
|
+
const user = new EntityUser()
|
|
354
206
|
|
|
355
|
-
expect(user.entityName).toBe('
|
|
207
|
+
expect(user.entityName).toBe('user')
|
|
356
208
|
})
|
|
357
209
|
|
|
358
210
|
// Test: `entityTable` getter
|
|
359
211
|
test('13_entityTable_returns_users', () => {
|
|
360
|
-
const user = new
|
|
212
|
+
const user = new EntityUser()
|
|
361
213
|
|
|
362
214
|
expect(user.entityTable).toBe('users')
|
|
363
215
|
})
|
|
364
216
|
|
|
365
217
|
// Test: `mergeExisting` updates user when `ei.updated_at` is newer
|
|
366
218
|
test('14_mergeExisting_updates_user_when_ei_updated_at_is_newer', async () => {
|
|
367
|
-
const user = new
|
|
219
|
+
const user = new EntityUser({
|
|
368
220
|
userId: 1,
|
|
369
221
|
created_at: new Date('2023-01-01'),
|
|
370
222
|
updated_at: new Date('2023-01-01'),
|
|
@@ -372,7 +224,7 @@ describe('User class method tests', () => {
|
|
|
372
224
|
activeStorage: 'oldStorage'
|
|
373
225
|
})
|
|
374
226
|
|
|
375
|
-
const updatedEi:
|
|
227
|
+
const updatedEi: TableUser = {
|
|
376
228
|
userId: 1,
|
|
377
229
|
created_at: new Date('2023-01-01'),
|
|
378
230
|
updated_at: new Date('2023-02-01'), // Newer `updated_at`
|
|
@@ -382,7 +234,7 @@ describe('User class method tests', () => {
|
|
|
382
234
|
|
|
383
235
|
const result = await user.mergeExisting(
|
|
384
236
|
{
|
|
385
|
-
updateUser: async (id: number, data:
|
|
237
|
+
updateUser: async (id: number, data: TableUser) => {
|
|
386
238
|
expect(id).toBe(1)
|
|
387
239
|
expect(data.activeStorage).toBe('newStorage')
|
|
388
240
|
expect(data.updated_at).toBeInstanceOf(Date)
|
|
@@ -399,7 +251,7 @@ describe('User class method tests', () => {
|
|
|
399
251
|
|
|
400
252
|
// Test: `mergeExisting` does not update user when `ei.updated_at` is older
|
|
401
253
|
test('15_mergeExisting_does_not_update_user_when_ei_updated_at_is_older', async () => {
|
|
402
|
-
const user = new
|
|
254
|
+
const user = new EntityUser({
|
|
403
255
|
userId: 1,
|
|
404
256
|
created_at: new Date('2023-01-01'),
|
|
405
257
|
updated_at: new Date('2023-02-01'),
|
|
@@ -407,7 +259,7 @@ describe('User class method tests', () => {
|
|
|
407
259
|
activeStorage: 'oldStorage'
|
|
408
260
|
})
|
|
409
261
|
|
|
410
|
-
const olderEi:
|
|
262
|
+
const olderEi: TableUser = {
|
|
411
263
|
userId: 1,
|
|
412
264
|
created_at: new Date('2023-01-01'),
|
|
413
265
|
updated_at: new Date('2023-01-01'), // Older `updated_at`
|
|
@@ -432,7 +284,7 @@ describe('User class method tests', () => {
|
|
|
432
284
|
|
|
433
285
|
// Test: `mergeExisting` updates user and uses `trx` when provided
|
|
434
286
|
test('16_mergeExisting_updates_user_with_trx', async () => {
|
|
435
|
-
const user = new
|
|
287
|
+
const user = new EntityUser({
|
|
436
288
|
userId: 1,
|
|
437
289
|
created_at: new Date('2023-01-01'),
|
|
438
290
|
updated_at: new Date('2023-01-01'),
|
|
@@ -440,7 +292,7 @@ describe('User class method tests', () => {
|
|
|
440
292
|
activeStorage: 'oldStorage'
|
|
441
293
|
})
|
|
442
294
|
|
|
443
|
-
const updatedEi:
|
|
295
|
+
const updatedEi: TableUser = {
|
|
444
296
|
userId: 1,
|
|
445
297
|
created_at: new Date('2023-01-01'),
|
|
446
298
|
updated_at: new Date('2023-02-01'), // Newer `updated_at`
|
|
@@ -452,7 +304,7 @@ describe('User class method tests', () => {
|
|
|
452
304
|
|
|
453
305
|
const result = await user.mergeExisting(
|
|
454
306
|
{
|
|
455
|
-
updateUser: async (id: number, data:
|
|
307
|
+
updateUser: async (id: number, data: TableUser, trx: any) => {
|
|
456
308
|
expect(id).toBe(1)
|
|
457
309
|
expect(data.activeStorage).toBe('newStorage')
|
|
458
310
|
expect(data.updated_at).toBeInstanceOf(Date)
|
|
@@ -471,7 +323,7 @@ describe('User class method tests', () => {
|
|
|
471
323
|
|
|
472
324
|
// Test: `mergeNew` always throws an error
|
|
473
325
|
test('17_mergeNew_always_throws_error', async () => {
|
|
474
|
-
const user = new
|
|
326
|
+
const user = new EntityUser()
|
|
475
327
|
const storage = {} // Placeholder for `storage`, not used in this case.
|
|
476
328
|
const userId = 123 // Example userId
|
|
477
329
|
const syncMap = {} // Placeholder for `syncMap`, not used in this case.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Base64String, HexString, OutpointString, PubKeyHex } from '@bsv/sdk'
|
|
2
|
-
import { sdk,
|
|
2
|
+
import { sdk, TableCertificateField } from '../../../index.client'
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface TableCertificate extends sdk.EntityTimeStamp {
|
|
5
5
|
created_at: Date
|
|
6
6
|
updated_at: Date
|
|
7
7
|
certificateId: number
|
|
@@ -16,6 +16,6 @@ export interface Certificate extends sdk.EntityTimeStamp {
|
|
|
16
16
|
isDeleted: boolean
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export interface
|
|
20
|
-
fields?:
|
|
19
|
+
export interface TableCertificateX extends TableCertificate {
|
|
20
|
+
fields?: TableCertificateField[]
|
|
21
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Base64String } from '@bsv/sdk'
|
|
2
2
|
import { sdk } from '../../../index.client'
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface TableCertificateField extends sdk.EntityTimeStamp {
|
|
5
5
|
created_at: Date
|
|
6
6
|
updated_at: Date
|
|
7
7
|
userId: number
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Base64String, DescriptionString5to50Bytes, PubKeyHex } from '@bsv/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import { TableOutputBasket, TableOutputTag } from '.'
|
|
3
3
|
import { sdk } from '../../../index.client'
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface TableOutput extends sdk.EntityTimeStamp {
|
|
6
6
|
created_at: Date
|
|
7
7
|
updated_at: Date
|
|
8
8
|
outputId: number
|
|
@@ -30,9 +30,9 @@ export interface Output extends sdk.EntityTimeStamp {
|
|
|
30
30
|
lockingScript?: number[]
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export interface
|
|
34
|
-
basket?:
|
|
35
|
-
tags?:
|
|
33
|
+
export interface TableOutputX extends TableOutput {
|
|
34
|
+
basket?: TableOutputBasket
|
|
35
|
+
tags?: TableOutputTag[]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export const outputColumnsWithoutLockingScript = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sdk } from '../../../index.client'
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface TableProvenTxReq extends TableProvenTxReqDynamics {
|
|
4
4
|
created_at: Date
|
|
5
5
|
updated_at: Date
|
|
6
6
|
provenTxReqId: number
|
|
@@ -36,7 +36,7 @@ export interface ProvenTxReq extends ProvenTxReqDynamics {
|
|
|
36
36
|
/**
|
|
37
37
|
* Table properties that may change after initial record insertion.
|
|
38
38
|
*/
|
|
39
|
-
export interface
|
|
39
|
+
export interface TableProvenTxReqDynamics extends sdk.EntityTimeStamp {
|
|
40
40
|
updated_at: Date
|
|
41
41
|
provenTxId?: number
|
|
42
42
|
status: sdk.ProvenTxReqStatus
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Base64String } from '@bsv/sdk'
|
|
2
2
|
import { sdk } from '../../../index.client'
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface TableTransaction extends sdk.EntityTimeStamp {
|
|
5
5
|
created_at: Date
|
|
6
6
|
updated_at: Date
|
|
7
7
|
transactionId: number
|