Repository navigation
feat!: boolean-or-object event stream options and clearer export names - #185
Conversation
…oolean-or-object Follows middleapi/orpc#2428: a feature is configured by a single option that takes `true`/`false` or an object, so it can gain more settings later without another rename. - `initialComment: { enabled, comment }` becomes `initialComment?: boolean | { comment? }` (default `true`). - `keepAlive: { enabled, interval, comment }` becomes `keepAlive?: boolean | { interval?, comment? }` (default `true`). - The object shapes are exported as `ToEventStreamInitialCommentOptions` and `ToEventStreamKeepAliveOptions` (re-exported from node). Applies to every adapter's `eventStream` option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7Q9JBMYWnu5oKt7xQ8
…options
Optional option properties now include `| undefined`, matching the rest of the
codebase, so callers with `exactOptionalPropertyTypes` can forward a possibly
undefined value: `eventStream`, peer codec `prefix`, `getOrBind` `bind`, and
`ErrorEvent` `message`.
Also default fetch `toStandardBody` options to `{}` like the other adapters, and
drop the redundant optional chaining on already-defaulted options.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVaw7Q9JBMYWnu5oKt7xQ8
… aliases - node: `canWriteToNodeResponse`, `getNodeResponseError` and `isNodeResponseDisconnectError` become `canWriteNodeHttpResponse`, `getNodeHttpResponseError` and `isNodeHttpResponseDisconnectError`, matching `NodeHttpResponse` and `toNodeHttpBody`. - core: `assertEventStreamMessageName` becomes `assertEventStreamMessageEvent`, after the `event` field it checks, like its `Id`/`Retry`/`Comment` siblings. - core: `ErrorEvent` / `ErrorEventOptions` become `EventStreamErrorEvent` / `EventStreamErrorEventOptions`, so a missing import no longer silently falls back to the global `ErrorEvent`. - shared: `isTypescriptObject` becomes `isNonPrimitive`. The old names stay exported as `@deprecated` aliases of the new ones, so nothing breaks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7Q9JBMYWnu5oKt7xQ8
…xports Drops the old names kept by the previous commit: - core: `ErrorEvent`, `ErrorEventOptions`, `assertEventStreamMessageName` - node: `canWriteToNodeResponse`, `getNodeResponseError`, `isNodeResponseDisconnectError` - shared: `isTypescriptObject` Use `EventStreamErrorEvent`, `EventStreamErrorEventOptions`, `assertEventStreamMessageEvent`, `canWriteNodeHttpResponse`, `getNodeHttpResponseError`, `isNodeHttpResponseDisconnectError` and `isNonPrimitive` instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7Q9JBMYWnu5oKt7xQ8
@standard-server/aws-lambda
@standard-server/core
@standard-server/fastify
@standard-server/fetch
@standard-server/node
@standard-server/peer
@standard-server/shared
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Boolean-or-object event-stream options —
initialCommentandkeepAliveinpackages/fetch/src/event-stream.tsnow acceptboolean | <ObjectOptions> | undefined, with the object shapes exported asToEventStreamInitialCommentOptions/ToEventStreamKeepAliveOptionsand re-exported from@standard-server/node. Defaults are unchanged and coercion (!== falseto disable) is consistent across both options. EventStreamErrorEventrename — the core class and options interface no longer shadow the DOM globalErrorEvent; all core, fetch, peer, adapter, and e2e call sites were updated, and the intermediate deprecated aliases were removed before shipping.- Node HTTP response helper renames —
canWriteNodeHttpResponse,getNodeHttpResponseError,isNodeHttpResponseDisconnectError, plus the matching internal error-code set, withfastify/aws-lambdacall sites updated. isNonPrimitiverename —isTypescriptObjectrenamed in@standard-server/shared, with validators, event-stream meta, and peer call sites updated.- Optional-property
| undefined— fetch/nodeeventStream, peer codecprefix,getOrBind'sbind, andEventStreamErrorEventOptions.message, forexactOptionalPropertyTypescallers. - fetch
toStandardBodydefault —options: ToStandardBodyOptions = {}, dropping the redundantoptions?.chaining. - Docs — core README examples and export list updated to the new names.
I also verified the rename is complete: a repo-wide search finds no remaining references to any removed identifier in source, tests, benches, playgrounds, or markdown, and pnpm check plus the full vitest suite (1486 tests) pass locally.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Follows middleapi/orpc#2428: a feature is configured by one option that takes
true/falseor an object, so it can gain settings later without another rename. Also tidies option typing and renames a few unclear exports.Breaking changes
Event stream options (
fetch,node, and every adapter'seventStreamoption)true)initialComment: { enabled?, comment? }initialComment?: boolean | { comment? }keepAlive: { enabled, interval?, comment? }keepAlive?: boolean | { interval?, comment? }The object shapes are exported as
ToEventStreamInitialCommentOptionsandToEventStreamKeepAliveOptions(also re-exported from@standard-server/node).Renamed exports
ErrorEvent,ErrorEventOptions(core)EventStreamErrorEvent,EventStreamErrorEventOptionsErrorEventshadows the globalErrorEvent; a missing import silently type-checks against the global andinstanceofstops matchingassertEventStreamMessageName(core)assertEventStreamMessageEventeventfield it checks, like itsId/Retry/CommentsiblingscanWriteToNodeResponse(node)canWriteNodeHttpResponseNodeHttpResponse,toNodeHttpBodygetNodeResponseError(node)getNodeHttpResponseErrorisNodeResponseDisconnectError(node)isNodeHttpResponseDisconnectErrorisTypescriptObject(shared)isNonPrimitiveNon-breaking
| undefined, so callers usingexactOptionalPropertyTypescan forward a possibly undefined value:eventStream, peer codecprefix,getOrBind'sbind,EventStreamErrorEvent'smessage.toStandardBodydefaultsoptionsto{}like the other adapters; redundantoptions?.chaining removed.Downstream
oRPC needs updates when it bumps standard-server: the
initialComment/keepAliveexamples in its handler, link, adapter and Nest docs andfrom-v1.mdx,packages/client/src/adapters/fetch/rpc-link.test.ts, and its uses ofErrorEventandisTypescriptObject.Testing
pnpm format,pnpm check,tscandpnpm test(1486 tests) pass. Added a test thattrueenables the default initial comment and keep-alive.Generated by Claude Code