Skip to content

feat(hey-api): Hey API Integration #547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 27, 2025
Merged

feat(hey-api): Hey API Integration #547

merged 7 commits into from
May 27, 2025

Conversation

unnoq
Copy link
Owner

@unnoq unnoq commented May 26, 2025

Convert a Hey API generated-client into an oRPC client to take full advantage of oRPC.

Summary by CodeRabbit

  • New Features
    • Added the @orpc/hey-api package, facilitating integration of Hey API-generated clients with the oRPC ecosystem.
    • Included a detailed documentation guide for installing, generating, converting, and handling errors with Hey API clients.
    • Updated documentation navigation to feature a new "Hey API" section.
  • Documentation
    • Introduced comprehensive README and usage instructions for the new package.
  • Tests
    • Added extensive automated and type safety tests for the Hey API client integration.
  • Chores
    • Included configuration files, OpenAPI specification, and enhanced linting and gitignore settings.
    • Added msw as a development dependency for API mocking during testing.

Copy link

coderabbitai bot commented May 26, 2025

Walkthrough

This change introduces the @orpc/hey-api package, including implementation, tests, generated client code, OpenAPI specs, configuration, and documentation updates. It adds a conversion utility experimental_toORPCClient to transform SDKs into oRPC clients, along with related tests and documentation. Additionally, it updates the site navigation, ESLint ignore list, dependencies, and package metadata.

Changes

