# Changelog

All notable changes to the NEPSE API Node.js package will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.5] - 2025-08-27

### Fixed
- **Cache Management**: Fixed security and company symbol ID keymap cache invalidation
  - Clear `companySymbolIdKeymap` when new company list is fetched
  - Clear `securitySymbolIdKeymap` when new security list is fetched
  - Ensures cached keymaps are properly invalidated when underlying data changes
  - Prevents stale cache data from being used after list updates

## [1.0.4] - 2025-08-27

### Refactored
- **CLI Floorsheet Code**: Completely refactored floorsheet CLI functionality for better maintainability and reliability
  - Replaced manual pagination and retry logic with dedicated utility classes
  - Introduced `PaginationManager` for handling paginated API responses
  - Introduced `RetryManager` for robust error handling and retry logic
  - Improved code organization and separation of concerns
  - Enhanced error handling with graceful fallbacks

### Added
- **PaginationManager Utility**: New utility class for handling paginated API responses
  - Generic interface for paginated responses with type safety
  - Support for extracting all pages, page ranges, and custom processing
  - Configurable delay between requests for rate limiting
  - Callback hooks for page fetching, errors, and completion
  - Convenience functions for common pagination patterns

- **RetryManager Utility**: New utility class for robust retry logic
  - Configurable retry attempts with exponential backoff
  - Support for custom retry conditions and error handling
  - Graceful fallback mode that continues on failure
  - Comprehensive logging and error reporting
  - Convenience functions for simple retry operations

### Technical Improvements
- Enhanced error resilience in CLI operations
- Better separation of concerns between pagination and retry logic
- Improved code maintainability and testability
- More robust handling of API failures and network issues
- Cleaner and more modular codebase architecture

## [1.0.3] - 2025-08-23

### Fixed
- **CLI Documentation**: Updated README.md CLI command examples to match actual CLI implementation
  - Fixed incorrect command syntax from global options to proper subcommands
  - Updated `--show-status` to `status` subcommand
  - Updated `--get-floorsheet` to `floorsheet` subcommand  
  - Updated `--start-server` to `server` subcommand
  - Added missing examples for file output and CSV format options
  - Added example for hiding progress bar in floorsheet command

### Documentation
- Improved CLI usage examples for better user experience
- Added comprehensive examples for all available CLI options
- Ensured documentation accuracy with actual implementation

## [1.0.2] - 2025-08-22

### Fixed
- **TypeScript Declaration Files**: Fixed missing TypeScript declaration files (`.d.ts`) in npm package
  - Added proper `"types": "dist/index.d.ts"` field in package.json
  - Ensured all TypeScript declaration files are generated and included in npm package
  - Resolved TypeScript compilation errors when importing the package
- **ESLint Configuration**: Updated ESLint configuration to use flat config format (ESLint v9)
  - Converted from CommonJS to flat config format
  - Added proper TypeScript support with `@typescript-eslint` plugin
  - Fixed "File ignored because no matching configuration was supplied" warnings
  - Added missing globals for `URLSearchParams` and `WebAssembly`
  - Disabled problematic rules for better compatibility

### Added
- **NPM Ignore Configuration**: Added comprehensive `.npmignore` file
  - Excludes development files and source code from npm package
  - Ensures only compiled JavaScript and declaration files are published
  - Improves package size and security

### Technical Improvements
- Enhanced build process to ensure declaration files are properly generated
- Improved TypeScript configuration for better type safety
- Better development tooling with updated ESLint rules
- Cleaner npm package structure with proper file exclusions

## [1.0.0] - 2025-08-22

### Added
- Initial release of NEPSE API Node.js package
- Core functionality for interacting with Nepal Stock Exchange (NEPSE) APIs
- TypeScript support with comprehensive type definitions
- CLI interface for easy command-line usage
- Token management system for API authentication
- Error handling and validation
- Unit tests for core functionality

### Features
- Company details and information retrieval
- Stock price and volume data
- Floor sheet data access
- Index graph data
- Supply and demand information
- Today's price data
- Historical price and volume data

### Technical Details
- Built with TypeScript for type safety
- Uses Axios for HTTP requests
- Includes comprehensive error handling
- Supports both synchronous and asynchronous operations
- Includes CLI executable for command-line usage
- Full test coverage with Jest
- ESLint and Prettier configuration for code quality
