-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Conversation
WalkthroughThis change introduces the Changes
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 }
Possibly related PRs
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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 from0.0.0
The version is currently set to
0.0.0
, which is typically a placeholder. Consider setting it to a proper initial version like0.1.0
or1.0.0
before publishing.packages/hey-api/tests/spec.json (1)
1-133
: Consider the static analysis hints for production useWhile this appears to be a test specification, if this pattern is used for production APIs, consider:
- Adding security definitions (lines flagged by CKV_OPENAPI_4 and CKV_OPENAPI_5)
- Adding
maxItems
constraint to the array response to prevent potential resource exhaustionFor 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 mappingThe 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 functionThe 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 variableThe variable
c
is declared but never used.- const c = sdk.listPlanets()
14-16
: Improve type satisfaction testInstead 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 chainingSince
options
is a required parameter, the optional chaining onoptions?.headers
is unnecessary.- ...options?.headers + ...options.headerspackages/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
: Addalt
text to sponsor SVG for accessibility
The<img>
tag displaying sponsor logos lacks analt
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
⛔ 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 theprepare
script behavior is intentionalThe
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 implementationThe abort signal handling correctly manages signals from both
input
andoptions
, 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 suggestionConsider 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
, andresponse
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.tsLength 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. inclient-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 ofPlanet
andNewPlanet
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-exportstypes.gen
andsdk.gen
for convenient imports. Since ESLint is configured to ignore this directory, no further action is required.
There was a problem hiding this 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:
- Security definitions: Add authentication/authorization schemes even for test APIs
- Array constraints: Add
maxItems
to array responses to prevent potential DoS- 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 totrue
- 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
⛔ 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 mswLength 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=moderateLength 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 vulnerabilitiesNo 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 originalthrowOnError
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:
- Documenting this behavior clearly in the function's JSDoc
- Respecting the original
throwOnError
value if providedconst 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 hintThis provides excellent developer experience without being overly restrictive.
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
More templates
@orpc/arktype
@orpc/client
@orpc/hey-api
@orpc/contract
@orpc/nest
@orpc/openapi
@orpc/openapi-client
@orpc/react
@orpc/react-query
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/standard-server-peer
@orpc/svelte-query
@orpc/tanstack-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
There was a problem hiding this 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 with0.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
📒 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
Therepository.directory
field correctly points topackages/hey-api
, matching the mono-repo structure and aiding package consumers.
17-28
: Dual exports for development and publishing
Defining a top-levelexports
that points to source for local development and overriding it inpublishConfig.exports
to target thedist
output is a smart pattern, ensuring correct resolution in both contexts.
29-31
: Restrict published files to the dist directory
Listing only"dist"
in thefiles
array keeps the published package lightweight by excluding source and test artifacts.
32-37
: Automate client generation with prepare script
Theprepare
script invokesopenapi-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
viaworkspace:*
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.
Convert a Hey API generated-client into an oRPC client to take full advantage of oRPC.
Summary by CodeRabbit
@orpc/hey-api
package, facilitating integration of Hey API-generated clients with the oRPC ecosystem.msw
as a development dependency for API mocking during testing.