@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
@@ -0,0 +1,83 @@
1
+ import type { Response, ResponseBody } from '../../api/platform/Requests';
2
+ /**
3
+ * The shape of raw HTTP headers: names mapped to a value, a list of values, or no value.
4
+ * A Node `IncomingHttpHeaders` object satisfies this shape.
5
+ */
6
+ export type RawHeaders = Record<string, string | string[] | undefined>;
7
+ /**
8
+ * The source of response chunks. A platform provides the iterator from its own stream type.
9
+ * For example, a Node `IncomingMessage` provides a compatible iterator through its
10
+ * `Symbol.asyncIterator` method.
11
+ */
12
+ export interface ResponseChunkIterator {
13
+ /**
14
+ * Resolves with the next chunk, or with `done: true` when the stream ends. Rejects when
15
+ * the connection terminates before the server ends the stream. A chunk delivered together
16
+ * with `done: true` is discarded, so the iterator must deliver the last chunk on its own.
17
+ */
18
+ next(): Promise<{
19
+ done?: boolean;
20
+ value?: Uint8Array;
21
+ }>;
22
+ /**
23
+ * Releases the iterator. A Node `Readable` iterator queues this call behind a pending
24
+ * read, so this call alone does not release an idle stream.
25
+ */
26
+ return?(): Promise<{
27
+ done?: boolean;
28
+ value?: Uint8Array;
29
+ }>;
30
+ }
31
+ /**
32
+ * The key of the chunk iterator on a streaming response source. A consumer's compile-time
33
+ * lib may not declare `Symbol.asyncIterator`. This conditional resolves to that symbol when
34
+ * the lib declares it, and to no key at all otherwise. That keeps these declarations valid
35
+ * for every consumer, like `AbortSignalLike` does for the abort signal. Without the symbol,
36
+ * the source type cannot require the iterator, and a source without a stream fails at run
37
+ * time instead of compile time.
38
+ */
39
+ type AsyncIteratorKey = typeof Symbol extends {
40
+ readonly asyncIterator: infer S;
41
+ } ? S extends keyof any ? S : never : never;
42
+ /**
43
+ * The source of a streaming response: the metadata and the chunk stream. A Node
44
+ * `IncomingMessage` satisfies this shape, so a platform can pass its message directly.
45
+ */
46
+ export type StreamingResponseSource = {
47
+ headers: RawHeaders;
48
+ statusCode?: number;
49
+ statusMessage?: string;
50
+ /**
51
+ * Destroys the underlying stream. `cancel` uses it to release the connection even while
52
+ * a read is in progress. A Node `Readable` provides it. A source without it must release
53
+ * through the iterator `return` method; a source whose `return` queues behind a pending
54
+ * read, like a Node readable iterator, must provide `destroy` or `cancel` cannot release
55
+ * it mid-read.
56
+ */
57
+ destroy?(): void;
58
+ } & {
59
+ [K in AsyncIteratorKey]: () => ResponseChunkIterator;
60
+ };
61
+ /**
62
+ * A response for a streaming request. Unlike the base response, the body and the status
63
+ * message are always present.
64
+ */
65
+ export interface StreamingResponse extends Response {
66
+ body: ResponseBody;
67
+ statusText: string;
68
+ }
69
+ /**
70
+ * Creates a response for a streaming request. The response does not buffer the body. Each
71
+ * read hands out the next chunk from the source iterator. The body does not enforce a
72
+ * consumer lock: every `getReader`, `text`, and `json` call reads from the same iterator,
73
+ * so the caller uses one consumer per response. The `cancel` methods on the body and the
74
+ * reader call every release function the source provides: they destroy the source when it
75
+ * has a `destroy` method, and they also call the iterator's `return` method when one
76
+ * exists. The body passes through as-is, so the caller decodes any content encoding first.
77
+ *
78
+ * @param source The raw platform response, for example a Node `IncomingMessage`. A missing
79
+ * status code maps to 0, and a missing status message maps to an empty string.
80
+ */
81
+ export declare function createStreamingResponse(source: StreamingResponseSource): StreamingResponse;
82
+ export {};
83
+ //# sourceMappingURL=StreamingResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamingResponse.d.ts","sourceRoot":"","sources":["../../../src/internal/fetch/StreamingResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,QAAQ,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AASnF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IAExD;;;OAGG;IACH,MAAM,CAAC,IAAI,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;CAC5D;AAED;;;;;;;GAOG;AACH,KAAK,gBAAgB,GAAG,OAAO,MAAM,SAAS;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;CAAE,GAC7E,CAAC,SAAS,MAAM,GAAG,GACjB,CAAC,GACD,KAAK,GACP,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB,GAAG;KAAG,CAAC,IAAI,gBAAgB,GAAG,MAAM,qBAAqB;CAAE,CAAC;AA+B7D;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,iBAAiB,CA6E1F"}
@@ -0,0 +1,3 @@
1
+ export * from './StreamingResponse';
2
+ export * from './toRequestInit';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/fetch/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Options } from '../../api/platform/Requests';
2
+ /**
3
+ * Converts the request options into the init shape a platform's native `fetch` accepts. A
4
+ * platform can declare its `AbortSignal` as a lexical class, which `AbortSignalLike`
5
+ * cannot resolve to, so the `signal` member widens here. The caller must pass a signal
6
+ * created by the running platform. The widening then only restores the type the runtime
7
+ * already has.
8
+ */
9
+ export declare function toRequestInit(options: Options): Omit<Options, 'signal'> & {
10
+ signal?: any;
11
+ };
12
+ //# sourceMappingURL=toRequestInit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toRequestInit.d.ts","sourceRoot":"","sources":["../../../src/internal/fetch/toRequestInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,CAE1F"}
@@ -3,6 +3,7 @@ export * from './diagnostics';
3
3
  export * from './evaluation';
