Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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
FlagNetworkDataSourcewith a Controller state machine backed by dedicatedStreamSource,PollingSource, andBundledSourceI/O modulesstream,poll,bundled,provided,fetched), flowing into a newmetrics.sourcefield (in-memory,remote,embedded)configUpdatedAtguard that rejects stale data from overwriting newer in-memory stateX-Retry-Attemptheaders aid debuggingWeakSetto per-instance, so multiplecreateClient()calls no longer share tracking stateUsageTracker— failed ingest events are prepended back to the queue (capped at 500) instead of silently droppedevaluate()calls during a build share a single fetch promise and emit a single usage tracking eventcreateClientAPI usingfetchMockandcreateMockStream, removing themswdependencyBreaking Changes
Renamed exports (old names preserved as deprecated aliases):
FlagNetworkDataSourceclass →Controller(alias kept)FlagNetworkDataSourceOptionstype →ControllerOptions(alias kept)DataSourceinterface →ControllerInterface(no alias — this was the lower-level interface, not the re-exported one)Since
FlagNetworkDataSourceandFlagNetworkDataSourceOptionsare still exported with@deprecatedannotations, consumers using those names won't break. However,DataSourcewas renamed toControllerInterfacewithout an alias — anyone importingDataSourcefrom types will break.Metrics.modeis now required on all evaluation results:mode: 'streaming' | 'polling' | 'build' | 'offline'to theMetricstypeMetricsobjects exhaustively would need updatingevaluate()no longer throws when all data sources fail (ifdefaultValueis provided):main:controller-fns.evaluate()callsds.read()without try/catch — if read throws, the error propagatescontrol: wrapscontroller.read()in try/catch and returns{ value: defaultValue, reason: ERROR }when a default is providedevaluate()when sources are down will now silently get the default value backevaluate()now reports on FLAG_NOT_FOUND:main: nointernalReportValuecall when the flag definition is missingcontrol: callsinternalReportValuewithreason: ERRORwhendatafile.projectIdexistscreate-raw-clientinitialization failures are swallowed:main:evaluate()doesif (!instance?.initialized) await api.initialize()— init errors propagatecontrol: wraps in try/catch — init errors are swallowed, lettingevaluate()handle its own fallback chainError message prefix changed:
'flags: Missing sdkKey'→'@vercel/flags-core: Missing sdkKey''flags: Missing sdkKey in connection string'→'@vercel/flags-core: Missing sdkKey in connection string''Definition not found for flag "..."'→ `'@vercel/flags-core: Definition not found for flag "..."Additions (non-breaking)
ControllerexportControllerOptionstypeMetrics.modefield'streaming' | 'polling' | 'build' | 'offline'ControllerInterfaceDataSourcegetDatafile()awaits pending initcreateClientsdkKeyOrConnectionStringis not a string (previously only checked for falsy)Removals
DataSourceinterface nameControllerInterface, no aliasclient-map.tsmoduleClientInstanceandclientMapare nowControllerInstanceandcontrollerInstanceMapincontroller-fns.tsdata-source/directoryFlagNetworkDataSource,InMemoryDataSource,stream-connectionall replaced bycontroller/mswdev dependencyfetchMockDeprecations
FlagNetworkDataSourceControllerFlagNetworkDataSourceOptions