Files/Group Change Summary
apps/content/.vitepress/config.ts, apps/content/docs/hey-api.md Added "Hey API" to the sidebar and introduced a new documentation page explaining Hey API integration.
eslint.config.js Updated ESLint config to ignore packages/hey-api/tests/client/**.
package.json Added msw as a development dependency.
packages/hey-api/.gitignore Added .gitignore for build, log, and temp files in the hey-api package.
packages/hey-api/README.md Added a detailed README for @orpc/hey-api with features, ecosystem, and licensing info.
packages/hey-api/package.json Introduced package manifest for @orpc/hey-api with scripts, dependencies, and publishing config.
packages/hey-api/src/index.ts Barrel export of all from to-orpc-client.
packages/hey-api/src/to-orpc-client.ts Implemented experimental_toORPCClient to convert SDKs into oRPC clients.
packages/hey-api/src/to-orpc-client.test-d.ts Added type-level tests for toORPCClient ensuring type safety and correct signatures.
packages/hey-api/src/to-orpc-client.test.ts Added runtime tests for toORPCClient using msw for mocking HTTP requests and verifying client behavior.
packages/hey-api/tests/client/client.gen.ts Auto-generated Hey API client initializer using @hey-api/openapi-ts.
packages/hey-api/tests/client/index.ts Auto-generated re-export aggregator for types and SDK.
packages/hey-api/tests/client/sdk.gen.ts Auto-generated SDK functions for planet API endpoints.
packages/hey-api/tests/client/types.gen.ts Auto-generated TypeScript types for planet API endpoints and data models.
packages/hey-api/tests/spec.json Added OpenAPI 3.1.1 spec for planets API (used for code generation and testing).
packages/hey-api/tsconfig.json TypeScript config for the hey-api package, including references and exclusions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GeneratedSDK as Hey API SDK
    participant oRPCClient as experimental_toORPCClient
    participant Server

    User->>oRPCClient: Call client method (e.g., listPlanets)
    oRPCClient->>GeneratedSDK: Invoke SDK function with params and headers
    GeneratedSDK->>Server: Make HTTP request
    Server-->>GeneratedSDK: Respond with data
    GeneratedSDK-->>oRPCClient: Return SDK response
    oRPCClient-->>User: Return { body, request, response }
Loading

Possibly related PRs

  • unnoq/orpc#391: Adds ecosystem documentation and navigation for oRPC and Hey API, closely related to this PR's documentation and integration work.
  • unnoq/orpc#262: Adds schema conversion support and OpenAPI spec generation, relevant to schema and codegen aspects.
  • unnoq/orpc#442: Adds OpenAPI Reference plugin, related through API documentation and OpenAPI integration.

Poem

In burrows deep, a rabbit found
New ways for APIs to abound.
With Hey and oRPC combined,
Type-safe journeys are defined.
Docs and tests now lead the way—
Hop along, code friends, and play!
🐇✨


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented May 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orpc ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 9:44am

@unnoq unnoq marked this pull request as ready for review May 26, 2025 09:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (14)
packages/hey-api/package.json (1)

4-4: Consider updating the version from 0.0.0

The version is currently set to 0.0.0, which is typically a placeholder. Consider setting it to a proper initial version like 0.1.0 or 1.0.0 before publishing.

packages/hey-api/tests/spec.json (1)

1-133: Consider the static analysis hints for production use

While this appears to be a test specification, if this pattern is used for production APIs, consider:

  1. Adding security definitions (lines flagged by CKV_OPENAPI_4 and CKV_OPENAPI_5)
  2. Adding maxItems constraint to the array response to prevent potential resource exhaustion

For test purposes, the current specification is adequate.

🧰 Tools
🪛 Checkov (3.2.334)

[HIGH] 1-133: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-133: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[MEDIUM] 35-40: Ensure that arrays have a maximum number of items

(CKV_OPENAPI_21)

apps/content/docs/hey-api.md (2)

36-36: Fix grammar: "an Hey API" → "a Hey API"

-## Generating an Hey API Client
+## Generating a Hey API Client
🧰 Tools
🪛 LanguageTool

[misspelling] ~36-~36: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: .../hey-api@latest ``` ::: ## Generating an Hey API Client To generate a Hey API c...

(EN_A_VS_AN)


71-71: Add missing comma for clarity

-Internally, oRPC passes the `throwOnError` option to the Hey API client. If the original Hey API client throws an error, oRPC will forward it as is without modification ensuring consistent error handling.
+Internally, oRPC passes the `throwOnError` option to the Hey API client. If the original Hey API client throws an error, oRPC will forward it as is without modification, ensuring consistent error handling.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~71-~71: A comma might be missing here.
Context: ...ror, oRPC will forward it as is without modification ensuring consistent error handling.

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/hey-api/src/to-orpc-client.ts (2)

4-8: Consider adding documentation for the complex type mapping

The type mapping is complex and would benefit from documentation explaining what transformations are being applied.

+/**
+ * Maps SDK functions to oRPC Client types, extracting input/output types and wrapping responses
+ * in the standard oRPC response format with body, request, and response properties.
+ */
export type experimental_ToORPCClientResult<T extends Record<string, any>> = {

10-50: Add JSDoc documentation for the main conversion function

The function is well-implemented with proper abort signal handling. Consider adding comprehensive JSDoc documentation.

+/**
+ * Converts a Hey API SDK into an oRPC-compatible client.
+ * 
+ * @param sdk - The Hey API generated SDK object containing API methods
+ * @returns An oRPC client with the same methods but wrapped to match oRPC's interface
+ * 
+ * @experimental This API is experimental and may change in future versions
+ * 
+ * @example
+ * ```ts
+ * import * as sdk from './generated/sdk'
+ * const client = experimental_toORPCClient(sdk)
+ * const result = await client.listItems()
+ * ```
+ */
export function experimental_toORPCClient<T extends Record<string, any>>(sdk: T): experimental_ToORPCClientResult<T> {
packages/hey-api/src/to-orpc-client.test.ts (1)

39-159: Consider adding edge case tests.

The test suite is comprehensive but could benefit from additional edge cases.

Consider adding tests for:

  • Empty response bodies
  • Null/undefined values in headers
  • Malformed responses
  • Network errors (connection refused, timeouts)
  • Multiple concurrent requests

Example test:

it('handles empty response body', async () => {
  server.use(
    http.get('https://example.com/planets', () => {
      return new HttpResponse(null, { status: 204 })
    })
  )
  
  const result = await client.listPlanets()
  expect(result.body).toBeNull()
})
packages/hey-api/src/to-orpc-client.test-d.ts (2)

12-12: Remove unused variable

The variable c is declared but never used.

-  const c = sdk.listPlanets()

14-16: Improve type satisfaction test

Instead of using an unused variable, consider using a type assertion or satisfies operator.

   it('satisfies nested client', () => {
-    const _b: NestedClient<Record<never, never>> = client
+    client satisfies NestedClient<Record<never, never>>
   })
packages/hey-api/tests/client/sdk.gen.ts (1)

34-34: Remove unnecessary optional chaining

Since options is a required parameter, the optional chaining on options?.headers is unnecessary.

-            ...options?.headers
+            ...options.headers
packages/hey-api/README.md (4)

1-3: Replace <image> with standard <img> tag
The <image> element is not a valid HTML tag in Markdown/HTML contexts. Please switch to:

- <image align="center" src="...logo.webp" width=280 alt="oRPC logo" />
+ <img align="center" src="...logo.webp" width="280" alt="oRPC logo" />

5-6: Remove or populate the empty <h1> element
An empty <h1></h1> serves no purpose and may confuse screen readers or break layout. Either add the intended title content or remove these lines.


47-63: Consider varying list item phrasing to reduce repetition
Several package descriptions repeatedly start with “Integration with.” To improve readability, you could alternate phrasing (e.g., “Provides integration for…”, “Supports…”, “Enables…”).

🧰 Tools
🪛 LanguageTool

[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


72-72: Add alt text to sponsor SVG for accessibility
The <img> tag displaying sponsor logos lacks an alt attribute. Consider:

- <img src="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg"/>
+ <img src="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg" alt="oRPC Sponsors"/>
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

72-72: Images should have alternate text (alt text)
null

(MD045, no-alt-text)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72c0312 and 1b60c91.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • apps/content/.vitepress/config.ts (1 hunks)
  • apps/content/docs/hey-api.md (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/hey-api/.gitignore (1 hunks)
  • packages/hey-api/README.md (1 hunks)
  • packages/hey-api/package.json (1 hunks)
  • packages/hey-api/src/index.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.test-d.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.test.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.ts (1 hunks)
  • packages/hey-api/tests/client/client.gen.ts (1 hunks)
  • packages/hey-api/tests/client/index.ts (1 hunks)
  • packages/hey-api/tests/client/sdk.gen.ts (1 hunks)
  • packages/hey-api/tests/client/types.gen.ts (1 hunks)
  • packages/hey-api/tests/spec.json (1 hunks)
  • packages/hey-api/tsconfig.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
apps/content/docs/hey-api.md

[misspelling] ~36-~36: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: .../hey-api@latest ``` ::: ## Generating an Hey API Client To generate a Hey API c...

(EN_A_VS_AN)


[uncategorized] ~71-~71: A comma might be missing here.
Context: ...ror, oRPC will forward it as is without modification ensuring consistent error handling.

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/hey-api/README.md

[misspelling] ~33-~33: Possible spelling mistakes found.
Context: ...tack Query (React, Vue, Solid, Svelte), Pinia Colada, and more. - 🚀 Server Actions: Ful...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 Checkov (3.2.334)
packages/hey-api/tests/spec.json

[HIGH] 1-133: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-133: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[MEDIUM] 35-40: Ensure that arrays have a maximum number of items

(CKV_OPENAPI_21)

🪛 markdownlint-cli2 (0.17.2)
packages/hey-api/README.md

72-72: Images should have alternate text (alt text)
null

(MD045, no-alt-text)

🔇 Additional comments (21)
packages/hey-api/src/index.ts (1)

1-1: LGTM! Clean entry point pattern.

The re-export statement follows standard TypeScript module patterns and provides a clean API surface for the package.

package.json (1)

45-45:

✅ Verification successful

Verify MSW version and approve addition.

Adding MSW as a dev dependency is appropriate for API mocking in tests. Please verify this is the latest stable version and check for any known security vulnerabilities.


🏁 Script executed:

#!/bin/bash
# Description: Check MSW latest version and security status

# Check latest MSW version on npm
curl -s https://registry.npmjs.org/msw/latest | jq '.version'

# Check for known vulnerabilities in MSW 2.8.4
npm audit --audit-level=moderate --package-lock-only [email protected] 2>/dev/null || echo "No audit data available"

Length of output: 191


MSW v2.8.4 is current and secure – approved

  • Verified latest MSW version is 2.8.4
  • No known vulnerabilities reported at the moderate level
  • Placement in devDependencies and alphabetical ordering are correct
apps/content/.vitepress/config.ts (1)

176-176: LGTM! Proper documentation navigation addition.

The Hey API link is correctly placed in the "Others" section and follows the established link format pattern. This supports the documentation for the new Hey API integration.

packages/hey-api/tsconfig.json (1)

1-16: LGTM! Well-structured TypeScript configuration.

The configuration properly:

  • Extends the monorepo base library configuration
  • Sets up appropriate package references to dependencies
  • Excludes test files and development artifacts from compilation
  • Follows established patterns used by other packages in the monorepo
packages/hey-api/package.json (1)

35-35: Verify the prepare script behavior is intentional

The prepare script runs during package installation and generates client code. This could cause issues in CI/CD environments or when the package is installed as a dependency. Consider whether this generation should happen at build time instead.

packages/hey-api/.gitignore (1)

1-26: LGTM!

The .gitignore file is comprehensive and follows best practices for Node.js/TypeScript projects.

packages/hey-api/src/to-orpc-client.ts (1)

20-46: Excellent abort signal handling implementation

The abort signal handling correctly manages signals from both input and options, properly checking for already-aborted signals and setting up event listeners. This ensures proper cancellation propagation.

packages/hey-api/src/to-orpc-client.test.ts (1)

13-15: 🛠️ Refactor suggestion

Consider using a dedicated test endpoint for error simulation.

Using query parameters to control test behavior mixes test concerns with actual API functionality. This approach could lead to false positives if the real API uses a throwOnError parameter.

Consider using a dedicated endpoint pattern for error testing:

-    if (req.request.url.includes('throwOnError=1')) {
-      return HttpResponse.json(null, { status: 500 })
-    }
+http.get('https://example.com/test/error', () => {
+  return HttpResponse.json(null, { status: 500 })
+}),

Likely an incorrect or invalid review comment.

packages/hey-api/tests/client/client.gen.ts (2)

6-14: Well-documented type definition!

The CreateClientConfig type is properly structured with clear documentation explaining its purpose for client initialization.


16-16: Correct client initialization pattern!

The client is properly initialized using the Hey API pattern.

packages/hey-api/src/to-orpc-client.test-d.ts (2)

18-40: Comprehensive input validation tests!

Good coverage of both valid inputs and type error scenarios using @ts-expect-error.


42-46: Well-structured output type tests!

The tests correctly verify that all methods return the expected shape with body, request, and response properties.

packages/hey-api/tests/client/sdk.gen.ts (3)

7-19: Well-structured Options type!

The type properly extends ClientOptions and adds useful fields with clear documentation.


21-26: Clean implementation of listPlanets!

Proper use of optional parameters and client fallback.


41-41:

❓ Verification inconclusive

Verify path parameter substitution

The URL contains a path parameter {planetId} but there's no visible substitution logic. Please ensure the Hey API client handles this correctly.


🏁 Script executed:

#!/bin/bash
# Description: Check if the Hey API client handles path parameter substitution
# Look for path parameter handling in the client-fetch package

# Search for path parameter handling logic
rg -A 10 "planetId|path.*param|{.*}" --glob "!packages/hey-api/tests/**"

# Check if there's documentation about path parameters
fd README -e md | xargs rg -i "path.*param|url.*substit"

Length of output: 255


🏁 Script executed:

#!/bin/bash
# Inspect the generated getPlanet function for parameter handling
rg -n 'function getPlanet' -A20 packages/hey-api/tests/client/sdk.gen.ts

# Search for any `.replace(` calls in the SDK to see if placeholders are substituted
rg '\.replace\(' -n packages/hey-api/tests/client/sdk.gen.ts

Length of output: 137


Verify path parameter substitution in getPlanet

I don’t see any logic replacing {planetId} in the generated URL. Please confirm that the Hey API client (e.g. in client-fetch) automatically interpolates path parameters; otherwise requests to /planets/{planetId} will fail.

• Location: packages/hey-api/tests/client/sdk.gen.ts (lines 39–44)

packages/hey-api/tests/client/types.gen.ts (1)

1-67: Well-structured auto-generated types.

The generated types follow REST conventions correctly with proper use of TypeScript features like never types and template literals. The separation of Planet and NewPlanet types is appropriate for distinguishing between existing and new entities.

packages/hey-api/README.md (4)

28-39: Highlights section is clear and concise
The bullet list effectively communicates the package’s key features with consistent formatting and emoji usage.

🧰 Tools
🪛 LanguageTool

[misspelling] ~33-~33: Possible spelling mistakes found.
Context: ...tack Query (React, Vue, Solid, Svelte), Pinia Colada, and more. - 🚀 Server Actions: Ful...

(EN_MULTITOKEN_SPELLING_TWO)


43-46: Documentation link is correctly referenced
The “full documentation” link is clear and prominently placed. Ensure the URL (https://orpc.unnoq.com) is accessible once published.


64-67: Section for @orpc/hey-api is clear
The subsection succinctly names and links the new package. No changes needed here.


76-79: License section is properly linked
The MIT license notice is clear and points to the canonical file.

packages/hey-api/tests/client/index.ts (1)

1-3: Auto-generated aggregator exports
This file correctly re-exports types.gen and sdk.gen for convenient imports. Since ESLint is configured to ignore this directory, no further action is required.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (9)
packages/hey-api/tests/client/index.ts (1)

1-3: LGTM! Auto-generated test client aggregator.

This auto-generated file serves as a proper entry point for the generated types and SDK used in testing. The barrel export pattern is appropriate for consolidating the generated modules.

Consider documenting the code generation process in the package's README or development documentation to help contributors understand how to regenerate these files when the OpenAPI spec changes.

packages/hey-api/tests/spec.json (1)

1-133: Consider adding security definitions and response constraints for completeness.

While this OpenAPI specification works well for testing purposes, consider the following improvements to align with best practices:

  1. Security definitions: Add authentication/authorization schemes even for test APIs
  2. Array constraints: Add maxItems to array responses to prevent potential DoS
  3. Input validation: Consider adding string length limits and patterns

Here's an example of improvements you could make:

{
  "openapi": "3.1.1",
  "info": {
    "title": "Hey API Test",
    "version": "1.0.0"
  },
+ "security": [
+   {
+     "apiKey": []
+   }
+ ],
  "paths": {
    "/planets": {
      "get": {
+       "security": [
+         {
+           "apiKey": []
+         }
+       ],
        "operationId": "listPlanets",
        // ... parameters ...
        "responses": {
          "200": {
            "description": "A list of planets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
+                 "maxItems": 1000,
                  "items": {
                    "$ref": "#/components/schemas/Planet"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
+   "securitySchemes": {
+     "apiKey": {
+       "type": "apiKey",
+       "in": "header",
+       "name": "X-API-Key"
+     }
+   },
    "schemas": {
      "Planet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
+           "maxLength": 100
          }
        },
        "required": ["id", "name"]
      }
    }
  }
}

These additions demonstrate security and validation best practices, even in test scenarios.

🧰 Tools
🪛 Checkov (3.2.334)

[HIGH] 1-133: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-133: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[MEDIUM] 35-40: Ensure that arrays have a maximum number of items

(CKV_OPENAPI_21)

packages/hey-api/src/to-orpc-client.test-d.ts (1)

12-12: Remove unused variable.

The variable c is defined but never used in the test.

-  const c = sdk.listPlanets()
apps/content/docs/hey-api.md (2)

36-36: Fix grammar: Use "a" instead of "an" before "Hey API".

Since "Hey" starts with a consonant sound, it should be preceded by "a" rather than "an".

-## Generating an Hey API Client
+## Generating a Hey API Client
🧰 Tools
🪛 LanguageTool

[misspelling] ~36-~36: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: .../hey-api@latest ``` ::: ## Generating an Hey API Client To generate a Hey API c...

(EN_A_VS_AN)


71-71: Add missing comma for clarity.

A comma should be added after "modification" to improve readability.

-Internally, oRPC passes the `throwOnError` option to the Hey API client. If the original Hey API client throws an error, oRPC will forward it as is without modification ensuring consistent error handling.
+Internally, oRPC passes the `throwOnError` option to the Hey API client. If the original Hey API client throws an error, oRPC will forward it as is without modification, ensuring consistent error handling.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~71-~71: A comma might be missing here.
Context: ...ror, oRPC will forward it as is without modification ensuring consistent error handling.

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/hey-api/README.md (1)

47-63: Consider varying the sentence structure in the package list.

The repetitive pattern of starting each line with the package name makes the list harder to scan. Consider using a more concise format.

You could restructure this section as a table or use a more varied sentence structure:

-## Packages
-
-- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
-- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
-- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
-- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
-- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
-- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
-- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
-- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
-- [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
-- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
-- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
-- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
-- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
-- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
+## Packages
+
+### Core
+- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract
+- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract
+- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety
+
+### Framework Integrations
+- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deep integration with NestJS
+- [@orpc/react](https://www.npmjs.com/package/@orpc/react): React utilities and Server Actions support
+- Query library integrations:
+  - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): [React Query](https://tanstack.com/query/latest/docs/framework/react/overview)
+  - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview)
+  - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview)
+  - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview)
+  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): [Pinia Colada](https://pinia-colada.esm.dev/)
+
+### Schema & OpenAPI
+- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle requests
+- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): Additional schemas for [Zod](https://zod.dev/)
+- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): [Valibot](https://valibot.dev/) support
+- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): [ArkType](https://arktype.io/) support
🧰 Tools
🪛 LanguageTool

[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

packages/hey-api/src/to-orpc-client.ts (1)

10-50: Add JSDoc documentation for the experimental function.

Since this is marked as experimental, it would be helpful to add comprehensive JSDoc documentation explaining:

  • The purpose and usage of the function
  • The experimental status and potential breaking changes
  • The behavior regarding throwOnError being forced to true
  • Example usage
+/**
+ * Experimental: Converts a Hey API SDK into an oRPC-compatible client.
+ * 
+ * @experimental This API is experimental and may change in future versions.
+ * 
+ * @param sdk - The Hey API SDK object containing API methods
+ * @returns An oRPC client with the same methods as the SDK
+ * 
+ * @remarks
+ * - All SDK methods are wrapped to support oRPC's abort signal handling
+ * - The `throwOnError` option is always set to `true` for consistency with oRPC error handling
+ * - Supports passing `lastEventId` through options for SSE compatibility
+ * 
+ * @example
+ * ```ts
+ * import { createClient } from '@hey-api/client-fetch'
+ * import * as sdk from './generated/sdk'
+ * import { experimental_toORPCClient } from '@orpc/hey-api'
+ * 
+ * const heyApiClient = createClient({ baseUrl: 'https://api.example.com' })
+ * const orpcClient = experimental_toORPCClient({ ...sdk, client: heyApiClient })
+ * 
+ * const result = await orpcClient.listPlanets()
+ * ```
+ */
 export function experimental_toORPCClient<T extends Record<string, any>>(sdk: T): experimental_ToORPCClientResult<T> {
packages/hey-api/src/to-orpc-client.test.ts (2)

7-9: Consider test isolation for client configuration.

The global client configuration could potentially affect other tests if this module is imported elsewhere. Consider moving this configuration inside the test suite or using a setup function to ensure test isolation.

-client.setConfig({
-  baseUrl: 'https://example.com',
-})
+beforeEach(() => {
+  client.setConfig({
+    baseUrl: 'https://example.com',
+  })
+})

39-159: Consider adding tests for additional edge cases.

The test suite is comprehensive, but consider adding tests for:

  • Network errors (connection refused, timeouts)
  • Concurrent requests with shared abort controllers
  • Large response bodies
  • Empty response bodies
  • Invalid response formats (non-JSON)

Would you like me to help generate additional test cases for these scenarios?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72c0312 and 1b60c91.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • apps/content/.vitepress/config.ts (1 hunks)
  • apps/content/docs/hey-api.md (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/hey-api/.gitignore (1 hunks)
  • packages/hey-api/README.md (1 hunks)
  • packages/hey-api/package.json (1 hunks)
  • packages/hey-api/src/index.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.test-d.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.test.ts (1 hunks)
  • packages/hey-api/src/to-orpc-client.ts (1 hunks)
  • packages/hey-api/tests/client/client.gen.ts (1 hunks)
  • packages/hey-api/tests/client/index.ts (1 hunks)
  • packages/hey-api/tests/client/sdk.gen.ts (1 hunks)
  • packages/hey-api/tests/client/types.gen.ts (1 hunks)
  • packages/hey-api/tests/spec.json (1 hunks)
  • packages/hey-api/tsconfig.json (1 hunks)
🧰 Additional context used
🪛 Checkov (3.2.334)
packages/hey-api/tests/spec.json

[HIGH] 1-133: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)


[HIGH] 1-133: Ensure that security operations is not empty.

(CKV_OPENAPI_5)


[MEDIUM] 35-40: Ensure that arrays have a maximum number of items

(CKV_OPENAPI_21)

🪛 LanguageTool
apps/content/docs/hey-api.md

[misspelling] ~36-~36: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: .../hey-api@latest ``` ::: ## Generating an Hey API Client To generate a Hey API c...

(EN_A_VS_AN)


[uncategorized] ~71-~71: A comma might be missing here.
Context: ...ror, oRPC will forward it as is without modification ensuring consistent error handling.

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/hey-api/README.md

[misspelling] ~33-~33: Possible spelling mistakes found.
Context: ...tack Query (React, Vue, Solid, Svelte), Pinia Colada, and more. - 🚀 Server Actions: Ful...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~51-~51: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... your API or implement API contract. - [@orpc/client](https://www.npmjs.com/package/@...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... API on the client with type-safety. - [@orpc/nest](https://www.npmjs.com/package/@or...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...: Deeply integrate oRPC with NestJS. - [@orpc/react](https://www.npmjs.com/package/@o...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~54-~54: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...with React and React Server Actions. - [@orpc/react-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~55-~55: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/react/overview). - [@orpc/vue-query](https://www.npmjs.com/packag...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~56-~56: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...latest/docs/framework/vue/overview). - [@orpc/solid-query](https://www.npmjs.com/pack...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~57-~57: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...test/docs/framework/solid/overview). - [@orpc/svelte-query](https://www.npmjs.com/pac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~58-~58: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...est/docs/framework/svelte/overview). - [@orpc/vue-colada](https://www.npmjs.com/packa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[misspelling] ~58-~58: Possible spelling mistakes found.
Context: ...ge/@orpc/vue-colada): Integration with Pinia Colada. - [@or...

(EN_MULTITOKEN_SPELLING_TWO)


[style] ~59-~59: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ada](https://pinia-colada.esm.dev/). - [@orpc/openapi](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~60-~60: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...I specs and handle OpenAPI requests. - [@orpc/zod](https://www.npmjs.com/package/@orp...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tps://zod.dev/) doesn't support yet. - [@orpc/valibot](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~62-~62: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...rom Valibot. - [@orpc/arktype](https://www.npmjs.com/package/...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 markdownlint-cli2 (0.17.2)
packages/hey-api/README.md

72-72: Images should have alternate text (alt text)
null

(MD045, no-alt-text)

🔇 Additional comments (17)
package.json (1)

45-45:

✅ Verification successful

Verify the msw version for security and currency.

The addition of Mock Service Worker for testing the Hey API integration is appropriate. However, please verify that version ^2.8.4 is current and free from security vulnerabilities.


🏁 Script executed:

#!/bin/bash
# Description: Check for the latest version of msw and any security advisories

# Check latest version on npm
npm view msw version

# Check for security advisories
npm audit --package-lock-only --audit-level=moderate msw

Length of output: 436


To get accurate security results, let’s generate a lockfile for just [email protected] and then run an audit:


🏁 Script executed:

#!/bin/bash
# Create a minimal project to audit msw
npm init -y
# Generate package-lock for [email protected] only
npm install [email protected] --package-lock-only
# Audit at the moderate level
npm audit --audit-level=moderate

Length of output: 531


[email protected] verified as latest and free of known vulnerabilities

  • npm view msw version confirms 2.8.4 is the current release
  • An isolated npm audit reports 0 vulnerabilities

No further action needed.

packages/hey-api/src/index.ts (1)

1-1: LGTM! Clean barrel export pattern.

The re-export from ./to-orpc-client provides a clean public API surface for the package. This follows standard barrel export patterns and simplifies imports for consumers.

apps/content/.vitepress/config.ts (1)

176-176: LGTM! Proper documentation navigation addition.

The addition of the "Hey API" link to the documentation sidebar is well-placed in the "Others" section and follows the existing navigation pattern consistently.

packages/hey-api/.gitignore (1)

1-26: LGTM! Well-structured .gitignore file.

The .gitignore file follows best practices by comprehensively excluding build artifacts, logs, temporary files, and hidden files while preserving important configuration files. The patterns are appropriate for a TypeScript package in a monorepo environment.

packages/hey-api/tsconfig.json (1)

1-16: LGTM! Proper TypeScript configuration for monorepo.

The configuration correctly extends the base library config, sets up project references for dependency management, and appropriately includes/excludes directories. This setup enables incremental builds and maintains consistency across the monorepo.

eslint.config.js (1)

6-6: LGTM! Appropriate exclusion of generated code.

Adding the ignore pattern for the Hey API generated client code is the right approach. Generated code typically doesn't follow project linting rules and should be excluded from ESLint checks.

packages/hey-api/src/to-orpc-client.test-d.ts (1)

14-46: Excellent type safety testing approach.

The test suite comprehensively covers:

  • Type compatibility with NestedClient
  • Input validation with proper @ts-expect-error annotations
  • Output type verification using expectTypeOf

This ensures the experimental_toORPCClient function maintains type safety across all usage scenarios.

apps/content/docs/hey-api.md (1)

1-72: Well-structured documentation with clear examples.

The documentation provides comprehensive coverage of:

  • Installation across multiple package managers
  • Step-by-step client generation process
  • Clear conversion examples with experimental_toORPCClient
  • Error handling behavior explanation

This will help users successfully integrate Hey API clients with oRPC.

🧰 Tools
🪛 LanguageTool

[misspelling] ~36-~36: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: .../hey-api@latest ``` ::: ## Generating an Hey API Client To generate a Hey API c...

(EN_A_VS_AN)


[uncategorized] ~71-~71: A comma might be missing here.
Context: ...ror, oRPC will forward it as is without modification ensuring consistent error handling.

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

packages/hey-api/tests/client/client.gen.ts (1)

1-16: Auto-generated client configuration looks correct.

The generated code properly:

  • Defines appropriate TypeScript types with generics
  • Sets up client configuration with proper type constraints
  • Exports both configuration types and client instance
  • Follows Hey API's recommended patterns for client initialization

Since this is auto-generated code, it correctly implements the expected client setup patterns.

packages/hey-api/package.json (1)

1-48: Well-configured package setup for Hey API integration.

The package configuration correctly includes:

  • Proper ES module setup with appropriate export mappings
  • Correct peer dependency on @hey-api/client-fetch (required for functionality)
  • Workspace dependencies for internal oRPC packages
  • Automated OpenAPI client generation via prepare script
  • Appropriate build and type-checking scripts

This setup will ensure seamless integration with the oRPC ecosystem while maintaining compatibility with Hey API tools.

packages/hey-api/src/to-orpc-client.ts (1)

31-39: Consider respecting the original throwOnError option from the SDK.

The function always forces throwOnError: true, which overrides any user preference from the original SDK call. This might cause unexpected behavior for users who expect non-throwing error handling.

Since this is marked as experimental, this behavior might be intentional. However, consider either:

  1. Documenting this behavior clearly in the function's JSDoc
  2. Respecting the original throwOnError value if provided
 const result = await fn({
   ...input,
   signal: controller.signal,
   headers: {
     ...input?.headers,
     ...typeof options?.lastEventId === 'string' ? { 'last-event-id': options.lastEventId } : {},
   },
-  throwOnError: true,
+  throwOnError: input?.throwOnError ?? true,
 })
packages/hey-api/tests/client/sdk.gen.ts (1)

1-44: Auto-generated file looks good.

This auto-generated SDK structure aligns well with the experimental_toORPCClient converter expectations. The Hey API client library handles URL parameter substitution internally.

packages/hey-api/src/to-orpc-client.test.ts (3)

33-37: Well-structured test lifecycle hooks!

Great use of MSW lifecycle methods with proper setup and cleanup. The onUnhandledRequest: 'error' option ensures that any unhandled requests will fail the tests, which helps catch missing mocks.


100-154: Excellent comprehensive abort signal testing!

The four test cases thoroughly cover different abort signal scenarios:

  • Aborting via first controller after request
  • Aborting via second controller after request
  • Aborting via first controller before request
  • Aborting via second controller before request

This ensures proper signal propagation and error handling in all cases.


157-157: Type assertion is acceptable for error testing.

Using as any here is reasonable since you're intentionally testing error scenarios with invalid input that TypeScript would normally prevent.

packages/hey-api/tests/client/types.gen.ts (2)

12-64: Well-structured type definitions for API contracts!

The use of discriminated unions with never types ensures compile-time safety by preventing the use of incompatible request properties. The response type mappings by status code provide clear API contracts.


65-67: Clever use of TypeScript's template literal types!

The baseUrl type uses a smart pattern:

  • The template literal ${string}://${string} provides IntelliSense hints for URL format
  • The union with (string & {}) allows any string value while preserving the hint

This provides excellent developer experience without being overly restrictive.

Copy link

codecov bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/hey-api/src/index.ts 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link

pkg-pr-new bot commented May 26, 2025

More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@547

@orpc/client

npm i https://pkg.pr.new/@orpc/client@547

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@547

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@547

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@547

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@547

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@547

@orpc/react

npm i https://pkg.pr.new/@orpc/react@547

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@547

@orpc/server

npm i https://pkg.pr.new/@orpc/server@547

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@547

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@547

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@547

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@547

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@547

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@547

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@547

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@547

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@547

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@547

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@547

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@547

commit: 582ea3c

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/hey-api/package.json (3)

4-4: Consider version bump strategy
The version is set to "0.0.0" as an initial placeholder. For clearer semantic versioning, consider starting with 0.1.0 or a prerelease tag when you publish the first usable version.


12-16: Normalize keyword casing
Keywords currently include "Hey API" in title case. It’s more conventional to use lowercase, hyphenated keywords (e.g., "hey-api") to improve searchability on npm.


38-40: Tighten peer dependency version range
Using "*" for @hey-api/client-fetch can allow unintended breaking changes. Consider specifying a minimum compatible range (e.g., ^0.10.1) to enforce compatibility.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b60c91 and 582ea3c.

📒 Files selected for processing (1)
  • packages/hey-api/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint
🔇 Additional comments (8)
packages/hey-api/package.json (8)

2-3: Package scope and module type are correctly set
The package name is scoped to @orpc/hey-api and "type": "module" ensures ES module resolution.


5-6: License and homepage settings are valid
Using the MIT license and linking to the project homepage aligns with open-source best practices.


7-11: Repository configuration for monorepo paths
The repository.directory field correctly points to packages/hey-api, matching the mono-repo structure and aiding package consumers.


17-28: Dual exports for development and publishing
Defining a top-level exports that points to source for local development and overriding it in publishConfig.exports to target the dist output is a smart pattern, ensuring correct resolution in both contexts.


29-31: Restrict published files to the dist directory
Listing only "dist" in the files array keeps the published package lightweight by excluding source and test artifacts.


32-37: Automate client generation with prepare script
The prepare script invokes openapi-ts to generate or refresh the test client before install and publish, ensuring the SDK stays in sync with the OpenAPI spec.


41-44: Workspace dependencies are correctly declared
Referencing @orpc/client and @orpc/shared via workspace:* aligns with your monorepo setup.


45-48: Development dependencies for code generation
Pinning @hey-api/client-fetch and @hey-api/openapi-ts ensures the OpenAPI client is generated consistently with known tool versions.

@unnoq unnoq merged commit 78cfb43 into main May 27, 2025
7 of 8 checks passed
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.

1 participant