@bsv/wallet-toolbox-client 2.4.4 → 2.4.20
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/LICENSE.txt +58 -0
- package/README.md +43 -22
- package/out/index.client.cjs +33583 -0
- package/out/index.client.cjs.map +1 -0
- package/out/index.client.d.cts +10768 -0
- package/out/index.client.d.cts.map +1 -0
- package/out/index.client.d.mts +10767 -0
- package/out/index.client.d.mts.map +1 -0
- package/out/index.client.mjs +33377 -0
- package/out/index.client.mjs.map +1 -0
- package/out/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +56 -9
- package/out/src/CWIStyleWalletManager.d.ts +0 -564
- package/out/src/CWIStyleWalletManager.d.ts.map +0 -1
- package/out/src/CWIStyleWalletManager.js +0 -1966
- package/out/src/CWIStyleWalletManager.js.map +0 -1
- package/out/src/SetupClient.d.ts +0 -135
- package/out/src/SetupClient.d.ts.map +0 -1
- package/out/src/SetupClient.js +0 -226
- package/out/src/SetupClient.js.map +0 -1
- package/out/src/SetupWallet.d.ts +0 -103
- package/out/src/SetupWallet.d.ts.map +0 -1
- package/out/src/SetupWallet.js +0 -3
- package/out/src/SetupWallet.js.map +0 -1
- package/out/src/SimpleWalletManager.d.ts +0 -179
- package/out/src/SimpleWalletManager.d.ts.map +0 -1
- package/out/src/SimpleWalletManager.js +0 -360
- package/out/src/SimpleWalletManager.js.map +0 -1
- package/out/src/Wallet.d.ts +0 -262
- package/out/src/Wallet.d.ts.map +0 -1
- package/out/src/Wallet.js +0 -923
- package/out/src/Wallet.js.map +0 -1
- package/out/src/WalletAuthenticationManager.d.ts +0 -47
- package/out/src/WalletAuthenticationManager.d.ts.map +0 -1
- package/out/src/WalletAuthenticationManager.js +0 -306
- package/out/src/WalletAuthenticationManager.js.map +0 -1
- package/out/src/WalletLogger.d.ts +0 -65
- package/out/src/WalletLogger.d.ts.map +0 -1
- package/out/src/WalletLogger.js +0 -177
- package/out/src/WalletLogger.js.map +0 -1
- package/out/src/WalletPermissionsManager.d.ts +0 -981
- package/out/src/WalletPermissionsManager.d.ts.map +0 -1
- package/out/src/WalletPermissionsManager.js +0 -3744
- package/out/src/WalletPermissionsManager.js.map +0 -1
- package/out/src/WalletSettingsManager.d.ts +0 -53
- package/out/src/WalletSettingsManager.d.ts.map +0 -1
- package/out/src/WalletSettingsManager.js +0 -86
- package/out/src/WalletSettingsManager.js.map +0 -1
- package/out/src/fundWalletP2PKH.d.ts +0 -48
- package/out/src/fundWalletP2PKH.d.ts.map +0 -1
- package/out/src/fundWalletP2PKH.js +0 -239
- package/out/src/fundWalletP2PKH.js.map +0 -1
- package/out/src/index.client.d.ts +0 -25
- package/out/src/index.client.d.ts.map +0 -1
- package/out/src/index.client.js +0 -64
- package/out/src/index.client.js.map +0 -1
- package/out/src/mockchain/MockChainMigrations.d.ts +0 -20
- package/out/src/mockchain/MockChainMigrations.d.ts.map +0 -1
- package/out/src/mockchain/MockChainMigrations.js +0 -67
- package/out/src/mockchain/MockChainMigrations.js.map +0 -1
- package/out/src/mockchain/MockChainStorage.d.ts +0 -58
- package/out/src/mockchain/MockChainStorage.d.ts.map +0 -1
- package/out/src/mockchain/MockChainStorage.js +0 -102
- package/out/src/mockchain/MockChainStorage.js.map +0 -1
- package/out/src/mockchain/MockChainTracker.d.ts +0 -28
- package/out/src/mockchain/MockChainTracker.d.ts.map +0 -1
- package/out/src/mockchain/MockChainTracker.js +0 -97
- package/out/src/mockchain/MockChainTracker.js.map +0 -1
- package/out/src/mockchain/MockMiner.d.ts +0 -16
- package/out/src/mockchain/MockMiner.d.ts.map +0 -1
- package/out/src/mockchain/MockMiner.js +0 -137
- package/out/src/mockchain/MockMiner.js.map +0 -1
- package/out/src/mockchain/MockServices.d.ts +0 -53
- package/out/src/mockchain/MockServices.d.ts.map +0 -1
- package/out/src/mockchain/MockServices.js +0 -459
- package/out/src/mockchain/MockServices.js.map +0 -1
- package/out/src/mockchain/merkleTree.d.ts +0 -13
- package/out/src/mockchain/merkleTree.d.ts.map +0 -1
- package/out/src/mockchain/merkleTree.js +0 -122
- package/out/src/mockchain/merkleTree.js.map +0 -1
- package/out/src/monitor/Monitor.d.ts +0 -189
- package/out/src/monitor/Monitor.d.ts.map +0 -1
- package/out/src/monitor/Monitor.js +0 -387
- package/out/src/monitor/Monitor.js.map +0 -1
- package/out/src/monitor/tasks/TaskArcSSE.d.ts +0 -29
- package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskArcSSE.js +0 -259
- package/out/src/monitor/tasks/TaskArcSSE.js.map +0 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +0 -53
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +0 -224
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +0 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +0 -91
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js +0 -159
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +0 -1
- package/out/src/monitor/tasks/TaskCleanupActionBatches.d.ts +0 -13
- package/out/src/monitor/tasks/TaskCleanupActionBatches.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskCleanupActionBatches.js +0 -24
- package/out/src/monitor/tasks/TaskCleanupActionBatches.js.map +0 -1
- package/out/src/monitor/tasks/TaskClock.d.ts +0 -14
- package/out/src/monitor/tasks/TaskClock.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskClock.js +0 -29
- package/out/src/monitor/tasks/TaskClock.js.map +0 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +0 -20
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.js +0 -53
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +0 -1
- package/out/src/monitor/tasks/TaskMineBlock.d.ts +0 -13
- package/out/src/monitor/tasks/TaskMineBlock.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskMineBlock.js +0 -30
- package/out/src/monitor/tasks/TaskMineBlock.js.map +0 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +0 -12
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js +0 -25
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +0 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +0 -50
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskNewHeader.js +0 -97
- package/out/src/monitor/tasks/TaskNewHeader.js.map +0 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts +0 -45
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskPurge.js +0 -36
- package/out/src/monitor/tasks/TaskPurge.js.map +0 -1
- package/out/src/monitor/tasks/TaskReorg.d.ts +0 -43
- package/out/src/monitor/tasks/TaskReorg.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskReorg.js +0 -84
- package/out/src/monitor/tasks/TaskReorg.js.map +0 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts +0 -26
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js +0 -127
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js.map +0 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts +0 -34
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js +0 -136
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js.map +0 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +0 -26
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js +0 -50
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +0 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts +0 -23
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.js +0 -75
- package/out/src/monitor/tasks/TaskReviewUtxos.js.map +0 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +0 -48
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +0 -202
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +0 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts +0 -41
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +0 -1
- package/out/src/monitor/tasks/TaskUnFail.js +0 -89
- package/out/src/monitor/tasks/TaskUnFail.js.map +0 -1
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts +0 -40
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +0 -1
- package/out/src/monitor/tasks/WalletMonitorTask.js +0 -42
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +0 -1
- package/out/src/sdk/ActionBatch.interfaces.d.ts +0 -105
- package/out/src/sdk/ActionBatch.interfaces.d.ts.map +0 -1
- package/out/src/sdk/ActionBatch.interfaces.js +0 -3
- package/out/src/sdk/ActionBatch.interfaces.js.map +0 -1
- package/out/src/sdk/CertOpsWallet.d.ts +0 -7
- package/out/src/sdk/CertOpsWallet.d.ts.map +0 -1
- package/out/src/sdk/CertOpsWallet.js +0 -3
- package/out/src/sdk/CertOpsWallet.js.map +0 -1
- package/out/src/sdk/PrivilegedKeyManager.d.ts +0 -125
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +0 -1
- package/out/src/sdk/PrivilegedKeyManager.js +0 -320
- package/out/src/sdk/PrivilegedKeyManager.js.map +0 -1
- package/out/src/sdk/WERR_errors.d.ts +0 -136
- package/out/src/sdk/WERR_errors.d.ts.map +0 -1
- package/out/src/sdk/WERR_errors.js +0 -233
- package/out/src/sdk/WERR_errors.js.map +0 -1
- package/out/src/sdk/WalletError.d.ts +0 -63
- package/out/src/sdk/WalletError.d.ts.map +0 -1
- package/out/src/sdk/WalletError.js +0 -177
- package/out/src/sdk/WalletError.js.map +0 -1
- package/out/src/sdk/WalletErrorFromJson.d.ts +0 -12
- package/out/src/sdk/WalletErrorFromJson.d.ts.map +0 -1
- package/out/src/sdk/WalletErrorFromJson.js +0 -67
- package/out/src/sdk/WalletErrorFromJson.js.map +0 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +0 -643
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +0 -1
- package/out/src/sdk/WalletServices.interfaces.js +0 -3
- package/out/src/sdk/WalletServices.interfaces.js.map +0 -1
- package/out/src/sdk/WalletSigner.interfaces.d.ts +0 -10
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +0 -1
- package/out/src/sdk/WalletSigner.interfaces.js +0 -3
- package/out/src/sdk/WalletSigner.interfaces.js.map +0 -1
- package/out/src/sdk/WalletStorage.interfaces.d.ts +0 -556
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +0 -1
- package/out/src/sdk/WalletStorage.interfaces.js +0 -3
- package/out/src/sdk/WalletStorage.interfaces.js.map +0 -1
- package/out/src/sdk/index.d.ts +0 -12
- package/out/src/sdk/index.d.ts.map +0 -1
- package/out/src/sdk/index.js +0 -30
- package/out/src/sdk/index.js.map +0 -1
- package/out/src/sdk/types.d.ts +0 -178
- package/out/src/sdk/types.d.ts.map +0 -1
- package/out/src/sdk/types.js +0 -104
- package/out/src/sdk/types.js.map +0 -1
- package/out/src/services/ServiceCollection.d.ts +0 -79
- package/out/src/services/ServiceCollection.d.ts.map +0 -1
- package/out/src/services/ServiceCollection.js +0 -197
- package/out/src/services/ServiceCollection.js.map +0 -1
- package/out/src/services/Services.d.ts +0 -97
- package/out/src/services/Services.d.ts.map +0 -1
- package/out/src/services/Services.js +0 -729
- package/out/src/services/Services.js.map +0 -1
- package/out/src/services/chaintracker/BHServiceClient.d.ts +0 -39
- package/out/src/services/chaintracker/BHServiceClient.d.ts.map +0 -1
- package/out/src/services/chaintracker/BHServiceClient.js +0 -180
- package/out/src/services/chaintracker/BHServiceClient.js.map +0 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +0 -16
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +0 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +0 -59
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +0 -57
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js +0 -38
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts +0 -70
- package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts +0 -81
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.d.ts +0 -54
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.d.ts +0 -163
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts +0 -18
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.d.ts +0 -55
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.d.ts +0 -338
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.d.ts +0 -19
- package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.js +0 -3
- package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +0 -113
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js +0 -607
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +0 -38
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +0 -149
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/GoChaintracksServiceClient.d.ts +0 -52
- package/out/src/services/chaintracker/chaintracks/GoChaintracksServiceClient.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/GoChaintracksServiceClient.js +0 -232
- package/out/src/services/chaintracker/chaintracks/GoChaintracksServiceClient.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts +0 -60
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +0 -126
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +0 -75
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +0 -121
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts +0 -13
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js +0 -20
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts +0 -62
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +0 -61
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts +0 -62
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +0 -44
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorChaintracksSSE.d.ts +0 -24
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorChaintracksSSE.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorChaintracksSSE.js +0 -55
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorChaintracksSSE.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts +0 -64
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js +0 -95
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +0 -171
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +0 -487
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +0 -89
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +0 -142
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts +0 -23
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +0 -63
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts +0 -68
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js +0 -311
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts +0 -92
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +0 -467
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +0 -37
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +0 -261
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts +0 -22
- package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.js +0 -54
- package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts +0 -5
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js +0 -29
- package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts +0 -5
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js +0 -29
- package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts +0 -13
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js +0 -27
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts +0 -13
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js +0 -27
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/index.client.d.ts +0 -4
- package/out/src/services/chaintracker/chaintracks/index.client.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/index.client.js +0 -20
- package/out/src/services/chaintracker/chaintracks/index.client.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/index.mobile.d.ts +0 -32
- package/out/src/services/chaintracker/chaintracks/index.mobile.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/index.mobile.js +0 -70
- package/out/src/services/chaintracker/chaintracks/index.mobile.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +0 -142
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +0 -821
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts +0 -22
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js +0 -65
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts +0 -78
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js +0 -284
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +0 -129
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +0 -168
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -21
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js +0 -108
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts +0 -90
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +0 -150
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +0 -14
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js +0 -86
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +0 -159
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +0 -530
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts +0 -20
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js +0 -31
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts +0 -37
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +0 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +0 -429
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +0 -1
- package/out/src/services/chaintracker/index.client.d.ts +0 -4
- package/out/src/services/chaintracker/index.client.d.ts.map +0 -1
- package/out/src/services/chaintracker/index.client.js +0 -20
- package/out/src/services/chaintracker/index.client.js.map +0 -1
- package/out/src/services/createDefaultWalletServicesOptions.d.ts +0 -25
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +0 -1
- package/out/src/services/createDefaultWalletServicesOptions.js +0 -143
- package/out/src/services/createDefaultWalletServicesOptions.js.map +0 -1
- package/out/src/services/networkConfig.d.ts +0 -29
- package/out/src/services/networkConfig.d.ts.map +0 -1
- package/out/src/services/networkConfig.js +0 -54
- package/out/src/services/networkConfig.js.map +0 -1
- package/out/src/services/providers/ARC.d.ts +0 -96
- package/out/src/services/providers/ARC.d.ts.map +0 -1
- package/out/src/services/providers/ARC.js +0 -332
- package/out/src/services/providers/ARC.js.map +0 -1
- package/out/src/services/providers/ArcSSEClient.d.ts +0 -58
- package/out/src/services/providers/ArcSSEClient.d.ts.map +0 -1
- package/out/src/services/providers/ArcSSEClient.js +0 -115
- package/out/src/services/providers/ArcSSEClient.js.map +0 -1
- package/out/src/services/providers/Arcade.d.ts +0 -73
- package/out/src/services/providers/Arcade.d.ts.map +0 -1
- package/out/src/services/providers/Arcade.js +0 -330
- package/out/src/services/providers/Arcade.js.map +0 -1
- package/out/src/services/providers/Bitails.d.ts +0 -50
- package/out/src/services/providers/Bitails.d.ts.map +0 -1
- package/out/src/services/providers/Bitails.js +0 -237
- package/out/src/services/providers/Bitails.js.map +0 -1
- package/out/src/services/providers/SdkWhatsOnChain.d.ts +0 -21
- package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +0 -1
- package/out/src/services/providers/SdkWhatsOnChain.js +0 -82
- package/out/src/services/providers/SdkWhatsOnChain.js.map +0 -1
- package/out/src/services/providers/WhatsOnChain.d.ts +0 -132
- package/out/src/services/providers/WhatsOnChain.d.ts.map +0 -1
- package/out/src/services/providers/WhatsOnChain.js +0 -558
- package/out/src/services/providers/WhatsOnChain.js.map +0 -1
- package/out/src/services/providers/exchangeRates.d.ts +0 -12
- package/out/src/services/providers/exchangeRates.d.ts.map +0 -1
- package/out/src/services/providers/exchangeRates.js +0 -244
- package/out/src/services/providers/exchangeRates.js.map +0 -1
- package/out/src/services/providers/getBeefForTxid.d.ts +0 -4
- package/out/src/services/providers/getBeefForTxid.d.ts.map +0 -1
- package/out/src/services/providers/getBeefForTxid.js +0 -287
- package/out/src/services/providers/getBeefForTxid.js.map +0 -1
- package/out/src/services/providers/whatsOnChainHelpers.d.ts +0 -68
- package/out/src/services/providers/whatsOnChainHelpers.d.ts.map +0 -1
- package/out/src/services/providers/whatsOnChainHelpers.js +0 -147
- package/out/src/services/providers/whatsOnChainHelpers.js.map +0 -1
- package/out/src/signer/WalletSigner.d.ts +0 -11
- package/out/src/signer/WalletSigner.d.ts.map +0 -1
- package/out/src/signer/WalletSigner.js +0 -16
- package/out/src/signer/WalletSigner.js.map +0 -1
- package/out/src/signer/actionBatch/ActionBatchPlanner.d.ts +0 -28
- package/out/src/signer/actionBatch/ActionBatchPlanner.d.ts.map +0 -1
- package/out/src/signer/actionBatch/ActionBatchPlanner.js +0 -313
- package/out/src/signer/actionBatch/ActionBatchPlanner.js.map +0 -1
- package/out/src/signer/actionBatch/ActionBatchWorkspace.d.ts +0 -33
- package/out/src/signer/actionBatch/ActionBatchWorkspace.d.ts.map +0 -1
- package/out/src/signer/actionBatch/ActionBatchWorkspace.js +0 -693
- package/out/src/signer/actionBatch/ActionBatchWorkspace.js.map +0 -1
- package/out/src/signer/methods/acquireDirectCertificate.d.ts +0 -5
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +0 -1
- package/out/src/signer/methods/acquireDirectCertificate.js +0 -44
- package/out/src/signer/methods/acquireDirectCertificate.js.map +0 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts +0 -69
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +0 -1
- package/out/src/signer/methods/buildSignableTransaction.js +0 -268
- package/out/src/signer/methods/buildSignableTransaction.js.map +0 -1
- package/out/src/signer/methods/completeSignedTransaction.d.ts +0 -10
- package/out/src/signer/methods/completeSignedTransaction.d.ts.map +0 -1
- package/out/src/signer/methods/completeSignedTransaction.js +0 -106
- package/out/src/signer/methods/completeSignedTransaction.js.map +0 -1
- package/out/src/signer/methods/createAction.d.ts +0 -14
- package/out/src/signer/methods/createAction.d.ts.map +0 -1
- package/out/src/signer/methods/createAction.js +0 -126
- package/out/src/signer/methods/createAction.js.map +0 -1
- package/out/src/signer/methods/internalizeAction.d.ts +0 -43
- package/out/src/signer/methods/internalizeAction.d.ts.map +0 -1
- package/out/src/signer/methods/internalizeAction.js +0 -109
- package/out/src/signer/methods/internalizeAction.js.map +0 -1
- package/out/src/signer/methods/proveCertificate.d.ts +0 -5
- package/out/src/signer/methods/proveCertificate.d.ts.map +0 -1
- package/out/src/signer/methods/proveCertificate.js +0 -29
- package/out/src/signer/methods/proveCertificate.js.map +0 -1
- package/out/src/signer/methods/resultBeef.d.ts +0 -4
- package/out/src/signer/methods/resultBeef.d.ts.map +0 -1
- package/out/src/signer/methods/resultBeef.js +0 -12
- package/out/src/signer/methods/resultBeef.js.map +0 -1
- package/out/src/signer/methods/signAction.d.ts +0 -11
- package/out/src/signer/methods/signAction.d.ts.map +0 -1
- package/out/src/signer/methods/signAction.js +0 -43
- package/out/src/signer/methods/signAction.js.map +0 -1
- package/out/src/storage/StorageIdb.d.ts +0 -248
- package/out/src/storage/StorageIdb.d.ts.map +0 -1
- package/out/src/storage/StorageIdb.js +0 -1827
- package/out/src/storage/StorageIdb.js.map +0 -1
- package/out/src/storage/StorageProvider.d.ts +0 -309
- package/out/src/storage/StorageProvider.d.ts.map +0 -1
- package/out/src/storage/StorageProvider.js +0 -973
- package/out/src/storage/StorageProvider.js.map +0 -1
- package/out/src/storage/StorageReader.d.ts +0 -77
- package/out/src/storage/StorageReader.d.ts.map +0 -1
- package/out/src/storage/StorageReader.js +0 -166
- package/out/src/storage/StorageReader.js.map +0 -1
- package/out/src/storage/StorageReaderWriter.d.ts +0 -102
- package/out/src/storage/StorageReaderWriter.d.ts.map +0 -1
- package/out/src/storage/StorageReaderWriter.js +0 -335
- package/out/src/storage/StorageReaderWriter.js.map +0 -1
- package/out/src/storage/StorageSyncReader.d.ts +0 -18
- package/out/src/storage/StorageSyncReader.d.ts.map +0 -1
- package/out/src/storage/StorageSyncReader.js +0 -73
- package/out/src/storage/StorageSyncReader.js.map +0 -1
- package/out/src/storage/WalletStorageManager.d.ts +0 -225
- package/out/src/storage/WalletStorageManager.d.ts.map +0 -1
- package/out/src/storage/WalletStorageManager.js +0 -854
- package/out/src/storage/WalletStorageManager.js.map +0 -1
- package/out/src/storage/idbHelpers.d.ts +0 -44
- package/out/src/storage/idbHelpers.d.ts.map +0 -1
- package/out/src/storage/idbHelpers.js +0 -393
- package/out/src/storage/idbHelpers.js.map +0 -1
- package/out/src/storage/index.client.d.ts +0 -12
- package/out/src/storage/index.client.d.ts.map +0 -1
- package/out/src/storage/index.client.js +0 -28
- package/out/src/storage/index.client.js.map +0 -1
- package/out/src/storage/methods/ListActionsSpecOp.d.ts +0 -23
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +0 -1
- package/out/src/storage/methods/ListActionsSpecOp.js +0 -129
- package/out/src/storage/methods/ListActionsSpecOp.js.map +0 -1
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts +0 -42
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +0 -1
- package/out/src/storage/methods/ListOutputsSpecOp.js +0 -154
- package/out/src/storage/methods/ListOutputsSpecOp.js.map +0 -1
- package/out/src/storage/methods/actionBatch.d.ts +0 -14
- package/out/src/storage/methods/actionBatch.d.ts.map +0 -1
- package/out/src/storage/methods/actionBatch.js +0 -644
- package/out/src/storage/methods/actionBatch.js.map +0 -1
- package/out/src/storage/methods/actionBatchBlobs.d.ts +0 -12
- package/out/src/storage/methods/actionBatchBlobs.d.ts.map +0 -1
- package/out/src/storage/methods/actionBatchBlobs.js +0 -121
- package/out/src/storage/methods/actionBatchBlobs.js.map +0 -1
- package/out/src/storage/methods/actionBatchValidation.d.ts +0 -15
- package/out/src/storage/methods/actionBatchValidation.d.ts.map +0 -1
- package/out/src/storage/methods/actionBatchValidation.js +0 -310
- package/out/src/storage/methods/actionBatchValidation.js.map +0 -1
- package/out/src/storage/methods/actionPlanning.d.ts +0 -12
- package/out/src/storage/methods/actionPlanning.d.ts.map +0 -1
- package/out/src/storage/methods/actionPlanning.js +0 -48
- package/out/src/storage/methods/actionPlanning.js.map +0 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +0 -124
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +0 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +0 -490
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +0 -1
- package/out/src/storage/methods/createAction.d.ts +0 -13
- package/out/src/storage/methods/createAction.d.ts.map +0 -1
- package/out/src/storage/methods/createAction.js +0 -777
- package/out/src/storage/methods/createAction.js.map +0 -1
- package/out/src/storage/methods/generateChange.d.ts +0 -121
- package/out/src/storage/methods/generateChange.d.ts.map +0 -1
- package/out/src/storage/methods/generateChange.js +0 -496
- package/out/src/storage/methods/generateChange.js.map +0 -1
- package/out/src/storage/methods/getBeefForTransaction.d.ts +0 -23
- package/out/src/storage/methods/getBeefForTransaction.d.ts.map +0 -1
- package/out/src/storage/methods/getBeefForTransaction.js +0 -132
- package/out/src/storage/methods/getBeefForTransaction.js.map +0 -1
- package/out/src/storage/methods/getSyncChunk.d.ts +0 -10
- package/out/src/storage/methods/getSyncChunk.d.ts.map +0 -1
- package/out/src/storage/methods/getSyncChunk.js +0 -273
- package/out/src/storage/methods/getSyncChunk.js.map +0 -1
- package/out/src/storage/methods/internalizeAction.d.ts +0 -102
- package/out/src/storage/methods/internalizeAction.d.ts.map +0 -1
- package/out/src/storage/methods/internalizeAction.js +0 -670
- package/out/src/storage/methods/internalizeAction.js.map +0 -1
- package/out/src/storage/methods/listActionsIdb.d.ts +0 -5
- package/out/src/storage/methods/listActionsIdb.d.ts.map +0 -1
- package/out/src/storage/methods/listActionsIdb.js +0 -142
- package/out/src/storage/methods/listActionsIdb.js.map +0 -1
- package/out/src/storage/methods/listCertificates.d.ts +0 -5
- package/out/src/storage/methods/listCertificates.d.ts.map +0 -1
- package/out/src/storage/methods/listCertificates.js +0 -68
- package/out/src/storage/methods/listCertificates.js.map +0 -1
- package/out/src/storage/methods/listOutputsIdb.d.ts +0 -5
- package/out/src/storage/methods/listOutputsIdb.d.ts.map +0 -1
- package/out/src/storage/methods/listOutputsIdb.js +0 -195
- package/out/src/storage/methods/listOutputsIdb.js.map +0 -1
- package/out/src/storage/methods/managedChange.d.ts +0 -26
- package/out/src/storage/methods/managedChange.d.ts.map +0 -1
- package/out/src/storage/methods/managedChange.js +0 -43
- package/out/src/storage/methods/managedChange.js.map +0 -1
- package/out/src/storage/methods/offsetKey.d.ts +0 -24
- package/out/src/storage/methods/offsetKey.d.ts.map +0 -1
- package/out/src/storage/methods/offsetKey.js +0 -65
- package/out/src/storage/methods/offsetKey.js.map +0 -1
- package/out/src/storage/methods/processAction.d.ts +0 -43
- package/out/src/storage/methods/processAction.d.ts.map +0 -1
- package/out/src/storage/methods/processAction.js +0 -313
- package/out/src/storage/methods/processAction.js.map +0 -1
- package/out/src/storage/methods/purgeDataIdb.d.ts +0 -4
- package/out/src/storage/methods/purgeDataIdb.d.ts.map +0 -1
- package/out/src/storage/methods/purgeDataIdb.js +0 -9
- package/out/src/storage/methods/purgeDataIdb.js.map +0 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts +0 -20
- package/out/src/storage/methods/reviewStatusIdb.d.ts.map +0 -1
- package/out/src/storage/methods/reviewStatusIdb.js +0 -76
- package/out/src/storage/methods/reviewStatusIdb.js.map +0 -1
- package/out/src/storage/methods/utils.d.ts +0 -25
- package/out/src/storage/methods/utils.d.ts.map +0 -1
- package/out/src/storage/methods/utils.js +0 -59
- package/out/src/storage/methods/utils.js.map +0 -1
- package/out/src/storage/portable/index.d.ts +0 -55
- package/out/src/storage/portable/index.d.ts.map +0 -1
- package/out/src/storage/portable/index.js +0 -872
- package/out/src/storage/portable/index.js.map +0 -1
- package/out/src/storage/remoting/BinaryJson.d.ts +0 -10
- package/out/src/storage/remoting/BinaryJson.d.ts.map +0 -1
- package/out/src/storage/remoting/BinaryJson.js +0 -172
- package/out/src/storage/remoting/BinaryJson.js.map +0 -1
- package/out/src/storage/remoting/StorageClient.d.ts +0 -26
- package/out/src/storage/remoting/StorageClient.d.ts.map +0 -1
- package/out/src/storage/remoting/StorageClient.js +0 -98
- package/out/src/storage/remoting/StorageClient.js.map +0 -1
- package/out/src/storage/remoting/StorageClientBase.d.ts +0 -308
- package/out/src/storage/remoting/StorageClientBase.d.ts.map +0 -1
- package/out/src/storage/remoting/StorageClientBase.js +0 -416
- package/out/src/storage/remoting/StorageClientBase.js.map +0 -1
- package/out/src/storage/remoting/entityValidationHelpers.d.ts +0 -29
- package/out/src/storage/remoting/entityValidationHelpers.d.ts.map +0 -1
- package/out/src/storage/remoting/entityValidationHelpers.js +0 -91
- package/out/src/storage/remoting/entityValidationHelpers.js.map +0 -1
- package/out/src/storage/schema/StorageIdbSchema.d.ts +0 -157
- package/out/src/storage/schema/StorageIdbSchema.d.ts.map +0 -1
- package/out/src/storage/schema/StorageIdbSchema.js +0 -3
- package/out/src/storage/schema/StorageIdbSchema.js.map +0 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts +0 -106
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityBase.js +0 -101
- package/out/src/storage/schema/entities/EntityBase.js.map +0 -1
- package/out/src/storage/schema/entities/EntityCertificate.d.ts +0 -44
- package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityCertificate.js +0 -163
- package/out/src/storage/schema/entities/EntityCertificate.js.map +0 -1
- package/out/src/storage/schema/entities/EntityCertificateField.d.ts +0 -33
- package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityCertificateField.js +0 -110
- package/out/src/storage/schema/entities/EntityCertificateField.js.map +0 -1
- package/out/src/storage/schema/entities/EntityCommission.d.ts +0 -38
- package/out/src/storage/schema/entities/EntityCommission.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityCommission.js +0 -125
- package/out/src/storage/schema/entities/EntityCommission.js.map +0 -1
- package/out/src/storage/schema/entities/EntityOutput.d.ts +0 -68
- package/out/src/storage/schema/entities/EntityOutput.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityOutput.js +0 -261
- package/out/src/storage/schema/entities/EntityOutput.js.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.d.ts +0 -36
- package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.js +0 -133
- package/out/src/storage/schema/entities/EntityOutputBasket.js.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputTag.d.ts +0 -32
- package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputTag.js +0 -104
- package/out/src/storage/schema/entities/EntityOutputTag.js.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts +0 -29
- package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.js +0 -96
- package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +0 -1
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts +0 -87
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityProvenTx.js +0 -276
- package/out/src/storage/schema/entities/EntityProvenTx.js.map +0 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +0 -148
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.js +0 -570
- package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +0 -1
- package/out/src/storage/schema/entities/EntitySyncState.d.ts +0 -69
- package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntitySyncState.js +0 -338
- package/out/src/storage/schema/entities/EntitySyncState.js.map +0 -1
- package/out/src/storage/schema/entities/EntityTransaction.d.ts +0 -71
- package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityTransaction.js +0 -265
- package/out/src/storage/schema/entities/EntityTransaction.js.map +0 -1
- package/out/src/storage/schema/entities/EntityTxLabel.d.ts +0 -32
- package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityTxLabel.js +0 -104
- package/out/src/storage/schema/entities/EntityTxLabel.js.map +0 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts +0 -29
- package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.js +0 -96
- package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +0 -1
- package/out/src/storage/schema/entities/EntityUser.d.ts +0 -30
- package/out/src/storage/schema/entities/EntityUser.d.ts.map +0 -1
- package/out/src/storage/schema/entities/EntityUser.js +0 -99
- package/out/src/storage/schema/entities/EntityUser.js.map +0 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts +0 -34
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +0 -1
- package/out/src/storage/schema/entities/MergeEntity.js +0 -67
- package/out/src/storage/schema/entities/MergeEntity.js.map +0 -1
- package/out/src/storage/schema/entities/index.d.ts +0 -17
- package/out/src/storage/schema/entities/index.d.ts.map +0 -1
- package/out/src/storage/schema/entities/index.js +0 -33
- package/out/src/storage/schema/entities/index.js.map +0 -1
- package/out/src/storage/schema/tables/TableActionBatch.d.ts +0 -24
- package/out/src/storage/schema/tables/TableActionBatch.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableActionBatch.js +0 -3
- package/out/src/storage/schema/tables/TableActionBatch.js.map +0 -1
- package/out/src/storage/schema/tables/TableAuthSession.d.ts +0 -20
- package/out/src/storage/schema/tables/TableAuthSession.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableAuthSession.js +0 -15
- package/out/src/storage/schema/tables/TableAuthSession.js.map +0 -1
- package/out/src/storage/schema/tables/TableCertificate.d.ts +0 -21
- package/out/src/storage/schema/tables/TableCertificate.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableCertificate.js +0 -3
- package/out/src/storage/schema/tables/TableCertificate.js.map +0 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts +0 -12
- package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableCertificateField.js +0 -3
- package/out/src/storage/schema/tables/TableCertificateField.js.map +0 -1
- package/out/src/storage/schema/tables/TableCommission.d.ts +0 -13
- package/out/src/storage/schema/tables/TableCommission.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableCommission.js +0 -3
- package/out/src/storage/schema/tables/TableCommission.js.map +0 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +0 -9
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.js +0 -3
- package/out/src/storage/schema/tables/TableMonitorEvent.js.map +0 -1
- package/out/src/storage/schema/tables/TableOutput.d.ts +0 -37
- package/out/src/storage/schema/tables/TableOutput.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableOutput.js +0 -31
- package/out/src/storage/schema/tables/TableOutput.js.map +0 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts +0 -12
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableOutputBasket.js +0 -3
- package/out/src/storage/schema/tables/TableOutputBasket.js.map +0 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts +0 -10
- package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableOutputTag.js +0 -3
- package/out/src/storage/schema/tables/TableOutputTag.js.map +0 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +0 -9
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.js +0 -3
- package/out/src/storage/schema/tables/TableOutputTagMap.js.map +0 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts +0 -14
- package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableProvenTx.js +0 -3
- package/out/src/storage/schema/tables/TableProvenTx.js.map +0 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +0 -87
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.js +0 -3
- package/out/src/storage/schema/tables/TableProvenTxReq.js.map +0 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts +0 -17
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableSettings.js +0 -3
- package/out/src/storage/schema/tables/TableSettings.js.map +0 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts +0 -18
- package/out/src/storage/schema/tables/TableSyncState.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableSyncState.js +0 -3
- package/out/src/storage/schema/tables/TableSyncState.js.map +0 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts +0 -37
- package/out/src/storage/schema/tables/TableTransaction.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableTransaction.js +0 -21
- package/out/src/storage/schema/tables/TableTransaction.js.map +0 -1
- package/out/src/storage/schema/tables/TableTxLabel.d.ts +0 -10
- package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableTxLabel.js +0 -3
- package/out/src/storage/schema/tables/TableTxLabel.js.map +0 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +0 -9
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.js +0 -3
- package/out/src/storage/schema/tables/TableTxLabelMap.js.map +0 -1
- package/out/src/storage/schema/tables/TableUser.d.ts +0 -16
- package/out/src/storage/schema/tables/TableUser.d.ts.map +0 -1
- package/out/src/storage/schema/tables/TableUser.js +0 -3
- package/out/src/storage/schema/tables/TableUser.js.map +0 -1
- package/out/src/storage/schema/tables/index.d.ts +0 -19
- package/out/src/storage/schema/tables/index.d.ts.map +0 -1
- package/out/src/storage/schema/tables/index.js +0 -35
- package/out/src/storage/schema/tables/index.js.map +0 -1
- package/out/src/storage/storageProviderHelpers.d.ts +0 -35
- package/out/src/storage/storageProviderHelpers.d.ts.map +0 -1
- package/out/src/storage/storageProviderHelpers.js +0 -100
- package/out/src/storage/storageProviderHelpers.js.map +0 -1
- package/out/src/utility/ScriptTemplateBRC29.d.ts +0 -25
- package/out/src/utility/ScriptTemplateBRC29.d.ts.map +0 -1
- package/out/src/utility/ScriptTemplateBRC29.js +0 -51
- package/out/src/utility/ScriptTemplateBRC29.js.map +0 -1
- package/out/src/utility/actionBatchDigest.d.ts +0 -9
- package/out/src/utility/actionBatchDigest.d.ts.map +0 -1
- package/out/src/utility/actionBatchDigest.js +0 -48
- package/out/src/utility/actionBatchDigest.js.map +0 -1
- package/out/src/utility/aggregateResults.d.ts +0 -8
- package/out/src/utility/aggregateResults.d.ts.map +0 -1
- package/out/src/utility/aggregateResults.js +0 -59
- package/out/src/utility/aggregateResults.js.map +0 -1
- package/out/src/utility/beefForTxids.d.ts +0 -9
- package/out/src/utility/beefForTxids.d.ts.map +0 -1
- package/out/src/utility/beefForTxids.js +0 -35
- package/out/src/utility/beefForTxids.js.map +0 -1
- package/out/src/utility/brc114ActionTimeLabels.d.ts +0 -9
- package/out/src/utility/brc114ActionTimeLabels.d.ts.map +0 -1
- package/out/src/utility/brc114ActionTimeLabels.js +0 -58
- package/out/src/utility/brc114ActionTimeLabels.js.map +0 -1
- package/out/src/utility/identityUtils.d.ts +0 -37
- package/out/src/utility/identityUtils.d.ts.map +0 -1
- package/out/src/utility/identityUtils.js +0 -162
- package/out/src/utility/identityUtils.js.map +0 -1
- package/out/src/utility/index.client.d.ts +0 -8
- package/out/src/utility/index.client.d.ts.map +0 -1
- package/out/src/utility/index.client.js +0 -24
- package/out/src/utility/index.client.js.map +0 -1
- package/out/src/utility/parseTxScriptOffsets.d.ts +0 -14
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +0 -1
- package/out/src/utility/parseTxScriptOffsets.js +0 -26
- package/out/src/utility/parseTxScriptOffsets.js.map +0 -1
- package/out/src/utility/stampLog.d.ts +0 -18
- package/out/src/utility/stampLog.d.ts.map +0 -1
- package/out/src/utility/stampLog.js +0 -74
- package/out/src/utility/stampLog.js.map +0 -1
- package/out/src/utility/tscProofToMerklePath.d.ts +0 -8
- package/out/src/utility/tscProofToMerklePath.d.ts.map +0 -1
- package/out/src/utility/tscProofToMerklePath.js +0 -41
- package/out/src/utility/tscProofToMerklePath.js.map +0 -1
- package/out/src/utility/utilityHelpers.d.ts +0 -142
- package/out/src/utility/utilityHelpers.d.ts.map +0 -1
- package/out/src/utility/utilityHelpers.js +0 -319
- package/out/src/utility/utilityHelpers.js.map +0 -1
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +0 -30
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +0 -1
- package/out/src/utility/utilityHelpers.noBuffer.js +0 -64
- package/out/src/utility/utilityHelpers.noBuffer.js.map +0 -1
- package/out/src/wab-client/WABClient.d.ts +0 -60
- package/out/src/wab-client/WABClient.d.ts.map +0 -1
- package/out/src/wab-client/WABClient.js +0 -140
- package/out/src/wab-client/WABClient.js.map +0 -1
- package/out/src/wab-client/WABTransport.d.ts +0 -53
- package/out/src/wab-client/WABTransport.d.ts.map +0 -1
- package/out/src/wab-client/WABTransport.js +0 -300
- package/out/src/wab-client/WABTransport.js.map +0 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +0 -41
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +0 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +0 -44
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +0 -1
- package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts +0 -11
- package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts.map +0 -1
- package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js +0 -15
- package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js.map +0 -1
- package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +0 -5
- package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +0 -1
- package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +0 -9
- package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +0 -1
- package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +0 -11
- package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +0 -1
- package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +0 -28
- package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +0 -1
- package/out/tsconfig.client.tsbuildinfo +0 -1
|
@@ -1,1827 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StorageIdb = void 0;
|
|
4
|
-
const idb_1 = require("idb");
|
|
5
|
-
const idbHelpers_1 = require("./idbHelpers");
|
|
6
|
-
const utilityHelpers_1 = require("../utility/utilityHelpers");
|
|
7
|
-
const StorageProvider_1 = require("./StorageProvider");
|
|
8
|
-
const listActionsIdb_1 = require("./methods/listActionsIdb");
|
|
9
|
-
const listOutputsIdb_1 = require("./methods/listOutputsIdb");
|
|
10
|
-
const reviewStatusIdb_1 = require("./methods/reviewStatusIdb");
|
|
11
|
-
const purgeDataIdb_1 = require("./methods/purgeDataIdb");
|
|
12
|
-
const WERR_errors_1 = require("../sdk/WERR_errors");
|
|
13
|
-
const managedChange_1 = require("./methods/managedChange");
|
|
14
|
-
const actionPlanning_1 = require("./methods/actionPlanning");
|
|
15
|
-
/**
|
|
16
|
-
* Shared cursor-scan loop used by all `filterXxx` methods of StorageIdb.
|
|
17
|
-
*
|
|
18
|
-
* Walks `cursor` forward, applying `since`, a caller-supplied `matches`
|
|
19
|
-
* predicate, paging (offset / limit), and an async `accept` callback for
|
|
20
|
-
* records that pass all filters. Returns the number of accepted records.
|
|
21
|
-
*
|
|
22
|
-
* Implemented as a module-level helper (not a class method) so that
|
|
23
|
-
* profiling/instrumentation that wraps class-prototype methods cannot
|
|
24
|
-
* intercept or mutate its `matches` / `accept` callbacks.
|
|
25
|
-
*/
|
|
26
|
-
async function scanCursor(
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
cursor, since, offset, limit, matches, accept) {
|
|
29
|
-
let skipped = 0;
|
|
30
|
-
let count = 0;
|
|
31
|
-
for (; cursor != null; cursor = await cursor.continue()) {
|
|
32
|
-
const r = cursor.value;
|
|
33
|
-
if (since != null && since > r.updated_at)
|
|
34
|
-
continue;
|
|
35
|
-
if (!await matches(r))
|
|
36
|
-
continue;
|
|
37
|
-
if (skipped < offset) {
|
|
38
|
-
skipped++;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
accept(r);
|
|
42
|
-
count++;
|
|
43
|
-
if ((limit ?? 0) > 0 && count >= limit)
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
return count;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* This class implements the `StorageProvider` interface using IndexedDB,
|
|
50
|
-
* via the promises wrapper package `idb`.
|
|
51
|
-
*/
|
|
52
|
-
class StorageIdb extends StorageProvider_1.StorageProvider {
|
|
53
|
-
dbName;
|
|
54
|
-
db;
|
|
55
|
-
constructor(options) {
|
|
56
|
-
super(options);
|
|
57
|
-
this.dbName = `wallet-toolbox-${this.chain}net`;
|
|
58
|
-
}
|
|
59
|
-
supportsActionBatchPersistence() { return true; }
|
|
60
|
-
/**
|
|
61
|
-
* This method must be called at least once before any other method accesses the database,
|
|
62
|
-
* and each time the schema may have updated.
|
|
63
|
-
*
|
|
64
|
-
* If the database has already been created in this context, `storageName` and `storageIdentityKey`
|
|
65
|
-
* are ignored.
|
|
66
|
-
*
|
|
67
|
-
* @param storageName
|
|
68
|
-
* @param storageIdentityKey
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
async migrate(storageName, storageIdentityKey) {
|
|
72
|
-
const db = await this.verifyDB(storageName, storageIdentityKey);
|
|
73
|
-
return db.version.toString();
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Following initial database initialization, this method verfies that db is ready for use.
|
|
77
|
-
*
|
|
78
|
-
* @throws `WERR_INVALID_OPERATION` if the database has not been initialized by a call to `migrate`.
|
|
79
|
-
*
|
|
80
|
-
* @param storageName
|
|
81
|
-
* @param storageIdentityKey
|
|
82
|
-
*
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
async verifyDB(storageName, storageIdentityKey) {
|
|
86
|
-
if (this.db != null)
|
|
87
|
-
return this.db;
|
|
88
|
-
this.db = await this.initDB(storageName, storageIdentityKey);
|
|
89
|
-
this._settings = (await this.db.getAll('settings'))[0];
|
|
90
|
-
this.whenLastAccess = new Date();
|
|
91
|
-
return this.db;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Convert the standard optional `TrxToken` parameter into either a direct knex database instance,
|
|
95
|
-
* or a Knex.Transaction as appropriate.
|
|
96
|
-
*/
|
|
97
|
-
toDbTrx(stores, mode, trx) {
|
|
98
|
-
if (trx != null) {
|
|
99
|
-
const t = trx;
|
|
100
|
-
return t;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
if (this.db == null)
|
|
104
|
-
throw new Error('not initialized');
|
|
105
|
-
const db = this.db;
|
|
106
|
-
const trx = db.transaction(stores.length > 0 ? stores : this.allStores, mode);
|
|
107
|
-
this.whenLastAccess = new Date();
|
|
108
|
-
return trx;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Called by `makeAvailable` to return storage `TableSettings`.
|
|
113
|
-
* Since this is the first async method that must be called by all clients,
|
|
114
|
-
* it is where async initialization occurs.
|
|
115
|
-
*
|
|
116
|
-
* After initialization, cached settings are returned.
|
|
117
|
-
*
|
|
118
|
-
* @param trx
|
|
119
|
-
*/
|
|
120
|
-
async readSettings(trx) {
|
|
121
|
-
await this.verifyDB();
|
|
122
|
-
return this._settings;
|
|
123
|
-
}
|
|
124
|
-
async initDB(storageName, storageIdentityKey) {
|
|
125
|
-
const chain = this.chain;
|
|
126
|
-
const maxOutputScript = 1024;
|
|
127
|
-
const db = await (0, idb_1.openDB)(this.dbName, 2, {
|
|
128
|
-
upgrade(db) {
|
|
129
|
-
(0, idbHelpers_1.upgradeAllStoresV1)(db);
|
|
130
|
-
(0, idbHelpers_1.upgradeActionBatchStoresV2)(db);
|
|
131
|
-
if (!db.objectStoreNames.contains('settings')) {
|
|
132
|
-
if (storageName == null || storageName === '' || storageIdentityKey == null || storageIdentityKey === '') {
|
|
133
|
-
throw new WERR_errors_1.WERR_INVALID_OPERATION('migrate must be called before first access');
|
|
134
|
-
}
|
|
135
|
-
const settings = db.createObjectStore('settings', { keyPath: 'storageIdentityKey' });
|
|
136
|
-
const s = {
|
|
137
|
-
created_at: new Date(),
|
|
138
|
-
updated_at: new Date(),
|
|
139
|
-
storageIdentityKey,
|
|
140
|
-
storageName,
|
|
141
|
-
chain,
|
|
142
|
-
dbtype: 'IndexedDB',
|
|
143
|
-
maxOutputScript
|
|
144
|
-
};
|
|
145
|
-
void settings.put(s);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
return db;
|
|
150
|
-
}
|
|
151
|
-
//
|
|
152
|
-
// StorageProvider abstract methods
|
|
153
|
-
//
|
|
154
|
-
async reviewStatus(args) {
|
|
155
|
-
return await (0, reviewStatusIdb_1.reviewStatusIdb)(this, args);
|
|
156
|
-
}
|
|
157
|
-
async purgeData(params, trx) {
|
|
158
|
-
return await (0, purgeDataIdb_1.purgeDataIdb)(this, params, trx);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Proceeds in three stages:
|
|
162
|
-
* 1. Find an output that exactly funds the transaction (if exactSatoshis is not undefined).
|
|
163
|
-
* 2. Find an output that overfunds by the least amount (targetSatoshis).
|
|
164
|
-
* 3. Find an output that comes as close to funding as possible (targetSatoshis).
|
|
165
|
-
* 4. Return undefined if no output is found.
|
|
166
|
-
*
|
|
167
|
-
* Outputs must belong to userId and basketId and satisfy the wallet-managed
|
|
168
|
-
* BRC-29 change policy.
|
|
169
|
-
* Their corresponding transaction must have status of 'completed', 'unproven', or 'sending' (if excludeSending is false).
|
|
170
|
-
*
|
|
171
|
-
* @param userId
|
|
172
|
-
* @param basketId
|
|
173
|
-
* @param targetSatoshis
|
|
174
|
-
* @param exactSatoshis
|
|
175
|
-
* @param excludeSending
|
|
176
|
-
* @param transactionId
|
|
177
|
-
* @returns next funding output to add to transaction or undefined if there are none.
|
|
178
|
-
*/
|
|
179
|
-
async allocateChangeInput(userId, basketId, targetSatoshis, exactSatoshis, excludeSending, transactionId) {
|
|
180
|
-
const dbTrx = this.toDbTrx(['outputs', 'transactions', 'proven_txs', 'proven_tx_reqs', 'action_batch_outputs'], 'readwrite');
|
|
181
|
-
try {
|
|
182
|
-
const txStatus = ['completed', 'unproven'];
|
|
183
|
-
if (!excludeSending)
|
|
184
|
-
txStatus.push('sending');
|
|
185
|
-
const args = {
|
|
186
|
-
partial: { userId, basketId, spendable: true, ...managedChange_1.managedChangeOutputFields },
|
|
187
|
-
txStatus,
|
|
188
|
-
// Skip per-output script hydration during the candidate scan — we only need
|
|
189
|
-
// the locking script for the one we actually pick below. Matches Knex's
|
|
190
|
-
// pattern: SELECT candidates cheaply, hydrate the chosen output explicitly.
|
|
191
|
-
noScript: true,
|
|
192
|
-
trx: dbTrx
|
|
193
|
-
};
|
|
194
|
-
const reservationStore = dbTrx.objectStore('action_batch_outputs');
|
|
195
|
-
if (reservationStore.get == null)
|
|
196
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_outputs store does not support get');
|
|
197
|
-
const outputs = [];
|
|
198
|
-
for (const candidate of (await this.findOutputs(args)).filter(managedChange_1.isAutoSpendableChangeOutput)) {
|
|
199
|
-
if (await reservationStore.get(candidate.outputId) == null)
|
|
200
|
-
outputs.push(candidate);
|
|
201
|
-
}
|
|
202
|
-
const output = (0, actionPlanning_1.selectCanonicalChange)(outputs, targetSatoshis, exactSatoshis);
|
|
203
|
-
if (output != null) {
|
|
204
|
-
// mark output as spent by transactionId
|
|
205
|
-
await this.updateOutput(output.outputId, { spendable: false, spentBy: transactionId }, dbTrx);
|
|
206
|
-
// Hydrate the locking script for the chosen output. Identical to Knex canon at
|
|
207
|
-
// StorageKnex.allocateChangeInput: required when the script was offloaded into
|
|
208
|
-
// rawTx storage due to exceeding maxOutputScript.
|
|
209
|
-
await this.validateOutputScript(output, dbTrx);
|
|
210
|
-
}
|
|
211
|
-
return output;
|
|
212
|
-
}
|
|
213
|
-
finally {
|
|
214
|
-
await dbTrx.done;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
async getProvenOrRawTx(txid, trx) {
|
|
218
|
-
const r = {
|
|
219
|
-
proven: undefined,
|
|
220
|
-
rawTx: undefined,
|
|
221
|
-
inputBEEF: undefined
|
|
222
|
-
};
|
|
223
|
-
r.proven = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxs({ partial: { txid }, trx }));
|
|
224
|
-
if (r.proven == null) {
|
|
225
|
-
const req = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxReqs({ partial: { txid }, trx }));
|
|
226
|
-
if ((req != null) && ['unsent', 'unmined', 'unconfirmed', 'sending', 'nosend', 'completed'].includes(req.status)) {
|
|
227
|
-
r.rawTx = req.rawTx;
|
|
228
|
-
r.inputBEEF = req.inputBEEF;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return r;
|
|
232
|
-
}
|
|
233
|
-
async getRawTxOfKnownValidTransaction(txid, offset, length, trx) {
|
|
234
|
-
if (txid == null || txid === '')
|
|
235
|
-
return undefined;
|
|
236
|
-
if (!this.isAvailable())
|
|
237
|
-
await this.makeAvailable();
|
|
238
|
-
const sliceRequested = offset !== undefined && length !== undefined && Number.isInteger(offset) && Number.isInteger(length);
|
|
239
|
-
// Slice path uses an extended status set that includes 'unfail' — matches Knex
|
|
240
|
-
// canon at StorageKnex.ts:131. The non-slice path continues to delegate to
|
|
241
|
-
// getProvenOrRawTx which uses the narrower set.
|
|
242
|
-
const rawTx = sliceRequested
|
|
243
|
-
? await this.getRawTxForSlice(txid, trx)
|
|
244
|
-
: await this.getRawTxFull(txid, trx);
|
|
245
|
-
if (rawTx != null && sliceRequested) {
|
|
246
|
-
return rawTx.slice(offset, offset + length);
|
|
247
|
-
}
|
|
248
|
-
return rawTx;
|
|
249
|
-
}
|
|
250
|
-
async getRawTxForSlice(txid, trx) {
|
|
251
|
-
const proven = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxs({ partial: { txid }, trx }));
|
|
252
|
-
if (proven != null)
|
|
253
|
-
return proven.rawTx;
|
|
254
|
-
const req = (0, utilityHelpers_1.verifyOneOrNone)(await this.findProvenTxReqs({ partial: { txid }, trx }));
|
|
255
|
-
const validStatuses = ['unsent', 'nosend', 'sending', 'unmined', 'completed', 'unfail'];
|
|
256
|
-
if (req != null && validStatuses.includes(req.status))
|
|
257
|
-
return req.rawTx;
|
|
258
|
-
return undefined;
|
|
259
|
-
}
|
|
260
|
-
async getRawTxFull(txid, trx) {
|
|
261
|
-
const r = await this.getProvenOrRawTx(txid, trx);
|
|
262
|
-
return r.proven != null ? r.proven.rawTx : r.rawTx;
|
|
263
|
-
}
|
|
264
|
-
async getLabelsForTransactionId(transactionId, trx) {
|
|
265
|
-
const maps = await this.findTxLabelMaps({ partial: { transactionId, isDeleted: false }, trx });
|
|
266
|
-
const labelIds = maps.map(m => m.txLabelId);
|
|
267
|
-
const labels = [];
|
|
268
|
-
for (const txLabelId of labelIds) {
|
|
269
|
-
// verifyOneOrNone: a map row may reference a label that was later soft-deleted.
|
|
270
|
-
// Knex/Bun drop it via JOIN; we must do the same silently or we'd break the whole
|
|
271
|
-
// listActions response. Skip + log so persistent orphans still produce a signal.
|
|
272
|
-
const label = (0, utilityHelpers_1.verifyOneOrNone)(await this.findTxLabels({ partial: { txLabelId, isDeleted: false }, trx }));
|
|
273
|
-
if (label != null) {
|
|
274
|
-
labels.push(label);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
console.debug(`[StorageIdb] orphan tx_labels_map row skipped: transactionId=${String(transactionId)} txLabelId=${txLabelId}`);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return labels;
|
|
281
|
-
}
|
|
282
|
-
async getTagsForOutputId(outputId, trx) {
|
|
283
|
-
const maps = await this.findOutputTagMaps({ partial: { outputId, isDeleted: false }, trx });
|
|
284
|
-
const tagIds = maps.map(m => m.outputTagId);
|
|
285
|
-
const tags = [];
|
|
286
|
-
for (const outputTagId of tagIds) {
|
|
287
|
-
const tag = (0, utilityHelpers_1.verifyOneOrNone)(await this.findOutputTags({ partial: { outputTagId, isDeleted: false }, trx }));
|
|
288
|
-
if (tag != null) {
|
|
289
|
-
tags.push(tag);
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
console.debug(`[StorageIdb] orphan output_tags_map row skipped: outputId=${outputId} outputTagId=${outputTagId}`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return tags;
|
|
296
|
-
}
|
|
297
|
-
async listActions(auth, vargs) {
|
|
298
|
-
if (auth.userId == null)
|
|
299
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
300
|
-
return await (0, listActionsIdb_1.listActionsIdb)(this, auth, vargs);
|
|
301
|
-
}
|
|
302
|
-
async listOutputs(auth, vargs) {
|
|
303
|
-
if (auth.userId == null)
|
|
304
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
305
|
-
return await (0, listOutputsIdb_1.listOutputsIdb)(this, auth, vargs);
|
|
306
|
-
}
|
|
307
|
-
async countChangeInputs(userId, basketId, excludeSending) {
|
|
308
|
-
const txStatus = ['completed', 'unproven'];
|
|
309
|
-
if (!excludeSending)
|
|
310
|
-
txStatus.push('sending');
|
|
311
|
-
const args = {
|
|
312
|
-
partial: { userId, basketId, spendable: true, ...managedChange_1.managedChangeOutputFields },
|
|
313
|
-
txStatus,
|
|
314
|
-
noScript: true
|
|
315
|
-
};
|
|
316
|
-
let count = 0;
|
|
317
|
-
await this.filterOutputs(args, r => {
|
|
318
|
-
if ((0, managedChange_1.isAutoSpendableChangeOutput)(r))
|
|
319
|
-
count++;
|
|
320
|
-
});
|
|
321
|
-
return count;
|
|
322
|
-
}
|
|
323
|
-
async findCertificatesAuth(auth, args) {
|
|
324
|
-
if (auth.userId == null || (args.partial.userId != null && args.partial.userId !== 0 && args.partial.userId !== auth.userId))
|
|
325
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
326
|
-
args.partial.userId = auth.userId;
|
|
327
|
-
return await this.findCertificates(args);
|
|
328
|
-
}
|
|
329
|
-
async findOutputBasketsAuth(auth, args) {
|
|
330
|
-
if (auth.userId == null || (args.partial.userId != null && args.partial.userId !== 0 && args.partial.userId !== auth.userId))
|
|
331
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
332
|
-
args.partial.userId = auth.userId;
|
|
333
|
-
return await this.findOutputBaskets(args);
|
|
334
|
-
}
|
|
335
|
-
async findOutputsAuth(auth, args) {
|
|
336
|
-
if (auth.userId == null || (args.partial.userId != null && args.partial.userId !== 0 && args.partial.userId !== auth.userId))
|
|
337
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
338
|
-
args.partial.userId = auth.userId;
|
|
339
|
-
return await this.findOutputs(args);
|
|
340
|
-
}
|
|
341
|
-
async insertCertificateAuth(auth, certificate) {
|
|
342
|
-
if (auth.userId == null || (certificate.userId != null && certificate.userId !== 0 && certificate.userId !== auth.userId))
|
|
343
|
-
throw new WERR_errors_1.WERR_UNAUTHORIZED();
|
|
344
|
-
certificate.userId = auth.userId;
|
|
345
|
-
return await this.insertCertificate(certificate);
|
|
346
|
-
}
|
|
347
|
-
//
|
|
348
|
-
// StorageReaderWriter abstract methods
|
|
349
|
-
//
|
|
350
|
-
async dropAllData() {
|
|
351
|
-
await (0, idb_1.deleteDB)(this.dbName);
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Reject undefined values in a `partial` filter argument. Matches
|
|
355
|
-
* Knex behavior (which throws `Undefined binding(s) detected`) so that
|
|
356
|
-
* callers can't pass an unmapped idMap lookup through as a silent
|
|
357
|
-
* match-anything. Omit the key to skip filtering on it; pass null if
|
|
358
|
-
* you need IS NULL semantics (only meaningful for nullable columns).
|
|
359
|
-
*/
|
|
360
|
-
assertNoUndefinedInPartial(partial) {
|
|
361
|
-
if (partial == null)
|
|
362
|
-
return;
|
|
363
|
-
for (const k of Object.keys(partial)) {
|
|
364
|
-
if (partial[k] === undefined) {
|
|
365
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER(`args.partial.${k}`, 'not undefined. Passing undefined as a filter value is not supported — omit the key to skip filtering. Matches Knex semantics.');
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
async filterOutputTagMaps(args, filtered, userId) {
|
|
370
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
371
|
-
const dbTrx = this.toDbTrx(['output_tags_map', 'output_tags'], 'readonly', args.trx);
|
|
372
|
-
const store = dbTrx.objectStore('output_tags_map');
|
|
373
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
374
|
-
let cursor;
|
|
375
|
-
if (args.partial?.outputTagId !== undefined) {
|
|
376
|
-
cursor = await store.index('outputTagId').openCursor(args.partial.outputTagId);
|
|
377
|
-
}
|
|
378
|
-
else if (args.partial?.outputId !== undefined) {
|
|
379
|
-
cursor = await store.index('outputId').openCursor(args.partial.outputId);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
cursor = await store.openCursor();
|
|
383
|
-
}
|
|
384
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
385
|
-
if (args.tagIds != null && !args.tagIds.includes(r.outputTagId))
|
|
386
|
-
return false;
|
|
387
|
-
if (!(0, idbHelpers_1.matchesOutputTagMapPartial)(r, args.partial))
|
|
388
|
-
return false;
|
|
389
|
-
if (userId !== undefined) {
|
|
390
|
-
const tagsForUser = await this.countOutputTags({ partial: { userId, outputTagId: r.outputTagId }, trx: dbTrx });
|
|
391
|
-
if (tagsForUser === 0)
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
return true;
|
|
395
|
-
}, filtered);
|
|
396
|
-
if (args.trx == null)
|
|
397
|
-
await dbTrx.done;
|
|
398
|
-
}
|
|
399
|
-
async findOutputTagMaps(args) {
|
|
400
|
-
const results = [];
|
|
401
|
-
await this.filterOutputTagMaps(args, r => {
|
|
402
|
-
results.push(this.validateEntity(r));
|
|
403
|
-
});
|
|
404
|
-
return results;
|
|
405
|
-
}
|
|
406
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
407
|
-
async openProvenTxReqsCursor(
|
|
408
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
409
|
-
store,
|
|
410
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
411
|
-
partial, direction
|
|
412
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
413
|
-
) {
|
|
414
|
-
if (partial?.provenTxReqId != null && partial.provenTxReqId !== 0)
|
|
415
|
-
return store.openCursor(partial.provenTxReqId, direction);
|
|
416
|
-
if (partial?.provenTxId !== undefined)
|
|
417
|
-
return store.index('provenTxId').openCursor(partial.provenTxId, direction);
|
|
418
|
-
if (partial?.txid !== undefined)
|
|
419
|
-
return store.index('txid').openCursor(partial.txid, direction);
|
|
420
|
-
if (partial?.status !== undefined)
|
|
421
|
-
return store.index('status').openCursor(partial.status, direction);
|
|
422
|
-
if (partial?.batch !== undefined)
|
|
423
|
-
return store.index('batch').openCursor(partial.batch, direction);
|
|
424
|
-
return store.openCursor(null, direction);
|
|
425
|
-
}
|
|
426
|
-
async filterProvenTxReqs(args, filtered, userId) {
|
|
427
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
428
|
-
if (args.partial.rawTx != null) {
|
|
429
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. ProvenTxReqs may not be found by rawTx value.');
|
|
430
|
-
}
|
|
431
|
-
if (args.partial.inputBEEF != null) {
|
|
432
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', 'undefined. ProvenTxReqs may not be found by inputBEEF value.');
|
|
433
|
-
}
|
|
434
|
-
const dbTrx = this.toDbTrx(['proven_tx_reqs', 'transactions'], 'readonly', args.trx);
|
|
435
|
-
const direction = args.orderDescending === true ? 'prev' : 'next';
|
|
436
|
-
const store = dbTrx.objectStore('proven_tx_reqs');
|
|
437
|
-
const cursor = await this.openProvenTxReqsCursor(store, args.partial, direction);
|
|
438
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
439
|
-
if (!(0, idbHelpers_1.matchesProvenTxReqPartial)(r, args.partial))
|
|
440
|
-
return false;
|
|
441
|
-
if (args.status != null && args.status.length > 0 && !args.status.includes(r.status))
|
|
442
|
-
return false;
|
|
443
|
-
if (args.txids != null && args.txids.length > 0 && !args.txids.includes(r.txid))
|
|
444
|
-
return false;
|
|
445
|
-
if (userId !== undefined) {
|
|
446
|
-
const txsForUser = await this.countTransactions({ partial: { userId, txid: r.txid }, trx: dbTrx });
|
|
447
|
-
if (txsForUser === 0)
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
return true;
|
|
451
|
-
}, filtered);
|
|
452
|
-
if (args.trx == null)
|
|
453
|
-
await dbTrx.done;
|
|
454
|
-
}
|
|
455
|
-
async findProvenTxReqs(args) {
|
|
456
|
-
const results = [];
|
|
457
|
-
await this.filterProvenTxReqs(args, r => {
|
|
458
|
-
results.push(this.validateEntity(r));
|
|
459
|
-
});
|
|
460
|
-
return results;
|
|
461
|
-
}
|
|
462
|
-
async filterProvenTxs(args, filtered, userId) {
|
|
463
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
464
|
-
if (args.partial.rawTx != null) {
|
|
465
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. ProvenTxs may not be found by rawTx value.');
|
|
466
|
-
}
|
|
467
|
-
if (args.partial.merklePath != null) {
|
|
468
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.merklePath', 'undefined. ProvenTxs may not be found by merklePath value.');
|
|
469
|
-
}
|
|
470
|
-
const dbTrx = this.toDbTrx(['proven_txs', 'transactions'], 'readonly', args.trx);
|
|
471
|
-
const direction = args.orderDescending === true ? 'prev' : 'next';
|
|
472
|
-
const store = dbTrx.objectStore('proven_txs');
|
|
473
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
474
|
-
let cursor;
|
|
475
|
-
if (args.partial?.provenTxId != null && args.partial.provenTxId > 0) {
|
|
476
|
-
cursor = await store.openCursor(args.partial.provenTxId, direction);
|
|
477
|
-
}
|
|
478
|
-
else if (args.partial?.txid !== undefined) {
|
|
479
|
-
cursor = await store.index('txid').openCursor(args.partial.txid, direction);
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
cursor = await store.openCursor(null, direction);
|
|
483
|
-
}
|
|
484
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
485
|
-
if (!(0, idbHelpers_1.matchesProvenTxPartial)(r, args.partial))
|
|
486
|
-
return false;
|
|
487
|
-
if (userId !== undefined) {
|
|
488
|
-
const txCount = await this.countTransactions({ partial: { userId, provenTxId: r.provenTxId }, trx: dbTrx });
|
|
489
|
-
if (txCount === 0)
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
return true;
|
|
493
|
-
}, filtered);
|
|
494
|
-
if (args.trx == null)
|
|
495
|
-
await dbTrx.done;
|
|
496
|
-
}
|
|
497
|
-
async findProvenTxs(args) {
|
|
498
|
-
const results = [];
|
|
499
|
-
await this.filterProvenTxs(args, r => {
|
|
500
|
-
results.push(this.validateEntity(r));
|
|
501
|
-
});
|
|
502
|
-
return results;
|
|
503
|
-
}
|
|
504
|
-
async filterTxLabelMaps(args, filtered, userId) {
|
|
505
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
506
|
-
const dbTrx = this.toDbTrx(['tx_labels_map', 'tx_labels'], 'readonly', args.trx);
|
|
507
|
-
const store = dbTrx.objectStore('tx_labels_map');
|
|
508
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
509
|
-
let cursor;
|
|
510
|
-
if (args.partial?.transactionId !== undefined) {
|
|
511
|
-
cursor = await store.index('transactionId').openCursor(args.partial.transactionId);
|
|
512
|
-
}
|
|
513
|
-
else if (args.partial?.txLabelId !== undefined) {
|
|
514
|
-
cursor = await store.index('txLabelId').openCursor(args.partial.txLabelId);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
cursor = await store.openCursor();
|
|
518
|
-
}
|
|
519
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
520
|
-
if (!(0, idbHelpers_1.matchesTxLabelMapPartial)(r, args.partial))
|
|
521
|
-
return false;
|
|
522
|
-
if (userId !== undefined) {
|
|
523
|
-
const labelCount = await this.countTxLabels({ partial: { userId, txLabelId: r.txLabelId }, trx: dbTrx });
|
|
524
|
-
if (labelCount === 0)
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
return true;
|
|
528
|
-
}, filtered);
|
|
529
|
-
if (args.trx == null)
|
|
530
|
-
await dbTrx.done;
|
|
531
|
-
}
|
|
532
|
-
async findTxLabelMaps(args) {
|
|
533
|
-
const results = [];
|
|
534
|
-
await this.filterTxLabelMaps(args, r => {
|
|
535
|
-
results.push(this.validateEntity(r));
|
|
536
|
-
});
|
|
537
|
-
return results;
|
|
538
|
-
}
|
|
539
|
-
async countOutputTagMaps(args) {
|
|
540
|
-
let count = 0;
|
|
541
|
-
await this.filterOutputTagMaps(args, () => {
|
|
542
|
-
count++;
|
|
543
|
-
});
|
|
544
|
-
return count;
|
|
545
|
-
}
|
|
546
|
-
async countProvenTxReqs(args) {
|
|
547
|
-
let count = 0;
|
|
548
|
-
await this.filterProvenTxReqs(args, () => {
|
|
549
|
-
count++;
|
|
550
|
-
});
|
|
551
|
-
return count;
|
|
552
|
-
}
|
|
553
|
-
async countProvenTxs(args) {
|
|
554
|
-
let count = 0;
|
|
555
|
-
await this.filterProvenTxs(args, () => {
|
|
556
|
-
count++;
|
|
557
|
-
});
|
|
558
|
-
return count;
|
|
559
|
-
}
|
|
560
|
-
async countTxLabelMaps(args) {
|
|
561
|
-
let count = 0;
|
|
562
|
-
await this.filterTxLabelMaps(args, () => {
|
|
563
|
-
count++;
|
|
564
|
-
});
|
|
565
|
-
return count;
|
|
566
|
-
}
|
|
567
|
-
async insertCertificate(certificate, trx) {
|
|
568
|
-
const e = await this.validateEntityForInsert(certificate, trx, undefined, ['isDeleted']);
|
|
569
|
-
// Strip non-schema runtime fields before insert. Matches Knex canon.
|
|
570
|
-
if (e.logger != null)
|
|
571
|
-
delete e.logger;
|
|
572
|
-
const fields = e.fields;
|
|
573
|
-
if (e.fields != null)
|
|
574
|
-
delete e.fields;
|
|
575
|
-
if (e.certificateId === 0)
|
|
576
|
-
delete e.certificateId;
|
|
577
|
-
const dbTrx = this.toDbTrx(['certificates', 'certificate_fields'], 'readwrite', trx);
|
|
578
|
-
const store = dbTrx.objectStore('certificates');
|
|
579
|
-
try {
|
|
580
|
-
const id = Number(await store.add(e));
|
|
581
|
-
certificate.certificateId = id;
|
|
582
|
-
if (fields != null) {
|
|
583
|
-
for (const field of fields) {
|
|
584
|
-
field.certificateId = certificate.certificateId;
|
|
585
|
-
field.userId = certificate.userId;
|
|
586
|
-
await this.insertCertificateField(field, dbTrx);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
finally {
|
|
591
|
-
if (trx == null)
|
|
592
|
-
await dbTrx.done;
|
|
593
|
-
}
|
|
594
|
-
return certificate.certificateId;
|
|
595
|
-
}
|
|
596
|
-
async insertCertificateField(certificateField, trx) {
|
|
597
|
-
const e = await this.validateEntityForInsert(certificateField, trx);
|
|
598
|
-
const dbTrx = this.toDbTrx(['certificate_fields'], 'readwrite', trx);
|
|
599
|
-
const store = dbTrx.objectStore('certificate_fields');
|
|
600
|
-
try {
|
|
601
|
-
await store.add(e);
|
|
602
|
-
}
|
|
603
|
-
finally {
|
|
604
|
-
if (trx == null)
|
|
605
|
-
await dbTrx.done;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
async insertCommission(commission, trx) {
|
|
609
|
-
const e = await this.validateEntityForInsert(commission, trx);
|
|
610
|
-
if (e.commissionId === 0)
|
|
611
|
-
delete e.commissionId;
|
|
612
|
-
const dbTrx = this.toDbTrx(['commissions'], 'readwrite', trx);
|
|
613
|
-
const store = dbTrx.objectStore('commissions');
|
|
614
|
-
try {
|
|
615
|
-
const id = Number(await store.add(e));
|
|
616
|
-
commission.commissionId = id;
|
|
617
|
-
}
|
|
618
|
-
finally {
|
|
619
|
-
if (trx == null)
|
|
620
|
-
await dbTrx.done;
|
|
621
|
-
}
|
|
622
|
-
return commission.commissionId;
|
|
623
|
-
}
|
|
624
|
-
async insertMonitorEvent(event, trx) {
|
|
625
|
-
const e = await this.validateEntityForInsert(event, trx);
|
|
626
|
-
if (e.id === 0)
|
|
627
|
-
delete e.id;
|
|
628
|
-
const dbTrx = this.toDbTrx(['monitor_events'], 'readwrite', trx);
|
|
629
|
-
const store = dbTrx.objectStore('monitor_events');
|
|
630
|
-
try {
|
|
631
|
-
const id = Number(await store.add(e));
|
|
632
|
-
event.id = id;
|
|
633
|
-
}
|
|
634
|
-
finally {
|
|
635
|
-
if (trx == null)
|
|
636
|
-
await dbTrx.done;
|
|
637
|
-
}
|
|
638
|
-
return event.id;
|
|
639
|
-
}
|
|
640
|
-
async insertOutput(output, trx) {
|
|
641
|
-
const e = await this.validateEntityForInsert(output, trx);
|
|
642
|
-
if (e.outputId === 0)
|
|
643
|
-
delete e.outputId;
|
|
644
|
-
const dbTrx = this.toDbTrx(['outputs'], 'readwrite', trx);
|
|
645
|
-
const store = dbTrx.objectStore('outputs');
|
|
646
|
-
try {
|
|
647
|
-
const id = Number(await store.add(e));
|
|
648
|
-
output.outputId = id;
|
|
649
|
-
}
|
|
650
|
-
finally {
|
|
651
|
-
if (trx == null)
|
|
652
|
-
await dbTrx.done;
|
|
653
|
-
}
|
|
654
|
-
return output.outputId;
|
|
655
|
-
}
|
|
656
|
-
async insertOutputBasket(basket, trx) {
|
|
657
|
-
const e = await this.validateEntityForInsert(basket, trx, undefined, ['isDeleted']);
|
|
658
|
-
if (e.basketId === 0)
|
|
659
|
-
delete e.basketId;
|
|
660
|
-
const dbTrx = this.toDbTrx(['output_baskets'], 'readwrite', trx);
|
|
661
|
-
const store = dbTrx.objectStore('output_baskets');
|
|
662
|
-
try {
|
|
663
|
-
const id = Number(await store.add(e));
|
|
664
|
-
basket.basketId = id;
|
|
665
|
-
}
|
|
666
|
-
finally {
|
|
667
|
-
if (trx == null)
|
|
668
|
-
await dbTrx.done;
|
|
669
|
-
}
|
|
670
|
-
return basket.basketId;
|
|
671
|
-
}
|
|
672
|
-
async insertOutputTag(tag, trx) {
|
|
673
|
-
const e = await this.validateEntityForInsert(tag, trx, undefined, ['isDeleted']);
|
|
674
|
-
if (e.outputTagId === 0)
|
|
675
|
-
delete e.outputTagId;
|
|
676
|
-
const dbTrx = this.toDbTrx(['output_tags'], 'readwrite', trx);
|
|
677
|
-
const store = dbTrx.objectStore('output_tags');
|
|
678
|
-
try {
|
|
679
|
-
const id = Number(await store.add(e));
|
|
680
|
-
tag.outputTagId = id;
|
|
681
|
-
}
|
|
682
|
-
finally {
|
|
683
|
-
if (trx == null)
|
|
684
|
-
await dbTrx.done;
|
|
685
|
-
}
|
|
686
|
-
return tag.outputTagId;
|
|
687
|
-
}
|
|
688
|
-
async insertOutputTagMap(tagMap, trx) {
|
|
689
|
-
const e = await this.validateEntityForInsert(tagMap, trx, undefined, ['isDeleted']);
|
|
690
|
-
const dbTrx = this.toDbTrx(['output_tags_map'], 'readwrite', trx);
|
|
691
|
-
const store = dbTrx.objectStore('output_tags_map');
|
|
692
|
-
try {
|
|
693
|
-
await store.add(e);
|
|
694
|
-
}
|
|
695
|
-
finally {
|
|
696
|
-
if (trx == null)
|
|
697
|
-
await dbTrx.done;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
async insertProvenTx(tx, trx) {
|
|
701
|
-
const e = await this.validateEntityForInsert(tx, trx);
|
|
702
|
-
if (e.provenTxId === 0)
|
|
703
|
-
delete e.provenTxId;
|
|
704
|
-
const dbTrx = this.toDbTrx(['proven_txs'], 'readwrite', trx);
|
|
705
|
-
const store = dbTrx.objectStore('proven_txs');
|
|
706
|
-
try {
|
|
707
|
-
const id = Number(await store.add(e));
|
|
708
|
-
tx.provenTxId = id;
|
|
709
|
-
}
|
|
710
|
-
finally {
|
|
711
|
-
if (trx == null)
|
|
712
|
-
await dbTrx.done;
|
|
713
|
-
}
|
|
714
|
-
return tx.provenTxId;
|
|
715
|
-
}
|
|
716
|
-
async insertProvenTxReq(tx, trx) {
|
|
717
|
-
const e = await this.validateEntityForInsert(tx, trx);
|
|
718
|
-
if (e.provenTxReqId === 0)
|
|
719
|
-
delete e.provenTxReqId;
|
|
720
|
-
const dbTrx = this.toDbTrx(['proven_tx_reqs'], 'readwrite', trx);
|
|
721
|
-
const store = dbTrx.objectStore('proven_tx_reqs');
|
|
722
|
-
try {
|
|
723
|
-
const id = Number(await store.add(e));
|
|
724
|
-
tx.provenTxReqId = id;
|
|
725
|
-
}
|
|
726
|
-
finally {
|
|
727
|
-
if (trx == null)
|
|
728
|
-
await dbTrx.done;
|
|
729
|
-
}
|
|
730
|
-
return tx.provenTxReqId;
|
|
731
|
-
}
|
|
732
|
-
async insertSyncState(syncState, trx) {
|
|
733
|
-
const e = await this.validateEntityForInsert(syncState, trx, ['when'], ['init']);
|
|
734
|
-
if (e.syncStateId === 0)
|
|
735
|
-
delete e.syncStateId;
|
|
736
|
-
const dbTrx = this.toDbTrx(['sync_states'], 'readwrite', trx);
|
|
737
|
-
const store = dbTrx.objectStore('sync_states');
|
|
738
|
-
try {
|
|
739
|
-
const id = Number(await store.add(e));
|
|
740
|
-
syncState.syncStateId = id;
|
|
741
|
-
}
|
|
742
|
-
finally {
|
|
743
|
-
if (trx == null)
|
|
744
|
-
await dbTrx.done;
|
|
745
|
-
}
|
|
746
|
-
return syncState.syncStateId;
|
|
747
|
-
}
|
|
748
|
-
async insertTransaction(tx, trx) {
|
|
749
|
-
const e = await this.validateEntityForInsert(tx, trx);
|
|
750
|
-
if (e.transactionId === 0)
|
|
751
|
-
delete e.transactionId;
|
|
752
|
-
const dbTrx = this.toDbTrx(['transactions'], 'readwrite', trx);
|
|
753
|
-
const store = dbTrx.objectStore('transactions');
|
|
754
|
-
try {
|
|
755
|
-
const id = Number(await store.add(e));
|
|
756
|
-
tx.transactionId = id;
|
|
757
|
-
}
|
|
758
|
-
finally {
|
|
759
|
-
if (trx == null)
|
|
760
|
-
await dbTrx.done;
|
|
761
|
-
}
|
|
762
|
-
return tx.transactionId;
|
|
763
|
-
}
|
|
764
|
-
async insertTxLabel(label, trx) {
|
|
765
|
-
const e = await this.validateEntityForInsert(label, trx, undefined, ['isDeleted']);
|
|
766
|
-
if (e.txLabelId === 0)
|
|
767
|
-
delete e.txLabelId;
|
|
768
|
-
const dbTrx = this.toDbTrx(['tx_labels'], 'readwrite', trx);
|
|
769
|
-
const store = dbTrx.objectStore('tx_labels');
|
|
770
|
-
try {
|
|
771
|
-
const id = Number(await store.add(e));
|
|
772
|
-
label.txLabelId = id;
|
|
773
|
-
}
|
|
774
|
-
finally {
|
|
775
|
-
if (trx == null)
|
|
776
|
-
await dbTrx.done;
|
|
777
|
-
}
|
|
778
|
-
return label.txLabelId;
|
|
779
|
-
}
|
|
780
|
-
async insertTxLabelMap(labelMap, trx) {
|
|
781
|
-
const e = await this.validateEntityForInsert(labelMap, trx, undefined, ['isDeleted']);
|
|
782
|
-
const dbTrx = this.toDbTrx(['tx_labels_map'], 'readwrite', trx);
|
|
783
|
-
const store = dbTrx.objectStore('tx_labels_map');
|
|
784
|
-
try {
|
|
785
|
-
await store.add(e);
|
|
786
|
-
}
|
|
787
|
-
finally {
|
|
788
|
-
if (trx == null)
|
|
789
|
-
await dbTrx.done;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
async insertUser(user, trx) {
|
|
793
|
-
const e = await this.validateEntityForInsert(user, trx);
|
|
794
|
-
if (e.userId === 0)
|
|
795
|
-
delete e.userId;
|
|
796
|
-
const dbTrx = this.toDbTrx(['users'], 'readwrite', trx);
|
|
797
|
-
const store = dbTrx.objectStore('users');
|
|
798
|
-
try {
|
|
799
|
-
const id = Number(await store.add(e));
|
|
800
|
-
user.userId = id;
|
|
801
|
-
}
|
|
802
|
-
finally {
|
|
803
|
-
if (trx == null)
|
|
804
|
-
await dbTrx.done;
|
|
805
|
-
}
|
|
806
|
-
return user.userId;
|
|
807
|
-
}
|
|
808
|
-
async updateIdb(id, update, keyProp, storeName, trx) {
|
|
809
|
-
if (update[keyProp] !== undefined && (Array.isArray(id) || update[keyProp] !== id)) {
|
|
810
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER(`update.${keyProp}`, 'undefined');
|
|
811
|
-
}
|
|
812
|
-
const u = this.validatePartialForUpdate(update);
|
|
813
|
-
const dbTrx = this.toDbTrx([storeName], 'readwrite', trx);
|
|
814
|
-
const store = dbTrx.objectStore(storeName);
|
|
815
|
-
const ids = Array.isArray(id) ? id : [id];
|
|
816
|
-
let updated = 0;
|
|
817
|
-
try {
|
|
818
|
-
for (const i of ids) {
|
|
819
|
-
const e = await store.get(i);
|
|
820
|
-
// Match Knex/Bun semantics: missing rows produce a 0-row result, not an error.
|
|
821
|
-
// Caller receives the true updated count and can decide how to react.
|
|
822
|
-
if (e == null)
|
|
823
|
-
continue;
|
|
824
|
-
const v = {
|
|
825
|
-
...e,
|
|
826
|
-
...u
|
|
827
|
-
};
|
|
828
|
-
const uid = await store.put(v);
|
|
829
|
-
if (uid !== i)
|
|
830
|
-
throw new WERR_errors_1.WERR_INTERNAL(`updated id ${String(uid)} does not match original ${String(id)}`);
|
|
831
|
-
updated++;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
finally {
|
|
835
|
-
if (trx == null)
|
|
836
|
-
await dbTrx.done;
|
|
837
|
-
}
|
|
838
|
-
return updated;
|
|
839
|
-
}
|
|
840
|
-
async updateIdbKey(key, update, keyProps, storeName, trx) {
|
|
841
|
-
if (key.length !== keyProps.length) {
|
|
842
|
-
throw new WERR_errors_1.WERR_INTERNAL(`key.length ${key.length} !== keyProps.length ${keyProps.length}`);
|
|
843
|
-
}
|
|
844
|
-
for (let i = 0; i < key.length; i++) {
|
|
845
|
-
if (update[keyProps[i]] !== undefined && update[keyProps[i]] !== key[i]) {
|
|
846
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER(`update.${keyProps[i]}`, 'undefined');
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
const u = this.validatePartialForUpdate(update);
|
|
850
|
-
const dbTrx = this.toDbTrx([storeName], 'readwrite', trx);
|
|
851
|
-
const store = dbTrx.objectStore(storeName);
|
|
852
|
-
try {
|
|
853
|
-
const e = await store.get(key);
|
|
854
|
-
if (e == null) {
|
|
855
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('key', `an existing record to update ${keyProps.join(',')} ${key.join(',')} not found`);
|
|
856
|
-
}
|
|
857
|
-
const v = {
|
|
858
|
-
...e,
|
|
859
|
-
...u
|
|
860
|
-
};
|
|
861
|
-
const uid = await store.put(v);
|
|
862
|
-
for (let i = 0; i < key.length; i++) {
|
|
863
|
-
if (uid[i] !== key[i])
|
|
864
|
-
throw new WERR_errors_1.WERR_INTERNAL(`updated key ${String(uid[i])} does not match original ${String(key[i])}`);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
finally {
|
|
868
|
-
if (trx == null)
|
|
869
|
-
await dbTrx.done;
|
|
870
|
-
}
|
|
871
|
-
return 1;
|
|
872
|
-
}
|
|
873
|
-
async updateCertificate(id, update, trx) {
|
|
874
|
-
return await this.updateIdb(id, update, 'certificateId', 'certificates', trx);
|
|
875
|
-
}
|
|
876
|
-
async updateCertificateField(certificateId, fieldName, update, trx) {
|
|
877
|
-
return await this.updateIdbKey([certificateId, fieldName], update, ['certificateId', 'fieldName'], 'certificate_fields', trx);
|
|
878
|
-
}
|
|
879
|
-
async updateCommission(id, update, trx) {
|
|
880
|
-
return await this.updateIdb(id, update, 'commissionId', 'commissions', trx);
|
|
881
|
-
}
|
|
882
|
-
async updateMonitorEvent(id, update, trx) {
|
|
883
|
-
return await this.updateIdb(id, update, 'id', 'monitor_events', trx);
|
|
884
|
-
}
|
|
885
|
-
async updateOutput(id, update, trx) {
|
|
886
|
-
return await this.updateIdb(id, update, 'outputId', 'outputs', trx);
|
|
887
|
-
}
|
|
888
|
-
async updateOutputBasket(id, update, trx) {
|
|
889
|
-
return await this.updateIdb(id, update, 'basketId', 'output_baskets', trx);
|
|
890
|
-
}
|
|
891
|
-
async updateOutputTag(id, update, trx) {
|
|
892
|
-
return await this.updateIdb(id, update, 'outputTagId', 'output_tags', trx);
|
|
893
|
-
}
|
|
894
|
-
async updateProvenTx(id, update, trx) {
|
|
895
|
-
return await this.updateIdb(id, update, 'provenTxId', 'proven_txs', trx);
|
|
896
|
-
}
|
|
897
|
-
async updateProvenTxReq(id, update, trx) {
|
|
898
|
-
return await this.updateIdb(id, update, 'provenTxReqId', 'proven_tx_reqs', trx);
|
|
899
|
-
}
|
|
900
|
-
async updateSyncState(id, update, trx) {
|
|
901
|
-
return await this.updateIdb(id, update, 'syncStateId', 'sync_states', trx);
|
|
902
|
-
}
|
|
903
|
-
async updateTransaction(id, update, trx) {
|
|
904
|
-
return await this.updateIdb(id, update, 'transactionId', 'transactions', trx);
|
|
905
|
-
}
|
|
906
|
-
async updateTxLabel(id, update, trx) {
|
|
907
|
-
return await this.updateIdb(id, update, 'txLabelId', 'tx_labels', trx);
|
|
908
|
-
}
|
|
909
|
-
async updateUser(id, update, trx) {
|
|
910
|
-
return await this.updateIdb(id, update, 'userId', 'users', trx);
|
|
911
|
-
}
|
|
912
|
-
async updateOutputTagMap(outputId, tagId, update, trx) {
|
|
913
|
-
return await this.updateIdbKey([tagId, outputId], update, ['outputTagId', 'outputId'], 'output_tags_map', trx);
|
|
914
|
-
}
|
|
915
|
-
async updateTxLabelMap(transactionId, txLabelId, update, trx) {
|
|
916
|
-
return await this.updateIdbKey([txLabelId, transactionId], update, ['txLabelId', 'transactionId'], 'tx_labels_map', trx);
|
|
917
|
-
}
|
|
918
|
-
//
|
|
919
|
-
// StorageReader abstract methods
|
|
920
|
-
//
|
|
921
|
-
async destroy() {
|
|
922
|
-
if (this.db != null) {
|
|
923
|
-
this.db.close();
|
|
924
|
-
}
|
|
925
|
-
this.db = undefined;
|
|
926
|
-
this._settings = undefined;
|
|
927
|
-
}
|
|
928
|
-
allStores = [
|
|
929
|
-
'action_batches',
|
|
930
|
-
'action_batch_outputs',
|
|
931
|
-
'action_batch_blobs',
|
|
932
|
-
'certificates',
|
|
933
|
-
'certificate_fields',
|
|
934
|
-
'commissions',
|
|
935
|
-
'monitor_events',
|
|
936
|
-
'outputs',
|
|
937
|
-
'output_baskets',
|
|
938
|
-
'output_tags',
|
|
939
|
-
'output_tags_map',
|
|
940
|
-
'proven_txs',
|
|
941
|
-
'proven_tx_reqs',
|
|
942
|
-
'sync_states',
|
|
943
|
-
'transactions',
|
|
944
|
-
'tx_labels',
|
|
945
|
-
'tx_labels_map',
|
|
946
|
-
'users'
|
|
947
|
-
];
|
|
948
|
-
async insertActionBatch(batch, trx) {
|
|
949
|
-
const tx = this.toDbTrx(['action_batches'], 'readwrite', trx);
|
|
950
|
-
const { actionBatchId: _actionBatchId, ...withoutId } = batch;
|
|
951
|
-
const entity = batch.actionBatchId === 0 ? withoutId : batch;
|
|
952
|
-
const store = tx.objectStore('action_batches');
|
|
953
|
-
if (store.add == null)
|
|
954
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batches store does not support add');
|
|
955
|
-
const id = await store.add(entity);
|
|
956
|
-
batch.actionBatchId = Number(id);
|
|
957
|
-
if (trx == null)
|
|
958
|
-
await tx.done;
|
|
959
|
-
return Number(id);
|
|
960
|
-
}
|
|
961
|
-
async findActionBatch(userId, batchId, trx) {
|
|
962
|
-
const tx = this.toDbTrx(['action_batches'], 'readonly', trx);
|
|
963
|
-
const index = tx.objectStore('action_batches').index('userId_batchId');
|
|
964
|
-
if (index.get == null)
|
|
965
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batches userId_batchId index does not support get');
|
|
966
|
-
const batch = await index.get([userId, batchId]);
|
|
967
|
-
if (trx == null)
|
|
968
|
-
await tx.done;
|
|
969
|
-
return batch;
|
|
970
|
-
}
|
|
971
|
-
async findExpiredActionBatches(now, trx) {
|
|
972
|
-
const tx = this.toDbTrx(['action_batches'], 'readonly', trx);
|
|
973
|
-
const store = tx.objectStore('action_batches');
|
|
974
|
-
if (store.getAll == null)
|
|
975
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batches store does not support getAll');
|
|
976
|
-
const rows = await store.getAll();
|
|
977
|
-
if (trx == null)
|
|
978
|
-
await tx.done;
|
|
979
|
-
return rows.filter(r => (r.status === 'active' || r.status === 'prepared') &&
|
|
980
|
-
(r.expiresAt.getTime() <= now.getTime() || r.hardExpiresAt.getTime() <= now.getTime()));
|
|
981
|
-
}
|
|
982
|
-
async updateActionBatch(actionBatchId, update, trx) {
|
|
983
|
-
const tx = this.toDbTrx(['action_batches'], 'readwrite', trx);
|
|
984
|
-
const store = tx.objectStore('action_batches');
|
|
985
|
-
if (store.get == null || store.put == null) {
|
|
986
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batches store does not support get and put');
|
|
987
|
-
}
|
|
988
|
-
const batch = await store.get(actionBatchId);
|
|
989
|
-
if (batch == null) {
|
|
990
|
-
if (trx == null)
|
|
991
|
-
await tx.done;
|
|
992
|
-
return 0;
|
|
993
|
-
}
|
|
994
|
-
await store.put({ ...batch, ...update, updated_at: new Date() });
|
|
995
|
-
if (trx == null)
|
|
996
|
-
await tx.done;
|
|
997
|
-
return 1;
|
|
998
|
-
}
|
|
999
|
-
async deleteActionBatch(actionBatchId, trx) {
|
|
1000
|
-
const tx = this.toDbTrx(['action_batches'], 'readwrite', trx);
|
|
1001
|
-
const store = tx.objectStore('action_batches');
|
|
1002
|
-
if (store.delete == null)
|
|
1003
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batches store does not support delete');
|
|
1004
|
-
await store.delete(actionBatchId);
|
|
1005
|
-
if (trx == null)
|
|
1006
|
-
await tx.done;
|
|
1007
|
-
}
|
|
1008
|
-
async reserveActionBatchOutputs(reservations, trx) {
|
|
1009
|
-
if (reservations.length === 0)
|
|
1010
|
-
return;
|
|
1011
|
-
const tx = this.toDbTrx(['action_batch_outputs'], 'readwrite', trx);
|
|
1012
|
-
const store = tx.objectStore('action_batch_outputs');
|
|
1013
|
-
if (store.add == null)
|
|
1014
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_outputs store does not support add');
|
|
1015
|
-
for (const reservation of reservations)
|
|
1016
|
-
await store.add(reservation);
|
|
1017
|
-
if (trx == null)
|
|
1018
|
-
await tx.done;
|
|
1019
|
-
}
|
|
1020
|
-
async findActionBatchOutputIds(actionBatchId, trx) {
|
|
1021
|
-
const tx = this.toDbTrx(['action_batch_outputs'], 'readonly', trx);
|
|
1022
|
-
const index = tx.objectStore('action_batch_outputs').index('actionBatchId');
|
|
1023
|
-
if (index.getAll == null)
|
|
1024
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_outputs index does not support getAll');
|
|
1025
|
-
const rows = await index.getAll(actionBatchId);
|
|
1026
|
-
if (trx == null)
|
|
1027
|
-
await tx.done;
|
|
1028
|
-
return rows.map(r => r.outputId);
|
|
1029
|
-
}
|
|
1030
|
-
async findReservedActionBatchOutputIds(outputIds, trx) {
|
|
1031
|
-
const tx = this.toDbTrx(['action_batch_outputs'], 'readonly', trx);
|
|
1032
|
-
const store = tx.objectStore('action_batch_outputs');
|
|
1033
|
-
if (store.get == null)
|
|
1034
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_outputs store does not support get');
|
|
1035
|
-
const reserved = [];
|
|
1036
|
-
for (const outputId of outputIds)
|
|
1037
|
-
if (await store.get(outputId) != null)
|
|
1038
|
-
reserved.push(outputId);
|
|
1039
|
-
if (trx == null)
|
|
1040
|
-
await tx.done;
|
|
1041
|
-
return reserved;
|
|
1042
|
-
}
|
|
1043
|
-
async deleteActionBatchOutputReservations(actionBatchId, trx) {
|
|
1044
|
-
const tx = this.toDbTrx(['action_batch_outputs'], 'readwrite', trx);
|
|
1045
|
-
const store = tx.objectStore('action_batch_outputs');
|
|
1046
|
-
const index = store.index('actionBatchId');
|
|
1047
|
-
if (index.getAllKeys == null || store.delete == null) {
|
|
1048
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_outputs store does not support indexed deletion');
|
|
1049
|
-
}
|
|
1050
|
-
const keys = await index.getAllKeys(actionBatchId);
|
|
1051
|
-
for (const key of keys)
|
|
1052
|
-
await store.delete(key);
|
|
1053
|
-
if (trx == null)
|
|
1054
|
-
await tx.done;
|
|
1055
|
-
}
|
|
1056
|
-
async putActionBatchBlobRecord(blob, trx) {
|
|
1057
|
-
const tx = this.toDbTrx(['action_batch_blobs'], 'readwrite', trx);
|
|
1058
|
-
const store = tx.objectStore('action_batch_blobs');
|
|
1059
|
-
if (store.put == null)
|
|
1060
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_blobs store does not support put');
|
|
1061
|
-
await store.put(blob);
|
|
1062
|
-
if (trx == null)
|
|
1063
|
-
await tx.done;
|
|
1064
|
-
}
|
|
1065
|
-
async findActionBatchBlobRecord(actionBatchId, digest, trx) {
|
|
1066
|
-
const tx = this.toDbTrx(['action_batch_blobs'], 'readonly', trx);
|
|
1067
|
-
const store = tx.objectStore('action_batch_blobs');
|
|
1068
|
-
if (store.get == null)
|
|
1069
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_blobs store does not support get');
|
|
1070
|
-
const blob = await store.get([actionBatchId, digest]);
|
|
1071
|
-
if (trx == null)
|
|
1072
|
-
await tx.done;
|
|
1073
|
-
return blob;
|
|
1074
|
-
}
|
|
1075
|
-
async deleteActionBatchBlobRecords(actionBatchId, trx) {
|
|
1076
|
-
const tx = this.toDbTrx(['action_batch_blobs'], 'readwrite', trx);
|
|
1077
|
-
const store = tx.objectStore('action_batch_blobs');
|
|
1078
|
-
const index = store.index('actionBatchId');
|
|
1079
|
-
if (index.getAllKeys == null || store.delete == null) {
|
|
1080
|
-
throw new WERR_errors_1.WERR_INTERNAL('IndexedDB action_batch_blobs store does not support indexed deletion');
|
|
1081
|
-
}
|
|
1082
|
-
const keys = await index.getAllKeys(actionBatchId);
|
|
1083
|
-
for (const key of keys)
|
|
1084
|
-
await store.delete(key);
|
|
1085
|
-
if (trx == null)
|
|
1086
|
-
await tx.done;
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* @param scope
|
|
1090
|
-
* @param trx
|
|
1091
|
-
* @returns
|
|
1092
|
-
*/
|
|
1093
|
-
async transaction(scope, trx) {
|
|
1094
|
-
if (trx != null)
|
|
1095
|
-
return await scope(trx);
|
|
1096
|
-
const stores = this.allStores;
|
|
1097
|
-
const db = await this.verifyDB();
|
|
1098
|
-
const tx = db.transaction(stores, 'readwrite');
|
|
1099
|
-
try {
|
|
1100
|
-
const r = await scope(tx);
|
|
1101
|
-
await tx.done;
|
|
1102
|
-
return r;
|
|
1103
|
-
}
|
|
1104
|
-
catch (err) {
|
|
1105
|
-
tx.abort();
|
|
1106
|
-
await tx.done;
|
|
1107
|
-
throw err;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
async filterCertificateFields(args, filtered) {
|
|
1111
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1112
|
-
const dbTrx = this.toDbTrx(['certificate_fields'], 'readonly', args.trx);
|
|
1113
|
-
const store = dbTrx.objectStore('certificate_fields');
|
|
1114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1115
|
-
let cursor;
|
|
1116
|
-
if (args.partial?.certificateId !== undefined) {
|
|
1117
|
-
cursor = await store.index('certificateId').openCursor(args.partial.certificateId);
|
|
1118
|
-
}
|
|
1119
|
-
else if (args.partial?.userId !== undefined) {
|
|
1120
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1121
|
-
}
|
|
1122
|
-
else {
|
|
1123
|
-
cursor = await store.openCursor();
|
|
1124
|
-
}
|
|
1125
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesCertificateFieldPartial)(r, args.partial), filtered);
|
|
1126
|
-
if (args.trx == null)
|
|
1127
|
-
await dbTrx.done;
|
|
1128
|
-
}
|
|
1129
|
-
async findCertificateFields(args) {
|
|
1130
|
-
const result = [];
|
|
1131
|
-
await this.filterCertificateFields(args, r => {
|
|
1132
|
-
result.push(this.validateEntity(r));
|
|
1133
|
-
});
|
|
1134
|
-
return result;
|
|
1135
|
-
}
|
|
1136
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1137
|
-
async openCertificatesCursor(
|
|
1138
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1139
|
-
store,
|
|
1140
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1141
|
-
partial
|
|
1142
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1143
|
-
) {
|
|
1144
|
-
if (partial?.certificateId != null && partial.certificateId !== 0)
|
|
1145
|
-
return store.openCursor(partial.certificateId);
|
|
1146
|
-
if (partial?.userId !== undefined) {
|
|
1147
|
-
if (partial?.type != null && partial?.certifier != null && partial?.serialNumber != null) {
|
|
1148
|
-
return store
|
|
1149
|
-
.index('userId_type_certifier_serialNumber')
|
|
1150
|
-
.openCursor([partial.userId, partial.type, partial.certifier, partial.serialNumber]);
|
|
1151
|
-
}
|
|
1152
|
-
return store.index('userId').openCursor(partial.userId);
|
|
1153
|
-
}
|
|
1154
|
-
return store.openCursor();
|
|
1155
|
-
}
|
|
1156
|
-
async filterCertificates(args, filtered) {
|
|
1157
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1158
|
-
const dbTrx = this.toDbTrx(['certificates'], 'readonly', args.trx);
|
|
1159
|
-
const store = dbTrx.objectStore('certificates');
|
|
1160
|
-
const cursor = await this.openCertificatesCursor(store, args.partial);
|
|
1161
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => {
|
|
1162
|
-
if (args.certifiers != null && !args.certifiers.includes(r.certifier))
|
|
1163
|
-
return false;
|
|
1164
|
-
if (args.types != null && !args.types.includes(r.type))
|
|
1165
|
-
return false;
|
|
1166
|
-
return (0, idbHelpers_1.matchesCertificatePartial)(r, args.partial);
|
|
1167
|
-
}, filtered);
|
|
1168
|
-
if (args.trx == null)
|
|
1169
|
-
await dbTrx.done;
|
|
1170
|
-
}
|
|
1171
|
-
async findCertificates(args) {
|
|
1172
|
-
const result = [];
|
|
1173
|
-
await this.filterCertificates(args, r => {
|
|
1174
|
-
result.push(this.validateEntity(r));
|
|
1175
|
-
});
|
|
1176
|
-
if (args.includeFields === true) {
|
|
1177
|
-
for (const c of result) {
|
|
1178
|
-
const fields = await this.findCertificateFields({ partial: { certificateId: c.certificateId }, trx: args.trx });
|
|
1179
|
-
c.fields = fields;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
return result;
|
|
1183
|
-
}
|
|
1184
|
-
async filterCommissions(args, filtered) {
|
|
1185
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1186
|
-
if (args.partial.lockingScript != null) {
|
|
1187
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('partial.lockingScript', 'undefined. Commissions may not be found by lockingScript value.');
|
|
1188
|
-
}
|
|
1189
|
-
const dbTrx = this.toDbTrx(['commissions'], 'readonly', args.trx);
|
|
1190
|
-
const store = dbTrx.objectStore('commissions');
|
|
1191
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1192
|
-
let cursor;
|
|
1193
|
-
if (args.partial?.commissionId != null && args.partial.commissionId !== 0) {
|
|
1194
|
-
cursor = await store.openCursor(args.partial.commissionId);
|
|
1195
|
-
}
|
|
1196
|
-
else if (args.partial?.userId !== undefined) {
|
|
1197
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1198
|
-
}
|
|
1199
|
-
else if (args.partial?.transactionId !== undefined) {
|
|
1200
|
-
cursor = await store.index('transactionId').openCursor(args.partial.transactionId);
|
|
1201
|
-
}
|
|
1202
|
-
else {
|
|
1203
|
-
cursor = await store.openCursor();
|
|
1204
|
-
}
|
|
1205
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesCommissionPartial)(r, args.partial), filtered);
|
|
1206
|
-
if (args.trx == null)
|
|
1207
|
-
await dbTrx.done;
|
|
1208
|
-
}
|
|
1209
|
-
async findCommissions(args) {
|
|
1210
|
-
const result = [];
|
|
1211
|
-
await this.filterCommissions(args, r => {
|
|
1212
|
-
result.push(this.validateEntity(r));
|
|
1213
|
-
});
|
|
1214
|
-
return result;
|
|
1215
|
-
}
|
|
1216
|
-
async filterMonitorEvents(args, filtered) {
|
|
1217
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1218
|
-
const dbTrx = this.toDbTrx(['monitor_events'], 'readonly', args.trx);
|
|
1219
|
-
const store = dbTrx.objectStore('monitor_events');
|
|
1220
|
-
const cursor = (args.partial?.id != null && args.partial.id !== 0) ? await store.openCursor(args.partial.id) : await store.openCursor();
|
|
1221
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesMonitorEventPartial)(r, args.partial), filtered);
|
|
1222
|
-
if (args.trx == null)
|
|
1223
|
-
await dbTrx.done;
|
|
1224
|
-
}
|
|
1225
|
-
async findMonitorEvents(args) {
|
|
1226
|
-
const result = [];
|
|
1227
|
-
await this.filterMonitorEvents(args, r => {
|
|
1228
|
-
result.push(this.validateEntity(r));
|
|
1229
|
-
});
|
|
1230
|
-
return result;
|
|
1231
|
-
}
|
|
1232
|
-
async filterOutputBaskets(args, filtered) {
|
|
1233
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1234
|
-
const dbTrx = this.toDbTrx(['output_baskets'], 'readonly', args.trx);
|
|
1235
|
-
const store = dbTrx.objectStore('output_baskets');
|
|
1236
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1237
|
-
let cursor;
|
|
1238
|
-
if (args.partial?.basketId != null && args.partial.basketId !== 0) {
|
|
1239
|
-
cursor = await store.openCursor(args.partial.basketId);
|
|
1240
|
-
}
|
|
1241
|
-
else if (args.partial?.userId !== undefined && args.partial?.name !== undefined) {
|
|
1242
|
-
cursor = await store.index('name_userId').openCursor([args.partial.name, args.partial.userId]);
|
|
1243
|
-
}
|
|
1244
|
-
else if (args.partial?.userId !== undefined) {
|
|
1245
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1246
|
-
}
|
|
1247
|
-
else {
|
|
1248
|
-
cursor = await store.openCursor();
|
|
1249
|
-
}
|
|
1250
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesOutputBasketPartial)(r, args.partial), filtered);
|
|
1251
|
-
if (args.trx == null)
|
|
1252
|
-
await dbTrx.done;
|
|
1253
|
-
}
|
|
1254
|
-
async findOutputBaskets(args) {
|
|
1255
|
-
const result = [];
|
|
1256
|
-
await this.filterOutputBaskets(args, r => {
|
|
1257
|
-
result.push(this.validateEntity(r));
|
|
1258
|
-
});
|
|
1259
|
-
return result;
|
|
1260
|
-
}
|
|
1261
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1262
|
-
async openOutputsCursor(
|
|
1263
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1264
|
-
store,
|
|
1265
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1266
|
-
partial, direction
|
|
1267
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1268
|
-
) {
|
|
1269
|
-
if (partial?.outputId != null && partial.outputId !== 0)
|
|
1270
|
-
return store.openCursor(partial.outputId, direction);
|
|
1271
|
-
if (partial?.userId !== undefined) {
|
|
1272
|
-
if (partial?.transactionId != null && partial.transactionId !== 0 && partial?.vout !== undefined) {
|
|
1273
|
-
return store.index('transactionId_vout_userId').openCursor([partial.transactionId, partial.vout, partial.userId], direction);
|
|
1274
|
-
}
|
|
1275
|
-
return store.index('userId').openCursor(partial.userId, direction);
|
|
1276
|
-
}
|
|
1277
|
-
if (partial?.transactionId !== undefined)
|
|
1278
|
-
return store.index('transactionId').openCursor(partial.transactionId, direction);
|
|
1279
|
-
if (partial?.basketId !== undefined)
|
|
1280
|
-
return store.index('basketId').openCursor(partial.basketId, direction);
|
|
1281
|
-
if (partial?.spentBy !== undefined)
|
|
1282
|
-
return store.index('spentBy').openCursor(partial.spentBy, direction);
|
|
1283
|
-
return store.openCursor(null, direction);
|
|
1284
|
-
}
|
|
1285
|
-
async filterOutputs(args, filtered, tagIds, isQueryModeAll) {
|
|
1286
|
-
this.assertNoUndefinedInPartial(args.partial);
|
|
1287
|
-
if (args.partial.lockingScript != null) {
|
|
1288
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.lockingScript', 'undefined. Outputs may not be found by lockingScript value.');
|
|
1289
|
-
}
|
|
1290
|
-
const stores = ['outputs'];
|
|
1291
|
-
if (tagIds != null && tagIds.length > 0)
|
|
1292
|
-
stores.push('output_tags_map');
|
|
1293
|
-
if (args.txStatus != null)
|
|
1294
|
-
stores.push('transactions');
|
|
1295
|
-
const dbTrx = this.toDbTrx(stores, 'readonly', args.trx);
|
|
1296
|
-
const direction = args.orderDescending === true ? 'prev' : 'next';
|
|
1297
|
-
const store = dbTrx.objectStore('outputs');
|
|
1298
|
-
const cursor = await this.openOutputsCursor(store, args.partial, direction);
|
|
1299
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
1300
|
-
if (!(0, idbHelpers_1.matchesOutputPartial)(r, args.partial))
|
|
1301
|
-
return false;
|
|
1302
|
-
if (args.txStatus !== undefined) {
|
|
1303
|
-
const txCount = await this.countTransactions({
|
|
1304
|
-
partial: { transactionId: r.transactionId },
|
|
1305
|
-
status: args.txStatus,
|
|
1306
|
-
trx: dbTrx
|
|
1307
|
-
});
|
|
1308
|
-
if (txCount === 0)
|
|
1309
|
-
return false;
|
|
1310
|
-
}
|
|
1311
|
-
if (tagIds != null && tagIds.length > 0 && !await this.outputMatchesTags(r.outputId, tagIds, isQueryModeAll, dbTrx))
|
|
1312
|
-
return false;
|
|
1313
|
-
return true;
|
|
1314
|
-
}, r => {
|
|
1315
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1316
|
-
if (args.noScript === true)
|
|
1317
|
-
r.script = undefined;
|
|
1318
|
-
filtered(r);
|
|
1319
|
-
});
|
|
1320
|
-
if (args.trx == null)
|
|
1321
|
-
await dbTrx.done;
|
|
1322
|
-
}
|
|
1323
|
-
async outputMatchesTags(outputId, tagIds, isQueryModeAll, dbTrx) {
|
|
1324
|
-
let ids = [...tagIds];
|
|
1325
|
-
await this.filterOutputTagMaps({ partial: { outputId }, trx: dbTrx }, tm => {
|
|
1326
|
-
if (ids.length > 0) {
|
|
1327
|
-
const i = ids.indexOf(tm.outputTagId);
|
|
1328
|
-
if (i >= 0) {
|
|
1329
|
-
if (isQueryModeAll === true) {
|
|
1330
|
-
ids.splice(i, 1);
|
|
1331
|
-
}
|
|
1332
|
-
else {
|
|
1333
|
-
ids = [];
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
});
|
|
1338
|
-
return ids.length === 0;
|
|
1339
|
-
}
|
|
1340
|
-
async findOutputs(args, tagIds, isQueryModeAll) {
|
|
1341
|
-
const results = [];
|
|
1342
|
-
await this.filterOutputs(args, r => {
|
|
1343
|
-
results.push(this.validateEntity(r));
|
|
1344
|
-
}, tagIds, isQueryModeAll);
|
|
1345
|
-
for (const o of results) {
|
|
1346
|
-
if (args.noScript === true) {
|
|
1347
|
-
o.lockingScript = undefined;
|
|
1348
|
-
}
|
|
1349
|
-
else {
|
|
1350
|
-
await this.validateOutputScript(o, args.trx);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
return results;
|
|
1354
|
-
}
|
|
1355
|
-
async filterOutputTags(args, filtered) {
|
|
1356
|
-
const dbTrx = this.toDbTrx(['output_tags'], 'readonly', args.trx);
|
|
1357
|
-
const store = dbTrx.objectStore('output_tags');
|
|
1358
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1359
|
-
let cursor;
|
|
1360
|
-
if (args.partial?.outputTagId != null && args.partial.outputTagId !== 0) {
|
|
1361
|
-
cursor = await store.openCursor(args.partial.outputTagId);
|
|
1362
|
-
}
|
|
1363
|
-
else if (args.partial?.userId !== undefined && args.partial?.tag !== undefined) {
|
|
1364
|
-
cursor = await store.index('tag_userId').openCursor([args.partial.tag, args.partial.userId]);
|
|
1365
|
-
}
|
|
1366
|
-
else if (args.partial?.userId !== undefined) {
|
|
1367
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1368
|
-
}
|
|
1369
|
-
else {
|
|
1370
|
-
cursor = await store.openCursor();
|
|
1371
|
-
}
|
|
1372
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesOutputTagPartial)(r, args.partial), filtered);
|
|
1373
|
-
if (args.trx == null)
|
|
1374
|
-
await dbTrx.done;
|
|
1375
|
-
}
|
|
1376
|
-
async findOutputTags(args) {
|
|
1377
|
-
const result = [];
|
|
1378
|
-
await this.filterOutputTags(args, r => {
|
|
1379
|
-
result.push(this.validateEntity(r));
|
|
1380
|
-
});
|
|
1381
|
-
return result;
|
|
1382
|
-
}
|
|
1383
|
-
async filterSyncStates(args, filtered) {
|
|
1384
|
-
if (args.partial.syncMap != null && args.partial.syncMap !== '') {
|
|
1385
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.syncMap', 'undefined. SyncStates may not be found by syncMap value.');
|
|
1386
|
-
}
|
|
1387
|
-
const dbTrx = this.toDbTrx(['sync_states'], 'readonly', args.trx);
|
|
1388
|
-
const store = dbTrx.objectStore('sync_states');
|
|
1389
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1390
|
-
let cursor;
|
|
1391
|
-
if (args.partial?.syncStateId != null && args.partial.syncStateId !== 0) {
|
|
1392
|
-
cursor = await store.openCursor(args.partial.syncStateId);
|
|
1393
|
-
}
|
|
1394
|
-
else if (args.partial?.userId !== undefined) {
|
|
1395
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1396
|
-
}
|
|
1397
|
-
else if (args.partial?.refNum !== undefined) {
|
|
1398
|
-
cursor = await store.index('refNum').openCursor(args.partial.refNum);
|
|
1399
|
-
}
|
|
1400
|
-
else if (args.partial?.status !== undefined) {
|
|
1401
|
-
cursor = await store.index('status').openCursor(args.partial.status);
|
|
1402
|
-
}
|
|
1403
|
-
else {
|
|
1404
|
-
cursor = await store.openCursor();
|
|
1405
|
-
}
|
|
1406
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesSyncStatePartial)(r, args.partial), filtered);
|
|
1407
|
-
if (args.trx == null)
|
|
1408
|
-
await dbTrx.done;
|
|
1409
|
-
}
|
|
1410
|
-
async findSyncStates(args) {
|
|
1411
|
-
const result = [];
|
|
1412
|
-
await this.filterSyncStates(args, r => {
|
|
1413
|
-
result.push(this.validateEntity(r));
|
|
1414
|
-
});
|
|
1415
|
-
return result;
|
|
1416
|
-
}
|
|
1417
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1418
|
-
async openTransactionsCursor(
|
|
1419
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1420
|
-
store,
|
|
1421
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1422
|
-
partial, direction
|
|
1423
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1424
|
-
) {
|
|
1425
|
-
if (partial?.transactionId != null && partial.transactionId !== 0)
|
|
1426
|
-
return store.openCursor(partial.transactionId, direction);
|
|
1427
|
-
if (partial?.userId !== undefined) {
|
|
1428
|
-
if (partial?.status !== undefined) {
|
|
1429
|
-
return store.index('status_userId').openCursor([partial.status, partial.userId], direction);
|
|
1430
|
-
}
|
|
1431
|
-
return store.index('userId').openCursor(partial.userId, direction);
|
|
1432
|
-
}
|
|
1433
|
-
if (partial?.status !== undefined)
|
|
1434
|
-
return store.index('status').openCursor(partial.status, direction);
|
|
1435
|
-
if (partial?.provenTxId !== undefined)
|
|
1436
|
-
return store.index('provenTxId').openCursor(partial.provenTxId, direction);
|
|
1437
|
-
if (partial?.reference !== undefined)
|
|
1438
|
-
return store.index('reference').openCursor(partial.reference, direction);
|
|
1439
|
-
return store.openCursor(null, direction);
|
|
1440
|
-
}
|
|
1441
|
-
async filterTransactions(args, filtered, labelIds, isQueryModeAll) {
|
|
1442
|
-
if (args.partial.rawTx != null) {
|
|
1443
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.rawTx', 'undefined. Transactions may not be found by rawTx value.');
|
|
1444
|
-
}
|
|
1445
|
-
if (args.partial.inputBEEF != null) {
|
|
1446
|
-
throw new WERR_errors_1.WERR_INVALID_PARAMETER('args.partial.inputBEEF', 'undefined. Transactions may not be found by inputBEEF value.');
|
|
1447
|
-
}
|
|
1448
|
-
const stores = ['transactions'];
|
|
1449
|
-
if (labelIds != null && labelIds.length > 0)
|
|
1450
|
-
stores.push('tx_labels_map');
|
|
1451
|
-
const dbTrx = this.toDbTrx(stores, 'readonly', args.trx);
|
|
1452
|
-
const direction = args.orderDescending === true ? 'prev' : 'next';
|
|
1453
|
-
const store = dbTrx.objectStore('transactions');
|
|
1454
|
-
const cursor = await this.openTransactionsCursor(store, args.partial, direction);
|
|
1455
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, async (r) => {
|
|
1456
|
-
if (args.from != null && r.created_at.getTime() < args.from.getTime())
|
|
1457
|
-
return false;
|
|
1458
|
-
if (args.to != null && r.created_at.getTime() >= args.to.getTime())
|
|
1459
|
-
return false;
|
|
1460
|
-
if (args.status != null && !args.status.includes(r.status))
|
|
1461
|
-
return false;
|
|
1462
|
-
if (!(0, idbHelpers_1.matchesTransactionPartial)(r, args.partial))
|
|
1463
|
-
return false;
|
|
1464
|
-
if (labelIds != null && labelIds.length > 0 && !await this.transactionMatchesLabels(r.transactionId, labelIds, isQueryModeAll, dbTrx))
|
|
1465
|
-
return false;
|
|
1466
|
-
return true;
|
|
1467
|
-
}, filtered);
|
|
1468
|
-
if (args.trx == null)
|
|
1469
|
-
await dbTrx.done;
|
|
1470
|
-
}
|
|
1471
|
-
async transactionMatchesLabels(transactionId, labelIds, isQueryModeAll, dbTrx) {
|
|
1472
|
-
let ids = [...labelIds];
|
|
1473
|
-
await this.filterTxLabelMaps({ partial: { transactionId }, trx: dbTrx }, lm => {
|
|
1474
|
-
if (ids.length > 0) {
|
|
1475
|
-
const i = ids.indexOf(lm.txLabelId);
|
|
1476
|
-
if (i >= 0) {
|
|
1477
|
-
if (isQueryModeAll === true) {
|
|
1478
|
-
ids.splice(i, 1);
|
|
1479
|
-
}
|
|
1480
|
-
else {
|
|
1481
|
-
ids = [];
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
return ids.length === 0;
|
|
1487
|
-
}
|
|
1488
|
-
async findTransactions(args, labelIds, isQueryModeAll) {
|
|
1489
|
-
const results = [];
|
|
1490
|
-
await this.filterTransactions(args, r => {
|
|
1491
|
-
results.push(this.validateEntity(r));
|
|
1492
|
-
}, labelIds, isQueryModeAll);
|
|
1493
|
-
for (const t of results) {
|
|
1494
|
-
if (args.noRawTx === true) {
|
|
1495
|
-
t.rawTx = undefined;
|
|
1496
|
-
t.inputBEEF = undefined;
|
|
1497
|
-
}
|
|
1498
|
-
else {
|
|
1499
|
-
await this.validateRawTransaction(t, args.trx);
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
return results;
|
|
1503
|
-
}
|
|
1504
|
-
async filterTxLabels(args, filtered) {
|
|
1505
|
-
const dbTrx = this.toDbTrx(['tx_labels'], 'readonly', args.trx);
|
|
1506
|
-
const store = dbTrx.objectStore('tx_labels');
|
|
1507
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1508
|
-
let cursor;
|
|
1509
|
-
if (args.partial?.txLabelId != null && args.partial.txLabelId !== 0) {
|
|
1510
|
-
cursor = await store.openCursor(args.partial.txLabelId);
|
|
1511
|
-
}
|
|
1512
|
-
else if (args.partial?.userId !== undefined && args.partial?.label !== undefined) {
|
|
1513
|
-
cursor = await store.index('label_userId').openCursor([args.partial.label, args.partial.userId]);
|
|
1514
|
-
}
|
|
1515
|
-
else if (args.partial?.userId !== undefined) {
|
|
1516
|
-
cursor = await store.index('userId').openCursor(args.partial.userId);
|
|
1517
|
-
}
|
|
1518
|
-
else {
|
|
1519
|
-
cursor = await store.openCursor();
|
|
1520
|
-
}
|
|
1521
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => (0, idbHelpers_1.matchesTxLabelPartial)(r, args.partial), filtered);
|
|
1522
|
-
if (args.trx == null)
|
|
1523
|
-
await dbTrx.done;
|
|
1524
|
-
}
|
|
1525
|
-
async findTxLabels(args) {
|
|
1526
|
-
const result = [];
|
|
1527
|
-
await this.filterTxLabels(args, r => {
|
|
1528
|
-
result.push(this.validateEntity(r));
|
|
1529
|
-
});
|
|
1530
|
-
return result;
|
|
1531
|
-
}
|
|
1532
|
-
matchesUserPartial(r, partial) {
|
|
1533
|
-
if (partial == null)
|
|
1534
|
-
return true;
|
|
1535
|
-
if (partial.userId != null && partial.userId !== 0 && r.userId !== partial.userId)
|
|
1536
|
-
return false;
|
|
1537
|
-
if ((partial.created_at != null) && r.created_at.getTime() !== partial.created_at.getTime())
|
|
1538
|
-
return false;
|
|
1539
|
-
if ((partial.updated_at != null) && r.updated_at.getTime() !== partial.updated_at.getTime())
|
|
1540
|
-
return false;
|
|
1541
|
-
if (partial.identityKey != null && partial.identityKey !== '' && r.identityKey !== partial.identityKey)
|
|
1542
|
-
return false;
|
|
1543
|
-
if (partial.activeStorage != null && partial.activeStorage !== '' && r.activeStorage !== partial.activeStorage)
|
|
1544
|
-
return false;
|
|
1545
|
-
return true;
|
|
1546
|
-
}
|
|
1547
|
-
async filterUsers(args, filtered) {
|
|
1548
|
-
const dbTrx = this.toDbTrx(['users'], 'readonly', args.trx);
|
|
1549
|
-
const cursor = await dbTrx.objectStore('users').openCursor();
|
|
1550
|
-
await scanCursor(cursor, args.since, args.paged?.offset ?? 0, args.paged?.limit, r => this.matchesUserPartial(r, args.partial), filtered);
|
|
1551
|
-
if (args.trx == null)
|
|
1552
|
-
await dbTrx.done;
|
|
1553
|
-
}
|
|
1554
|
-
async findUsers(args) {
|
|
1555
|
-
const result = [];
|
|
1556
|
-
await this.filterUsers(args, r => {
|
|
1557
|
-
result.push(this.validateEntity(r));
|
|
1558
|
-
});
|
|
1559
|
-
return result;
|
|
1560
|
-
}
|
|
1561
|
-
async countCertificateFields(args) {
|
|
1562
|
-
let count = 0;
|
|
1563
|
-
await this.filterCertificateFields(args, () => {
|
|
1564
|
-
count++;
|
|
1565
|
-
});
|
|
1566
|
-
return count;
|
|
1567
|
-
}
|
|
1568
|
-
async countCertificates(args) {
|
|
1569
|
-
let count = 0;
|
|
1570
|
-
await this.filterCertificates(args, () => {
|
|
1571
|
-
count++;
|
|
1572
|
-
});
|
|
1573
|
-
return count;
|
|
1574
|
-
}
|
|
1575
|
-
async countCommissions(args) {
|
|
1576
|
-
let count = 0;
|
|
1577
|
-
await this.filterCommissions(args, () => {
|
|
1578
|
-
count++;
|
|
1579
|
-
});
|
|
1580
|
-
return count;
|
|
1581
|
-
}
|
|
1582
|
-
async countMonitorEvents(args) {
|
|
1583
|
-
let count = 0;
|
|
1584
|
-
await this.filterMonitorEvents(args, () => {
|
|
1585
|
-
count++;
|
|
1586
|
-
});
|
|
1587
|
-
return count;
|
|
1588
|
-
}
|
|
1589
|
-
async countOutputBaskets(args) {
|
|
1590
|
-
let count = 0;
|
|
1591
|
-
await this.filterOutputBaskets(args, () => {
|
|
1592
|
-
count++;
|
|
1593
|
-
});
|
|
1594
|
-
return count;
|
|
1595
|
-
}
|
|
1596
|
-
async countOutputs(args, tagIds, isQueryModeAll) {
|
|
1597
|
-
let count = 0;
|
|
1598
|
-
await this.filterOutputs({ ...args, noScript: true }, () => {
|
|
1599
|
-
count++;
|
|
1600
|
-
}, tagIds, isQueryModeAll);
|
|
1601
|
-
return count;
|
|
1602
|
-
}
|
|
1603
|
-
async countOutputTags(args) {
|
|
1604
|
-
let count = 0;
|
|
1605
|
-
await this.filterOutputTags(args, () => {
|
|
1606
|
-
count++;
|
|
1607
|
-
});
|
|
1608
|
-
return count;
|
|
1609
|
-
}
|
|
1610
|
-
async countSyncStates(args) {
|
|
1611
|
-
let count = 0;
|
|
1612
|
-
await this.filterSyncStates(args, () => {
|
|
1613
|
-
count++;
|
|
1614
|
-
});
|
|
1615
|
-
return count;
|
|
1616
|
-
}
|
|
1617
|
-
async countTransactions(args, labelIds, isQueryModeAll) {
|
|
1618
|
-
let count = 0;
|
|
1619
|
-
await this.filterTransactions({ ...args, noRawTx: true }, () => {
|
|
1620
|
-
count++;
|
|
1621
|
-
}, labelIds, isQueryModeAll);
|
|
1622
|
-
return count;
|
|
1623
|
-
}
|
|
1624
|
-
async countTxLabels(args) {
|
|
1625
|
-
let count = 0;
|
|
1626
|
-
await this.filterTxLabels(args, () => {
|
|
1627
|
-
count++;
|
|
1628
|
-
});
|
|
1629
|
-
return count;
|
|
1630
|
-
}
|
|
1631
|
-
async countUsers(args) {
|
|
1632
|
-
let count = 0;
|
|
1633
|
-
await this.filterUsers(args, () => {
|
|
1634
|
-
count++;
|
|
1635
|
-
});
|
|
1636
|
-
return count;
|
|
1637
|
-
}
|
|
1638
|
-
async getProvenTxsForUser(args) {
|
|
1639
|
-
const results = [];
|
|
1640
|
-
const fargs = {
|
|
1641
|
-
partial: {},
|
|
1642
|
-
since: args.since,
|
|
1643
|
-
paged: args.paged,
|
|
1644
|
-
trx: args.trx
|
|
1645
|
-
};
|
|
1646
|
-
await this.filterProvenTxs(fargs, r => {
|
|
1647
|
-
results.push(this.validateEntity(r));
|
|
1648
|
-
}, args.userId);
|
|
1649
|
-
return results;
|
|
1650
|
-
}
|
|
1651
|
-
async getProvenTxReqsForUser(args) {
|
|
1652
|
-
const results = [];
|
|
1653
|
-
const fargs = {
|
|
1654
|
-
partial: {},
|
|
1655
|
-
since: args.since,
|
|
1656
|
-
paged: args.paged,
|
|
1657
|
-
trx: args.trx
|
|
1658
|
-
};
|
|
1659
|
-
await this.filterProvenTxReqs(fargs, r => {
|
|
1660
|
-
results.push(this.validateEntity(r));
|
|
1661
|
-
}, args.userId);
|
|
1662
|
-
return results;
|
|
1663
|
-
}
|
|
1664
|
-
async getTxLabelMapsForUser(args) {
|
|
1665
|
-
const results = [];
|
|
1666
|
-
const fargs = {
|
|
1667
|
-
partial: {},
|
|
1668
|
-
since: args.since,
|
|
1669
|
-
paged: args.paged,
|
|
1670
|
-
trx: args.trx
|
|
1671
|
-
};
|
|
1672
|
-
await this.filterTxLabelMaps(fargs, r => {
|
|
1673
|
-
results.push(this.validateEntity(r));
|
|
1674
|
-
}, args.userId);
|
|
1675
|
-
return results;
|
|
1676
|
-
}
|
|
1677
|
-
async getOutputTagMapsForUser(args) {
|
|
1678
|
-
const results = [];
|
|
1679
|
-
const fargs = {
|
|
1680
|
-
partial: {},
|
|
1681
|
-
since: args.since,
|
|
1682
|
-
paged: args.paged,
|
|
1683
|
-
trx: args.trx
|
|
1684
|
-
};
|
|
1685
|
-
await this.filterOutputTagMaps(fargs, r => {
|
|
1686
|
-
results.push(this.validateEntity(r));
|
|
1687
|
-
}, args.userId);
|
|
1688
|
-
return results;
|
|
1689
|
-
}
|
|
1690
|
-
async verifyReadyForDatabaseAccess(trx) {
|
|
1691
|
-
this._settings ??= await this.readSettings();
|
|
1692
|
-
return this._settings.dbtype;
|
|
1693
|
-
}
|
|
1694
|
-
/**
|
|
1695
|
-
* Helper to force uniform behavior across database engines.
|
|
1696
|
-
* Use to process all individual records with time stamps or number[] retreived from database.
|
|
1697
|
-
*/
|
|
1698
|
-
validateEntity(entity, dateFields, booleanFields) {
|
|
1699
|
-
entity.created_at = this.validateDate(entity.created_at);
|
|
1700
|
-
entity.updated_at = this.validateDate(entity.updated_at);
|
|
1701
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1702
|
-
const e = entity;
|
|
1703
|
-
this.applyDateFields(e, dateFields);
|
|
1704
|
-
this.applyBooleanFields(e, booleanFields);
|
|
1705
|
-
this.normalizeEntityValues(e);
|
|
1706
|
-
return entity;
|
|
1707
|
-
}
|
|
1708
|
-
applyDateFields(entity, dateFields) {
|
|
1709
|
-
if (dateFields == null)
|
|
1710
|
-
return;
|
|
1711
|
-
for (const df of dateFields) {
|
|
1712
|
-
if (entity[df] != null)
|
|
1713
|
-
entity[df] = this.validateDate(entity[df]);
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
applyBooleanFields(entity, booleanFields) {
|
|
1717
|
-
if (booleanFields == null)
|
|
1718
|
-
return;
|
|
1719
|
-
for (const df of booleanFields) {
|
|
1720
|
-
if (entity[df] !== undefined)
|
|
1721
|
-
entity[df] = entity[df] !== 0 && entity[df] != null && entity[df] !== false;
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
normalizeEntityValues(entity) {
|
|
1725
|
-
for (const key of Object.keys(entity)) {
|
|
1726
|
-
const val = entity[key];
|
|
1727
|
-
if (val === null) {
|
|
1728
|
-
entity[key] = undefined;
|
|
1729
|
-
}
|
|
1730
|
-
else if (val instanceof Uint8Array) {
|
|
1731
|
-
entity[key] = Array.from(val);
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
/**
|
|
1736
|
-
* Helper to force uniform behavior across database engines.
|
|
1737
|
-
* Use to process all arrays of records with time stamps retreived from database.
|
|
1738
|
-
* @returns input `entities` array with contained values validated.
|
|
1739
|
-
*/
|
|
1740
|
-
validateEntities(entities, dateFields, booleanFields) {
|
|
1741
|
-
for (let i = 0; i < entities.length; i++) {
|
|
1742
|
-
entities[i] = this.validateEntity(entities[i], dateFields, booleanFields);
|
|
1743
|
-
}
|
|
1744
|
-
return entities;
|
|
1745
|
-
}
|
|
1746
|
-
/**
|
|
1747
|
-
* Helper to force uniform behavior across database engines.
|
|
1748
|
-
* Use to process the update template for entities being updated.
|
|
1749
|
-
*/
|
|
1750
|
-
validatePartialForUpdate(update, dateFields, booleanFields) {
|
|
1751
|
-
if (this.dbtype == null)
|
|
1752
|
-
throw new WERR_errors_1.WERR_INTERNAL('must call verifyReadyForDatabaseAccess first');
|
|
1753
|
-
const v = { ...update };
|
|
1754
|
-
v.created_at = v.created_at != null ? this.validateEntityDate(v.created_at) : undefined;
|
|
1755
|
-
if (v.created_at == null)
|
|
1756
|
-
delete v.created_at;
|
|
1757
|
-
v.updated_at = v.updated_at != null ? this.validateEntityDate(v.updated_at) : this.validateEntityDate(new Date());
|
|
1758
|
-
this.applyOptionalDateFields(v, dateFields);
|
|
1759
|
-
this.applyIntegerBooleanFields(update, booleanFields);
|
|
1760
|
-
this.normalizeForStorage(v);
|
|
1761
|
-
this.isDirty = true;
|
|
1762
|
-
return v;
|
|
1763
|
-
}
|
|
1764
|
-
applyOptionalDateFields(v, dateFields) {
|
|
1765
|
-
if (dateFields == null)
|
|
1766
|
-
return;
|
|
1767
|
-
for (const df of dateFields) {
|
|
1768
|
-
if (v[df] != null)
|
|
1769
|
-
v[df] = this.validateOptionalEntityDate(v[df]);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
applyIntegerBooleanFields(update, booleanFields) {
|
|
1773
|
-
if (booleanFields == null)
|
|
1774
|
-
return;
|
|
1775
|
-
for (const df of booleanFields) {
|
|
1776
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1777
|
-
const u = update;
|
|
1778
|
-
if (u[df] !== undefined)
|
|
1779
|
-
u[df] = u[df] != null && u[df] !== false ? 1 : 0;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
normalizeForStorage(v) {
|
|
1783
|
-
for (const key of Object.keys(v)) {
|
|
1784
|
-
const val = v[key];
|
|
1785
|
-
if (Array.isArray(val) && (val.length === 0 || Number.isInteger(val[0]))) {
|
|
1786
|
-
v[key] = Uint8Array.from(val);
|
|
1787
|
-
}
|
|
1788
|
-
else if (val === null) {
|
|
1789
|
-
v[key] = undefined;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Helper to force uniform behavior across database engines.
|
|
1795
|
-
* Use to process new entities being inserted into the database.
|
|
1796
|
-
*/
|
|
1797
|
-
async validateEntityForInsert(entity, trx, dateFields, booleanFields) {
|
|
1798
|
-
await this.verifyReadyForDatabaseAccess(trx);
|
|
1799
|
-
const v = { ...entity };
|
|
1800
|
-
v.created_at = this.validateOptionalEntityDate(v.created_at, true) ?? new Date();
|
|
1801
|
-
v.updated_at = this.validateOptionalEntityDate(v.updated_at, true) ?? new Date();
|
|
1802
|
-
if (v.created_at == null)
|
|
1803
|
-
delete v.created_at;
|
|
1804
|
-
if (v.updated_at == null)
|
|
1805
|
-
delete v.updated_at;
|
|
1806
|
-
this.applyOptionalDateFields(v, dateFields);
|
|
1807
|
-
this.applyIntegerBooleanFields(entity, booleanFields);
|
|
1808
|
-
this.normalizeForStorage(v);
|
|
1809
|
-
this.isDirty = true;
|
|
1810
|
-
return v;
|
|
1811
|
-
}
|
|
1812
|
-
async validateRawTransaction(t, trx) {
|
|
1813
|
-
// if there is no txid or there is a rawTransaction return what we have.
|
|
1814
|
-
if (t.rawTx != null || t.txid == null || t.txid === '')
|
|
1815
|
-
return;
|
|
1816
|
-
// rawTransaction is missing, see if we moved it ...
|
|
1817
|
-
const rawTx = await this.getRawTxOfKnownValidTransaction(t.txid, undefined, undefined, trx);
|
|
1818
|
-
if (rawTx == null)
|
|
1819
|
-
return;
|
|
1820
|
-
t.rawTx = rawTx;
|
|
1821
|
-
}
|
|
1822
|
-
async adminStats(adminIdentityKey) {
|
|
1823
|
-
throw new Error('Method intentionally not implemented for personal storage.');
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
exports.StorageIdb = StorageIdb;
|
|
1827
|
-
//# sourceMappingURL=StorageIdb.js.map
|