Skip to content

feat: produce a dual ESM/CJS build#401

Draft
rhamzeh wants to merge 6 commits into
feat/drop-axiosfrom
feat/esm-modules
Draft

feat: produce a dual ESM/CJS build#401
rhamzeh wants to merge 6 commits into
feat/drop-axiosfrom
feat/esm-modules

Conversation

@rhamzeh
Copy link
Copy Markdown
Member

@rhamzeh rhamzeh commented May 7, 2026

Description

This, coupled with dropping axios, should address #17 #72

What problem is being solved?

How is it being solved?

What changes are made to solve it?

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Inline async pool to remove it as the only CJS-style required runtime dependency.

Info: about tiny-async-pool:

rhamzeh added 5 commits May 7, 2026 01:15
Inline async pool to remove it as the only CJS-style required runtime dependency.

Info: about tiny-async-pool:
- URL: https://github.com/rxaviers/async-pool
- License: MIT
- Author: Rafael Xavier de Souza | https://github.com/rxaviers
Separates crypto-free utilities from generate-random-id.ts (which imports from "crypto").
This allows consumers to import from utils/utils-lite without pulling in the crypto dependency.

We faced this issue recently when we tried to use assertNever from this lib in syntaxt-transformer
@rhamzeh rhamzeh requested review from a team as code owners May 7, 2026 05:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ee311d1-21de-448f-a6b6-e29f2e962925

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/esm-modules

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rhamzeh rhamzeh marked this pull request as draft May 7, 2026 05:24
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

❌ Patch coverage is 90.78947% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.24%. Comparing base (0f237f4) to head (cb5f6cd).

Files with missing lines Patch % Lines
utils/generate-random-id.ts 28.57% 5 Missing ⚠️
utils/utils-lite/async-pool.ts 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/drop-axios     #401      +/-   ##
===================================================
- Coverage            86.41%   86.24%   -0.17%     
===================================================
  Files                   25       27       +2     
  Lines                 1354     1374      +20     
  Branches               287      263      -24     
===================================================
+ Hits                  1170     1185      +15     
- Misses                 111      116       +5     
  Partials                73       73              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Pulls the fetch-based HTTP client + the FgaApiAuthenticationError
re-wrap path (PR #329) into the WIP ESM/CJS dual-build branch.

Conflicts:
* package.json — kept ESM build setup (main / module / exports fields,
  build:cjs / build:esm / build:post scripts) AND took drop-axios's
  newer dep versions inherited from main: jest 30.3.0, ts-jest 29.4.9,
  eslint ^10.3.0, typescript ^6.0.3, nock ^14.0.14, @types/node ^25.6.0,
  @typescript-eslint/* ^8.59.2, @opentelemetry/api ^1.9.1. Removed
  tiny-async-pool + @types/tiny-async-pool (this branch already
  replaced tiny-async-pool with a native impl).

* package-lock.json — regenerated via \`npm install\`. 0 axios entries,
  0 tiny-async-pool entries, 0 vulnerabilities.

* tests/apiExecutor.test.ts, tests/credentials.test.ts,
  tests/headers.test.ts — pure import-style conflicts. Kept this
  branch's \`.js\` extensions on every relative import (mandatory for
  ESM resolution) and drop-axios's default \`import nock from "nock"\`
  shape (nock 14's main entry is callable only via the default export;
  \`import * as nock\` works for namespace methods but breaks
  \`nock(url)\` calls). credentials.test.ts also kept the
  FgaApiAuthenticationError import that PR #329's tests need
  (it was lost on this branch when feat/esm-modules forked from
  the pre-#329 base).

Files auto-merged: credentials/credentials.ts, errors.ts (which now
includes PR #329's re-wrap branch in FgaApiAuthenticationError —
typed \`HttpErrorContext | FgaApiError\` with optional context arg),
tests/client.test.ts, tests/index.test.ts, tests/jest.config.js,
tests/helpers/nocks.ts, tsconfig.json.

Build (cjs + esm) clean. Tests: 302 passed across 15 suites.
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.

3 participants