Skip to content

feat: Modernize library, add comprehensive tests, and improve code qu… - #1

Open
AshutoshBuilds wants to merge 1 commit into
symphonyfintech:masterfrom
AshutoshBuilds:master
Open

AshutoshBuilds wants to merge 1 commit into
symphonyfintech:masterfrom
AshutoshBuilds:master

Conversation

@AshutoshBuilds

Copy link
Copy Markdown

Hello Symphony Fintech Team,

This pull request introduces a series of significant improvements and modernizations to the xts-interactive-api Node.js library. The goal of these changes was to enhance its robustness, maintainability, and developer experience.

Key Changes and Improvements:

  • Dependency Modernization:

    • Replaced deprecated request and request-promise with axios for HTTP requests.
    • Upgraded socket.io-client from v2.x to v4.8.1 (latest LTS) and updated lib/interactiveSocket.js for compatibility, including improved reconnection logic and event handling.
    • Removed the unused linq dependency, replacing its functionality with native URLSearchParams.
    • Added chalk for improved console output in the logger.
  • Comprehensive Test Suite:

    • Implemented a full test suite using Jest, achieving good coverage across all core modules:
      • lib/customError.js
      • lib/logger.js
      • lib/request.js (HTTP client wrapper)
      • lib/interactiveSocket.js (WebSocket handling)
      • lib/interactiveRestAPI.js (all API methods)
    • All 131 tests are currently passing.
  • Code Quality & Refinements:

    • Refactored lib/customError.js into a proper ES6 class.
    • Standardized error handling in lib/interactiveRestAPI.js to consistently use CustomError.
    • Removed Date.prototype extensions from lib/logger.js, replacing them with internal utility functions and adding timestamping to log messages.
    • Improved JSON parsing robustness in lib/interactiveSocket.js event handlers.
    • Minor refactorings in lib/interactiveRestAPI.js for clarity (URL construction, populateEnums variable scoping).
    • Cleaned up unused settings in lib/config/app/settings.json.
  • Documentation & Setup:

    • Updated README.md with current dependencies, new method documentation (getOrderHistory, loginWithToken), corrected examples, and testing instructions.
    • Added a comprehensive .gitignore file for Node.js projects.
    • Maintained a detailed changelog.md (included in this PR) and a PRD.md (also included) that guided these enhancements.

Benefits:

  • More stable and reliable library due to modern dependencies and extensive testing.
  • Easier maintenance and future development.
  • Improved developer experience with clearer logging and updated documentation.

All changes are based on the version of the library in my fork (AshutoshBuilds/xts-interactive-api) where this work was performed.

Please let me know if you have any questions or require further changes.

Thank you for considering these improvements!

@AshutoshBuilds

Copy link
Copy Markdown
Author

Hey @AjitNambiar @nagapavandev check this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant