@drift-labs/common 1.0.0
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/lib/Config.d.ts +26 -0
- package/lib/Config.js +29 -0
- package/lib/Config.js.map +1 -0
- package/lib/EnvironmentConstants.d.ts +40 -0
- package/lib/EnvironmentConstants.js +64 -0
- package/lib/EnvironmentConstants.js.map +1 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.d.ts +16 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.js +151 -0
- package/lib/actions/actionHelpers/accountDeletionHelpers.js.map +1 -0
- package/lib/actions/actionHelpers/actionHelpers.d.ts +13 -0
- package/lib/actions/actionHelpers/actionHelpers.js +8 -0
- package/lib/actions/actionHelpers/actionHelpers.js.map +1 -0
- package/lib/chartConstants.d.ts +2 -0
- package/lib/chartConstants.js +14 -0
- package/lib/chartConstants.js.map +1 -0
- package/lib/clients/candleClient.d.ts +74 -0
- package/lib/clients/candleClient.js +364 -0
- package/lib/clients/candleClient.js.map +1 -0
- package/lib/clients/dataApiWsClient.d.ts +33 -0
- package/lib/clients/dataApiWsClient.js +118 -0
- package/lib/clients/dataApiWsClient.js.map +1 -0
- package/lib/clients/index.d.ts +1 -0
- package/lib/clients/index.js +19 -0
- package/lib/clients/index.js.map +1 -0
- package/lib/clients/marketDataFeed.d.ts +42 -0
- package/lib/clients/marketDataFeed.js +422 -0
- package/lib/clients/marketDataFeed.js.map +1 -0
- package/lib/clients/redisClient.d.ts +89 -0
- package/lib/clients/redisClient.js +647 -0
- package/lib/clients/redisClient.js.map +1 -0
- package/lib/clients/swiftClient.d.ts +57 -0
- package/lib/clients/swiftClient.js +289 -0
- package/lib/clients/swiftClient.js.map +1 -0
- package/lib/clients/tvFeed.d.ts +63 -0
- package/lib/clients/tvFeed.js +351 -0
- package/lib/clients/tvFeed.js.map +1 -0
- package/lib/common-ui-utils/commonUiUtils.d.ts +211 -0
- package/lib/common-ui-utils/commonUiUtils.js +624 -0
- package/lib/common-ui-utils/commonUiUtils.js.map +1 -0
- package/lib/common-ui-utils/index.d.ts +6 -0
- package/lib/common-ui-utils/index.js +23 -0
- package/lib/common-ui-utils/index.js.map +1 -0
- package/lib/common-ui-utils/market.d.ts +27 -0
- package/lib/common-ui-utils/market.js +80 -0
- package/lib/common-ui-utils/market.js.map +1 -0
- package/lib/common-ui-utils/order.d.ts +11 -0
- package/lib/common-ui-utils/order.js +161 -0
- package/lib/common-ui-utils/order.js.map +1 -0
- package/lib/common-ui-utils/settings/settings.d.ts +51 -0
- package/lib/common-ui-utils/settings/settings.js +84 -0
- package/lib/common-ui-utils/settings/settings.js.map +1 -0
- package/lib/common-ui-utils/trading.d.ts +56 -0
- package/lib/common-ui-utils/trading.js +200 -0
- package/lib/common-ui-utils/trading.js.map +1 -0
- package/lib/common-ui-utils/user.d.ts +13 -0
- package/lib/common-ui-utils/user.js +124 -0
- package/lib/common-ui-utils/user.js.map +1 -0
- package/lib/constants/autogenerated/driftErrors.json +1787 -0
- package/lib/constants/autogenerated/jup-v4-error-codes.json +67 -0
- package/lib/constants/autogenerated/jup-v6-error-codes.json +115 -0
- package/lib/constants/dev.d.ts +15 -0
- package/lib/constants/dev.js +19 -0
- package/lib/constants/dev.js.map +1 -0
- package/lib/constants/geoblockList.d.ts +4 -0
- package/lib/constants/geoblockList.js +32 -0
- package/lib/constants/geoblockList.js.map +1 -0
- package/lib/constants/index.d.ts +9 -0
- package/lib/constants/index.js +26 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/markets.d.ts +1 -0
- package/lib/constants/markets.js +5 -0
- package/lib/constants/markets.js.map +1 -0
- package/lib/constants/misc.d.ts +23 -0
- package/lib/constants/misc.js +27 -0
- package/lib/constants/misc.js.map +1 -0
- package/lib/constants/orders.d.ts +12 -0
- package/lib/constants/orders.js +79 -0
- package/lib/constants/orders.js.map +1 -0
- package/lib/constants/pools.d.ts +5 -0
- package/lib/constants/pools.js +9 -0
- package/lib/constants/pools.js.map +1 -0
- package/lib/constants/predictionMarket.d.ts +3 -0
- package/lib/constants/predictionMarket.js +7 -0
- package/lib/constants/predictionMarket.js.map +1 -0
- package/lib/constants/superstake.d.ts +22 -0
- package/lib/constants/superstake.js +45 -0
- package/lib/constants/superstake.js.map +1 -0
- package/lib/constants/trade.d.ts +2 -0
- package/lib/constants/trade.js +9 -0
- package/lib/constants/trade.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.d.ts +68 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.js +146 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftL2OrderbookManager.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.d.ts +204 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js +530 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.d.ts +90 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.js +3 -0
- package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/types.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.d.ts +139 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.js +287 -0
- package/lib/drift/Drift/clients/AuthorityDrift/SubscriptionManager.js.map +1 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.d.ts +242 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.js +503 -0
- package/lib/drift/Drift/clients/AuthorityDrift/index.js.map +1 -0
- package/lib/drift/Drift/clients/CentralServerDrift.d.ts +91 -0
- package/lib/drift/Drift/clients/CentralServerDrift.js +326 -0
- package/lib/drift/Drift/clients/CentralServerDrift.js.map +1 -0
- package/lib/drift/Drift/clients/index.d.ts +3 -0
- package/lib/drift/Drift/clients/index.js +20 -0
- package/lib/drift/Drift/clients/index.js.map +1 -0
- package/lib/drift/Drift/constants/blockchain.d.ts +24 -0
- package/lib/drift/Drift/constants/blockchain.js +32 -0
- package/lib/drift/Drift/constants/blockchain.js.map +1 -0
- package/lib/drift/Drift/constants/errors.d.ts +6 -0
- package/lib/drift/Drift/constants/errors.js +14 -0
- package/lib/drift/Drift/constants/errors.js.map +1 -0
- package/lib/drift/Drift/constants/index.d.ts +3 -0
- package/lib/drift/Drift/constants/index.js +20 -0
- package/lib/drift/Drift/constants/index.js.map +1 -0
- package/lib/drift/Drift/constants/orderbook.d.ts +7 -0
- package/lib/drift/Drift/constants/orderbook.js +10 -0
- package/lib/drift/Drift/constants/orderbook.js.map +1 -0
- package/lib/drift/Drift/data/PollingDlob.d.ts +154 -0
- package/lib/drift/Drift/data/PollingDlob.js +387 -0
- package/lib/drift/Drift/data/PollingDlob.js.map +1 -0
- package/lib/drift/Drift/data/index.d.ts +1 -0
- package/lib/drift/Drift/data/index.js +18 -0
- package/lib/drift/Drift/data/index.js.map +1 -0
- package/lib/drift/Drift/index.d.ts +4 -0
- package/lib/drift/Drift/index.js +21 -0
- package/lib/drift/Drift/index.js.map +1 -0
- package/lib/drift/Drift/stores/MarkPriceCache.d.ts +27 -0
- package/lib/drift/Drift/stores/MarkPriceCache.js +59 -0
- package/lib/drift/Drift/stores/MarkPriceCache.js.map +1 -0
- package/lib/drift/Drift/stores/OraclePriceCache.d.ts +21 -0
- package/lib/drift/Drift/stores/OraclePriceCache.js +57 -0
- package/lib/drift/Drift/stores/OraclePriceCache.js.map +1 -0
- package/lib/drift/Drift/stores/UserAccountCache.d.ts +49 -0
- package/lib/drift/Drift/stores/UserAccountCache.js +107 -0
- package/lib/drift/Drift/stores/UserAccountCache.js.map +1 -0
- package/lib/drift/Drift/stores/index.d.ts +3 -0
- package/lib/drift/Drift/stores/index.js +20 -0
- package/lib/drift/Drift/stores/index.js.map +1 -0
- package/lib/drift/base/actions/index.d.ts +4 -0
- package/lib/drift/base/actions/index.js +21 -0
- package/lib/drift/base/actions/index.js.map +1 -0
- package/lib/drift/base/actions/perp/index.d.ts +2 -0
- package/lib/drift/base/actions/perp/index.js +19 -0
- package/lib/drift/base/actions/perp/index.js.map +1 -0
- package/lib/drift/base/actions/perp/settleFunding.d.ts +25 -0
- package/lib/drift/base/actions/perp/settleFunding.js +41 -0
- package/lib/drift/base/actions/perp/settleFunding.js.map +1 -0
- package/lib/drift/base/actions/perp/settlePnl.d.ts +35 -0
- package/lib/drift/base/actions/perp/settlePnl.js +44 -0
- package/lib/drift/base/actions/perp/settlePnl.js.map +1 -0
- package/lib/drift/base/actions/spot/borrow.d.ts +1 -0
- package/lib/drift/base/actions/spot/borrow.js +8 -0
- package/lib/drift/base/actions/spot/borrow.js.map +1 -0
- package/lib/drift/base/actions/spot/deposit.d.ts +40 -0
- package/lib/drift/base/actions/spot/deposit.js +82 -0
- package/lib/drift/base/actions/spot/deposit.js.map +1 -0
- package/lib/drift/base/actions/spot/index.d.ts +3 -0
- package/lib/drift/base/actions/spot/index.js +20 -0
- package/lib/drift/base/actions/spot/index.js.map +1 -0
- package/lib/drift/base/actions/spot/withdraw.d.ts +16 -0
- package/lib/drift/base/actions/spot/withdraw.js +39 -0
- package/lib/drift/base/actions/spot/withdraw.js.map +1 -0
- package/lib/drift/base/actions/trade/cancelOrder.d.ts +47 -0
- package/lib/drift/base/actions/trade/cancelOrder.js +55 -0
- package/lib/drift/base/actions/trade/cancelOrder.js.map +1 -0
- package/lib/drift/base/actions/trade/editOrder.d.ts +55 -0
- package/lib/drift/base/actions/trade/editOrder.js +35 -0
- package/lib/drift/base/actions/trade/editOrder.js.map +1 -0
- package/lib/drift/base/actions/trade/index.d.ts +4 -0
- package/lib/drift/base/actions/trade/index.js +21 -0
- package/lib/drift/base/actions/trade/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.d.ts +3 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.js +20 -0
- package/lib/drift/base/actions/trade/openPerpOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.d.ts +84 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js +293 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.d.ts +19 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js +161 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.d.ts +166 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js +156 -0
- package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js.map +1 -0
- package/lib/drift/base/actions/trade/swap.d.ts +62 -0
- package/lib/drift/base/actions/trade/swap.js +60 -0
- package/lib/drift/base/actions/trade/swap.js.map +1 -0
- package/lib/drift/base/actions/user/create.d.ts +75 -0
- package/lib/drift/base/actions/user/create.js +104 -0
- package/lib/drift/base/actions/user/create.js.map +1 -0
- package/lib/drift/base/actions/user/delete.d.ts +47 -0
- package/lib/drift/base/actions/user/delete.js +39 -0
- package/lib/drift/base/actions/user/delete.js.map +1 -0
- package/lib/drift/base/actions/user/index.d.ts +1 -0
- package/lib/drift/base/actions/user/index.js +18 -0
- package/lib/drift/base/actions/user/index.js.map +1 -0
- package/lib/drift/base/constants/accountNames.d.ts +1 -0
- package/lib/drift/base/constants/accountNames.js +13 -0
- package/lib/drift/base/constants/accountNames.js.map +1 -0
- package/lib/drift/base/details/index.d.ts +2 -0
- package/lib/drift/base/details/index.js +19 -0
- package/lib/drift/base/details/index.js.map +1 -0
- package/lib/drift/base/details/market/funding.d.ts +9 -0
- package/lib/drift/base/details/market/funding.js +50 -0
- package/lib/drift/base/details/market/funding.js.map +1 -0
- package/lib/drift/base/details/market/index.d.ts +2 -0
- package/lib/drift/base/details/market/index.js +19 -0
- package/lib/drift/base/details/market/index.js.map +1 -0
- package/lib/drift/base/details/market/openInterest.d.ts +5 -0
- package/lib/drift/base/details/market/openInterest.js +12 -0
- package/lib/drift/base/details/market/openInterest.js.map +1 -0
- package/lib/drift/base/details/user/balances.d.ts +40 -0
- package/lib/drift/base/details/user/balances.js +39 -0
- package/lib/drift/base/details/user/balances.js.map +1 -0
- package/lib/drift/base/details/user/index.d.ts +4 -0
- package/lib/drift/base/details/user/index.js +21 -0
- package/lib/drift/base/details/user/index.js.map +1 -0
- package/lib/drift/base/details/user/marginInfo.d.ts +29 -0
- package/lib/drift/base/details/user/marginInfo.js +49 -0
- package/lib/drift/base/details/user/marginInfo.js.map +1 -0
- package/lib/drift/base/details/user/orders.d.ts +3 -0
- package/lib/drift/base/details/user/orders.js +11 -0
- package/lib/drift/base/details/user/orders.js.map +1 -0
- package/lib/drift/base/details/user/positions.d.ts +70 -0
- package/lib/drift/base/details/user/positions.js +146 -0
- package/lib/drift/base/details/user/positions.js.map +1 -0
- package/lib/drift/cli.d.ts +25 -0
- package/lib/drift/cli.js +900 -0
- package/lib/drift/cli.js.map +1 -0
- package/lib/drift/constants/apiUrls.d.ts +27 -0
- package/lib/drift/constants/apiUrls.js +31 -0
- package/lib/drift/constants/apiUrls.js.map +1 -0
- package/lib/drift/example.d.ts +19 -0
- package/lib/drift/example.js +249 -0
- package/lib/drift/example.js.map +1 -0
- package/lib/drift/index.d.ts +3 -0
- package/lib/drift/index.js +20 -0
- package/lib/drift/index.js.map +1 -0
- package/lib/drift/utils/auctionParamsResponseMapper.d.ts +45 -0
- package/lib/drift/utils/auctionParamsResponseMapper.js +148 -0
- package/lib/drift/utils/auctionParamsResponseMapper.js.map +1 -0
- package/lib/drift/utils/funding.d.ts +2 -0
- package/lib/drift/utils/funding.js +9 -0
- package/lib/drift/utils/funding.js.map +1 -0
- package/lib/drift/utils/index.d.ts +3 -0
- package/lib/drift/utils/index.js +23 -0
- package/lib/drift/utils/index.js.map +1 -0
- package/lib/drift/utils/orderParams.d.ts +48 -0
- package/lib/drift/utils/orderParams.js +140 -0
- package/lib/drift/utils/orderParams.js.map +1 -0
- package/lib/index.d.ts +45 -0
- package/lib/index.js +68 -0
- package/lib/index.js.map +1 -0
- package/lib/serializableTypes.d.ts +961 -0
- package/lib/serializableTypes.js +3887 -0
- package/lib/serializableTypes.js.map +1 -0
- package/lib/types/MarketId.d.ts +26 -0
- package/lib/types/MarketId.js +64 -0
- package/lib/types/MarketId.js.map +1 -0
- package/lib/types/Superstake.d.ts +7 -0
- package/lib/types/Superstake.js +3 -0
- package/lib/types/Superstake.js.map +1 -0
- package/lib/types/UIEnv.d.ts +26 -0
- package/lib/types/UIEnv.js +49 -0
- package/lib/types/UIEnv.js.map +1 -0
- package/lib/types/UIMarket.d.ts +94 -0
- package/lib/types/UIMarket.js +224 -0
- package/lib/types/UIMarket.js.map +1 -0
- package/lib/types/candles.d.ts +4 -0
- package/lib/types/candles.js +9 -0
- package/lib/types/candles.js.map +1 -0
- package/lib/types/dataServer.d.ts +53 -0
- package/lib/types/dataServer.js +3 -0
- package/lib/types/dataServer.js.map +1 -0
- package/lib/types/historyServer.d.ts +38 -0
- package/lib/types/historyServer.js +11 -0
- package/lib/types/historyServer.js.map +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +29 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/leaderboard.d.ts +80 -0
- package/lib/types/leaderboard.js +11 -0
- package/lib/types/leaderboard.js.map +1 -0
- package/lib/types/remote-configs.d.ts +61 -0
- package/lib/types/remote-configs.js +3 -0
- package/lib/types/remote-configs.js.map +1 -0
- package/lib/types/trade.d.ts +18 -0
- package/lib/types/trade.js +3 -0
- package/lib/types/trade.js.map +1 -0
- package/lib/types/user.d.ts +40 -0
- package/lib/types/user.js +3 -0
- package/lib/types/user.js.map +1 -0
- package/lib/types/utility.d.ts +15 -0
- package/lib/types/utility.js +3 -0
- package/lib/types/utility.js.map +1 -0
- package/lib/utils/CircularBuffers/CircularBuffer.d.ts +22 -0
- package/lib/utils/CircularBuffers/CircularBuffer.js +73 -0
- package/lib/utils/CircularBuffers/CircularBuffer.js.map +1 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.d.ts +19 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.js +78 -0
- package/lib/utils/CircularBuffers/UniqueCircularBuffer.js.map +1 -0
- package/lib/utils/CircularBuffers/index.d.ts +2 -0
- package/lib/utils/CircularBuffers/index.js +19 -0
- package/lib/utils/CircularBuffers/index.js.map +1 -0
- package/lib/utils/MultiplexWebSocket.d.ts +95 -0
- package/lib/utils/MultiplexWebSocket.js +416 -0
- package/lib/utils/MultiplexWebSocket.js.map +1 -0
- package/lib/utils/NumLib.d.ts +106 -0
- package/lib/utils/NumLib.js +300 -0
- package/lib/utils/NumLib.js.map +1 -0
- package/lib/utils/SharedInterval.d.ts +21 -0
- package/lib/utils/SharedInterval.js +47 -0
- package/lib/utils/SharedInterval.js.map +1 -0
- package/lib/utils/SlotBasedResultValidator.d.ts +9 -0
- package/lib/utils/SlotBasedResultValidator.js +27 -0
- package/lib/utils/SlotBasedResultValidator.js.map +1 -0
- package/lib/utils/Stopwatch.d.ts +15 -0
- package/lib/utils/Stopwatch.js +31 -0
- package/lib/utils/Stopwatch.js.map +1 -0
- package/lib/utils/StrictEventEmitter.d.ts +15 -0
- package/lib/utils/StrictEventEmitter.js +55 -0
- package/lib/utils/StrictEventEmitter.js.map +1 -0
- package/lib/utils/WalletConnectionState.d.ts +31 -0
- package/lib/utils/WalletConnectionState.js +83 -0
- package/lib/utils/WalletConnectionState.js.map +1 -0
- package/lib/utils/assert.d.ts +1 -0
- package/lib/utils/assert.js +10 -0
- package/lib/utils/assert.js.map +1 -0
- package/lib/utils/candles/Candle.d.ts +94 -0
- package/lib/utils/candles/Candle.js +580 -0
- package/lib/utils/candles/Candle.js.map +1 -0
- package/lib/utils/candles/types.d.ts +8 -0
- package/lib/utils/candles/types.js +3 -0
- package/lib/utils/candles/types.js.map +1 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.d.ts +57 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.js +137 -0
- package/lib/utils/dlob-server/DlobServerWebsocketUtils.js.map +1 -0
- package/lib/utils/driftEvents.d.ts +10 -0
- package/lib/utils/driftEvents.js +123 -0
- package/lib/utils/driftEvents.js.map +1 -0
- package/lib/utils/equalityChecks.d.ts +12 -0
- package/lib/utils/equalityChecks.js +71 -0
- package/lib/utils/equalityChecks.js.map +1 -0
- package/lib/utils/featureFlags.d.ts +3 -0
- package/lib/utils/featureFlags.js +7 -0
- package/lib/utils/featureFlags.js.map +1 -0
- package/lib/utils/geoblock/index.d.ts +4 -0
- package/lib/utils/geoblock/index.js +20 -0
- package/lib/utils/geoblock/index.js.map +1 -0
- package/lib/utils/index.d.ts +181 -0
- package/lib/utils/index.js +608 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/insuranceFund.d.ts +15 -0
- package/lib/utils/insuranceFund.js +84 -0
- package/lib/utils/insuranceFund.js.map +1 -0
- package/lib/utils/logger.d.ts +5 -0
- package/lib/utils/logger.js +53 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/math.d.ts +10 -0
- package/lib/utils/math.js +89 -0
- package/lib/utils/math.js.map +1 -0
- package/lib/utils/orderbook/index.d.ts +65 -0
- package/lib/utils/orderbook/index.js +80 -0
- package/lib/utils/orderbook/index.js.map +1 -0
- package/lib/utils/pollingSequenceGuard.d.ts +9 -0
- package/lib/utils/pollingSequenceGuard.js +24 -0
- package/lib/utils/pollingSequenceGuard.js.map +1 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.d.ts +24 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.js +53 -0
- package/lib/utils/priority-fees/PriorityFeeCalculator.js.map +1 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.d.ts +5 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.js +43 -0
- package/lib/utils/priority-fees/PriorityFeeStrategies.js.map +1 -0
- package/lib/utils/priority-fees/index.d.ts +2 -0
- package/lib/utils/priority-fees/index.js +19 -0
- package/lib/utils/priority-fees/index.js.map +1 -0
- package/lib/utils/priorityFees.d.ts +14 -0
- package/lib/utils/priorityFees.js +68 -0
- package/lib/utils/priorityFees.js.map +1 -0
- package/lib/utils/rpcLatency.d.ts +7 -0
- package/lib/utils/rpcLatency.js +49 -0
- package/lib/utils/rpcLatency.js.map +1 -0
- package/lib/utils/rxjs.d.ts +11 -0
- package/lib/utils/rxjs.js +24 -0
- package/lib/utils/rxjs.js.map +1 -0
- package/lib/utils/s3Buckets.d.ts +43 -0
- package/lib/utils/s3Buckets.js +108 -0
- package/lib/utils/s3Buckets.js.map +1 -0
- package/lib/utils/superstake.d.ts +86 -0
- package/lib/utils/superstake.js +224 -0
- package/lib/utils/superstake.js.map +1 -0
- package/lib/utils/token.d.ts +16 -0
- package/lib/utils/token.js +44 -0
- package/lib/utils/token.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RedisClient = exports.getRedisClient = exports.getRedisClusterClient = exports.RedisClientPrefix = void 0;
|
|
16
|
+
const __1 = require("..");
|
|
17
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
18
|
+
const BULK_WRITE_CHUNK_SIZE = 500;
|
|
19
|
+
const BULK_READ_CHUNK_SIZE = 1000;
|
|
20
|
+
const CHUNK_SLEEP_TIME = 100;
|
|
21
|
+
var RedisClientPrefix;
|
|
22
|
+
(function (RedisClientPrefix) {
|
|
23
|
+
RedisClientPrefix["EXCHANGE"] = "";
|
|
24
|
+
RedisClientPrefix["USER_MAP"] = "usermap-server:";
|
|
25
|
+
RedisClientPrefix["DLOB"] = "dlob:";
|
|
26
|
+
RedisClientPrefix["DLOB_HELIUS"] = "dlob-helius:";
|
|
27
|
+
})(RedisClientPrefix || (exports.RedisClientPrefix = RedisClientPrefix = {}));
|
|
28
|
+
function isWrite() {
|
|
29
|
+
return function (_target, propertyKey, descriptor) {
|
|
30
|
+
const method = descriptor.value;
|
|
31
|
+
const methodName = propertyKey;
|
|
32
|
+
descriptor.value = function (...args) {
|
|
33
|
+
if (process.env.DISABLE_CACHE_WRITE) {
|
|
34
|
+
console.log(`DISABLE_CACHE_WRITE=true :: Skipping ${methodName}`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Run the decorated method and return the value
|
|
38
|
+
const returnValue = method.apply(this, args);
|
|
39
|
+
return returnValue;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function isRead(_target, _propertyKey, descriptor) {
|
|
44
|
+
return descriptor;
|
|
45
|
+
}
|
|
46
|
+
const getTlsConfiguration = () => {
|
|
47
|
+
if (process.env.RUNNING_LOCAL === 'true' &&
|
|
48
|
+
process.env.LOCAL_CACHE === 'true') {
|
|
49
|
+
console.log('Redis: Running LOCAL with LOCAL cache');
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
if (process.env.RUNNING_LOCAL === 'true') {
|
|
53
|
+
console.log('Redis: Running LOCAL with REMOTE cache');
|
|
54
|
+
return {
|
|
55
|
+
checkServerIdentity: () => {
|
|
56
|
+
return undefined;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
console.log('Redis: Making a tls connection');
|
|
61
|
+
return {};
|
|
62
|
+
};
|
|
63
|
+
const getNatMap = () => {
|
|
64
|
+
var _a;
|
|
65
|
+
if (process.env.RUNNING_LOCAL === 'true' &&
|
|
66
|
+
process.env.LOCAL_CACHE === 'false') {
|
|
67
|
+
console.log('Redis: Getting NATMAP for remote connection');
|
|
68
|
+
const natMap = ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NAT_MAP)
|
|
69
|
+
? JSON.parse(process.env.NAT_MAP)
|
|
70
|
+
: false;
|
|
71
|
+
console.log(`NATMAP: ${process.env.NAT_MAP}`);
|
|
72
|
+
if (!natMap) {
|
|
73
|
+
throw new Error('NATMAP not found. When running the openElasticacheTunnel script copy the output into your terminal');
|
|
74
|
+
}
|
|
75
|
+
return natMap;
|
|
76
|
+
}
|
|
77
|
+
return {};
|
|
78
|
+
};
|
|
79
|
+
const getRedisClusterClient = (host, port, prefix, opts) => {
|
|
80
|
+
if (host && port) {
|
|
81
|
+
console.log(`Connecting to configured cluster redis:: ${host}:${port}`);
|
|
82
|
+
const redisClient = new ioredis_1.default.Cluster([
|
|
83
|
+
{
|
|
84
|
+
host,
|
|
85
|
+
port: parseInt(port, 10),
|
|
86
|
+
},
|
|
87
|
+
], {
|
|
88
|
+
keyPrefix: prefix,
|
|
89
|
+
natMap: getNatMap(),
|
|
90
|
+
clusterRetryStrategy: (times) => {
|
|
91
|
+
const delay = Math.min(times * 1000, 10000);
|
|
92
|
+
console.log(`Reconnecting to Redis in ${delay}ms... (retries: ${times})`);
|
|
93
|
+
return delay;
|
|
94
|
+
},
|
|
95
|
+
dnsLookup: (address, callback) => callback(null, address),
|
|
96
|
+
redisOptions: {
|
|
97
|
+
reconnectOnError: (err) => {
|
|
98
|
+
const targetError = 'ECONNREFUSED';
|
|
99
|
+
if (err.message.includes(targetError)) {
|
|
100
|
+
console.log(`Redis error: ${targetError}. Attempting to reconnect...`);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
},
|
|
105
|
+
maxRetriesPerRequest: null,
|
|
106
|
+
tls: getTlsConfiguration(),
|
|
107
|
+
},
|
|
108
|
+
...(opts !== null && opts !== void 0 ? opts : {}),
|
|
109
|
+
});
|
|
110
|
+
redisClient.on('connect', () => {
|
|
111
|
+
console.log('Connected to Redis.');
|
|
112
|
+
});
|
|
113
|
+
redisClient.on('error', (err) => {
|
|
114
|
+
console.error('Redis error:', err);
|
|
115
|
+
});
|
|
116
|
+
redisClient.on('reconnecting', () => {
|
|
117
|
+
console.log('Reconnecting to Redis...');
|
|
118
|
+
});
|
|
119
|
+
return redisClient;
|
|
120
|
+
}
|
|
121
|
+
throw Error('Missing redis client configuration');
|
|
122
|
+
};
|
|
123
|
+
exports.getRedisClusterClient = getRedisClusterClient;
|
|
124
|
+
const getRedisClient = (host, port, prefix, opts) => {
|
|
125
|
+
if (host && port) {
|
|
126
|
+
console.log(`Connecting to configured redis:: ${host}:${port}`);
|
|
127
|
+
const redisClient = new ioredis_1.default({
|
|
128
|
+
host,
|
|
129
|
+
port: parseInt(port, 10),
|
|
130
|
+
keyPrefix: prefix,
|
|
131
|
+
retryStrategy: (times) => {
|
|
132
|
+
const delay = Math.min(times * 1000, 10000);
|
|
133
|
+
console.log(`Reconnecting to Redis in ${delay}ms... (retries: ${times})`);
|
|
134
|
+
return delay;
|
|
135
|
+
},
|
|
136
|
+
reconnectOnError: (err) => {
|
|
137
|
+
const targetError = 'ECONNREFUSED';
|
|
138
|
+
if (err.message.includes(targetError)) {
|
|
139
|
+
console.log(`Redis error: ${targetError}. Attempting to reconnect...`);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
},
|
|
144
|
+
maxRetriesPerRequest: null,
|
|
145
|
+
tls: getTlsConfiguration(),
|
|
146
|
+
...(opts !== null && opts !== void 0 ? opts : {}),
|
|
147
|
+
});
|
|
148
|
+
redisClient.on('connect', () => {
|
|
149
|
+
console.log('Connected to Redis.');
|
|
150
|
+
});
|
|
151
|
+
redisClient.on('error', (err) => {
|
|
152
|
+
console.error('Redis error:', err);
|
|
153
|
+
});
|
|
154
|
+
redisClient.on('reconnecting', () => {
|
|
155
|
+
console.log('Reconnecting to Redis...');
|
|
156
|
+
});
|
|
157
|
+
return redisClient;
|
|
158
|
+
}
|
|
159
|
+
throw Error('Missing redis client configuration');
|
|
160
|
+
};
|
|
161
|
+
exports.getRedisClient = getRedisClient;
|
|
162
|
+
/**
|
|
163
|
+
* Wrapper around the redis client.
|
|
164
|
+
*
|
|
165
|
+
* You can hover over the underlying redis client methods for explanations of the methods, but will also include links to DOCS for some important concepts below:
|
|
166
|
+
*
|
|
167
|
+
* zRange, zRangeByScore etc.:
|
|
168
|
+
* - All of the "z" methods are methods that use sorted sets.
|
|
169
|
+
* - Sorted sets are explained here : https://redis.io/docs/data-types/sorted-sets/
|
|
170
|
+
*/
|
|
171
|
+
class RedisClient {
|
|
172
|
+
constructor(_a) {
|
|
173
|
+
var _b, _c;
|
|
174
|
+
var { host = (_b = process.env.ELASTICACHE_HOST) !== null && _b !== void 0 ? _b : 'localhost', port = (_c = process.env.ELASTICACHE_PORT) !== null && _c !== void 0 ? _c : '6379', prefix = RedisClientPrefix.EXCHANGE, opts, cluster = process.env.LOCAL_CACHE === 'true' &&
|
|
175
|
+
process.env.RUNNING_LOCAL === 'true', } = _a;
|
|
176
|
+
this.prefix = prefix;
|
|
177
|
+
if (cluster) {
|
|
178
|
+
this.client = (0, exports.getRedisClusterClient)(host, port, prefix, opts);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.client = (0, exports.getRedisClient)(host, port, prefix, opts);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Should avoid using this unless necessary.
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
forceGetClient() {
|
|
188
|
+
return this.client;
|
|
189
|
+
}
|
|
190
|
+
getPrefix() {
|
|
191
|
+
return this.prefix;
|
|
192
|
+
}
|
|
193
|
+
get connected() {
|
|
194
|
+
var _a;
|
|
195
|
+
return ((_a = this === null || this === void 0 ? void 0 : this.client) === null || _a === void 0 ? void 0 : _a.status) === 'ready';
|
|
196
|
+
}
|
|
197
|
+
async connect() {
|
|
198
|
+
if (process.env.CI_TEST)
|
|
199
|
+
return;
|
|
200
|
+
if (this.connected)
|
|
201
|
+
return;
|
|
202
|
+
await (0, __1.sleep)(100);
|
|
203
|
+
if (this.client.status === 'connecting') {
|
|
204
|
+
return this.connectionPromise;
|
|
205
|
+
}
|
|
206
|
+
if (this.client.status === 'connect') {
|
|
207
|
+
return this.connectionPromise;
|
|
208
|
+
}
|
|
209
|
+
if (this.client.status === 'ready') {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
this.client.on('error', (error) => console.log(`'Redis Client Error :: ', ${error === null || error === void 0 ? void 0 : error.message}`));
|
|
213
|
+
try {
|
|
214
|
+
await this.client.connect();
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
console.error(e);
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
disconnect() {
|
|
222
|
+
if (process.env.CI_TEST)
|
|
223
|
+
return;
|
|
224
|
+
this.client.disconnect();
|
|
225
|
+
}
|
|
226
|
+
assertConnected() {
|
|
227
|
+
if (!this.connected) {
|
|
228
|
+
throw 'Redis client not connected';
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* IMPORTANT NOTE: non-expiring keys will not be cleared up by the eviction policy, so they must be cleared manually
|
|
233
|
+
* @param key
|
|
234
|
+
* @param value
|
|
235
|
+
*/
|
|
236
|
+
async set(key, value) {
|
|
237
|
+
this.assertConnected();
|
|
238
|
+
this.client.set(key, JSON.stringify(value));
|
|
239
|
+
}
|
|
240
|
+
async setRaw(key, value) {
|
|
241
|
+
this.assertConnected();
|
|
242
|
+
this.client.set(key, value);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* IMPORTANT NOTE: non-expiring keys will not be cleared up by the eviction policy, so they must be cleared manually
|
|
246
|
+
* @param key
|
|
247
|
+
* @param value
|
|
248
|
+
*/
|
|
249
|
+
async mset(values) {
|
|
250
|
+
this.assertConnected();
|
|
251
|
+
if (values.length === 0)
|
|
252
|
+
return;
|
|
253
|
+
const chunkedValues = __1.COMMON_UTILS.chunks(values, BULK_WRITE_CHUNK_SIZE);
|
|
254
|
+
for (const valuesChunk of chunkedValues) {
|
|
255
|
+
for (const [key, val] of valuesChunk) {
|
|
256
|
+
await this.client.set(key, JSON.stringify(val));
|
|
257
|
+
}
|
|
258
|
+
if (chunkedValues.length > 0) {
|
|
259
|
+
await (0, __1.sleep)(CHUNK_SLEEP_TIME);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
async setExpiring(key, value, expirySeconds) {
|
|
264
|
+
this.assertConnected();
|
|
265
|
+
const resp = await this.client.setex(key, expirySeconds, JSON.stringify(value));
|
|
266
|
+
return resp;
|
|
267
|
+
}
|
|
268
|
+
async msetExpiring(values, expirySeconds) {
|
|
269
|
+
if (!values)
|
|
270
|
+
return;
|
|
271
|
+
if (values.length === 0)
|
|
272
|
+
return;
|
|
273
|
+
this.assertConnected();
|
|
274
|
+
const chunkedValues = __1.COMMON_UTILS.chunks(values, BULK_WRITE_CHUNK_SIZE);
|
|
275
|
+
for (const valuesChunk of chunkedValues) {
|
|
276
|
+
for (const [key, val] of valuesChunk) {
|
|
277
|
+
this.client.setex(key, expirySeconds, JSON.stringify(val));
|
|
278
|
+
}
|
|
279
|
+
if (chunkedValues.length > 0) {
|
|
280
|
+
await (0, __1.sleep)(CHUNK_SLEEP_TIME);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
async expireKey(key, expirySeconds) {
|
|
285
|
+
this.assertConnected();
|
|
286
|
+
const resp = await this.client.expire(key, expirySeconds);
|
|
287
|
+
return resp;
|
|
288
|
+
}
|
|
289
|
+
async get(key) {
|
|
290
|
+
this.assertConnected();
|
|
291
|
+
const value = await this.client.get(key);
|
|
292
|
+
if (value) {
|
|
293
|
+
return JSON.parse(value);
|
|
294
|
+
}
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
async getRaw(key) {
|
|
298
|
+
this.assertConnected();
|
|
299
|
+
const resp = await this.client.get(key);
|
|
300
|
+
return resp;
|
|
301
|
+
}
|
|
302
|
+
async mget(keys) {
|
|
303
|
+
this.assertConnected();
|
|
304
|
+
if (keys.length === 0)
|
|
305
|
+
return [];
|
|
306
|
+
const chunkedValues = __1.COMMON_UTILS.chunks(keys, BULK_READ_CHUNK_SIZE);
|
|
307
|
+
const rawValues = [];
|
|
308
|
+
const chunkPromises = chunkedValues.map(async (valuesChunk, index) => {
|
|
309
|
+
const chunkResults = await Promise.all(valuesChunk.map((key) => this.client.get(key)));
|
|
310
|
+
if (index < chunkedValues.length - 1) {
|
|
311
|
+
await (0, __1.sleep)(20);
|
|
312
|
+
}
|
|
313
|
+
return chunkResults;
|
|
314
|
+
});
|
|
315
|
+
const allChunks = await Promise.all(chunkPromises);
|
|
316
|
+
for (const chunk of allChunks) {
|
|
317
|
+
rawValues.push(...chunk);
|
|
318
|
+
}
|
|
319
|
+
const parsedValues = rawValues.map((value) => {
|
|
320
|
+
if (value) {
|
|
321
|
+
return JSON.parse(value);
|
|
322
|
+
}
|
|
323
|
+
return undefined;
|
|
324
|
+
});
|
|
325
|
+
return parsedValues;
|
|
326
|
+
}
|
|
327
|
+
async smembers(key) {
|
|
328
|
+
const resp = await this.client.smembers(key);
|
|
329
|
+
return resp;
|
|
330
|
+
}
|
|
331
|
+
async zRange(key, min, max) {
|
|
332
|
+
const resp = await this.client.zrange(key, min, max);
|
|
333
|
+
return resp;
|
|
334
|
+
}
|
|
335
|
+
async zRevRange(key, start, stop, withScores) {
|
|
336
|
+
const resp = withScores
|
|
337
|
+
? this.client.zrevrange(key, start, stop, withScores)
|
|
338
|
+
: this.client.zrevrange(key, start, stop);
|
|
339
|
+
return resp;
|
|
340
|
+
}
|
|
341
|
+
async zRangeByScore(key, min, max) {
|
|
342
|
+
const resp = await this.client.zrangebyscore(key, min, max);
|
|
343
|
+
return resp;
|
|
344
|
+
}
|
|
345
|
+
async zRevRangeByScore(key, max, min) {
|
|
346
|
+
const resp = await this.client.zrevrangebyscore(key, max, min);
|
|
347
|
+
return resp;
|
|
348
|
+
}
|
|
349
|
+
async zRank(key, member) {
|
|
350
|
+
const resp = await this.client.zrank(key, member);
|
|
351
|
+
return resp;
|
|
352
|
+
}
|
|
353
|
+
async zRevRank(key, member) {
|
|
354
|
+
const resp = await this.client.zrevrank(key, member);
|
|
355
|
+
return resp;
|
|
356
|
+
}
|
|
357
|
+
async zRem(key, member) {
|
|
358
|
+
const resp = await this.client.zrem(key, member);
|
|
359
|
+
return resp;
|
|
360
|
+
}
|
|
361
|
+
async zRemRange(key, start, stop) {
|
|
362
|
+
const resp = await this.client.zremrangebyrank(key, start, stop);
|
|
363
|
+
return resp;
|
|
364
|
+
}
|
|
365
|
+
async zRemRangeByScore(key, start, stop) {
|
|
366
|
+
const resp = await this.client.zremrangebyscore(key, start, stop);
|
|
367
|
+
return resp;
|
|
368
|
+
}
|
|
369
|
+
async zCount(key, start, stop) {
|
|
370
|
+
const resp = await this.client.zcount(key, start, stop);
|
|
371
|
+
return resp;
|
|
372
|
+
}
|
|
373
|
+
async zCard(key) {
|
|
374
|
+
const resp = await this.client.zcard(key);
|
|
375
|
+
return resp;
|
|
376
|
+
}
|
|
377
|
+
async zAdd(key, ...scoreMembers) {
|
|
378
|
+
const resp = await this.client.zadd(key, ...scoreMembers);
|
|
379
|
+
return resp;
|
|
380
|
+
}
|
|
381
|
+
async lPush(key, ...elements) {
|
|
382
|
+
const resp = await this.client.lpush(key, ...elements);
|
|
383
|
+
return resp;
|
|
384
|
+
}
|
|
385
|
+
async rPush(key, ...elements) {
|
|
386
|
+
const resp = await this.client.rpush(key, ...elements);
|
|
387
|
+
return resp;
|
|
388
|
+
}
|
|
389
|
+
async lTrim(key, start, stop) {
|
|
390
|
+
const resp = await this.client.ltrim(key, start, stop);
|
|
391
|
+
return resp;
|
|
392
|
+
}
|
|
393
|
+
async lRem(key, count, element) {
|
|
394
|
+
const resp = await this.client.lrem(key, count, element);
|
|
395
|
+
return resp;
|
|
396
|
+
}
|
|
397
|
+
async lSet(key, index, element) {
|
|
398
|
+
const resp = await this.client.lset(key, index, element);
|
|
399
|
+
return resp;
|
|
400
|
+
}
|
|
401
|
+
async lRange(key, start, stop) {
|
|
402
|
+
const resp = await this.client.lrange(key, start, stop);
|
|
403
|
+
return resp;
|
|
404
|
+
}
|
|
405
|
+
async lLen(key) {
|
|
406
|
+
const resp = await this.client.llen(key);
|
|
407
|
+
return resp;
|
|
408
|
+
}
|
|
409
|
+
async lIndex(key, index) {
|
|
410
|
+
const resp = await this.client.lindex(key, index);
|
|
411
|
+
return resp;
|
|
412
|
+
}
|
|
413
|
+
async publish(key, value) {
|
|
414
|
+
const resp = await this.client.publish(key, JSON.stringify(value));
|
|
415
|
+
return resp;
|
|
416
|
+
}
|
|
417
|
+
async subscribe(key) {
|
|
418
|
+
const resp = await this.client.subscribe(key);
|
|
419
|
+
return resp;
|
|
420
|
+
}
|
|
421
|
+
async unsubscribe(key) {
|
|
422
|
+
const resp = await this.client.unsubscribe(key);
|
|
423
|
+
return resp;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Clears the entire cache of the current DB (not the other DBs in the redis instance)
|
|
427
|
+
*/
|
|
428
|
+
async flush() {
|
|
429
|
+
this.assertConnected();
|
|
430
|
+
return this.client.flushdb();
|
|
431
|
+
}
|
|
432
|
+
async delete(...keys) {
|
|
433
|
+
this.assertConnected();
|
|
434
|
+
const chunkedValues = __1.COMMON_UTILS.chunks(keys, BULK_WRITE_CHUNK_SIZE);
|
|
435
|
+
let count = 0;
|
|
436
|
+
for (const valuesChunk of chunkedValues) {
|
|
437
|
+
for (const key of valuesChunk) {
|
|
438
|
+
await this.client.del(key);
|
|
439
|
+
count++;
|
|
440
|
+
}
|
|
441
|
+
if (chunkedValues.length > 0) {
|
|
442
|
+
await (0, __1.sleep)(20);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return count;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
exports.RedisClient = RedisClient;
|
|
449
|
+
__decorate([
|
|
450
|
+
isWrite(),
|
|
451
|
+
__metadata("design:type", Function),
|
|
452
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
453
|
+
__metadata("design:returntype", Promise)
|
|
454
|
+
], RedisClient.prototype, "set", null);
|
|
455
|
+
__decorate([
|
|
456
|
+
isWrite(),
|
|
457
|
+
__metadata("design:type", Function),
|
|
458
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
459
|
+
__metadata("design:returntype", Promise)
|
|
460
|
+
], RedisClient.prototype, "setRaw", null);
|
|
461
|
+
__decorate([
|
|
462
|
+
isWrite(),
|
|
463
|
+
__metadata("design:type", Function),
|
|
464
|
+
__metadata("design:paramtypes", [Array]),
|
|
465
|
+
__metadata("design:returntype", Promise)
|
|
466
|
+
], RedisClient.prototype, "mset", null);
|
|
467
|
+
__decorate([
|
|
468
|
+
isWrite(),
|
|
469
|
+
__metadata("design:type", Function),
|
|
470
|
+
__metadata("design:paramtypes", [String, Object, Number]),
|
|
471
|
+
__metadata("design:returntype", Promise)
|
|
472
|
+
], RedisClient.prototype, "setExpiring", null);
|
|
473
|
+
__decorate([
|
|
474
|
+
isRead,
|
|
475
|
+
__metadata("design:type", Function),
|
|
476
|
+
__metadata("design:paramtypes", [Array, Number]),
|
|
477
|
+
__metadata("design:returntype", Promise)
|
|
478
|
+
], RedisClient.prototype, "msetExpiring", null);
|
|
479
|
+
__decorate([
|
|
480
|
+
isWrite(),
|
|
481
|
+
__metadata("design:type", Function),
|
|
482
|
+
__metadata("design:paramtypes", [String, Number]),
|
|
483
|
+
__metadata("design:returntype", Promise)
|
|
484
|
+
], RedisClient.prototype, "expireKey", null);
|
|
485
|
+
__decorate([
|
|
486
|
+
isRead,
|
|
487
|
+
__metadata("design:type", Function),
|
|
488
|
+
__metadata("design:paramtypes", [String]),
|
|
489
|
+
__metadata("design:returntype", Promise)
|
|
490
|
+
], RedisClient.prototype, "get", null);
|
|
491
|
+
__decorate([
|
|
492
|
+
isRead,
|
|
493
|
+
__metadata("design:type", Function),
|
|
494
|
+
__metadata("design:paramtypes", [String]),
|
|
495
|
+
__metadata("design:returntype", Promise)
|
|
496
|
+
], RedisClient.prototype, "getRaw", null);
|
|
497
|
+
__decorate([
|
|
498
|
+
isRead,
|
|
499
|
+
__metadata("design:type", Function),
|
|
500
|
+
__metadata("design:paramtypes", [Array]),
|
|
501
|
+
__metadata("design:returntype", Promise)
|
|
502
|
+
], RedisClient.prototype, "mget", null);
|
|
503
|
+
__decorate([
|
|
504
|
+
isRead,
|
|
505
|
+
__metadata("design:type", Function),
|
|
506
|
+
__metadata("design:paramtypes", [String]),
|
|
507
|
+
__metadata("design:returntype", Promise)
|
|
508
|
+
], RedisClient.prototype, "smembers", null);
|
|
509
|
+
__decorate([
|
|
510
|
+
isRead,
|
|
511
|
+
__metadata("design:type", Function),
|
|
512
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
513
|
+
__metadata("design:returntype", Promise)
|
|
514
|
+
], RedisClient.prototype, "zRange", null);
|
|
515
|
+
__decorate([
|
|
516
|
+
isRead,
|
|
517
|
+
__metadata("design:type", Function),
|
|
518
|
+
__metadata("design:paramtypes", [String, Number, Number, String]),
|
|
519
|
+
__metadata("design:returntype", Promise)
|
|
520
|
+
], RedisClient.prototype, "zRevRange", null);
|
|
521
|
+
__decorate([
|
|
522
|
+
isRead,
|
|
523
|
+
__metadata("design:type", Function),
|
|
524
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
525
|
+
__metadata("design:returntype", Promise)
|
|
526
|
+
], RedisClient.prototype, "zRangeByScore", null);
|
|
527
|
+
__decorate([
|
|
528
|
+
isRead,
|
|
529
|
+
__metadata("design:type", Function),
|
|
530
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
531
|
+
__metadata("design:returntype", Promise)
|
|
532
|
+
], RedisClient.prototype, "zRevRangeByScore", null);
|
|
533
|
+
__decorate([
|
|
534
|
+
isRead,
|
|
535
|
+
__metadata("design:type", Function),
|
|
536
|
+
__metadata("design:paramtypes", [String, String]),
|
|
537
|
+
__metadata("design:returntype", Promise)
|
|
538
|
+
], RedisClient.prototype, "zRank", null);
|
|
539
|
+
__decorate([
|
|
540
|
+
isRead,
|
|
541
|
+
__metadata("design:type", Function),
|
|
542
|
+
__metadata("design:paramtypes", [String, String]),
|
|
543
|
+
__metadata("design:returntype", Promise)
|
|
544
|
+
], RedisClient.prototype, "zRevRank", null);
|
|
545
|
+
__decorate([
|
|
546
|
+
isWrite(),
|
|
547
|
+
__metadata("design:type", Function),
|
|
548
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
549
|
+
__metadata("design:returntype", Promise)
|
|
550
|
+
], RedisClient.prototype, "zRem", null);
|
|
551
|
+
__decorate([
|
|
552
|
+
isWrite(),
|
|
553
|
+
__metadata("design:type", Function),
|
|
554
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
555
|
+
__metadata("design:returntype", Promise)
|
|
556
|
+
], RedisClient.prototype, "zRemRange", null);
|
|
557
|
+
__decorate([
|
|
558
|
+
isWrite(),
|
|
559
|
+
__metadata("design:type", Function),
|
|
560
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
561
|
+
__metadata("design:returntype", Promise)
|
|
562
|
+
], RedisClient.prototype, "zRemRangeByScore", null);
|
|
563
|
+
__decorate([
|
|
564
|
+
isRead,
|
|
565
|
+
__metadata("design:type", Function),
|
|
566
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
567
|
+
__metadata("design:returntype", Promise)
|
|
568
|
+
], RedisClient.prototype, "zCount", null);
|
|
569
|
+
__decorate([
|
|
570
|
+
isRead,
|
|
571
|
+
__metadata("design:type", Function),
|
|
572
|
+
__metadata("design:paramtypes", [String]),
|
|
573
|
+
__metadata("design:returntype", Promise)
|
|
574
|
+
], RedisClient.prototype, "zCard", null);
|
|
575
|
+
__decorate([
|
|
576
|
+
isWrite(),
|
|
577
|
+
__metadata("design:type", Function),
|
|
578
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
579
|
+
__metadata("design:returntype", Promise)
|
|
580
|
+
], RedisClient.prototype, "zAdd", null);
|
|
581
|
+
__decorate([
|
|
582
|
+
isWrite(),
|
|
583
|
+
__metadata("design:type", Function),
|
|
584
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
585
|
+
__metadata("design:returntype", Promise)
|
|
586
|
+
], RedisClient.prototype, "lPush", null);
|
|
587
|
+
__decorate([
|
|
588
|
+
isWrite(),
|
|
589
|
+
__metadata("design:type", Function),
|
|
590
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
591
|
+
__metadata("design:returntype", Promise)
|
|
592
|
+
], RedisClient.prototype, "rPush", null);
|
|
593
|
+
__decorate([
|
|
594
|
+
isWrite(),
|
|
595
|
+
__metadata("design:type", Function),
|
|
596
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
597
|
+
__metadata("design:returntype", Promise)
|
|
598
|
+
], RedisClient.prototype, "lTrim", null);
|
|
599
|
+
__decorate([
|
|
600
|
+
isWrite(),
|
|
601
|
+
__metadata("design:type", Function),
|
|
602
|
+
__metadata("design:paramtypes", [String, Number, Object]),
|
|
603
|
+
__metadata("design:returntype", Promise)
|
|
604
|
+
], RedisClient.prototype, "lRem", null);
|
|
605
|
+
__decorate([
|
|
606
|
+
isWrite(),
|
|
607
|
+
__metadata("design:type", Function),
|
|
608
|
+
__metadata("design:paramtypes", [String, Number, Object]),
|
|
609
|
+
__metadata("design:returntype", Promise)
|
|
610
|
+
], RedisClient.prototype, "lSet", null);
|
|
611
|
+
__decorate([
|
|
612
|
+
isRead,
|
|
613
|
+
__metadata("design:type", Function),
|
|
614
|
+
__metadata("design:paramtypes", [String, Number, Number]),
|
|
615
|
+
__metadata("design:returntype", Promise)
|
|
616
|
+
], RedisClient.prototype, "lRange", null);
|
|
617
|
+
__decorate([
|
|
618
|
+
isRead,
|
|
619
|
+
__metadata("design:type", Function),
|
|
620
|
+
__metadata("design:paramtypes", [String]),
|
|
621
|
+
__metadata("design:returntype", Promise)
|
|
622
|
+
], RedisClient.prototype, "lLen", null);
|
|
623
|
+
__decorate([
|
|
624
|
+
isRead,
|
|
625
|
+
__metadata("design:type", Function),
|
|
626
|
+
__metadata("design:paramtypes", [String, Number]),
|
|
627
|
+
__metadata("design:returntype", Promise)
|
|
628
|
+
], RedisClient.prototype, "lIndex", null);
|
|
629
|
+
__decorate([
|
|
630
|
+
isWrite(),
|
|
631
|
+
__metadata("design:type", Function),
|
|
632
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
633
|
+
__metadata("design:returntype", Promise)
|
|
634
|
+
], RedisClient.prototype, "publish", null);
|
|
635
|
+
__decorate([
|
|
636
|
+
isRead,
|
|
637
|
+
__metadata("design:type", Function),
|
|
638
|
+
__metadata("design:paramtypes", []),
|
|
639
|
+
__metadata("design:returntype", Promise)
|
|
640
|
+
], RedisClient.prototype, "flush", null);
|
|
641
|
+
__decorate([
|
|
642
|
+
isRead,
|
|
643
|
+
__metadata("design:type", Function),
|
|
644
|
+
__metadata("design:paramtypes", [String]),
|
|
645
|
+
__metadata("design:returntype", Promise)
|
|
646
|
+
], RedisClient.prototype, "delete", null);
|
|
647
|
+
//# sourceMappingURL=redisClient.js.map
|