feat(sse): add @apimatic/sse package for Server-Sent Events#321
Merged
Conversation
asadali214
added a commit
that referenced
this pull request
Jul 8, 2026
Fix the two reliability bugs and raise new-code coverage above the 80% gate on PR #321. - createEventStream: rename the `JSON` const (S2137) so it no longer shadows the global - requestBuilder.test: await the rejects assertion (S8780) and give the three "should not update ..." cases explicit spy assertions (S2699) - sseStream.test: cover drainBodyToText, the web-ReadableStream/Blob/ string body branches, close(), and unsupported body/chunk errors (sseStream.ts 61% -> 97% lines) - createEventStream.test: cover later-abort forwarding and the non-2xx error-body buffering interceptor (createEventStream.ts -> 100% lines) - sonar-project.properties: classify all packages/*/test/** files as tests so helpers (setup.js, sseTestKit.ts) stop counting as coverable production source Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
asadali214
force-pushed
the
feat/sse-package
branch
from
July 9, 2026 05:06
bddcac9 to
6a87167
Compare
Spec-compliant incremental SSE parser, single-use async-iterable SseStream<T> with read-timeout and typed errors, and a createEventStream factory that core's RequestBuilder.callAsEventStream hook delegates to. Version starts at 0.0.0 so the first release (`minor`) lands it at 0.1.0; a 0.0.0 placeholder is already published on npm to enable OIDC trusted publishing for the real release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
asadali214
force-pushed
the
feat/sse-package
branch
from
July 9, 2026 06:49
6a87167 to
ca02e33
Compare
Shield-Jaguar
previously approved these changes
Jul 9, 2026
Shield-Jaguar
left a comment
There was a problem hiding this comment.
You need to make sure that this is the right solution. that we need a dedicated package for that. if you can do without separate package that should be better.
- schemaSseDecoder: retry validation with the raw text when the JSON-parsed form fails a non-string schema, so plain-text frames that happen to be valid JSON (123, true, null) decode as strings instead of aborting the stream. - createEventStream: abort the controller when callAsStream rejects so the user-signal abort-forwarding listener is always detached. - package.json: point "module" at es/index.js (the ESM build) to match sibling packages; lib/ is the CJS build. - rollup.config.js: mark dependencies as external, matching siblings. Adds regression tests for the JSON-lookalike decode and the listener-cleanup-on-failure paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019U1ScRb4izn5axBgMyjHiP
Shield-Jaguar
approved these changes
Jul 9, 2026
Shield-Jaguar
left a comment
There was a problem hiding this comment.
Approved, see my pervious comment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds the
@apimatic/ssepackage. #322 (core + release infra) is merged and@apimatic/core@0.10.30has shipped via OIDC, so this PR is rebased ontomasterand its diff is now sse-only.Contents
@apimatic/sse: spec-compliant SSE parser, single-use async-iterableSseStream<T>(read-timeout, typed errors), andcreateEventStream— the factory that core'sRequestBuilder.callAsEventStreamhook delegates to. Works in both Node and the browser (duck-typed body handling; no Node built-ins).tsconfig.monorepo.jsonreference.sonar-project.properties: classify alltest/**files as tests (so SSE test helpers don't count as coverable source).Release plan
package.jsonversion is intentionally0.0.0. After merge, dispatch the Release workflow withminor→@apimatic/sse 0.0.0 → 0.1.0via OIDC. (A0.0.0placeholder is already on npm with trusted publishing configured; it can be unpublished cleanly until 2026-07-12 09:35 PKT — publish0.1.0first, then unpublish0.0.0.)🤖 Generated with Claude Code