@metamask-previews/perps-controller 0.0.0-preview-ae46ab603 → 0.0.0-preview-e4aa1532
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/CHANGELOG.md +11 -1
- package/dist/PerpsController.cjs +2224 -66
- package/dist/PerpsController.cjs.map +1 -1
- package/dist/PerpsController.d.cts +933 -79
- package/dist/PerpsController.d.cts.map +1 -1
- package/dist/PerpsController.d.mts +933 -79
- package/dist/PerpsController.d.mts.map +1 -1
- package/dist/PerpsController.mjs +2221 -64
- package/dist/PerpsController.mjs.map +1 -1
- package/dist/__mocks__/hyperliquidMock.cjs +68 -0
- package/dist/__mocks__/hyperliquidMock.cjs.map +1 -0
- package/dist/__mocks__/hyperliquidMock.d.cts +15 -0
- package/dist/__mocks__/hyperliquidMock.d.cts.map +1 -0
- package/dist/__mocks__/hyperliquidMock.d.mts +15 -0
- package/dist/__mocks__/hyperliquidMock.d.mts.map +1 -0
- package/dist/__mocks__/hyperliquidMock.mjs +65 -0
- package/dist/__mocks__/hyperliquidMock.mjs.map +1 -0
- package/dist/__mocks__/providerMocks.cjs +144 -0
- package/dist/__mocks__/providerMocks.cjs.map +1 -0
- package/dist/__mocks__/providerMocks.d.cts +44 -0
- package/dist/__mocks__/providerMocks.d.cts.map +1 -0
- package/dist/__mocks__/providerMocks.d.mts +44 -0
- package/dist/__mocks__/providerMocks.d.mts.map +1 -0
- package/dist/__mocks__/providerMocks.mjs +136 -0
- package/dist/__mocks__/providerMocks.mjs.map +1 -0
- package/dist/__mocks__/serviceMocks.cjs +187 -0
- package/dist/__mocks__/serviceMocks.cjs.map +1 -0
- package/dist/__mocks__/serviceMocks.d.cts +58 -0
- package/dist/__mocks__/serviceMocks.d.cts.map +1 -0
- package/dist/__mocks__/serviceMocks.d.mts +58 -0
- package/dist/__mocks__/serviceMocks.d.mts.map +1 -0
- package/dist/__mocks__/serviceMocks.mjs +180 -0
- package/dist/__mocks__/serviceMocks.mjs.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.cjs +459 -0
- package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts +222 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts +222 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs +455 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -0
- package/dist/aggregation/index.cjs +9 -0
- package/dist/aggregation/index.cjs.map +1 -0
- package/dist/aggregation/index.d.cts +6 -0
- package/dist/aggregation/index.d.cts.map +1 -0
- package/dist/aggregation/index.d.mts +6 -0
- package/dist/aggregation/index.d.mts.map +1 -0
- package/dist/aggregation/index.mjs +5 -0
- package/dist/aggregation/index.mjs.map +1 -0
- package/dist/constants/eventNames.cjs +117 -0
- package/dist/constants/eventNames.cjs.map +1 -0
- package/dist/constants/eventNames.d.cts +106 -0
- package/dist/constants/eventNames.d.cts.map +1 -0
- package/dist/constants/eventNames.d.mts +106 -0
- package/dist/constants/eventNames.d.mts.map +1 -0
- package/dist/constants/eventNames.mjs +114 -0
- package/dist/constants/eventNames.mjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.cjs +366 -0
- package/dist/constants/hyperLiquidConfig.cjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.cts +276 -0
- package/dist/constants/hyperLiquidConfig.d.cts.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.mts +276 -0
- package/dist/constants/hyperLiquidConfig.d.mts.map +1 -0
- package/dist/constants/hyperLiquidConfig.mjs +357 -0
- package/dist/constants/hyperLiquidConfig.mjs.map +1 -0
- package/dist/constants/index.cjs +23 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +7 -0
- package/dist/constants/index.d.cts.map +1 -0
- package/dist/constants/index.d.mts +7 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +7 -0
- package/dist/constants/index.mjs.map +1 -0
- package/dist/constants/orderTypes.cjs +31 -0
- package/dist/constants/orderTypes.cjs.map +1 -0
- package/dist/constants/orderTypes.d.cts +19 -0
- package/dist/constants/orderTypes.d.cts.map +1 -0
- package/dist/constants/orderTypes.d.mts +19 -0
- package/dist/constants/orderTypes.d.mts.map +1 -0
- package/dist/constants/orderTypes.mjs +27 -0
- package/dist/constants/orderTypes.mjs.map +1 -0
- package/dist/constants/performanceMetrics.cjs +61 -0
- package/dist/constants/performanceMetrics.cjs.map +1 -0
- package/dist/constants/performanceMetrics.d.cts +44 -0
- package/dist/constants/performanceMetrics.d.cts.map +1 -0
- package/dist/constants/performanceMetrics.d.mts +44 -0
- package/dist/constants/performanceMetrics.d.mts.map +1 -0
- package/dist/constants/performanceMetrics.mjs +58 -0
- package/dist/constants/performanceMetrics.mjs.map +1 -0
- package/dist/constants/perpsConfig.cjs +461 -0
- package/dist/constants/perpsConfig.cjs.map +1 -0
- package/dist/constants/perpsConfig.d.cts +343 -0
- package/dist/constants/perpsConfig.d.cts.map +1 -0
- package/dist/constants/perpsConfig.d.mts +343 -0
- package/dist/constants/perpsConfig.d.mts.map +1 -0
- package/dist/constants/perpsConfig.mjs +458 -0
- package/dist/constants/perpsConfig.mjs.map +1 -0
- package/dist/constants/perpsErrorCodes.cjs +79 -0
- package/dist/constants/perpsErrorCodes.cjs.map +1 -0
- package/dist/constants/perpsErrorCodes.d.cts +64 -0
- package/dist/constants/perpsErrorCodes.d.cts.map +1 -0
- package/dist/constants/perpsErrorCodes.d.mts +64 -0
- package/dist/constants/perpsErrorCodes.d.mts.map +1 -0
- package/dist/constants/perpsErrorCodes.mjs +76 -0
- package/dist/constants/perpsErrorCodes.mjs.map +1 -0
- package/dist/index.cjs +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/dist/platform-services/HyperLiquidClientService.cjs +857 -0
- package/dist/platform-services/HyperLiquidClientService.cjs.map +1 -0
- package/dist/platform-services/HyperLiquidClientService.d.cts +263 -0
- package/dist/platform-services/HyperLiquidClientService.d.cts.map +1 -0
- package/dist/platform-services/HyperLiquidClientService.d.mts +263 -0
- package/dist/platform-services/HyperLiquidClientService.d.mts.map +1 -0
- package/dist/platform-services/HyperLiquidClientService.mjs +853 -0
- package/dist/platform-services/HyperLiquidClientService.mjs.map +1 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.cjs +2170 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.cjs.map +1 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.d.cts +424 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.d.cts.map +1 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.d.mts +424 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.d.mts.map +1 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.mjs +2166 -0
- package/dist/platform-services/HyperLiquidSubscriptionService.mjs.map +1 -0
- package/dist/platform-services/HyperLiquidWalletService.cjs +140 -0
- package/dist/platform-services/HyperLiquidWalletService.cjs.map +1 -0
- package/dist/platform-services/HyperLiquidWalletService.d.cts +78 -0
- package/dist/platform-services/HyperLiquidWalletService.d.cts.map +1 -0
- package/dist/platform-services/HyperLiquidWalletService.d.mts +78 -0
- package/dist/platform-services/HyperLiquidWalletService.d.mts.map +1 -0
- package/dist/platform-services/HyperLiquidWalletService.mjs +136 -0
- package/dist/platform-services/HyperLiquidWalletService.mjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.cjs +777 -0
- package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts +466 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts +466 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.mjs +773 -0
- package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.cjs +5172 -0
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.cts +881 -0
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.mts +881 -0
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -0
- package/dist/providers/HyperLiquidProvider.mjs +5168 -0
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -0
- package/dist/providers/index.cjs +11 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +6 -0
- package/dist/providers/index.d.cts.map +1 -0
- package/dist/providers/index.d.mts +6 -0
- package/dist/providers/index.d.mts.map +1 -0
- package/dist/providers/index.mjs +6 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/routing/ProviderRouter.cjs +148 -0
- package/dist/routing/ProviderRouter.cjs.map +1 -0
- package/dist/routing/ProviderRouter.d.cts +124 -0
- package/dist/routing/ProviderRouter.d.cts.map +1 -0
- package/dist/routing/ProviderRouter.d.mts +124 -0
- package/dist/routing/ProviderRouter.d.mts.map +1 -0
- package/dist/routing/ProviderRouter.mjs +144 -0
- package/dist/routing/ProviderRouter.mjs.map +1 -0
- package/dist/routing/index.cjs +9 -0
- package/dist/routing/index.cjs.map +1 -0
- package/dist/routing/index.d.cts +6 -0
- package/dist/routing/index.d.cts.map +1 -0
- package/dist/routing/index.d.mts +6 -0
- package/dist/routing/index.d.mts.map +1 -0
- package/dist/routing/index.mjs +5 -0
- package/dist/routing/index.mjs.map +1 -0
- package/dist/selectors.cjs +161 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +345 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +345 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +153 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/services/AccountService.cjs +313 -0
- package/dist/services/AccountService.cjs.map +1 -0
- package/dist/services/AccountService.d.cts +53 -0
- package/dist/services/AccountService.d.cts.map +1 -0
- package/dist/services/AccountService.d.mts +53 -0
- package/dist/services/AccountService.d.mts.map +1 -0
- package/dist/services/AccountService.mjs +309 -0
- package/dist/services/AccountService.mjs.map +1 -0
- package/dist/services/DataLakeService.cjs +219 -0
- package/dist/services/DataLakeService.cjs.map +1 -0
- package/dist/services/DataLakeService.d.cts +49 -0
- package/dist/services/DataLakeService.d.cts.map +1 -0
- package/dist/services/DataLakeService.d.mts +49 -0
- package/dist/services/DataLakeService.d.mts.map +1 -0
- package/dist/services/DataLakeService.mjs +215 -0
- package/dist/services/DataLakeService.mjs.map +1 -0
- package/dist/services/DepositService.cjs +96 -0
- package/dist/services/DepositService.cjs.map +1 -0
- package/dist/services/DepositService.d.cts +37 -0
- package/dist/services/DepositService.d.cts.map +1 -0
- package/dist/services/DepositService.d.mts +37 -0
- package/dist/services/DepositService.d.mts.map +1 -0
- package/dist/services/DepositService.mjs +92 -0
- package/dist/services/DepositService.mjs.map +1 -0
- package/dist/services/EligibilityService.cjs +156 -0
- package/dist/services/EligibilityService.cjs.map +1 -0
- package/dist/services/EligibilityService.d.cts +48 -0
- package/dist/services/EligibilityService.d.cts.map +1 -0
- package/dist/services/EligibilityService.d.mts +48 -0
- package/dist/services/EligibilityService.d.mts.map +1 -0
- package/dist/services/EligibilityService.mjs +152 -0
- package/dist/services/EligibilityService.mjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.cjs +258 -0
- package/dist/services/FeatureFlagConfigurationService.cjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts +100 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts +100 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.mjs +254 -0
- package/dist/services/FeatureFlagConfigurationService.mjs.map +1 -0
- package/dist/services/MarketDataService.cjs +875 -0
- package/dist/services/MarketDataService.cjs.map +1 -0
- package/dist/services/MarketDataService.d.cts +289 -0
- package/dist/services/MarketDataService.d.cts.map +1 -0
- package/dist/services/MarketDataService.d.mts +289 -0
- package/dist/services/MarketDataService.d.mts.map +1 -0
- package/dist/services/MarketDataService.mjs +871 -0
- package/dist/services/MarketDataService.mjs.map +1 -0
- package/dist/services/RewardsIntegrationService.cjs +94 -0
- package/dist/services/RewardsIntegrationService.cjs.map +1 -0
- package/dist/services/RewardsIntegrationService.d.cts +30 -0
- package/dist/services/RewardsIntegrationService.d.cts.map +1 -0
- package/dist/services/RewardsIntegrationService.d.mts +30 -0
- package/dist/services/RewardsIntegrationService.d.mts.map +1 -0
- package/dist/services/RewardsIntegrationService.mjs +90 -0
- package/dist/services/RewardsIntegrationService.mjs.map +1 -0
- package/dist/services/ServiceContext.cjs +3 -0
- package/dist/services/ServiceContext.cjs.map +1 -0
- package/dist/services/ServiceContext.d.cts +110 -0
- package/dist/services/ServiceContext.d.cts.map +1 -0
- package/dist/services/ServiceContext.d.mts +110 -0
- package/dist/services/ServiceContext.d.mts.map +1 -0
- package/dist/services/ServiceContext.mjs +2 -0
- package/dist/services/ServiceContext.mjs.map +1 -0
- package/dist/services/TradingService.cjs +1481 -0
- package/dist/services/TradingService.cjs.map +1 -0
- package/dist/services/TradingService.d.cts +308 -0
- package/dist/services/TradingService.d.cts.map +1 -0
- package/dist/services/TradingService.d.mts +308 -0
- package/dist/services/TradingService.d.mts.map +1 -0
- package/dist/services/TradingService.mjs +1477 -0
- package/dist/services/TradingService.mjs.map +1 -0
- package/dist/services/index.cjs +26 -0
- package/dist/services/index.cjs.map +1 -0
- package/dist/services/index.d.cts +11 -0
- package/dist/services/index.d.cts.map +1 -0
- package/dist/services/index.d.mts +11 -0
- package/dist/services/index.d.mts.map +1 -0
- package/dist/services/index.mjs +10 -0
- package/dist/services/index.mjs.map +1 -0
- package/dist/services/utils.cjs +16 -0
- package/dist/services/utils.cjs.map +1 -0
- package/dist/services/utils.d.cts +8 -0
- package/dist/services/utils.d.cts.map +1 -0
- package/dist/services/utils.d.mts +8 -0
- package/dist/services/utils.d.mts.map +1 -0
- package/dist/services/utils.mjs +12 -0
- package/dist/services/utils.mjs.map +1 -0
- package/dist/types/chart.cjs +42 -0
- package/dist/types/chart.cjs.map +1 -0
- package/dist/types/chart.d.cts +62 -0
- package/dist/types/chart.d.cts.map +1 -0
- package/dist/types/chart.d.mts +62 -0
- package/dist/types/chart.d.mts.map +1 -0
- package/dist/types/chart.mjs +39 -0
- package/dist/types/chart.mjs.map +1 -0
- package/dist/types/hyperliquid-types.cjs +3 -0
- package/dist/types/hyperliquid-types.cjs.map +1 -0
- package/dist/types/hyperliquid-types.d.cts +52 -0
- package/dist/types/hyperliquid-types.d.cts.map +1 -0
- package/dist/types/hyperliquid-types.d.mts +52 -0
- package/dist/types/hyperliquid-types.d.mts.map +1 -0
- package/dist/types/hyperliquid-types.mjs +2 -0
- package/dist/types/hyperliquid-types.mjs.map +1 -0
- package/dist/types/index.cjs +96 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1153 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +1153 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +79 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/transactionTypes.cjs +28 -0
- package/dist/types/transactionTypes.cjs.map +1 -0
- package/dist/types/transactionTypes.d.cts +64 -0
- package/dist/types/transactionTypes.d.cts.map +1 -0
- package/dist/types/transactionTypes.d.mts +64 -0
- package/dist/types/transactionTypes.d.mts.map +1 -0
- package/dist/types/transactionTypes.mjs +23 -0
- package/dist/types/transactionTypes.mjs.map +1 -0
- package/dist/utils/accountUtils.cjs +65 -0
- package/dist/utils/accountUtils.cjs.map +1 -0
- package/dist/utils/accountUtils.d.cts +26 -0
- package/dist/utils/accountUtils.d.cts.map +1 -0
- package/dist/utils/accountUtils.d.mts +26 -0
- package/dist/utils/accountUtils.d.mts.map +1 -0
- package/dist/utils/accountUtils.mjs +61 -0
- package/dist/utils/accountUtils.mjs.map +1 -0
- package/dist/utils/amountConversion.cjs +61 -0
- package/dist/utils/amountConversion.cjs.map +1 -0
- package/dist/utils/amountConversion.d.cts +16 -0
- package/dist/utils/amountConversion.d.cts.map +1 -0
- package/dist/utils/amountConversion.d.mts +16 -0
- package/dist/utils/amountConversion.d.mts.map +1 -0
- package/dist/utils/amountConversion.mjs +54 -0
- package/dist/utils/amountConversion.mjs.map +1 -0
- package/dist/utils/chartUtils.cjs +98 -0
- package/dist/utils/chartUtils.cjs.map +1 -0
- package/dist/utils/chartUtils.d.cts +14 -0
- package/dist/utils/chartUtils.d.cts.map +1 -0
- package/dist/utils/chartUtils.d.mts +14 -0
- package/dist/utils/chartUtils.d.mts.map +1 -0
- package/dist/utils/chartUtils.mjs +94 -0
- package/dist/utils/chartUtils.mjs.map +1 -0
- package/dist/utils/errorUtils.cjs +22 -0
- package/dist/utils/errorUtils.cjs.map +1 -0
- package/dist/utils/errorUtils.d.cts +13 -0
- package/dist/utils/errorUtils.d.cts.map +1 -0
- package/dist/utils/errorUtils.d.mts +13 -0
- package/dist/utils/errorUtils.d.mts.map +1 -0
- package/dist/utils/errorUtils.mjs +18 -0
- package/dist/utils/errorUtils.mjs.map +1 -0
- package/dist/utils/formatUtils.cjs +987 -0
- package/dist/utils/formatUtils.cjs.map +1 -0
- package/dist/utils/formatUtils.d.cts +387 -0
- package/dist/utils/formatUtils.d.cts.map +1 -0
- package/dist/utils/formatUtils.d.mts +387 -0
- package/dist/utils/formatUtils.d.mts.map +1 -0
- package/dist/utils/formatUtils.mjs +966 -0
- package/dist/utils/formatUtils.mjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.cjs +454 -0
- package/dist/utils/hyperLiquidAdapter.cjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.cts +158 -0
- package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.mts +158 -0
- package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.mjs +439 -0
- package/dist/utils/hyperLiquidAdapter.mjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs +89 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +58 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +58 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs +84 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.cjs +426 -0
- package/dist/utils/hyperLiquidValidation.cjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.cts +143 -0
- package/dist/utils/hyperLiquidValidation.d.cts.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.mts +143 -0
- package/dist/utils/hyperLiquidValidation.d.mts.map +1 -0
- package/dist/utils/hyperLiquidValidation.mjs +413 -0
- package/dist/utils/hyperLiquidValidation.mjs.map +1 -0
- package/dist/utils/idUtils.cjs +50 -0
- package/dist/utils/idUtils.cjs.map +1 -0
- package/dist/utils/idUtils.d.cts +38 -0
- package/dist/utils/idUtils.d.cts.map +1 -0
- package/dist/utils/idUtils.d.mts +38 -0
- package/dist/utils/idUtils.d.mts.map +1 -0
- package/dist/utils/idUtils.mjs +42 -0
- package/dist/utils/idUtils.mjs.map +1 -0
- package/dist/utils/marginUtils.cjs +137 -0
- package/dist/utils/marginUtils.cjs.map +1 -0
- package/dist/utils/marginUtils.d.cts +64 -0
- package/dist/utils/marginUtils.d.cts.map +1 -0
- package/dist/utils/marginUtils.d.mts +64 -0
- package/dist/utils/marginUtils.d.mts.map +1 -0
- package/dist/utils/marginUtils.mjs +131 -0
- package/dist/utils/marginUtils.mjs.map +1 -0
- package/dist/utils/marketDataTransform.cjs +227 -0
- package/dist/utils/marketDataTransform.cjs.map +1 -0
- package/dist/utils/marketDataTransform.d.cts +45 -0
- package/dist/utils/marketDataTransform.d.cts.map +1 -0
- package/dist/utils/marketDataTransform.d.mts +45 -0
- package/dist/utils/marketDataTransform.d.mts.map +1 -0
- package/dist/utils/marketDataTransform.mjs +220 -0
- package/dist/utils/marketDataTransform.mjs.map +1 -0
- package/dist/utils/marketUtils.cjs +420 -0
- package/dist/utils/marketUtils.cjs.map +1 -0
- package/dist/utils/marketUtils.d.cts +227 -0
- package/dist/utils/marketUtils.d.cts.map +1 -0
- package/dist/utils/marketUtils.d.mts +227 -0
- package/dist/utils/marketUtils.d.mts.map +1 -0
- package/dist/utils/marketUtils.mjs +404 -0
- package/dist/utils/marketUtils.mjs.map +1 -0
- package/dist/utils/orderBookGrouping.cjs +151 -0
- package/dist/utils/orderBookGrouping.cjs.map +1 -0
- package/dist/utils/orderBookGrouping.d.cts +76 -0
- package/dist/utils/orderBookGrouping.d.cts.map +1 -0
- package/dist/utils/orderBookGrouping.d.mts +76 -0
- package/dist/utils/orderBookGrouping.d.mts.map +1 -0
- package/dist/utils/orderBookGrouping.mjs +143 -0
- package/dist/utils/orderBookGrouping.mjs.map +1 -0
- package/dist/utils/orderCalculations.cjs +283 -0
- package/dist/utils/orderCalculations.cjs.map +1 -0
- package/dist/utils/orderCalculations.d.cts +107 -0
- package/dist/utils/orderCalculations.d.cts.map +1 -0
- package/dist/utils/orderCalculations.d.mts +107 -0
- package/dist/utils/orderCalculations.d.mts.map +1 -0
- package/dist/utils/orderCalculations.mjs +274 -0
- package/dist/utils/orderCalculations.mjs.map +1 -0
- package/dist/utils/orderUtils.cjs +159 -0
- package/dist/utils/orderUtils.cjs.map +1 -0
- package/dist/utils/orderUtils.d.cts +66 -0
- package/dist/utils/orderUtils.d.cts.map +1 -0
- package/dist/utils/orderUtils.d.mts +66 -0
- package/dist/utils/orderUtils.d.mts.map +1 -0
- package/dist/utils/orderUtils.mjs +151 -0
- package/dist/utils/orderUtils.mjs.map +1 -0
- package/dist/utils/pnlCalculations.cjs +107 -0
- package/dist/utils/pnlCalculations.cjs.map +1 -0
- package/dist/utils/pnlCalculations.d.cts +79 -0
- package/dist/utils/pnlCalculations.d.cts.map +1 -0
- package/dist/utils/pnlCalculations.d.mts +79 -0
- package/dist/utils/pnlCalculations.d.mts.map +1 -0
- package/dist/utils/pnlCalculations.mjs +97 -0
- package/dist/utils/pnlCalculations.mjs.map +1 -0
- package/dist/utils/positionCalculations.cjs +176 -0
- package/dist/utils/positionCalculations.cjs.map +1 -0
- package/dist/utils/positionCalculations.d.cts +85 -0
- package/dist/utils/positionCalculations.d.cts.map +1 -0
- package/dist/utils/positionCalculations.d.mts +85 -0
- package/dist/utils/positionCalculations.d.mts.map +1 -0
- package/dist/utils/positionCalculations.mjs +165 -0
- package/dist/utils/positionCalculations.mjs.map +1 -0
- package/dist/utils/sortMarkets.cjs +88 -0
- package/dist/utils/sortMarkets.cjs.map +1 -0
- package/dist/utils/sortMarkets.d.cts +21 -0
- package/dist/utils/sortMarkets.d.cts.map +1 -0
- package/dist/utils/sortMarkets.d.mts +21 -0
- package/dist/utils/sortMarkets.d.mts.map +1 -0
- package/dist/utils/sortMarkets.mjs +84 -0
- package/dist/utils/sortMarkets.mjs.map +1 -0
- package/dist/utils/standaloneInfoClient.cjs +34 -0
- package/dist/utils/standaloneInfoClient.cjs.map +1 -0
- package/dist/utils/standaloneInfoClient.d.cts +31 -0
- package/dist/utils/standaloneInfoClient.d.cts.map +1 -0
- package/dist/utils/standaloneInfoClient.d.mts +31 -0
- package/dist/utils/standaloneInfoClient.d.mts.map +1 -0
- package/dist/utils/standaloneInfoClient.mjs +30 -0
- package/dist/utils/standaloneInfoClient.mjs.map +1 -0
- package/dist/utils/stringParseUtils.cjs +49 -0
- package/dist/utils/stringParseUtils.cjs.map +1 -0
- package/dist/utils/stringParseUtils.d.cts +35 -0
- package/dist/utils/stringParseUtils.d.cts.map +1 -0
- package/dist/utils/stringParseUtils.d.mts +35 -0
- package/dist/utils/stringParseUtils.d.mts.map +1 -0
- package/dist/utils/stringParseUtils.mjs +44 -0
- package/dist/utils/stringParseUtils.mjs.map +1 -0
- package/dist/utils/time.cjs +37 -0
- package/dist/utils/time.cjs.map +1 -0
- package/dist/utils/time.d.cts +17 -0
- package/dist/utils/time.d.cts.map +1 -0
- package/dist/utils/time.d.mts +17 -0
- package/dist/utils/time.d.mts.map +1 -0
- package/dist/utils/time.mjs +33 -0
- package/dist/utils/time.mjs.map +1 -0
- package/dist/utils/tpslValidation.cjs +505 -0
- package/dist/utils/tpslValidation.cjs.map +1 -0
- package/dist/utils/tpslValidation.d.cts +182 -0
- package/dist/utils/tpslValidation.d.cts.map +1 -0
- package/dist/utils/tpslValidation.d.mts +182 -0
- package/dist/utils/tpslValidation.d.mts.map +1 -0
- package/dist/utils/tpslValidation.mjs +482 -0
- package/dist/utils/tpslValidation.mjs.map +1 -0
- package/dist/utils/transactionUtils.cjs +36 -0
- package/dist/utils/transactionUtils.cjs.map +1 -0
- package/dist/utils/transactionUtils.d.cts +17 -0
- package/dist/utils/transactionUtils.d.cts.map +1 -0
- package/dist/utils/transactionUtils.d.mts +17 -0
- package/dist/utils/transactionUtils.d.mts.map +1 -0
- package/dist/utils/transactionUtils.mjs +32 -0
- package/dist/utils/transactionUtils.mjs.map +1 -0
- package/dist/utils/wait.cjs +12 -0
- package/dist/utils/wait.cjs.map +1 -0
- package/dist/utils/wait.d.cts +8 -0
- package/dist/utils/wait.d.cts.map +1 -0
- package/dist/utils/wait.d.mts +8 -0
- package/dist/utils/wait.d.mts.map +1 -0
- package/dist/utils/wait.mjs +8 -0
- package/dist/utils/wait.mjs.map +1 -0
- package/package.json +19 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringParseUtils.cjs","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,IACE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC1C,CAAC;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAY,EAAE,CACnE,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAJ1B,QAAA,yBAAyB,6BAIC","sourcesContent":["/**\n * Strip surrounding quotes from a string (handles both single and double quotes)\n * Use this to clean up values that may have been JSON-encoded with extra quotes\n *\n * @param str - String to strip quotes from\n * @returns String with surrounding quotes removed, or unchanged if no matching quotes\n *\n * @example\n * stripQuotes('\"xyz\"') // returns \"xyz\"\n * stripQuotes(\"'abc'\") // returns \"abc\"\n * stripQuotes('xyz') // returns \"xyz\" (unchanged)\n */\nexport const stripQuotes = (str: string): string => {\n if (\n (str.startsWith('\"') && str.endsWith('\"')) ||\n (str.startsWith(\"'\") && str.endsWith(\"'\"))\n ) {\n return str.slice(1, -1);\n }\n return str;\n};\n\n/**\n * Parse comma-separated string into array of trimmed non-empty values\n * Commonly used for LaunchDarkly feature flag list values\n *\n * Note: This function only handles parsing and trimming. If your values may\n * contain surrounding quotes (e.g., from LaunchDarkly JSON encoding), apply\n * stripQuotes separately: `parseCommaSeparatedString(value).map(stripQuotes)`\n *\n * @param value - Comma-separated string\n * @returns Array of trimmed non-empty strings\n *\n * @example Basic usage\n * parseCommaSeparatedString(\"xyz:*, abc:TSLA\") // returns [\"xyz:*\", \"abc:TSLA\"]\n *\n * @example Empty string\n * parseCommaSeparatedString(\"\") // returns []\n *\n * @example Whitespace handling\n * parseCommaSeparatedString(\" , , xyz \") // returns [\"xyz\"]\n */\nexport const parseCommaSeparatedString = (value: string): string[] =>\n value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip surrounding quotes from a string (handles both single and double quotes)
|
|
3
|
+
* Use this to clean up values that may have been JSON-encoded with extra quotes
|
|
4
|
+
*
|
|
5
|
+
* @param str - String to strip quotes from
|
|
6
|
+
* @returns String with surrounding quotes removed, or unchanged if no matching quotes
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* stripQuotes('"xyz"') // returns "xyz"
|
|
10
|
+
* stripQuotes("'abc'") // returns "abc"
|
|
11
|
+
* stripQuotes('xyz') // returns "xyz" (unchanged)
|
|
12
|
+
*/
|
|
13
|
+
export declare const stripQuotes: (str: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Parse comma-separated string into array of trimmed non-empty values
|
|
16
|
+
* Commonly used for LaunchDarkly feature flag list values
|
|
17
|
+
*
|
|
18
|
+
* Note: This function only handles parsing and trimming. If your values may
|
|
19
|
+
* contain surrounding quotes (e.g., from LaunchDarkly JSON encoding), apply
|
|
20
|
+
* stripQuotes separately: `parseCommaSeparatedString(value).map(stripQuotes)`
|
|
21
|
+
*
|
|
22
|
+
* @param value - Comma-separated string
|
|
23
|
+
* @returns Array of trimmed non-empty strings
|
|
24
|
+
*
|
|
25
|
+
* @example Basic usage
|
|
26
|
+
* parseCommaSeparatedString("xyz:*, abc:TSLA") // returns ["xyz:*", "abc:TSLA"]
|
|
27
|
+
*
|
|
28
|
+
* @example Empty string
|
|
29
|
+
* parseCommaSeparatedString("") // returns []
|
|
30
|
+
*
|
|
31
|
+
* @example Whitespace handling
|
|
32
|
+
* parseCommaSeparatedString(" , , xyz ") // returns ["xyz"]
|
|
33
|
+
*/
|
|
34
|
+
export declare const parseCommaSeparatedString: (value: string) => string[];
|
|
35
|
+
//# sourceMappingURL=stringParseUtils.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringParseUtils.d.cts","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAQzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,MAAM,EAI1B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip surrounding quotes from a string (handles both single and double quotes)
|
|
3
|
+
* Use this to clean up values that may have been JSON-encoded with extra quotes
|
|
4
|
+
*
|
|
5
|
+
* @param str - String to strip quotes from
|
|
6
|
+
* @returns String with surrounding quotes removed, or unchanged if no matching quotes
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* stripQuotes('"xyz"') // returns "xyz"
|
|
10
|
+
* stripQuotes("'abc'") // returns "abc"
|
|
11
|
+
* stripQuotes('xyz') // returns "xyz" (unchanged)
|
|
12
|
+
*/
|
|
13
|
+
export declare const stripQuotes: (str: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Parse comma-separated string into array of trimmed non-empty values
|
|
16
|
+
* Commonly used for LaunchDarkly feature flag list values
|
|
17
|
+
*
|
|
18
|
+
* Note: This function only handles parsing and trimming. If your values may
|
|
19
|
+
* contain surrounding quotes (e.g., from LaunchDarkly JSON encoding), apply
|
|
20
|
+
* stripQuotes separately: `parseCommaSeparatedString(value).map(stripQuotes)`
|
|
21
|
+
*
|
|
22
|
+
* @param value - Comma-separated string
|
|
23
|
+
* @returns Array of trimmed non-empty strings
|
|
24
|
+
*
|
|
25
|
+
* @example Basic usage
|
|
26
|
+
* parseCommaSeparatedString("xyz:*, abc:TSLA") // returns ["xyz:*", "abc:TSLA"]
|
|
27
|
+
*
|
|
28
|
+
* @example Empty string
|
|
29
|
+
* parseCommaSeparatedString("") // returns []
|
|
30
|
+
*
|
|
31
|
+
* @example Whitespace handling
|
|
32
|
+
* parseCommaSeparatedString(" , , xyz ") // returns ["xyz"]
|
|
33
|
+
*/
|
|
34
|
+
export declare const parseCommaSeparatedString: (value: string) => string[];
|
|
35
|
+
//# sourceMappingURL=stringParseUtils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringParseUtils.d.mts","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAQzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,MAAM,EAI1B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip surrounding quotes from a string (handles both single and double quotes)
|
|
3
|
+
* Use this to clean up values that may have been JSON-encoded with extra quotes
|
|
4
|
+
*
|
|
5
|
+
* @param str - String to strip quotes from
|
|
6
|
+
* @returns String with surrounding quotes removed, or unchanged if no matching quotes
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* stripQuotes('"xyz"') // returns "xyz"
|
|
10
|
+
* stripQuotes("'abc'") // returns "abc"
|
|
11
|
+
* stripQuotes('xyz') // returns "xyz" (unchanged)
|
|
12
|
+
*/
|
|
13
|
+
export const stripQuotes = (str) => {
|
|
14
|
+
if ((str.startsWith('"') && str.endsWith('"')) ||
|
|
15
|
+
(str.startsWith("'") && str.endsWith("'"))) {
|
|
16
|
+
return str.slice(1, -1);
|
|
17
|
+
}
|
|
18
|
+
return str;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Parse comma-separated string into array of trimmed non-empty values
|
|
22
|
+
* Commonly used for LaunchDarkly feature flag list values
|
|
23
|
+
*
|
|
24
|
+
* Note: This function only handles parsing and trimming. If your values may
|
|
25
|
+
* contain surrounding quotes (e.g., from LaunchDarkly JSON encoding), apply
|
|
26
|
+
* stripQuotes separately: `parseCommaSeparatedString(value).map(stripQuotes)`
|
|
27
|
+
*
|
|
28
|
+
* @param value - Comma-separated string
|
|
29
|
+
* @returns Array of trimmed non-empty strings
|
|
30
|
+
*
|
|
31
|
+
* @example Basic usage
|
|
32
|
+
* parseCommaSeparatedString("xyz:*, abc:TSLA") // returns ["xyz:*", "abc:TSLA"]
|
|
33
|
+
*
|
|
34
|
+
* @example Empty string
|
|
35
|
+
* parseCommaSeparatedString("") // returns []
|
|
36
|
+
*
|
|
37
|
+
* @example Whitespace handling
|
|
38
|
+
* parseCommaSeparatedString(" , , xyz ") // returns ["xyz"]
|
|
39
|
+
*/
|
|
40
|
+
export const parseCommaSeparatedString = (value) => value
|
|
41
|
+
.split(',')
|
|
42
|
+
.map((item) => item.trim())
|
|
43
|
+
.filter((item) => item.length > 0);
|
|
44
|
+
//# sourceMappingURL=stringParseUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringParseUtils.mjs","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,IACE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC1C,CAAC;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAY,EAAE,CACnE,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Strip surrounding quotes from a string (handles both single and double quotes)\n * Use this to clean up values that may have been JSON-encoded with extra quotes\n *\n * @param str - String to strip quotes from\n * @returns String with surrounding quotes removed, or unchanged if no matching quotes\n *\n * @example\n * stripQuotes('\"xyz\"') // returns \"xyz\"\n * stripQuotes(\"'abc'\") // returns \"abc\"\n * stripQuotes('xyz') // returns \"xyz\" (unchanged)\n */\nexport const stripQuotes = (str: string): string => {\n if (\n (str.startsWith('\"') && str.endsWith('\"')) ||\n (str.startsWith(\"'\") && str.endsWith(\"'\"))\n ) {\n return str.slice(1, -1);\n }\n return str;\n};\n\n/**\n * Parse comma-separated string into array of trimmed non-empty values\n * Commonly used for LaunchDarkly feature flag list values\n *\n * Note: This function only handles parsing and trimming. If your values may\n * contain surrounding quotes (e.g., from LaunchDarkly JSON encoding), apply\n * stripQuotes separately: `parseCommaSeparatedString(value).map(stripQuotes)`\n *\n * @param value - Comma-separated string\n * @returns Array of trimmed non-empty strings\n *\n * @example Basic usage\n * parseCommaSeparatedString(\"xyz:*, abc:TSLA\") // returns [\"xyz:*\", \"abc:TSLA\"]\n *\n * @example Empty string\n * parseCommaSeparatedString(\"\") // returns []\n *\n * @example Whitespace handling\n * parseCommaSeparatedString(\" , , xyz \") // returns [\"xyz\"]\n */\nexport const parseCommaSeparatedString = (value: string): string[] =>\n value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDurationForDisplay = void 0;
|
|
4
|
+
const TIME_UNITS = [
|
|
5
|
+
{ threshold: 3600, singular: 'hour', plural: 'hours', divisor: 3600 },
|
|
6
|
+
{ threshold: 60, singular: 'minute', plural: 'minutes', divisor: 60 },
|
|
7
|
+
{ threshold: 0, singular: 'second', plural: 'seconds', divisor: 1 },
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Formats a duration in seconds into a human-readable string using the most appropriate unit.
|
|
11
|
+
*
|
|
12
|
+
* The function automatically selects the largest suitable unit (hours, minutes, or seconds)
|
|
13
|
+
* and rounds to the nearest whole number for cleaner display.
|
|
14
|
+
*
|
|
15
|
+
* @param seconds - The duration in seconds to format
|
|
16
|
+
* @returns A formatted string with the appropriate unit (e.g., "30 seconds", "2 minutes", "1 hour")
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* formatDurationForDisplay(30) // "30 seconds"
|
|
20
|
+
* formatDurationForDisplay(90) // "2 minutes" (rounds 1.5 to 2)
|
|
21
|
+
* formatDurationForDisplay(3600) // "1 hour"
|
|
22
|
+
* formatDurationForDisplay(5400) // "2 hours" (rounds 1.5 to 2)
|
|
23
|
+
*/
|
|
24
|
+
const formatDurationForDisplay = (seconds) => {
|
|
25
|
+
// Find the appropriate unit based on the duration
|
|
26
|
+
for (const unit of TIME_UNITS) {
|
|
27
|
+
if (seconds >= unit.threshold) {
|
|
28
|
+
const value = Math.round(seconds / unit.divisor);
|
|
29
|
+
const unitName = value === 1 ? unit.singular : unit.plural;
|
|
30
|
+
return `${value} ${unitName}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Fallback for very small values (should not normally reach here)
|
|
34
|
+
return `${Math.round(seconds)} seconds`;
|
|
35
|
+
};
|
|
36
|
+
exports.formatDurationForDisplay = formatDurationForDisplay;
|
|
37
|
+
//# sourceMappingURL=time.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.cjs","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":";;;AAUA,MAAM,UAAU,GAAe;IAC7B,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IACrE,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IACrE,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE;CACpE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACI,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,kDAAkD;IAClD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAC3D,OAAO,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IAED,kEAAkE;IAClE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;AAC1C,CAAC,CAAC;AAZW,QAAA,wBAAwB,4BAYnC","sourcesContent":["/**\n * Time unit configuration for formatting\n */\ntype TimeUnit = {\n threshold: number;\n singular: string;\n plural: string;\n divisor: number;\n};\n\nconst TIME_UNITS: TimeUnit[] = [\n { threshold: 3600, singular: 'hour', plural: 'hours', divisor: 3600 },\n { threshold: 60, singular: 'minute', plural: 'minutes', divisor: 60 },\n { threshold: 0, singular: 'second', plural: 'seconds', divisor: 1 },\n];\n\n/**\n * Formats a duration in seconds into a human-readable string using the most appropriate unit.\n *\n * The function automatically selects the largest suitable unit (hours, minutes, or seconds)\n * and rounds to the nearest whole number for cleaner display.\n *\n * @param seconds - The duration in seconds to format\n * @returns A formatted string with the appropriate unit (e.g., \"30 seconds\", \"2 minutes\", \"1 hour\")\n *\n * @example\n * formatDurationForDisplay(30) // \"30 seconds\"\n * formatDurationForDisplay(90) // \"2 minutes\" (rounds 1.5 to 2)\n * formatDurationForDisplay(3600) // \"1 hour\"\n * formatDurationForDisplay(5400) // \"2 hours\" (rounds 1.5 to 2)\n */\nexport const formatDurationForDisplay = (seconds: number): string => {\n // Find the appropriate unit based on the duration\n for (const unit of TIME_UNITS) {\n if (seconds >= unit.threshold) {\n const value = Math.round(seconds / unit.divisor);\n const unitName = value === 1 ? unit.singular : unit.plural;\n return `${value} ${unitName}`;\n }\n }\n\n // Fallback for very small values (should not normally reach here)\n return `${Math.round(seconds)} seconds`;\n};\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a duration in seconds into a human-readable string using the most appropriate unit.
|
|
3
|
+
*
|
|
4
|
+
* The function automatically selects the largest suitable unit (hours, minutes, or seconds)
|
|
5
|
+
* and rounds to the nearest whole number for cleaner display.
|
|
6
|
+
*
|
|
7
|
+
* @param seconds - The duration in seconds to format
|
|
8
|
+
* @returns A formatted string with the appropriate unit (e.g., "30 seconds", "2 minutes", "1 hour")
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* formatDurationForDisplay(30) // "30 seconds"
|
|
12
|
+
* formatDurationForDisplay(90) // "2 minutes" (rounds 1.5 to 2)
|
|
13
|
+
* formatDurationForDisplay(3600) // "1 hour"
|
|
14
|
+
* formatDurationForDisplay(5400) // "2 hours" (rounds 1.5 to 2)
|
|
15
|
+
*/
|
|
16
|
+
export declare const formatDurationForDisplay: (seconds: number) => string;
|
|
17
|
+
//# sourceMappingURL=time.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.cts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,YAAa,MAAM,KAAG,MAY1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a duration in seconds into a human-readable string using the most appropriate unit.
|
|
3
|
+
*
|
|
4
|
+
* The function automatically selects the largest suitable unit (hours, minutes, or seconds)
|
|
5
|
+
* and rounds to the nearest whole number for cleaner display.
|
|
6
|
+
*
|
|
7
|
+
* @param seconds - The duration in seconds to format
|
|
8
|
+
* @returns A formatted string with the appropriate unit (e.g., "30 seconds", "2 minutes", "1 hour")
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* formatDurationForDisplay(30) // "30 seconds"
|
|
12
|
+
* formatDurationForDisplay(90) // "2 minutes" (rounds 1.5 to 2)
|
|
13
|
+
* formatDurationForDisplay(3600) // "1 hour"
|
|
14
|
+
* formatDurationForDisplay(5400) // "2 hours" (rounds 1.5 to 2)
|
|
15
|
+
*/
|
|
16
|
+
export declare const formatDurationForDisplay: (seconds: number) => string;
|
|
17
|
+
//# sourceMappingURL=time.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.mts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,YAAa,MAAM,KAAG,MAY1D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const TIME_UNITS = [
|
|
2
|
+
{ threshold: 3600, singular: 'hour', plural: 'hours', divisor: 3600 },
|
|
3
|
+
{ threshold: 60, singular: 'minute', plural: 'minutes', divisor: 60 },
|
|
4
|
+
{ threshold: 0, singular: 'second', plural: 'seconds', divisor: 1 },
|
|
5
|
+
];
|
|
6
|
+
/**
|
|
7
|
+
* Formats a duration in seconds into a human-readable string using the most appropriate unit.
|
|
8
|
+
*
|
|
9
|
+
* The function automatically selects the largest suitable unit (hours, minutes, or seconds)
|
|
10
|
+
* and rounds to the nearest whole number for cleaner display.
|
|
11
|
+
*
|
|
12
|
+
* @param seconds - The duration in seconds to format
|
|
13
|
+
* @returns A formatted string with the appropriate unit (e.g., "30 seconds", "2 minutes", "1 hour")
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* formatDurationForDisplay(30) // "30 seconds"
|
|
17
|
+
* formatDurationForDisplay(90) // "2 minutes" (rounds 1.5 to 2)
|
|
18
|
+
* formatDurationForDisplay(3600) // "1 hour"
|
|
19
|
+
* formatDurationForDisplay(5400) // "2 hours" (rounds 1.5 to 2)
|
|
20
|
+
*/
|
|
21
|
+
export const formatDurationForDisplay = (seconds) => {
|
|
22
|
+
// Find the appropriate unit based on the duration
|
|
23
|
+
for (const unit of TIME_UNITS) {
|
|
24
|
+
if (seconds >= unit.threshold) {
|
|
25
|
+
const value = Math.round(seconds / unit.divisor);
|
|
26
|
+
const unitName = value === 1 ? unit.singular : unit.plural;
|
|
27
|
+
return `${value} ${unitName}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Fallback for very small values (should not normally reach here)
|
|
31
|
+
return `${Math.round(seconds)} seconds`;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=time.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.mjs","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,GAAe;IAC7B,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IACrE,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IACrE,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE;CACpE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,kDAAkD;IAClD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAC3D,OAAO,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IAED,kEAAkE;IAClE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["/**\n * Time unit configuration for formatting\n */\ntype TimeUnit = {\n threshold: number;\n singular: string;\n plural: string;\n divisor: number;\n};\n\nconst TIME_UNITS: TimeUnit[] = [\n { threshold: 3600, singular: 'hour', plural: 'hours', divisor: 3600 },\n { threshold: 60, singular: 'minute', plural: 'minutes', divisor: 60 },\n { threshold: 0, singular: 'second', plural: 'seconds', divisor: 1 },\n];\n\n/**\n * Formats a duration in seconds into a human-readable string using the most appropriate unit.\n *\n * The function automatically selects the largest suitable unit (hours, minutes, or seconds)\n * and rounds to the nearest whole number for cleaner display.\n *\n * @param seconds - The duration in seconds to format\n * @returns A formatted string with the appropriate unit (e.g., \"30 seconds\", \"2 minutes\", \"1 hour\")\n *\n * @example\n * formatDurationForDisplay(30) // \"30 seconds\"\n * formatDurationForDisplay(90) // \"2 minutes\" (rounds 1.5 to 2)\n * formatDurationForDisplay(3600) // \"1 hour\"\n * formatDurationForDisplay(5400) // \"2 hours\" (rounds 1.5 to 2)\n */\nexport const formatDurationForDisplay = (seconds: number): string => {\n // Find the appropriate unit based on the duration\n for (const unit of TIME_UNITS) {\n if (seconds >= unit.threshold) {\n const value = Math.round(seconds / unit.divisor);\n const unitName = value === 1 ? unit.singular : unit.plural;\n return `${value} ${unitName}`;\n }\n }\n\n // Fallback for very small values (should not normally reach here)\n return `${Math.round(seconds)} seconds`;\n};\n"]}
|