@launchdarkly/js-sdk-common 2.28.1 → 2.30.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/api/platform/Requests.d.ts +85 -0
- package/dist/cjs/api/platform/Requests.d.ts.map +1 -1
- package/dist/cjs/datasource/retry/ResetPolicy.d.ts.map +1 -1
- package/dist/cjs/index.cjs +1074 -924
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/internal/fetch/StreamingResponse.d.ts +83 -0
- package/dist/cjs/internal/fetch/StreamingResponse.d.ts.map +1 -0
- package/dist/cjs/internal/fetch/index.d.ts +3 -0
- package/dist/cjs/internal/fetch/index.d.ts.map +1 -0
- package/dist/cjs/internal/fetch/toRequestInit.d.ts +12 -0
- package/dist/cjs/internal/fetch/toRequestInit.d.ts.map +1 -0
- package/dist/cjs/internal/index.d.ts +1 -0
- package/dist/cjs/internal/index.d.ts.map +1 -1
- package/dist/cjs/utils/index.d.ts +2 -1
- package/dist/cjs/utils/index.d.ts.map +1 -1
- package/dist/cjs/utils/time.d.ts +16 -0
- package/dist/cjs/utils/time.d.ts.map +1 -0
- package/dist/esm/api/platform/Requests.d.ts +85 -0
- package/dist/esm/api/platform/Requests.d.ts.map +1 -1
- package/dist/esm/datasource/retry/ResetPolicy.d.ts.map +1 -1
- package/dist/esm/index.mjs +1074 -925
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/internal/fetch/StreamingResponse.d.ts +83 -0
- package/dist/esm/internal/fetch/StreamingResponse.d.ts.map +1 -0
- package/dist/esm/internal/fetch/index.d.ts +3 -0
- package/dist/esm/internal/fetch/index.d.ts.map +1 -0
- package/dist/esm/internal/fetch/toRequestInit.d.ts +12 -0
- package/dist/esm/internal/fetch/toRequestInit.d.ts.map +1 -0
- package/dist/esm/internal/index.d.ts +1 -0
- package/dist/esm/internal/index.d.ts.map +1 -1
- package/dist/esm/utils/index.d.ts +2 -1
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/time.d.ts +16 -0
- package/dist/esm/utils/time.d.ts.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.30.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.29.0...js-sdk-common-v2.30.0) (2026-10-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
|
|
12
|
+
## [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)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **common:** add a shared `monotonicNow()` method ([#2083](https://github.com/launchdarkly/js-core/issues/2083)) ([83edf68](https://github.com/launchdarkly/js-core/commit/83edf68b96fdbde40a91b81cad62b7ec9637c5eb))
|
|
18
|
+
|
|
5
19
|
## [2.28.1](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.28.0...js-sdk-common-v2.28.1) (2026-10-05)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -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,OAAO,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtC;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;
|
|
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,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BAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPolicy.d.ts","sourceRoot":"","sources":["../../../src/datasource/retry/ResetPolicy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResetPolicy.d.ts","sourceRoot":"","sources":["../../../src/datasource/retry/ResetPolicy.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;OAEG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,MAAM,MAAqB,GACjC,WAAW,CAkBb;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAgB1E"}
|