Skip to content

Conversation

@mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Jan 16, 2026

This pull request refactors how configuration types are imported and organized throughout the SDK. The main change is the migration of type-only imports from Config to a new ConfigTypes module, improving type safety, clarity, and separation of concerns. Additionally, some exports are moved to reflect this new structure.

Note

This PR resolves Config.tsutils/utils.tsConfig.ts circular dependency.

Changes

Refactoring configuration type imports:

  • Replaced direct imports of types such as StreamrClientConfig, StrictStreamrClientConfig, NetworkPeerDescriptor, and others from Config with type-only imports from a new ConfigTypes module across all SDK files. This includes files like MetricsPublisher.ts, NetworkNodeFacade.ts, ProxyNodeFinder.ts, various contract-related files, and encryption modules. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

  • Updated StreamrClient.ts to import only types from ConfigTypes, while keeping function imports (like createStrictConfig, redactConfig) from Config for clearer separation between types and implementation.

Export and API surface changes:

  • Moved exports of types and constants (e.g., EnvironmentId, EntryPointDiscovery, GapFillStrategy, ConfigInjectionToken) from Config to ConfigTypes in exports.ts, ensuring all type exports come from the new module.

  • Removed the direct export of GapFillStrategy from exports.ts in favor of exporting it via ConfigTypes.

Future steps

  • This PR addresses only 1 out of 3 circular dependency issues in the SDK package. 2 more to go (separately). The other ones are more complex because they require many more changes to logic.

These changes help ensure a cleaner codebase by keeping type definitions and implementation details separate, making the SDK easier to maintain and understand.

Important

Remember to run npm run clean && npm run bootstrap to avoid confusion.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors configuration types by extracting them from Config.ts into a new ConfigTypes.ts module. The primary goal is to resolve a circular dependency between Config.tsutils/utils.tsConfig.ts. The refactoring maintains a clear separation between type definitions (now in ConfigTypes.ts) and implementation logic (remaining in Config.ts).

Changes:

  • Created ConfigTypes.ts containing all type definitions, interfaces, enums, and configuration-related constants
  • Updated Config.ts to import types from ConfigTypes and retain only implementation functions
  • Updated 30+ files across the SDK to import types from ConfigTypes instead of Config

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/sdk/src/ConfigTypes.ts New file containing all configuration type definitions, interfaces, enums (NetworkNodeType), and constants (ENVIRONMENT_IDS, ConfigInjectionToken, etc.)
packages/sdk/src/Config.ts Removed type definitions; now imports types from ConfigTypes and retains implementation functions (createStrictConfig, validateConfig, redactConfig)
packages/sdk/src/exports.ts Updated to export types and constants from ConfigTypes instead of Config
packages/sdk/src/StreamrClient.ts Imports types from ConfigTypes and functions from Config, demonstrating the separation
packages/sdk/src/utils/utils.ts Now imports from ConfigTypes, breaking the circular dependency
packages/sdk/src/subscribe/ordering/GapFiller.ts Removed local GapFillStrategy type definition; now imports from ConfigTypes
packages/sdk/src/ConfigTest.ts Updated to import StreamrClientConfig type from ConfigTypes
24+ other files Updated to use type-only imports from ConfigTypes for configuration types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mondoreale mondoreale merged commit ddcf69e into main Jan 16, 2026
23 checks passed
@mondoreale mondoreale deleted the resolve-some-sdks-circular-dependencies branch January 16, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants