@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
|
@@ -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"}
|
|
@@ -7,7 +7,8 @@ import fastDeepEqual from './fast-deep-equal';
|
|
|
7
7
|
import { base64UrlEncode, defaultHeaders, httpErrorMessage, LDHeaders, shouldRetry } from './http';
|
|
8
8
|
import noop from './noop';
|
|
9
9
|
import sleep from './sleep';
|
|
10
|
+
import { monotonicNow } from './time';
|
|
10
11
|
import timedPromise from './timedPromise';
|
|
11
12
|
import { VoidFunction } from './VoidFunction';
|
|
12
|
-
export { base64UrlEncode, clone, debounce, deepCompact, defaultHeaders, fastDeepEqual, httpErrorMessage, noop, LDHeaders, shouldRetry, secondsToMillis, sleep, timedPromise, VoidFunction, type CancelableTimeout, cancelableTimedPromise, };
|
|
13
|
+
export { base64UrlEncode, clone, debounce, deepCompact, defaultHeaders, fastDeepEqual, httpErrorMessage, monotonicNow, noop, LDHeaders, shouldRetry, secondsToMillis, sleep, timedPromise, VoidFunction, type CancelableTimeout, cancelableTimedPromise, };
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,KAAK,EACL,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,iBAAiB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,KAAK,EACL,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,iBAAiB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Milliseconds from a monotonic clock when the runtime provides one.
|
|
3
|
+
*
|
|
4
|
+
* Deadlines and embargoes compare differences of these values. A wall clock can
|
|
5
|
+
* step backward, for example through an NTP correction, and a deadline armed
|
|
6
|
+
* against it would then never pass. Values from this function are not epoch
|
|
7
|
+
* times and must only be compared with each other.
|
|
8
|
+
*
|
|
9
|
+
* The time source is selected on the first call and never changes after that.
|
|
10
|
+
* Monotonic values and wall-clock values have different origins, so a switch
|
|
11
|
+
* between sources would corrupt in-flight measurements. A runtime without a
|
|
12
|
+
* performance global at the first call uses the wall clock from then on, even
|
|
13
|
+
* if a polyfill appears later.
|
|
14
|
+
*/
|
|
15
|
+
export declare function monotonicNow(): number;
|
|
16
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,YAAY,IAAI,MAAM,CAMrC"}
|
|
@@ -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","sourceR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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"}
|
|
@@ -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"}
|