4
4
  export * from './events';
5
5
  export * from './fdv2';
6
+ export * from './fetch';
6
7
  export * from './metadata';
7
8
  export * from './plugins';
8
9
  export * from './json';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -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;IACH,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzB;;;;;OAKG;IACH,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,OA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;;;;;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"}
@@ -2738,12 +2738,13 @@ function isMigration(u) {
2738
2738
  * @internal
2739
2739
  */
2740
2740
  class SummaryCounter {
2741
- constructor(count, key, value, defValue, version, variation) {
2741
+ constructor(count, key, value, defValue, version, variation, overrideAffected) {
2742
2742
  this.count = count;
2743
2743
  this.key = key;
2744
2744
  this.value = value;
2745
2745
  this.version = version;
2746
2746
  this.variation = variation;
2747
+ this.overrideAffected = overrideAffected;
2747
2748
  this.default = defValue;
2748
2749
  }
2749
2750
  increment() {
@@ -2751,8 +2752,10 @@ class SummaryCounter {
2751
2752
  }
2752
2753
  }
2753
2754
 
2755
+ // The override marker is part of the key, so override-affected and other evaluations of the same
2756
+ // flag, variation, and version accumulate into separate counters.
2754
2757
  function counterKey(event) {
2755
- return `${event.key}:${event.variation !== null && event.variation !== undefined ? event.variation : ''}:${event.version !== null && event.version !== undefined ? event.version : ''}`;
2758
+ return `${event.key}:${event.variation !== null && event.variation !== undefined ? event.variation : ''}:${event.version !== null && event.version !== undefined ? event.version : ''}:${event.overrideAffected ? 'overrideAffected' : ''}`;
2756
2759
  }
2757
2760
  /**
2758
2761
  * @internal
@@ -2783,7 +2786,7 @@ class EventSummarizer {
2783
2786
  counter.increment();
2784
2787
  }
2785
2788
  else {
2786
- this._counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation);
2789
+ this._counters[countKey] = new SummaryCounter(1, event.key, event.value, event.default, event.version, event.variation, event.overrideAffected);
2787
2790
  }
2788
2791
  if (this._startDate === 0 || event.creationDate < this._startDate) {
2789
2792
  this._startDate = event.creationDate;
@@ -2817,6 +2820,10 @@ class EventSummarizer {
2817
2820
  else {
2818
2821
  counterOut.unknown = true;
2819
2822
  }
2823
+ if (counter.overrideAffected) {
2824
+ // The marker is present only when true, like the unknown marker.
2825
+ counterOut.overrideAffected = true;
2826
+ }
2820
2827
  flagSummary.counters.push(counterOut);
2821
2828
  return acc;
2822
2829
  }, {});
@@ -3021,8 +3028,11 @@ class EventProcessor {
3021
3028
  }
3022
3029
  this._summarizer.summarizeEvent(inputEvent);
3023
3030
  const isFeatureEvent = isFeature(inputEvent);
3024
- const addFullEvent = (isFeatureEvent && inputEvent.trackEvents) || !isFeatureEvent;
3025
- const addDebugEvent = this._shouldDebugEvent(inputEvent);
3031
+ // An override-affected evaluation appears only in the summary counters. It produces no
3032
+ // individual feature event and no debug event, even when the flag requests them.
3033
+ const overrideAffected = isFeatureEvent && !!inputEvent.overrideAffected;
3034
+ const addFullEvent = (isFeatureEvent && inputEvent.trackEvents && !overrideAffected) || !isFeatureEvent;
3035
+ const addDebugEvent = !overrideAffected && this._shouldDebugEvent(inputEvent);
3026
3036
  const isIdentifyEvent = isIdentify(inputEvent);
3027
3037
  const shouldNotDeduplicate = this._contextDeduplicator?.processContext(inputEvent.context);
3028
3038
  // If there is no cache, then it will never be in the cache.
@@ -3188,7 +3198,7 @@ class InputCustomEvent {
3188
3198
 
3189
3199
  class InputEvalEvent {
3190
3200
  constructor(withReasons, context, key, value, defValue, // default is a reserved keyword in this context.
3191
- version, variation, trackEvents, prereqOf, reason, debugEventsUntilDate, excludeFromSummaries, samplingRatio = 1) {
3201
+ version, variation, trackEvents, prereqOf, reason, debugEventsUntilDate, excludeFromSummaries, samplingRatio = 1, overrideAffected) {
3192
3202
  this.withReasons = withReasons;
3193
3203
  this.context = context;
3194
3204
  this.key = key;
@@ -3218,6 +3228,9 @@ class InputEvalEvent {
3218
3228
  if (excludeFromSummaries !== undefined) {
3219
3229
  this.excludeFromSummaries = excludeFromSummaries;
3220
3230
  }
3231
+ if (overrideAffected !== undefined) {
3232
+ this.overrideAffected = overrideAffected;
3233
+ }
3221
3234
  }
3222
3235
  }
3223
3236
 
@@ -3245,7 +3258,7 @@ class EventFactoryBase {
3245
3258
  evalEvent(e) {
3246
3259
  return new InputEvalEvent(this._withReasons, e.context, e.flagKey, e.value, e.defaultVal, e.version,
3247
3260
  // Exclude null as a possibility.
3248
- e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this._withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio);
3261
+ e.variation ?? undefined, e.trackEvents || e.addExperimentData, e.prereqOfFlagKey, this._withReasons || e.addExperimentData ? e.reason : undefined, e.debugEventsUntilDate, e.excludeFromSummaries, e.samplingRatio, e.overrideAffected);
3249
3262
  }
3250
3263
  unknownFlagEvent(key, defVal, context) {
3251
3264
  return new InputEvalEvent(this._withReasons, context, key, defVal, defVal,
@@ -3659,6 +3672,136 @@ class PayloadStreamReader {
3659
3672
  }
3660
3673
  }
3661
3674
 
3675
+ /**
3676
+ * Wraps the raw headers in the fetch `Headers` shape. Lookups are case-insensitive.
3677
+ * Multi-value headers are joined with ", ", names that differ only by case merge into one
3678
+ * joined value, and names without a value are skipped.
3679
+ */
3680
+ function wrapRawHeaders(headers) {
3681
+ const normalized = new Map();
3682
+ Object.keys(headers).forEach((key) => {
3683
+ const val = headers[key];
3684
+ if (val !== undefined && val !== null) {
3685
+ const name = key.toLowerCase();
3686
+ const joined = Array.isArray(val) ? val.join(', ') : val;
3687
+ const existing = normalized.get(name);
3688
+ normalized.set(name, existing === undefined ? joined : `${existing}, ${joined}`);
3689
+ }
3690
+ });
3691
+ return {
3692
+ get: (name) => normalized.get(name.toLowerCase()) ?? null,
3693
+ keys: () => normalized.keys(),
3694
+ values: () => normalized.values(),
3695
+ entries: () => normalized.entries(),
3696
+ forEach: (callback) => {
3697
+ normalized.forEach((value, key) => callback(value, key));
3698
+ },
3699
+ has: (name) => normalized.has(name.toLowerCase()),
3700
+ };
3701
+ }
3702
+ /**
3703
+ * Creates a response for a streaming request. The response does not buffer the body. Each
3704
+ * read hands out the next chunk from the source iterator. The body does not enforce a
3705
+ * consumer lock: every `getReader`, `text`, and `json` call reads from the same iterator,
3706
+ * so the caller uses one consumer per response. The `cancel` methods on the body and the
3707
+ * reader call every release function the source provides: they destroy the source when it
3708
+ * has a `destroy` method, and they also call the iterator's `return` method when one
3709
+ * exists. The body passes through as-is, so the caller decodes any content encoding first.
3710
+ *
3711
+ * @param source The raw platform response, for example a Node `IncomingMessage`. A missing
3712
+ * status code maps to 0, and a missing status message maps to an empty string.
3713
+ */
3714
+ function createStreamingResponse(source) {
3715
+ // A consumer compiled without `Symbol.asyncIterator` in its lib can pass a source that
3716
+ // lacks the iterator without a compile error. The check turns that mistake into a named
3717
+ // failure instead of a bare member-access TypeError.
3718
+ if (typeof source[Symbol.asyncIterator] !== 'function') {
3719
+ throw new TypeError('the streaming response source does not provide an async iterator');
3720
+ }
3721
+ const iterator = source[Symbol.asyncIterator]();
3722
+ const cancel = async () => {
3723
+ // Destroy the stream first. That rejects a pending read and unblocks a queued return
3724
+ // call. A Node readable iterator queues the return call behind a pending read, and on
3725
+ // a stream that was never read it completes without a destroy, so the return call
3726
+ // alone cannot release the connection. Do not await it for the same reason. Each
3727
+ // release call is guarded on its own, so a release function that throws, or a return
3728
+ // that resolves synchronously, does not skip the other release path or reject cancel.
3729
+ try {
3730
+ source.destroy?.();
3731
+ }
3732
+ catch {
3733
+ // A throwing destroy has nothing left to release.
3734
+ }
3735
+ try {
3736
+ Promise.resolve(iterator.return?.()).catch(() => { });
3737
+ }
3738
+ catch {
3739
+ // A throwing return has nothing left to release.
3740
+ }
3741
+ };
3742
+ async function text() {
3743
+ const decoder = new TextDecoder();
3744
+ let result = '';
3745
+ try {
3746
+ let next = await iterator.next();
3747
+ while (!next.done) {
3748
+ if (next.value !== undefined) {
3749
+ try {
3750
+ result += decoder.decode(next.value, { stream: true });
3751
+ }
3752
+ catch {
3753
+ // decode() rejects a chunk that is not a BufferSource. The fixed message keeps
3754
+ // chunk contents out of error messages.
3755
+ throw new TypeError('the source supplied a chunk that is not a BufferSource');
3756
+ }
3757
+ }
3758
+ // The stream provides the chunks in sequence, so the reads cannot run in parallel.
3759
+ // oxlint-disable-next-line no-await-in-loop
3760
+ next = await iterator.next();
3761
+ }
3762
+ }
3763
+ catch (err) {
3764
+ // text() owns the body, so any failed read must release the source itself. This
3765
+ // covers a rejecting next() as well as a bad chunk.
3766
+ cancel();
3767
+ throw err;
3768
+ }
3769
+ // The final decode flushes a trailing partial multi-byte sequence.
3770
+ return result + decoder.decode();
3771
+ }
3772
+ return {
3773
+ headers: wrapRawHeaders(source.headers),
3774
+ status: source.statusCode ?? 0,
3775
+ statusText: source.statusMessage ?? '',
3776
+ body: {
3777
+ getReader: () => ({
3778
+ read: async () => {
3779
+ const next = await iterator.next();
3780
+ if (next.done) {
3781
+ return { done: true };
3782
+ }
3783
+ return { done: false, value: next.value };
3784
+ },
3785
+ cancel,
3786
+ }),
3787
+ cancel,
3788
+ },
3789
+ text,
3790
+ json: async () => JSON.parse(await text()),
3791
+ };
3792
+ }
3793
+
3794
+ /**
3795
+ * Converts the request options into the init shape a platform's native `fetch` accepts. A
3796
+ * platform can declare its `AbortSignal` as a lexical class, which `AbortSignalLike`
3797
+ * cannot resolve to, so the `signal` member widens here. The caller must pass a signal
3798
+ * created by the running platform. The widening then only restores the type the runtime
3799
+ * already has.
3800
+ */
3801
+ function toRequestInit(options) {
3802
+ return options;
3803
+ }
3804
+
3662
3805
  /**
3663
3806
  * Creates an InitMetadata object from initialization headers.
3664
3807
  *
@@ -3734,6 +3877,7 @@ var index = /*#__PURE__*/Object.freeze({
3734
3877
  PayloadStreamReader: PayloadStreamReader,
3735
3878
  canonicalize: canonicalize,
3736
3879
  createProtocolHandler: createProtocolHandler,
3880
+ createStreamingResponse: createStreamingResponse,
3737
3881
  initMetadataFromHeaders: initMetadataFromHeaders,
3738
3882
  isLegacyUser: isLegacyUser,
3739
3883
  isMultiKind: isMultiKind,
@@ -3743,7 +3887,8 @@ var index = /*#__PURE__*/Object.freeze({
3743
3887
  safeGetHooks: safeGetHooks,
3744
3888
  safeGetName: safeGetName,
3745
3889
  safeRegisterPlugins: safeRegisterPlugins,
3746
- shouldSample: shouldSample
3890
+ shouldSample: shouldSample,
3891
+ toRequestInit: toRequestInit
3747
3892
  });
3748
3893
 
3749
3894
  export { ApplicationTags, AttributeReference, AutoEnvAttributes, BasicLogger, ClientContext, CompositeDataSource, Context, ContextFilter, DataSourceErrorKind, DateValidator, DefaultBackoff, FactoryOrInstance, Function, KindValidator, LDClientError, LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, LDTimeoutError, LDUnexpectedResponseError, NullableBoolean, NumberWithMinimum, OneOf, OptionMessages, SafeLogger, ServiceEndpoints, StringMatchingRegex, Type, TypeArray, TypeValidators, base64UrlEncode, cancelableTimedPromise, classifyHttpStatus, classifyTransportFailure, clone, createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, createSafeLogger, debounce, deepCompact, defaultHeaders, fastDeepEqual, forPolling, forStreaming, getEventsUri, getPollingUri, getStreamingUri, httpErrorMessage, index as internal, isHttpLocallyRecoverable, isHttpRecoverable, isNullish, monotonicNow, noop, secondsToMillis, shouldRetry, sleep, index$1 as subsystem, timedPromise };