Skip to content

feat: Add eventSource factory and usePost options to the client-side SDK common - #2032

Draft
joker23 wants to merge 5 commits into
mainfrom
skz/sdk-3150/common-eventsource-sdk-client-options
Draft

joker23 wants to merge 5 commits into
mainfrom
skz/sdk-3150/common-eventsource-sdk-client-options

Conversation

@joker23

@joker23 joker23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds two pieces to the client-side SDK common in support of customizable streaming transports:

  • LDEventSourceFactory: a public contract for supplying a custom EventSource implementation (createEventSource(url, initDict) plus a capabilities declaration -- customMethod, headers, readTimeout). The SDK consults the declared capabilities before using a transport feature; a factory that declares nothing is treated as supporting nothing.

  • usePost option (early access, FDv2 dataSystem only): when enabled, streaming and polling flag requests use POST with the evaluation context in the request body instead of GET with the context in the URL path, keeping the context out of URL-based request logs. Streaming POST requires an EventSource whose factory declares customMethod; because there is no fallback on that path, the client throws at construction time if usePost is set without a compatible EventSource. useReport has no effect under FDv2 (usePost is its equivalent there) -- it is ignored with a warning rather than silently changing behavior.

Plumbing: the FDv2 streaming base accepts a method and body, and the source factory provider selects the POST paths and passes the context body through to both the stream and its polling requestor. Covered by new construction-guard, provider, and streaming-base tests.

🤖 Generated with Claude Code


Note

Overview
Adds LDEventSourceFactory as a public contract for custom streaming transports, including optional capabilities (notably customMethod) that the SDK consults before using non-default HTTP methods on streams.

Introduces the early-access usePost option for FDv2 when dataSystem is enabled: polling and streaming can send the evaluation context in a POST body instead of a GET URL. Streaming POST is used only when the platform EventSource reports customMethod; otherwise the client logs a warning and streaming stays on GET while polling still uses POST. useReport is documented and enforced as ineffective under dataSystem (warning + forced off; use usePost instead).

Wiring runs through configuration validation, SourceFactoryProvider (path selection and method/body on StreamingFDv2Base), and client construction checks in LDClientImpl. Tests cover provider behavior, POST stream init, and config warnings.

Reviewed by Cursor Bugbot for commit a757d2c. Bugbot is set up for automated code reviews on this repo. Configure here.

@joker23
joker23 added this pull request to stack #2035 September 18, 2026 20:32
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 29603 bytes
Compressed size limit: 30000
Uncompressed size: 142116 bytes

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32886 bytes
Compressed size limit: 34000
Uncompressed size: 117900 bytes

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25687 bytes
Compressed size limit: 44000
Uncompressed size: 166720 bytes

@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from a0d5217 to 06c2b30 Compare September 18, 2026 20:54
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 06c2b30 to 6f792c9 Compare September 18, 2026 21:35
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 6f792c9 to dd6776f Compare September 21, 2026 13:44
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 3 times, most recently from b9636ed to d0601a6 Compare September 22, 2026 19:43
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from d0601a6 to 55953d7 Compare September 22, 2026 19:53
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 2 times, most recently from 670ac07 to 571e2e3 Compare September 22, 2026 21:44
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 571e2e3 to 8ee6c98 Compare September 23, 2026 16:32
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 8ee6c98 to 73835c5 Compare September 23, 2026 19:26
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 73835c5 to a1ec7a0 Compare September 24, 2026 14:07
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 2 times, most recently from 0e9a389 to cef8863 Compare September 24, 2026 15:20
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from fda03ff to bf66a54 Compare October 1, 2026 18:05
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from bf66a54 to ce76718 Compare October 5, 2026 18:24
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 3 times, most recently from 8a349f0 to 8ab663e Compare October 7, 2026 15:32
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 8ab663e to 0d2bbd1 Compare October 7, 2026 15:55
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 3 times, most recently from 401bed7 to 379fff1 Compare October 7, 2026 20:52
Base automatically changed from skz/sdk-3149/common-eventsource-contract-tests to main October 7, 2026 21:48
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from 379fff1 to 2cb6473 Compare October 7, 2026 21:48
@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch 2 times, most recently from 379fff1 to a757d2c Compare October 8, 2026 16:13
joker23 added a commit that referenced this pull request Oct 8, 2026
This PR will do a pre-release of the new `@launchdarkly/eventsource`
module.

> NOTE: this PR could be merged in parallel to
#2032


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Wires `@launchdarkly/eventsource` (`packages/shared/eventsource`)
into automated release and docs publishing** so it can ship as a **0.0.1
prerelease** via release-please.
> 
> Release-please gains a manifest entry, package config with
`prerelease: true` and `bump-minor-pre-major`, a `release-eventsource`
job/output, and the workspace is added to manual doc publish and release
workflow choices. A bump to `@launchdarkly/js-sdk-common` in
`packages/shared/common` is tied to eventsource’s `package.json`
devDependency.
> 
> The eventsource **README** is expanded with install/quick-start, API
surface notes, and runnable examples for events, retry/backoff,
`errorFilter`, and custom request options.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
59cd76a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@joker23
joker23 marked this pull request as draft October 8, 2026 19:30
@joker23

joker23 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

moved this back to draft so I can sneak in another layer below this one.

@joker23
joker23 force-pushed the skz/sdk-3150/common-eventsource-sdk-client-options branch from a757d2c to 76025e6 Compare October 8, 2026 19:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant