@launchdarkly/js-sdk-common 2.29.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/api/data/LDEvaluationReason.d.ts +11 -0
  3. package/dist/cjs/api/data/LDEvaluationReason.d.ts.map +1 -1
  4. package/dist/cjs/api/platform/Filesystem.d.ts +31 -1
  5. package/dist/cjs/api/platform/Filesystem.d.ts.map +1 -1
  6. package/dist/cjs/api/platform/Requests.d.ts +85 -0
  7. package/dist/cjs/api/platform/Requests.d.ts.map +1 -1
  8. package/dist/cjs/index.cjs +153 -8
  9. package/dist/cjs/index.cjs.map +1 -1
  10. package/dist/cjs/internal/evaluation/EventFactoryBase.d.ts +1 -0
  11. package/dist/cjs/internal/evaluation/EventFactoryBase.d.ts.map +1 -1
  12. package/dist/cjs/internal/events/EventProcessor.d.ts.map +1 -1
  13. package/dist/cjs/internal/events/InputEvalEvent.d.ts +7 -1
  14. package/dist/cjs/internal/events/InputEvalEvent.d.ts.map +1 -1
  15. package/dist/cjs/internal/events/LDEventSummarizer.d.ts.map +1 -1
  16. package/dist/cjs/internal/fetch/StreamingResponse.d.ts +83 -0
  17. package/dist/cjs/internal/fetch/StreamingResponse.d.ts.map +1 -0
  18. package/dist/cjs/internal/fetch/index.d.ts +3 -0
  19. package/dist/cjs/internal/fetch/index.d.ts.map +1 -0
  20. package/dist/cjs/internal/fetch/toRequestInit.d.ts +12 -0
  21. package/dist/cjs/internal/fetch/toRequestInit.d.ts.map +1 -0
  22. package/dist/cjs/internal/index.d.ts +1 -0
  23. package/dist/cjs/internal/index.d.ts.map +1 -1
  24. package/dist/esm/api/data/LDEvaluationReason.d.ts +11 -0
  25. package/dist/esm/api/data/LDEvaluationReason.d.ts.map +1 -1
  26. package/dist/esm/api/platform/Filesystem.d.ts +31 -1
  27. package/dist/esm/api/platform/Filesystem.d.ts.map +1 -1
  28. package/dist/esm/api/platform/Requests.d.ts +85 -0
  29. package/dist/esm/api/platform/Requests.d.ts.map +1 -1
  30. package/dist/esm/index.mjs +153 -8
  31. package/dist/esm/index.mjs.map +1 -1
  32. package/dist/esm/internal/evaluation/EventFactoryBase.d.ts +1 -0
  33. package/dist/esm/internal/evaluation/EventFactoryBase.d.ts.map +1 -1
  34. package/dist/esm/internal/events/EventProcessor.d.ts.map +1 -1
  35. package/dist/esm/internal/events/InputEvalEvent.d.ts +7 -1
  36. package/dist/esm/internal/events/InputEvalEvent.d.ts.map +1 -1
  37. package/dist/esm/internal/events/LDEventSummarizer.d.ts.map +1 -1
  38. package/dist/esm/internal/fetch/StreamingResponse.d.ts +83 -0
  39. package/dist/esm/internal/fetch/StreamingResponse.d.ts.map +1 -0
  40. package/dist/esm/internal/fetch/index.d.ts +3 -0
  41. package/dist/esm/internal/fetch/index.d.ts.map +1 -0
  42. package/dist/esm/internal/fetch/toRequestInit.d.ts +12 -0
  43. package/dist/esm/internal/fetch/toRequestInit.d.ts.map +1 -0
  44. package/dist/esm/internal/index.d.ts +1 -0
  45. package/dist/esm/internal/index.d.ts.map +1 -1
  46. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes to `@launchdarkly/js-sdk-common` will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## [2.31.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.30.0...js-sdk-common-v2.31.0) (2026-10-16)
