Skip to content

v3.0.0: ESM migration and FRED API v2 support#113

Merged
pastorsj merged 1 commit intomasterfrom
feature/esm-migration
Jan 31, 2026
Merged

v3.0.0: ESM migration and FRED API v2 support#113
pastorsj merged 1 commit intomasterfrom
feature/esm-migration

Conversation

@pastorsj
Copy link
Owner

BREAKING CHANGES:

  • Migrated to native ES modules with dual CJS/ESM package support
  • Requires Node.js 18+
  • Updated all imports to use explicit .js extensions

New Features:

  • Add FRED API v2 support with Bearer token authentication
  • Add getObservationsForRelease() for v2/release/observations endpoint
  • Add getAllObservationsForRelease() with automatic pagination
  • Add start_time and end_time parameters to series/updates
  • Add endpoint-specific limit validation:
    • 100,000 for series/observations
    • 10,000 for series/vintagedates and release/dates
    • 500,000 for v2/release/observations

Build:

  • Replace webpack/babel with tsup for simpler dual ESM/CJS output
  • Update GitHub Actions to Node 18/20/22
  • Update all dependencies to latest versions

@pastorsj pastorsj requested a review from Copilot January 31, 2026 20:03
@pastorsj pastorsj self-assigned this Jan 31, 2026
Copy link

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 PR migrates the node-fred library from CommonJS to native ES modules (ESM) with dual CJS/ESM support, modernizes the build toolchain, and adds FRED API v2 support with Bearer token authentication.

Changes:

  • Migrated to native ES modules with dual package support (ESM/CJS) using tsup bundler
  • Added FRED API v2 endpoints for release observations with pagination support
  • Updated minimum Node.js version to 18+ and GitHub Actions to test against Node 18/20/22

Reviewed changes

Copilot reviewed 37 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Updated version to 3.0.0, configured dual ESM/CJS exports, upgraded dependencies to ESM-native versions
webpack.config.js Removed webpack configuration as part of migration to tsup
tsup.config.js Added tsup configuration for dual ESM/CJS bundling
src/Api/releases.js Added v2 API methods for release observations with pagination
src/Api/Builders/releaseBuilder.js Added v2-specific builder methods for format, cursor, and limit validation
src/Api/Builders/builder.js Added endpoint-specific limit validation methods
src/Api/Builders/seriesBuilder.js Added start_time and end_time parameter support
src/Api/series.js Updated to use endpoint-specific limit methods
All test files Updated imports to use .js extensions for ESM compatibility
.github/workflows/*.yml Updated to Node 18/20/22 and actions v4
LICENSE Updated copyright year to 2026

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

## Test Tooling

Upgrade to ESM-native versions:
- mocha ^11.1.0
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Documentation specifies mocha ^11.1.0, but package.json uses ^11.3.0. These versions should be consistent.

Suggested change
- mocha ^11.1.0
- mocha ^11.3.0

Copilot uses AI. Check for mistakes.

Upgrade to ESM-native versions:
- mocha ^11.1.0
- chai ^5.2.0
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Documentation specifies chai ^5.2.0, but package.json uses ^5.3.3. These versions should be consistent.

Suggested change
- chai ^5.2.0
- chai ^5.3.3

Copilot uses AI. Check for mistakes.
Upgrade to ESM-native versions:
- mocha ^11.1.0
- chai ^5.2.0
- sinon ^21.0.0
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Documentation specifies sinon ^21.0.0, but package.json uses ^21.0.1. These versions should be consistent.

Suggested change
- sinon ^21.0.0
- sinon ^21.0.1

Copilot uses AI. Check for mistakes.
Major release with breaking changes:

ESM Migration:
- Convert to native ES modules with dual CJS/ESM package support
- Use tsup for building both formats

FRED API v2 Support:
- Add getObservationsForRelease() for v2/release/observations endpoint
- Add getAllObservationsForRelease() with automatic pagination
- v2 API uses Bearer token authentication via Authorization header

New Features:
- Add start_time and end_time parameters to series/updates endpoint
- Add endpoint-specific limit validation (100k observations, 10k dates, 500k v2)
- Add exponential backoff with automatic retry for all endpoints
  - Retries on 429 (rate limit) and 503 (service unavailable)
  - Configurable: maxRetries, initialDelayMs, maxDelayMs, backoffMultiplier

TypeScript:
- Update type definitions for v2 API types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@pastorsj pastorsj force-pushed the feature/esm-migration branch from 1915547 to 05bf637 Compare January 31, 2026 20:36
@pastorsj pastorsj merged commit 7fbf8d3 into master Jan 31, 2026
3 checks passed
@pastorsj pastorsj deleted the feature/esm-migration branch January 31, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant