feat(mllp-client): Deno runtime adapter#615
Open
meleksomai wants to merge 1 commit intomainfrom
Open
Conversation
@glion/ack
@glion/annotate-delimiters
@glion/annotate-profile-context
@glion/annotate-profile-datatypes
@glion/annotate-profile-fields
@glion/annotate-profile-fields-code-systems
@glion/annotate-profile-segments
@glion/ast
@glion/builder
@glion/config
@glion/decode-escapes
@glion/encode-escapes
@glion/cli
@glion/hl7v2
@glion/jsonify
@glion/lint-max-message-size
@glion/lint-message-version
@glion/lint-no-trailing-empty-field
@glion/lint-profile-events-segments-order
@glion/lint-profile-extra-components
@glion/lint-profile-extra-fields
@glion/lint-profile-field-max-length
@glion/lint-profile-field-repetition
@glion/lint-profile-required-components
@glion/lint-profile-required-fields
@glion/lint-profile-table-values
@glion/lint-required-message-header
@glion/lint-segment-header-length
@glion/mllp
@glion/mllp-ack
@glion/mllp-client
@glion/mllp-transport
@glion/parser
@glion/preset-annotate-profile-recommended
@glion/preset-lint-profile-recommended
@glion/preset-lint-recommended
@glion/profiles
@glion/to-hl7v2
@glion/util-query
@glion/util-semver
@glion/util-timestamp
@glion/util-visit
@glion/utils
commit: |
6 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #615 +/- ##
==========================================
- Coverage 93.81% 93.75% -0.07%
==========================================
Files 134 135 +1
Lines 4093 4147 +54
Branches 1051 1069 +18
==========================================
+ Hits 3840 3888 +48
- Misses 253 259 +6
🚀 New features to boost your workflow:
|
meleksomai
pushed a commit
that referenced
this pull request
Apr 29, 2026
Replaces the placeholder "(separate PR)" labels in the runtime status table with concrete PR numbers so readers can navigate to the stacked work. https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
10 tasks
Base automatically changed from
claude/create-mllp-client-package-uYzCj
to
main
April 29, 2026 16:01
Adds @glion/mllp-client/deno backed by Deno.connect / Deno.connectTls. The user-facing API matches the Node adapter exactly — only the import path changes. Stacked on PR #609 (mllp-client foundation + Node adapter). Will rebase onto main once #609 merges. Adapter-specific behaviour: - TLS material accepted as string OR Uint8Array; non-string inputs are decoded to PEM before being handed to Deno.connectTls. - tls.passphrase rejected with INVALID_INPUT (Deno does not accept inline passphrases). - tls.insecure: true rejected with INVALID_INPUT (Deno has no runtime flag for this; use --unsafely-ignore-certificate-errors). - Deno.errors.PermissionDenied / NotCapable route to INVALID_INPUT with a message naming --allow-net=host:port. - AbortSignal honoured at connect-phase; pre-aborted signals short-circuit before allocating a socket. Tests: test/deno.test.ts monkey-patches globalThis.Deno so the adapter wiring is exercisable in plain Node vitest. 9 tests cover TCP/TLS connect, TLS option coercion, all three INVALID_INPUT rejections, permission mapping, conn.close after exchange, and pre-aborted-signal short-circuit. Total: 54 -> 63 tests on this branch (the +9 are deno-only). Lint, typecheck, build all clean. https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
0922f18 to
7d2faa6
Compare
🦋 Changeset detectedLatest commit: 7d2faa6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 51 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2 tasks
meleksomai
pushed a commit
that referenced
this pull request
Apr 29, 2026
Adds explicit pnpm scripts for each runtime project so the test matrix is discoverable from package.json: - test:node — runs the Node adapter + runtime-free core tests - test:cf — runs the workerd-based tests - test — unchanged, runs both projects (plain `vitest run`) test:deno and test:bun are not added on this PR. The Deno PR (#615) will add test:deno once its tests are converted from mocked globalThis.Deno to running inside actual Deno (mirroring what this PR did for Workers). Bun support is currently exercised through test:node because the Node adapter is the codepath Bun uses. https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
This was referenced Apr 29, 2026
meleksomai
pushed a commit
that referenced
this pull request
Apr 30, 2026
BREAKING CHANGE: Empty fields, repetitions, and components are now always
represented with `children: []`. The `experimental.emptyMode` setting (which
toggled between "legacy" full-skeleton-with-empty-string-leaf and "empty"
empty-children-array) is removed entirely.
Why this matters now
====================
Every @glion/builder factory call (f(), r(), c()) was routing through
loadConfig() from @glion/config to decide which AST shape to produce. That
imported cosmiconfig + Node-only modules (fs, path, os, crypto, module, url)
into every consumer's bundle:
@glion/mllp-client → @glion/ack → @glion/builder
→ @glion/config (loadConfig)
→ cosmiconfig
→ fs, path, os, crypto, ...
This broke runtime portability: Workers and Deno bundles dragged in Node
builtins they couldn't resolve, even though the harness/runtime never invoked
config-loading code. The architectural fix is to remove disk-based config
discovery from leaf factory functions; sunsetting `legacy` mode is the
cleanest way to do that, since it was the only thing the lookup gated.
Migration
=========
Consumers branching on placeholder leaves of empty fields:
-if (field.children[0]?.children[0]?.children[0]?.value === "") { ... }
+if (field.children.length === 0) { ... }
Config files carrying `experimental.emptyMode` are now rejected by the
@glion/config schema validator. Remove that block from .hl7v2rc.* files.
@glion/util-query's `value()` helper already returns `null` for empty
children — most consumers using it need no change.
What changed
============
- @glion/builder: dropped @glion/config dependency entirely; f()/r()/c() now
always emit `children: []` for empty inputs.
- @glion/parser: dropped emptyMode plumbing from parser.ts/processor.ts/
types.ts. parseHL7v2's settings argument no longer accepts
experimental.emptyMode.
- @glion/config: removed ExperimentalSchema from the settings schema. The
`loadConfig`/`loadConfigAsync` API is unchanged but no longer exposes any
experimental keys.
- @glion/util-visit: deleted the test-helpers + legacy/empty fixture configs;
the visit() implementation was already mode-agnostic.
- @glion/jsonify: updated the runtime serializer to materialize empty fields/
repetitions as "" (preserving the existing JSON output shape — empty
children now flow through here, where previously legacy always produced a
full skeleton with "" leaves).
Side effects
============
- @glion/builder/dist/index.js no longer contains `import "@glion/config"`;
consumers' bundles shrink (cosmiconfig + dependencies dropped).
- The Workers and Deno runtime adapters of @glion/mllp-client (PR #615,
#616) bundle cleanly without `nodejs_compat` polyfills; the cosmiconfig
bundle leak is resolved.
Tests
=====
All affected packages green:
- @glion/builder: 25 tests
- @glion/parser: 56 tests (parser.legacy.test.ts + processor.legacy.test.ts
deleted; their behaviour is now the default)
- @glion/config: 34 tests
- @glion/util-query: 224 tests
- @glion/util-visit: 31 tests (visit.legacy.test.ts deleted; redundant)
- @glion/jsonify: 12 tests
- @glion/hl7v2: 9 tests
The pre-existing @glion/cli config-discover.test.ts flake (.js vs .ts) is
unrelated and was already failing on main before this PR.
https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
meleksomai
pushed a commit
that referenced
this pull request
Apr 30, 2026
Adds explicit pnpm scripts for each runtime project so the test matrix is discoverable from package.json: - test:node — runs the Node adapter + runtime-free core tests - test:cf — runs the workerd-based tests - test — unchanged, runs both projects (plain `vitest run`) test:deno and test:bun are not added on this PR. The Deno PR (#615) will add test:deno once its tests are converted from mocked globalThis.Deno to running inside actual Deno (mirroring what this PR did for Workers). Bun support is currently exercised through test:node because the Node adapter is the codepath Bun uses. https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
meleksomai
pushed a commit
that referenced
this pull request
Apr 30, 2026
Adds explicit pnpm scripts for each runtime project so the test matrix is discoverable from package.json: - test:node — runs the Node adapter + runtime-free core tests - test:cf — runs the workerd-based tests - test — unchanged, runs both projects (plain `vitest run`) test:deno and test:bun are not added on this PR. The Deno PR (#615) will add test:deno once its tests are converted from mocked globalThis.Deno to running inside actual Deno (mirroring what this PR did for Workers). Bun support is currently exercised through test:node because the Node adapter is the codepath Bun uses. https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg
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.
Summary
Adds the Deno runtime adapter to
@glion/mllp-client, backed byDeno.connect/Deno.connectTls. Now rebased ontomainafter PR #609 landed.The user-facing API (
new MllpClient({ host, port }).send(message),client.stream(...),MllpClientError,AckException) is identical to the Node adapter — only the import path changes.Adapter-specific behaviour
stringorUint8Array. Non-string CA/cert/key is decoded to a PEM string before being handed toDeno.connectTls(which expectsstring/string[]).tls.passphraserejected withINVALID_INPUT. Deno'sconnectTlsdoes not accept inline passphrases — decrypt the private key before passing it to the client.tls.insecure: truerejected withINVALID_INPUT. Deno has no runtime flag to disable certificate verification; for self-signed local-dev scenarios, run Deno with--unsafely-ignore-certificate-errors=<host>instead.INVALID_INPUT.Deno.errors.PermissionDeniedandNotCapableare mapped with a message naming thehost:portthe operator must add to--allow-net=…. (Otherwise these would be miscategorised asCONNECTION_REFUSED.)AbortSignalhonoured at connect-phase. Pre-aborted signals short-circuit beforeDeno.connectruns (no socket allocated). A signal that fires during the open is mapped toTIMEOUTwith the abort reason chained ascause.Files of interest
packages/mllp-client/src/runtimes/deno.tsdenoConnect+ theMllpClientsubclass withdenoConnectpre-boundpackages/mllp-client/test/deno.test.tspackages/mllp-client/package.jsondenoconditional export at.and./denosubpathpackages/mllp-client/tsdown.config.tsruntimes/denoentry-point bindingpackages/mllp-client/README.mdshippedin the runtime status table and adds the Deno code exampleTests
test/deno.test.tsmonkey-patchesglobalThis.Denoso the adapter's wiring is exercised in plain Node vitest. Coverage:Uint8Arrayinputs.tls.insecure: truerejection.tls.passphraserejection.Deno.errors.PermissionDeniedmapping with--allow-net=…hint.Deno.connectfailure →CONNECTION_REFUSED.conn.close()runs after a successful exchange.AbortSignalshort-circuits before the runtime allocates a socket.For end-to-end verification inside the actual Deno runtime, write a
*.deno.test.tsfile that runs viadeno testagainst a real server. The MLLP exchange logic itself is covered by the runtime-freetest/core.test.ts(already on main).Test plan
await client.send(message)resolves withAA.--allow-net, the surfaced error isINVALID_INPUTand names the required permission flag.https://claude.ai/code/session_01MvBEUcGkRokNw2GWYVHADg