6
+
7
+
8
+ ### Features
9
+
10
+ * Add experimental support for file-based overrides. ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
11
+ * Add optional file stats, watch error reporting, and the changed entry name to the platform filesystem interface ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * Coalesce bursts of file change notifications into one file data reload ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
17
+ * Detect rename-based writes and recreated files in the file data source by watching the containing directories ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
18
+ * Re-establish the file data watch when a watched directory is deleted and created again ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
19
+ * Report file data read and processing failures through the error handler instead of an unhandled promise rejection ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
20
+ * Retry a failed file data reload and keep the last good data in effect ([9c0effe](https://github.com/launchdarkly/js-core/commit/9c0effe9d614ce41cf72a3254e25822c32d9d2f2))
21
+
22
+ ## [2.30.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.29.0...js-sdk-common-v2.30.0) (2026-10-14)
23
+
24
+
25
+ ### Features
26
+
27
+ * Add optional streaming members to the platform fetch types ([#2092](https://github.com/launchdarkly/js-core/issues/2092)) ([4137805](https://github.com/launchdarkly/js-core/commit/4137805723e14f1f21c07b45039c4eeda9889519))
28
+
5
29
  ## [2.29.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.28.1...js-sdk-common-v2.29.0) (2026-10-06)
6
30
 
7
31
 
@@ -53,5 +53,16 @@ export interface LDEvaluationReason {
53
53
  * instance due to a database error.
54
54
  */
55
55
  bigSegmentsStatus?: 'HEALTHY' | 'STALE' | 'NOT_CONFIGURED' | 'STORE_ERROR';
56
+ /**
57
+ * True when an override affected the evaluation, directly or transitively.
58
+ *
59
+ * This is the case when the evaluated flag came from the SDK's override store, or when a
60
+ * prerequisite flag at any depth or a segment read during the evaluation came from that store.
61
+ * Otherwise it is false or undefined. In the JSON representation of the reason the property is
62
+ * present only when it is true.
63
+ *
64
+ * @experimental Flag overrides are currently experimental and subject to change.
65
+ */
66
+ overrideAffected?: boolean;
56
67
  }
57
68
  //# sourceMappingURL=LDEvaluationReason.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LDEvaluationReason.d.ts","sourceRoot":"","sources":["../../../src/api/data/LDEvaluationReason.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,gBAAgB,GAAG,aAAa,CAAC;CAC5E"}
1
+ {"version":3,"file":"LDEvaluationReason.d.ts","sourceRoot":"","sources":["../../../src/api/data/LDEvaluationReason.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,gBAAgB,GAAG,aAAa,CAAC;IAE3E;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -4,6 +4,20 @@ export interface WatchHandle {
4
4
  */
5
5
  close(): void;
6
6
  }
7
+ /**
8
+ * Metadata of a file that a component can compare between two observations to detect a
9
+ * change.
10
+ */
11
+ export interface FileStats {
12
+ /**
13
+ * The time, in ms since POSIX epoch, that the file was last modified.
14
+ */
15
+ timestamp: number;
16
+ /**
17
+ * The size of the file in bytes.
18
+ */
19
+ size: number;
20
+ }
7
21
  /**
8
22
  * Interface for doing filesystem operations on the platform.
9
23
  */
@@ -24,6 +38,16 @@ export interface Filesystem {
24
38
  * rejected if the operation fails.
25
39
  */
26
40
  readFile(path: string): Promise<string>;
41
+ /**
42
+ * Get the metadata of a file. Components use it to detect that a file changed, appeared, or
43
+ * disappeared.
44
+ *
45
+ * @param path The path of the file.
46
+ *
47
+ * @returns A promise which will resolve to the file metadata, or to undefined when the file
48
+ * does not exist. The promise is rejected when the operation fails for another reason.
49
+ */
50
+ getFileStats?(path: string): Promise<FileStats | undefined>;
27
51
  /**
28
52
  * Watch for changes to the specified path.
29
53
  *
@@ -31,10 +55,16 @@ export interface Filesystem {
31
55
  * it should not keep the containing process running as long as it is
32
56
  * executing. For node this means setting the persistent option to false.
33
57
  *
58
+ * When the watch itself fails, the implementation should invoke the callback with the event
59
+ * type `error` instead of raising, so that the owner of the watch can set it up again.
60
+ *
34
61
  * @param path The path to watch.
62
+ * @param callback Receives the event type, the watched path, and, when the platform reports
63
+ * it, the name of the entry within the watched path that changed. The name is undefined when
64
+ * the platform does not report it.
35
65
  *
36
66
  * @returns An async iterator that watches for changes to `path`.
37
67
  */
38
- watch(path: string, callback: (eventType: string, filename: string) => void): WatchHandle;
68
+ watch(path: string, callback: (eventType: string, filename: string, changedName?: string) => void): WatchHandle;
39
69
  }
40
70
  //# sourceMappingURL=Filesystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Filesystem.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Filesystem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,WAAW,CAAC;CAC3F"}
1
+ {"version":3,"file":"Filesystem.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Filesystem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC;;;;;;;;OAQG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CACH,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,GAC5E,WAAW,CAAC;CAChB"}
@@ -38,6 +38,41 @@ export interface Headers {
38
38
  * @param name The name of the header to check.
39
39
  */
40
40
  has(name: string): boolean;
41
+ /**
42
+ * Executes the callback once for each header, with the value first. Optional so existing
43
+ * implementations remain valid. The streaming client reads response headers through this
44
+ * method, or through {@link Headers.entries} when this method is absent.
45
+ *
46
+ * https://developer.mozilla.org/en-US/docs/Web/API/Headers/forEach
47
+ */
48
+ forEach?(callback: (value: string, key: string) => void): void;
49
+ }
50
+ /**
51
+ * A reader over a response body stream.
52
+ */
53
+ export interface BodyReader {
54
+ /**
55
+ * Resolves with the next chunk, or with `done: true` when the server ends the stream.
56
+ * Rejects when the connection terminates before the server ends the stream.
57
+ */
58
+ read(): Promise<{
59
+ done: boolean;
60
+ value?: Uint8Array;
61
+ }>;
62
+ /**
63
+ * Releases the reader and its connection.
64
+ */
65
+ cancel?(): Promise<unknown> | void;
66
+ }
67
+ /**
68
+ * A response body stream.
69
+ */
70
+ export interface ResponseBody {
71
+ getReader(): BodyReader;
72
+ /**
73
+ * Releases the body.
74
+ */
75
+ cancel?(): Promise<unknown> | void;
41
76
  }
42
77
  /**
43
78
  * Interface for fetch responses.
@@ -45,6 +80,20 @@ export interface Headers {
45
80
  export interface Response {
46
81
  headers: Headers;
47
82
  status: number;
83
+ /**
84
+ * The HTTP status message of the response. Optional so existing implementations remain
85
+ * valid.
86
+ *
87
+ * https://developer.mozilla.org/en-US/docs/Web/API/Response/statusText
88
+ */
89
+ statusText?: string;
90
+ /**
91
+ * The response body stream. An implementation provides it for a request made with
92
+ * {@link Options.streaming}. It can also provide it for other requests.
93
+ *
94
+ * https://developer.mozilla.org/en-US/docs/Web/API/Response/body
95
+ */
96
+ body?: ResponseBody | null;
48
97
  /**
49
98
  * Read the response and provide it as a string.
50
99
  */
@@ -54,6 +103,25 @@ export interface Response {
54
103
  */
55
104
  json(): Promise<any>;
56
105
  }
106
+ /**
107
+ * The platform's own `AbortSignal` type when the platform declares one as a global
108
+ * variable. An implementation that passes {@link Options} to a native `fetch` then
109
+ * type-checks against its platform's `RequestInit`. A platform that declares
110
+ * `AbortSignal` as a lexical class resolves to the fallback instead. The fallback is
111
+ * the minimal structural subset an implementation consumes. It keeps these declarations
112
+ * valid on a platform without the global.
113
+ */
114
+ export type AbortSignalLike = typeof globalThis extends {
115
+ AbortSignal: {
116
+ prototype: infer T;
117
+ };
118
+ } ? T : {
119
+ readonly aborted: boolean;
120
+ addEventListener(type: 'abort', listener: () => void, options?: {
121
+ once?: boolean;
122
+ }): void;
123
+ removeEventListener(type: 'abort', listener: () => void): void;
124
+ };
57
125
  export interface Options {
58
126
  headers?: Record<string, string>;
59
127
  method?: string;
@@ -69,6 +137,23 @@ export interface Options {
69
137
  * https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#keepalive
70
138
  */
71
139
  keepalive?: boolean;
140
+ /**
141
+ * An abort signal for the request. When the signal aborts, the implementation stops the
142
+ * request and rejects any pending read. Platform support for this field is best effort.
143
+ *
144
+ * https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#signal
145
+ */
146
+ signal?: AbortSignalLike;
147
+ /**
148
+ * True for a streaming request. The implementation does not buffer the response body,
149
+ * it does not request compressed content, and it ignores {@link Options.timeout}. The
150
+ * response exposes its body through
151
+ * {@link Response.body}. An SDK must use a fetch as a streaming transport only when the
152
+ * implementation honors this field. A streaming implementation must provide at least one
153
+ * release path. It honors {@link Options.signal}, or it provides the body cancel. It
154
+ * preferably provides both.
155
+ */
156
+ streaming?: boolean;
72
157
  }
73
158
  export interface EventSourceCapabilities {
74
159
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Requests.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOtE;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;;OAMG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;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;OASG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEzD,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,GAAG,WAAW,CAAC;IAEtF,0BAA0B,IAAI,uBAAuB,CAAC;IAEtD;;OAEG;IACH,UAAU,CAAC,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,cAAc,CAAC,IAAI,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
@@ -2740,12 +2740,13 @@ function isMigration(u) {
2740
2740
  * @internal
2741
2741
  */
2742
2742
  class SummaryCounter {
2743
- constructor(count, key, value, defValue, version, variation) {
2743
+ constructor(count, key, value, defValue, version, variation, overrideAffected) {
2744
2744
  this.count = count;
2745
2745
  this.key = key;
2746
2746
  this.value = value;
2747
2747
  this.version = version;
2748
2748
  this.variation = variation;
2749
+ this.overrideAffected = overrideAffected;
2749
2750
  this.default = defValue;
2750
2751
  }
2751
2752
  increment() {
@@ -2753,8 +2754,10 @@ class SummaryCounter {
2753
2754
  }
2754
2755
  }
2755
2756
 
2757
+ // The override marker is part of the key, so override-affected and other evaluations of the same
2758
+ // flag, variation, and version accumulate into separate counters.
2756
2759
  function counterKey(event) {
2757
- return `${event.key}:${event.variation !== null && event.variation !== undefined ? event.variation : ''}:${event.version !== null && event.version !== undefined ? event.version : ''}`;
2760
+ return `${event.key}:${event.variation !== null && event.variation !== undefined ? event.variation : ''}:${event.version !== null && event.version !== undefined ? event.version : ''}:${event.overrideAffected ? 'overrideAffected' : ''}`;
2758
2761
  }
2759
2762
  /**
2760
2763
  * @internal
@@ -2785,7 +2788,7 @@ class EventSummarizer {
2785
2788
  counter.increment();
2786
2789
  }
2787
2790
  else {
2788
- this._counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation);
2791
+ this._counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation, event.overrideAffected);
2789
2792
  }
2790
2793
  if (this._startDate === 0 || event.creationDate < this._startDate) {
2791
2794
  this._startDate = event.creationDate;
@@ -2819,6 +2822,10 @@ class EventSummarizer {
2819
2822
  else {
2820
2823
  counterOut.unknown = true;
2821
2824
  }
2825
+ if (counter.overrideAffected) {
2826
+ // The marker is present only when true, like the unknown marker.
2827
+ counterOut.overrideAffected = true;
2828
+ }
2822
2829
  flagSummary.counters.push(counterOut);
2823
2830
  return acc;
2824
2831
  }, {});
@@ -3023,8 +3030,11 @@ class EventProcessor {
3023
3030
  }
3024
3031
  this._summarizer.summarizeEvent(inputEvent);
3025
3032
  const isFeatureEvent = isFeature(inputEvent);
3026
- const addFullEvent = (isFeatureEvent && inputEvent.trackEvents) || !isFeatureEvent;
3027
- const addDebugEvent = this._shouldDebugEvent(inputEvent);
3033
+ // An override-affected evaluation appears only in the summary counters. It produces no
3034
+ // individual feature event and no debug event, even when the flag requests them.
3035
+ const overrideAffected = isFeatureEvent && !!inputEvent.overrideAffected;
3036
+ const addFullEvent = (isFeatureEvent && inputEvent.trackEvents && !overrideAffected) || !isFeatureEvent;
3037
+ const addDebugEvent = !overrideAffected && this._shouldDebugEvent(inputEvent);
3028
3038
  const isIdentifyEvent = isIdentify(inputEvent);
3029
3039
  const shouldNotDeduplicate = this._contextDeduplicator?.processContext(inputEvent.context);
3030
3040
  // If there is no cache, then it will never be in the cache.
@@ -3190,7 +3200,7 @@ class InputCustomEvent {
3190
3200
 
3191
3201
  class InputEvalEvent {
3192
3202
  constructor(withReasons, context, key, value, defValue, // default is a reserved keyword in this context.
3193
- version, variation, trackEvents, prereqOf, reason, debugEventsUntilDate, excludeFromSummaries, samplingRatio = 1) {
3203
+ version, variation, trackEvents, prereqOf, reason, debugEventsUntilDate, excludeFromSummaries, samplingRatio = 1, overrideAffected) {
3194
3204
  this.withReasons = withReasons;
3195
3205
  this.context = context;
3196
3206
  this.key = key;
@@ -3220,6 +3230,9 @@ class InputEvalEvent {
3220
3230
  if (excludeFromSummaries !== undefined) {
3221
3231
  this.excludeFromSummaries = excludeFromSummaries;
3222
3232
  }
3233
+ if (overrideAffected !== undefined) {
3234
+ this.overrideAffected = overrideAffected;
3235
+ }
3223
3236
  }
3224
3237
  }
3225
3238
 
@@ -3247,7 +3260,7 @@ class EventFactoryBase {
3247
3260
  evalEvent(e) {
3248
3261
  return new InputEvalEvent(this._withReasons, e.context, e.flagKey, e.value, e.defaultVal, e.version,
3249
3262
  // Exclude null as a possibility.
3250
- e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this._withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio);
3263
+ e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this._withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio, e.overrideAffected);
3251
3264
  }
3252
3265
  unknownFlagEvent(key, defVal, context) {
3253
3266
  return new InputEvalEvent(this._withReasons, context, key, defVal, defVal,
@@ -3661,6 +3674,136 @@ class PayloadStreamReader {
3661
3674
  }
3662
3675
  }
3663
3676
 
3677
+ /**
3678
+ * Wraps the raw headers in the fetch `Headers` shape. Lookups are case-insensitive.
3679
+ * Multi-value headers are joined with ", ", names that differ only by case merge into one
3680
+ * joined value, and names without a value are skipped.
3681
+ */
3682
+ function wrapRawHeaders(headers) {
3683
+ const normalized = new Map();
3684
+ Object.keys(headers).forEach((key) => {
3685
+ const val = headers[key];
3686
+ if (val !== undefined && val !== null) {
3687
+ const name = key.toLowerCase();
3688
+ const joined = Array.isArray(val) ? val.join(', ') : val;
3689
+ const existing = normalized.get(name);
3690
+ normalized.set(name, existing === undefined ? joined : `${existing}, ${joined}`);
3691
+ }
3692
+ });
3693
+ return {
3694
+ get: (name) => normalized.get(name.toLowerCase()) ?? null,
3695
+ keys: () => normalized.keys(),
3696
+ values: () => normalized.values(),
3697
+ entries: () => normalized.entries(),
3698
+ forEach: (callback) => {
3699
+ normalized.forEach((value, key) => callback(value, key));
3700
+ },
3701
+ has: (name) => normalized.has(name.toLowerCase()),
3702
+ };
3703
+ }
3704
+ /**
3705
+ * Creates a response for a streaming request. The response does not buffer the body. Each
3706
+ * read hands out the next chunk from the source iterator. The body does not enforce a
3707
+ * consumer lock: every `getReader`, `text`, and `json` call reads from the same iterator,
3708
+ * so the caller uses one consumer per response. The `cancel` methods on the body and the
3709
+ * reader call every release function the source provides: they destroy the source when it
3710
+ * has a `destroy` method, and they also call the iterator's `return` method when one
3711
+ * exists. The body passes through as-is, so the caller decodes any content encoding first.
3712
+ *
3713
+ * @param source The raw platform response, for example a Node `IncomingMessage`. A missing
3714
+ * status code maps to 0, and a missing status message maps to an empty string.
3715
+ */
3716
+ function createStreamingResponse(source) {
3717
+ // A consumer compiled without `Symbol.asyncIterator` in its lib can pass a source that
3718
+ // lacks the iterator without a compile error. The check turns that mistake into a named
3719
+ // failure instead of a bare member-access TypeError.
3720
+ if (typeof source[Symbol.asyncIterator] !== 'function') {
3721
+ throw new TypeError('the streaming response source does not provide an async iterator');
3722
+ }
3723
+ const iterator = source[Symbol.asyncIterator]();
3724
+ const cancel = async () => {
3725
+ // Destroy the stream first. That rejects a pending read and unblocks a queued return
3726
+ // call. A Node readable iterator queues the return call behind a pending read, and on
3727
+ // a stream that was never read it completes without a destroy, so the return call
3728
+ // alone cannot release the connection. Do not await it for the same reason. Each
3729
+ // release call is guarded on its own, so a release function that throws, or a return
3730
+ // that resolves synchronously, does not skip the other release path or reject cancel.
3731
+ try {
3732
+ source.destroy?.();
3733
+ }
3734
+ catch {
3735
+ // A throwing destroy has nothing left to release.
3736
+ }
3737
+ try {
3738
+ Promise.resolve(iterator.return?.()).catch(() => { });
3739
+ }
3740
+ catch {
3741
+ // A throwing return has nothing left to release.
3742
+ }
3743
+ };
3744
+ async function text() {
3745
+ const decoder = new TextDecoder();
3746
+ let result = '';
3747
+ try {
3748
+ let next = await iterator.next();
3749
+ while (!next.done) {
3750
+ if (next.value !== undefined) {
3751
+ try {
3752
+ result += decoder.decode(next.value, { stream: true });
3753
+ }
3754
+ catch {
3755
+ // decode() rejects a chunk that is not a BufferSource. The fixed message keeps
3756
+ // chunk contents out of error messages.
3757
+ throw new TypeError('the source supplied a chunk that is not a BufferSource');
3758
+ }
3759
+ }
3760
+ // The stream provides the chunks in sequence, so the reads cannot run in parallel.
3761
+ // oxlint-disable-next-line no-await-in-loop
3762
+ next = await iterator.next();
3763
+ }
3764
+ }
3765
+ catch (err) {
3766
+ // text() owns the body, so any failed read must release the source itself. This
3767
+ // covers a rejecting next() as well as a bad chunk.
3768
+ cancel();
3769
+ throw err;
3770
+ }
3771
+ // The final decode flushes a trailing partial multi-byte sequence.
3772
+ return result + decoder.decode();
3773
+ }
3774
+ return {
3775
+ headers: wrapRawHeaders(source.headers),
3776
+ status: source.statusCode ?? 0,
3777
+ statusText: source.statusMessage ?? '',
3778
+ body: {
3779
+ getReader: () => ({
3780
+ read: async () => {
3781
+ const next = await iterator.next();
3782
+ if (next.done) {
3783
+ return { done: true };
3784
+ }
3785
+ return { done: false, value: next.value };
3786
+ },
3787
+ cancel,
3788
+ }),
3789
+ cancel,
3790
+ },
3791
+ text,
3792
+ json: async () => JSON.parse(await text()),
3793
+ };
3794
+ }
3795
+
3796
+ /**
3797
+ * Converts the request options into the init shape a platform's native `fetch` accepts. A
3798
+ * platform can declare its `AbortSignal` as a lexical class, which `AbortSignalLike`
3799
+ * cannot resolve to, so the `signal` member widens here. The caller must pass a signal
3800
+ * created by the running platform. The widening then only restores the type the runtime
3801
+ * already has.
3802
+ */
3803
+ function toRequestInit(options) {
3804
+ return options;
3805
+ }
3806
+
3664
3807
  /**
3665
3808
  * Creates an InitMetadata object from initialization headers.
3666
3809
  *
@@ -3736,6 +3879,7 @@ var index = /*#__PURE__*/Object.freeze({
3736
3879
  PayloadStreamReader: PayloadStreamReader,
3737
3880
  canonicalize: canonicalize,
3738
3881
  createProtocolHandler: createProtocolHandler,
3882
+ createStreamingResponse: createStreamingResponse,
3739
3883
  initMetadataFromHeaders: initMetadataFromHeaders,
3740
3884
  isLegacyUser: isLegacyUser,
3741
3885
  isMultiKind: isMultiKind,
@@ -3745,7 +3889,8 @@ var index = /*#__PURE__*/Object.freeze({
3745
3889
  safeGetHooks: safeGetHooks,
3746
3890
  safeGetName: safeGetName,
3747
3891
  safeRegisterPlugins: safeRegisterPlugins,
3748
- shouldSample: shouldSample
3892
+ shouldSample: shouldSample,
3893
+ toRequestInit: toRequestInit
3749
3894
  });
3750
3895
 
3751
3896
  exports.ApplicationTags = ApplicationTags;