Skip to content

feat: Refactor package for TypeScript ESM module support#1

Draft
MaximumFX wants to merge 18 commits into
mainfrom
dev
Draft

feat: Refactor package for TypeScript ESM module support#1
MaximumFX wants to merge 18 commits into
mainfrom
dev

Conversation

@MaximumFX
Copy link
Copy Markdown
Owner

No description provided.

@MaximumFX MaximumFX self-assigned this Dec 24, 2025
@MaximumFX MaximumFX added the enhancement New feature or request label Dec 24, 2025
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/client.ts
Comment on lines +274 to +278
if (typeof globalThis.fetch === 'function') {
return globalThis.fetch.bind(globalThis) as (input: unknown, init?: unknown) => Promise<any>;
}

throw new Error('Fetch API is not available. Provide a global fetch implementation.');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore node-fetch fallback for non-fetch runtimes

The new getFetch implementation throws whenever globalThis.fetch is missing, and fetchWithRetry calls it for every request. In Node <18 or any environment without a global fetch, this makes the client unusable even though the previous version worked by calling the node-fetch import directly. Unless you explicitly want to drop support for those runtimes (and declare it via engines), this is a behavior regression; using the imported node-fetch as a fallback would preserve prior functionality.

Useful? React with 👍 / 👎.

Comment on lines +46 to +49
const out = new PaginatedRecordResponse(await client.request({
path,
skipBasePathPrepend: true
}) as PaginatedRecordParams<T>);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve subclass type in paginated navigation

In _get, the result is now constructed with new PaginatedRecordResponse(...) instead of new this.constructor(...). That means if a consumer subclasses PaginatedRecordResponse to add helpers, calling getNext/getPrev on the subclass will now return the base class and drop those subclass methods. This is a regression from the previous behavior and can break downstream code that relies on subclassing.

Useful? React with 👍 / 👎.

@MaximumFX MaximumFX marked this pull request as draft January 7, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant