Repository navigation
feat(eventStream): the DicomEventStream facade and namespace wiring - #557
Merged
Merged
Conversation
The final slice of the writers wave: the recommended public source/sink API (spec section 32). DicomEventStream wraps a re-runnable run(listener) thunk so one source can drive multiple sinks; Naturalized.from() and DicomWebJson.from() are the section-32 sink helpers. Ported from the v2 rewrite trimmed to core scope: fromPart10, fromPart10Stream, fromDicomWebJson, fromDataSet, from, process, toNaturalized, toDicomWebJson, toPart10, toDataSet, asyncIterable. The media factories (fromImage, fromPdf, fromVideo, fromVideoStream, toPdf, toVideo) and the FHIR pair (fromFhir, toFhir) stay behind for the media and FHIR waves -- which resolves review finding 14 (the video factory's unhandled rejection) by omission for this branch; the media-wave port should create the video source promise lazily inside _run (or attach a no-op catch) when those factories land. The eventStream namespace is wired into src/index.js by hand (core had none), the facade exports join src/eventStream/index.js, and the re-runnability suite that was waiting behind describe.skip in fromPart10Stream.test.js is now live. Tests ported with fixture roots reworked to the packages/fixtures layout. Co-Authored-By: Claude Fable 5 <[email protected]>
awatson1978
added a commit
that referenced
this pull request
Sep 30, 2026
…ne and event-stream findings Engine findings 1/3/4/24/25/27/28/32 landed as PRs #544-#551; the writers wave (#552-#557) fixed 5/6/7/11/22/23 in the ports and retired 14 by trimming the video factories from the core facade. Master verdicts are now verified against origin/master, not just triaged. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
This is the last slice of the writers wave: the
DicomEventStreamfacade from the v2 rewrite, plus the namespace wiring that finally putsdcmjs.eventStreamon the public default export. With the sources, listeners, and writer sinks all landed (#521–#556), the ergonomic wrapper over them is the only piece that was missing:What's verbatim, what's trimmed, what's hand-written:
src/eventStream/api.jsis the v2 file (316 lines) trimmed to core scope (178 lines). The kept surface is verbatim from v2:fromPart10,fromPart10Stream(with its buffer-re-runnable / iterator-single-use split),fromDicomWebJson,fromDataSet,from,process,toNaturalized,toDicomWebJson,toPart10,toDataSet,asyncIterable, and theNaturalized/DicomWebJsonsink helpers. Dropped:fromImage,fromPdf,fromVideo,fromVideoStream,fromFhir,toPdf,toVideo,toFhirand their imports — those belong to the media and FHIR waves.src/eventStream/index.jsadditions and thesrc/index.jsnamespace wiring are hand-written — core's root index had noeventStreamnamespace, and v2's version drags in image/encapsulated/validation modules core doesn't have.eventStreamslots into both the default export and the named exports.fromVideo/fromVideoStreamcallcreateVideoEventSourceeagerly at factory time, so a bad MP4 rejects with no handler attached until the caller drives the stream — an unhandled rejection under Node's defaults. Those factories are exactly the ones trimmed out here, so the finding doesn't apply to this branch. When the media wave ports them, the fix shape is to create the source promise lazily inside_run(or attach a no-op.catch()at factory time) so the rejection always surfaces to the caller'sawait.Tests travel with the code:
test/eventStream/api.test.jsandtest/eventStream/crossSource.test.jsare the v2 suites with fixture roots reworked topackages/fixtures/testImages+packages/fixtures/dicom. Nothing needed trimming — neither suite touches a dropped facade method (the media/FHIR source tests live in separate v2 files that travel with their waves).test/eventStream/export.test.jsasserts the namespace shape ondcmjs.eventStream, includingCONTRACT_VERSION === "1.0.0-A"— core's constant matches v2's, so the assertion is unchanged (I added one line assertingDicomEventStreamis exposed).describe.skipre-runnability block that has been waiting intest/eventStream/fromPart10Stream.test.jssince the streaming reader landed is now live — it importsapi.js, which didn't exist until this PR, and both tests (buffer inputs re-run cleanly; iterator inputs reject with the "already been consumed" error on a second.process()) pass.Full suite: 832 passed / 14 skipped across 68 suites (was 791 / 16 — the two un-skipped re-runnability tests plus the three new suites). 431 insertions, no waiver needed.
🤖 Generated with Claude Code