Skip to content

Tech debt: Refactor oversized modules #30

@evans-sam

Description

@evans-sam

Problem

Three source files are significantly oversized:

  • src/wsdl/index.ts1,464 LOC
  • src/wsdl/elements.ts1,198 LOC
  • src/client.ts633 LOC

Combined, these three files hold almost all of the complexity in the library.

Why it matters

Proposed approach

This is a multi-PR effort. Suggested sequence:

Phase 1 — client.ts (smallest, clearest wins):

  • Extract request-builder into src/client/request-builder.ts.
  • Extract response-parser into src/client/response-parser.ts.
  • Extract event-wiring / EventEmitter surface into src/client/events.ts.
  • Keep client.ts as the public facade.

Phase 2 — src/wsdl/elements.ts:

  • Each "element" class is roughly independent. Split into a directory with one file per element class (or small related groups).
  • Keep a barrel src/wsdl/elements/index.ts.

Phase 3 — src/wsdl/index.ts:

  • After elements are split, the WSDL parser can be broken into:
    • schema loader
    • schema cache
    • XML ingestion (sax wiring)
    • tree builder
  • Land each as its own PR.

Each phase: tests pass, public API unchanged.

Acceptance criteria

  • No source file exceeds ~500 LOC.
  • Public API (exports) unchanged.
  • All tests pass.
  • Internal module boundaries are clearer (no circular deps).

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt / code quality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions