@launchdarkly/js-sdk-common 2.31.0 → 2.32.1
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 +22 -0
- package/dist/cjs/datasource/CompositeDataSource.d.ts.map +1 -1
- package/dist/cjs/index.cjs +97 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/internal/events/EventProcessor.d.ts.map +1 -1
- package/dist/cjs/internal/events/EventSender.d.ts.map +1 -1
- package/dist/cjs/internal/events/InputCustomEvent.d.ts +2 -2
- package/dist/cjs/internal/events/InputCustomEvent.d.ts.map +1 -1
- package/dist/cjs/internal/events/MultiEventSummarizer.d.ts.map +1 -1
- package/dist/cjs/internal/fdv2/payloadProcessor.d.ts.map +1 -1
- package/dist/cjs/internal/fdv2/payloadStreamReader.d.ts.map +1 -1
- package/dist/cjs/internal/fdv2/protocolHandler.d.ts.map +1 -1
- package/dist/cjs/internal/fetch/followRedirects.d.ts +34 -0
- package/dist/cjs/internal/fetch/followRedirects.d.ts.map +1 -0
- package/dist/cjs/internal/fetch/index.d.ts +1 -0
- package/dist/cjs/internal/fetch/index.d.ts.map +1 -1
- package/dist/cjs/logging/createSafeLogger.d.ts.map +1 -1
- package/dist/cjs/utils/debounce.d.ts +1 -1
- package/dist/cjs/utils/debounce.d.ts.map +1 -1
- package/dist/cjs/utils/deepCompact.d.ts +1 -1
- package/dist/cjs/utils/deepCompact.d.ts.map +1 -1
- package/dist/cjs/utils/http.d.ts.map +1 -1
- package/dist/cjs/utils/isEmptyObject.d.ts.map +1 -1
- package/dist/cjs/utils/sleep.d.ts.map +1 -1
- package/dist/cjs/utils/timedPromise.d.ts.map +1 -1
- package/dist/esm/AttributeReference.d.ts +1 -1
- package/dist/esm/Context.d.ts +2 -2
- package/dist/esm/ContextFilter.d.ts +2 -2
- package/dist/esm/api/context/LDContext.d.ts +3 -3
- package/dist/esm/api/context/LDContextCommon.d.ts +1 -1
- package/dist/esm/api/context/LDMultiKindContext.d.ts +1 -1
- package/dist/esm/api/context/LDSingleKindContext.d.ts +1 -1
- package/dist/esm/api/context/index.d.ts +6 -6
- package/dist/esm/api/data/LDEvaluationDetail.d.ts +2 -2
- package/dist/esm/api/data/LDFlagSet.d.ts +1 -1
- package/dist/esm/api/data/index.d.ts +4 -4
- package/dist/esm/api/index.d.ts +7 -7
- package/dist/esm/api/integrations/index.d.ts +1 -1
- package/dist/esm/api/logging/BasicLoggerOptions.d.ts +1 -1
- package/dist/esm/api/logging/index.d.ts +3 -3
- package/dist/esm/api/options/LDClientContext.d.ts +2 -2
- package/dist/esm/api/options/index.d.ts +1 -1
- package/dist/esm/api/platform/EventSource.d.ts +1 -1
- package/dist/esm/api/platform/Info.d.ts +1 -1
- package/dist/esm/api/platform/Platform.d.ts +6 -6
- package/dist/esm/api/platform/Requests.d.ts +1 -1
- package/dist/esm/api/platform/index.d.ts +9 -9
- package/dist/esm/api/subsystem/DataSystem/CallbackHandler.d.ts +1 -1
- package/dist/esm/api/subsystem/DataSystem/index.d.ts +1 -1
- package/dist/esm/api/subsystem/LDContextDeduplicator.d.ts +1 -1
- package/dist/esm/api/subsystem/LDEventProcessor.d.ts +1 -1
- package/dist/esm/api/subsystem/index.d.ts +5 -5
- package/dist/esm/datasource/CompositeDataSource.d.ts +3 -3
- package/dist/esm/datasource/CompositeDataSource.d.ts.map +1 -1
- package/dist/esm/datasource/errors.d.ts +1 -1
- package/dist/esm/datasource/index.d.ts +5 -5
- package/dist/esm/datasource/retry/RetryState.d.ts +3 -3
- package/dist/esm/datasource/retry/index.d.ts +2 -2
- package/dist/esm/index.d.ts +11 -11
- package/dist/esm/index.mjs +97 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/internal/context/index.d.ts +1 -1
- package/dist/esm/internal/diagnostics/DiagnosticsManager.d.ts +2 -2
- package/dist/esm/internal/diagnostics/index.d.ts +1 -1
- package/dist/esm/internal/evaluation/EventFactoryBase.d.ts +3 -3
- package/dist/esm/internal/evaluation/index.d.ts +2 -2
- package/dist/esm/internal/events/EventProcessor.d.ts +6 -6
- package/dist/esm/internal/events/EventProcessor.d.ts.map +1 -1
- package/dist/esm/internal/events/EventSender.d.ts +3 -3
- package/dist/esm/internal/events/EventSender.d.ts.map +1 -1
- package/dist/esm/internal/events/InputClickEvent.d.ts +1 -1
- package/dist/esm/internal/events/InputCustomEvent.d.ts +3 -3
- package/dist/esm/internal/events/InputCustomEvent.d.ts.map +1 -1
- package/dist/esm/internal/events/InputEvalEvent.d.ts +2 -2
- package/dist/esm/internal/events/InputEvent.d.ts +6 -6
- package/dist/esm/internal/events/InputEventBase.d.ts +1 -1
- package/dist/esm/internal/events/InputIdentifyEvent.d.ts +1 -1
- package/dist/esm/internal/events/InputMigrationEvent.d.ts +1 -1
- package/dist/esm/internal/events/InputPageViewEvent.d.ts +1 -1
- package/dist/esm/internal/events/LDEventSummarizer.d.ts +1 -1
- package/dist/esm/internal/events/MultiEventSummarizer.d.ts +4 -4
- package/dist/esm/internal/events/MultiEventSummarizer.d.ts.map +1 -1
- package/dist/esm/internal/events/NullEventProcessor.d.ts +1 -1
- package/dist/esm/internal/events/guards.d.ts +4 -4
- package/dist/esm/internal/events/index.d.ts +10 -10
- package/dist/esm/internal/fdv2/FDv1PayloadAdaptor.d.ts +1 -1
- package/dist/esm/internal/fdv2/index.d.ts +8 -8
- package/dist/esm/internal/fdv2/payloadProcessor.d.ts +4 -4
- package/dist/esm/internal/fdv2/payloadProcessor.d.ts.map +1 -1
- package/dist/esm/internal/fdv2/payloadStreamReader.d.ts +3 -3
- package/dist/esm/internal/fdv2/payloadStreamReader.d.ts.map +1 -1
- package/dist/esm/internal/fdv2/protocolHandler.d.ts +2 -2
- package/dist/esm/internal/fdv2/protocolHandler.d.ts.map +1 -1
- package/dist/esm/internal/fetch/StreamingResponse.d.ts +1 -1
- package/dist/esm/internal/fetch/followRedirects.d.ts +34 -0
- package/dist/esm/internal/fetch/followRedirects.d.ts.map +1 -0
- package/dist/esm/internal/fetch/index.d.ts +3 -2
- package/dist/esm/internal/fetch/index.d.ts.map +1 -1
- package/dist/esm/internal/fetch/toRequestInit.d.ts +1 -1
- package/dist/esm/internal/index.d.ts +9 -9
- package/dist/esm/internal/json/index.d.ts +1 -1
- package/dist/esm/internal/metadata/index.d.ts +1 -1
- package/dist/esm/internal/plugins/index.d.ts +3 -3
- package/dist/esm/internal/plugins/safeGetHooks.d.ts +2 -2
- package/dist/esm/internal/plugins/safeGetName.d.ts +2 -2
- package/dist/esm/internal/plugins/safeRegisterPlugins.d.ts +2 -2
- package/dist/esm/logging/BasicLogger.d.ts +1 -1
- package/dist/esm/logging/SafeLogger.d.ts +1 -1
- package/dist/esm/logging/createSafeLogger.d.ts +3 -3
- package/dist/esm/logging/createSafeLogger.d.ts.map +1 -1
- package/dist/esm/logging/index.d.ts +3 -3
- package/dist/esm/options/ApplicationTags.d.ts +1 -1
- package/dist/esm/options/ClientContext.d.ts +3 -3
- package/dist/esm/options/index.d.ts +4 -4
- package/dist/esm/utils/cancelableTimedPromise.d.ts +1 -1
- package/dist/esm/utils/debounce.d.ts +1 -1
- package/dist/esm/utils/debounce.d.ts.map +1 -1
- package/dist/esm/utils/deepCompact.d.ts +1 -1
- package/dist/esm/utils/deepCompact.d.ts.map +1 -1
- package/dist/esm/utils/http.d.ts +2 -2
- package/dist/esm/utils/http.d.ts.map +1 -1
- package/dist/esm/utils/index.d.ts +12 -12
- package/dist/esm/utils/isEmptyObject.d.ts.map +1 -1
- package/dist/esm/utils/sleep.d.ts.map +1 -1
- package/dist/esm/utils/timedPromise.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RawHeaders } from './StreamingResponse';
|
|
2
|
+
/**
|
|
3
|
+
* The most redirect hops one streaming request follows. When a chain exceeds the cap, the last
|
|
4
|
+
* redirect response goes to the caller as an ordinary non-200 response. The caller's error
|
|
5
|
+
* handling decides whether to retry.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_STREAMING_REDIRECT_HOPS = 5;
|
|
8
|
+
/**
|
|
9
|
+
* The response shape the redirect loop inspects. A Node `IncomingMessage` satisfies it.
|
|
10
|
+
*/
|
|
11
|
+
export interface RedirectResponseSource {
|
|
12
|
+
statusCode?: number;
|
|
13
|
+
headers: RawHeaders;
|
|
14
|
+
/**
|
|
15
|
+
* Destroys the stream, so a followed redirect response releases its connection at once. A
|
|
16
|
+
* source without it leaves the skipped body to the socket teardown.
|
|
17
|
+
*/
|
|
18
|
+
destroy?(): unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Issues a streaming request and follows up to {@link MAX_STREAMING_REDIRECT_HOPS} hops of
|
|
22
|
+
* `301` and `307` redirects. Each hop calls `doRequest` again with the target URL, so the
|
|
23
|
+
* request carries the same method, body, and headers to each target, the `Authorization`
|
|
24
|
+
* header included. A `302` and every other status return to the caller unfollowed.
|
|
25
|
+
*
|
|
26
|
+
* The loop holds no state across calls. A reconnect starts from the original URL again and
|
|
27
|
+
* re-follows the chain.
|
|
28
|
+
*
|
|
29
|
+
* @param url The URL of the initial request.
|
|
30
|
+
* @param doRequest Issues one request and resolves with its response. The caller builds the
|
|
31
|
+
* options inside it from the given URL, so each hop gets options for its own target.
|
|
32
|
+
*/
|
|
33
|
+
export declare function followStreamingRedirects<T extends RedirectResponseSource>(url: string, doRequest: (requestUrl: string) => Promise<T>): Promise<T>;
|
|
34
|
+
//# sourceMappingURL=followRedirects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followRedirects.d.ts","sourceRoot":"","sources":["../../../src/internal/fetch/followRedirects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC;CACrB;AAyBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,SAAS,sBAAsB,EAC7E,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC5C,OAAO,CAAC,CAAC,CAAC,CAuBZ"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/fetch/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSafeLogger.d.ts","sourceRoot":"","sources":["../../src/logging/createSafeLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"createSafeLogger.d.ts","sourceRoot":"","sources":["../../src/logging/createSafeLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,QAAA,MAAM,gBAAgB,GAAI,SAAS,QAAQ,6BAQ1C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
* @param fn The function to be debounced.
|
|
19
19
|
* @param delayMs Defaults to 5 seconds.
|
|
20
20
|
*/
|
|
21
|
-
declare const debounce: <T extends (...args: any[]) => ReturnType<T>>(fn: T, delayMs?: number) => (...args: Parameters<T>) => void;
|
|
21
|
+
declare const debounce: <T extends (...args: any[]) => ReturnType<T>>(fn: T, delayMs?: number) => ((...args: Parameters<T>) => void);
|
|
22
22
|
export default debounce;
|
|
23
23
|
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,QAAQ,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAC3D,IAAI,CAAC,EACL,UAAS,MAAa,KACrB,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CASnC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @param obj
|
|
7
7
|
* @param ignoreKeys
|
|
8
8
|
*/
|
|
9
|
-
declare const deepCompact: <T extends object>(obj?: T
|
|
9
|
+
declare const deepCompact: <T extends object>(obj?: T, ignoreKeys?: string[]) => T | undefined;
|
|
10
10
|
export default deepCompact;
|
|
11
11
|
//# sourceMappingURL=deepCompact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepCompact.d.ts","sourceRoot":"","sources":["../../src/utils/deepCompact.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"deepCompact.d.ts","sourceRoot":"","sources":["../../src/utils/deepCompact.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,MAAM,EAAE,kBAWpE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,eAAe,EACtB,0BAA0B,GAAE,OAAc,EAC1C,mBAAmB,GAAE,YAAY,GAAG,2BAA0C,EAC9E,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAiCX;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CASR;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,iBAAiB,WAExD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,eAAe,EACtB,0BAA0B,GAAE,OAAc,EAC1C,mBAAmB,GAAE,YAAY,GAAG,2BAA0C,EAC9E,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,CAiCX;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CASR;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,iBAAiB,WAExD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,EAAE,UAAU,QAAQ,KAAG,MACa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyObject.d.ts","sourceRoot":"","sources":["../../src/utils/isEmptyObject.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"isEmptyObject.d.ts","sourceRoot":"","sources":["../../src/utils/isEmptyObject.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,GAAI,KAAK,GAAG,YAAiC,CAAC;AAEjE,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../src/utils/sleep.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,GAAU,cAAa,MAAa,qBAG3C,CAAC;AAEL,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timedPromise.d.ts","sourceRoot":"","sources":["../../src/utils/timedPromise.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"timedPromise.d.ts","sourceRoot":"","sources":["../../src/utils/timedPromise.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,QAAA,MAAM,YAAY,GAAI,GAAG,MAAM,EAAE,UAAU,MAAM,kBAM7C,CAAC;AAEL,eAAe,YAAY,CAAC"}
|
package/dist/esm/Context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LDContext, LDContextCommon } from './api';
|
|
2
|
-
import AttributeReference from './AttributeReference';
|
|
1
|
+
import type { LDContext, LDContextCommon } from './api/index.js';
|
|
2
|
+
import AttributeReference from './AttributeReference.js';
|
|
3
3
|
/**
|
|
4
4
|
* Container for a context/contexts. Because contexts come from external code
|
|
5
5
|
* they must be thoroughly validated and then formed to comply with
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import AttributeReference from './AttributeReference';
|
|
2
|
-
import Context from './Context';
|
|
1
|
+
import AttributeReference from './AttributeReference.js';
|
|
2
|
+
import Context from './Context.js';
|
|
3
3
|
export default class ContextFilter {
|
|
4
4
|
private readonly _allAttributesPrivate;
|
|
5
5
|
private readonly _privateAttributes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LDMultiKindContext } from './LDMultiKindContext';
|
|
2
|
-
import { LDSingleKindContext } from './LDSingleKindContext';
|
|
3
|
-
import { LDUser } from './LDUser';
|
|
1
|
+
import { LDMultiKindContext } from './LDMultiKindContext.js';
|
|
2
|
+
import { LDSingleKindContext } from './LDSingleKindContext.js';
|
|
3
|
+
import { LDUser } from './LDUser.js';
|
|
4
4
|
/**
|
|
5
5
|
* A LaunchDarkly context object. LaunchDarkly contexts are objects representing users, devices, organizations, and
|
|
6
6
|
* other entities that feature flags serve different variations to according to your flag targeting rules. These data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './LDContextCommon';
|
|
2
|
-
export * from './LDContextMeta';
|
|
3
|
-
export * from './LDMultiKindContext';
|
|
4
|
-
export * from './LDSingleKindContext';
|
|
5
|
-
export * from './LDUser';
|
|
6
|
-
export * from './LDContext';
|
|
1
|
+
export * from './LDContextCommon.js';
|
|
2
|
+
export * from './LDContextMeta.js';
|
|
3
|
+
export * from './LDMultiKindContext.js';
|
|
4
|
+
export * from './LDSingleKindContext.js';
|
|
5
|
+
export * from './LDUser.js';
|
|
6
|
+
export * from './LDContext.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LDEvaluationReason } from './LDEvaluationReason';
|
|
2
|
-
import { LDFlagValue } from './LDFlagValue';
|
|
1
|
+
import { LDEvaluationReason } from './LDEvaluationReason.js';
|
|
2
|
+
import { LDFlagValue } from './LDFlagValue.js';
|
|
3
3
|
/**
|
|
4
4
|
* An object that combines the result of a feature flag evaluation with information about
|
|
5
5
|
* how it was calculated.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './LDEvaluationDetail';
|
|
2
|
-
export * from './LDEvaluationReason';
|
|
3
|
-
export * from './LDFlagSet';
|
|
4
|
-
export * from './LDFlagValue';
|
|
1
|
+
export * from './LDEvaluationDetail.js';
|
|
2
|
+
export * from './LDEvaluationReason.js';
|
|
3
|
+
export * from './LDFlagSet.js';
|
|
4
|
+
export * from './LDFlagValue.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/api/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './context';
|
|
2
|
-
export * from './logging';
|
|
3
|
-
export * from './data';
|
|
4
|
-
export * from './options';
|
|
5
|
-
export * from './platform';
|
|
6
|
-
export * as subsystem from './subsystem';
|
|
7
|
-
export * from './integrations';
|
|
1
|
+
export * from './context/index.js';
|
|
2
|
+
export * from './logging/index.js';
|
|
3
|
+
export * from './data/index.js';
|
|
4
|
+
export * from './options/index.js';
|
|
5
|
+
export * from './platform/index.js';
|
|
6
|
+
export * as subsystem from './subsystem/index.js';
|
|
7
|
+
export * from './integrations/index.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './plugins';
|
|
1
|
+
export * from './plugins.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './BasicLoggerOptions';
|
|
2
|
-
export * from './LDLogger';
|
|
3
|
-
export * from './LDLogLevel';
|
|
1
|
+
export * from './BasicLoggerOptions.js';
|
|
2
|
+
export * from './LDLogger.js';
|
|
3
|
+
export * from './LDLogLevel.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Crypto } from './Crypto';
|
|
2
|
-
import { Encoding } from './Encoding';
|
|
3
|
-
import { Filesystem } from './Filesystem';
|
|
4
|
-
import { Info } from './Info';
|
|
5
|
-
import { Requests } from './Requests';
|
|
6
|
-
import { Storage } from './Storage';
|
|
1
|
+
import { Crypto } from './Crypto.js';
|
|
2
|
+
import { Encoding } from './Encoding.js';
|
|
3
|
+
import { Filesystem } from './Filesystem.js';
|
|
4
|
+
import { Info } from './Info.js';
|
|
5
|
+
import { Requests } from './Requests.js';
|
|
6
|
+
import { Storage } from './Storage.js';
|
|
7
7
|
export interface Platform {
|
|
8
8
|
/**
|
|
9
9
|
* The interface for performing encoding operations.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './AutoEnv';
|
|
2
|
-
export * from './Crypto';
|
|
3
|
-
export * from './Encoding';
|
|
4
|
-
export * from './EventSource';
|
|
5
|
-
export * from './Filesystem';
|
|
6
|
-
export * from './Info';
|
|
7
|
-
export * from './Platform';
|
|
8
|
-
export * from './Requests';
|
|
9
|
-
export * from './Storage';
|
|
1
|
+
export * from './AutoEnv.js';
|
|
2
|
+
export * from './Crypto.js';
|
|
3
|
+
export * from './Encoding.js';
|
|
4
|
+
export * from './EventSource.js';
|
|
5
|
+
export * from './Filesystem.js';
|
|
6
|
+
export * from './Info.js';
|
|
7
|
+
export * from './Platform.js';
|
|
8
|
+
export * from './Requests.js';
|
|
9
|
+
export * from './Storage.js';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSourceState } from './DataSource';
|
|
1
|
+
import { DataSourceState } from './DataSource.js';
|
|
2
2
|
/**
|
|
3
3
|
* Handler that connects the current {@link DataSource} to the {@link CompositeDataSource}. A single
|
|
4
4
|
* {@link CallbackHandler} should only be given to one {@link DataSource}. Use {@link disable()} to
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DataSource, DataSourceState, LDDataSourceFactory } from './DataSource';
|
|
1
|
+
export { DataSource, DataSourceState, LDDataSourceFactory } from './DataSource.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DataSource, DataSourceState, LDDataSourceFactory } from './DataSystem';
|
|
2
|
-
import LDContextDeduplicator from './LDContextDeduplicator';
|
|
3
|
-
import LDEventProcessor from './LDEventProcessor';
|
|
4
|
-
import LDEventSender, { LDDeliveryStatus, LDEventSenderResult, LDEventType } from './LDEventSender';
|
|
5
|
-
import { LDStreamProcessor } from './LDStreamProcessor';
|
|
1
|
+
import { DataSource, DataSourceState, LDDataSourceFactory } from './DataSystem/index.js';
|
|
2
|
+
import LDContextDeduplicator from './LDContextDeduplicator.js';
|
|
3
|
+
import LDEventProcessor from './LDEventProcessor.js';
|
|
4
|
+
import LDEventSender, { LDDeliveryStatus, LDEventSenderResult, LDEventType } from './LDEventSender.js';
|
|
5
|
+
import { LDStreamProcessor } from './LDStreamProcessor.js';
|
|
6
6
|
export { DataSource, DataSourceState, LDDataSourceFactory, LDEventProcessor, LDContextDeduplicator, LDEventSender, LDDeliveryStatus, LDEventType, LDEventSenderResult, LDStreamProcessor, };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LDLogger } from '../api/logging';
|
|
2
|
-
import { DataSource, DataSourceState, LDDataSourceFactory } from '../api/subsystem/DataSystem/DataSource';
|
|
3
|
-
import { Backoff } from './Backoff';
|
|
1
|
+
import { LDLogger } from '../api/logging/index.js';
|
|
2
|
+
import { DataSource, DataSourceState, LDDataSourceFactory } from '../api/subsystem/DataSystem/DataSource.js';
|
|
3
|
+
import { Backoff } from './Backoff.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a transition between data sources.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeDataSource.d.ts","sourceRoot":"","sources":["../../src/datasource/CompositeDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAOpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,eAAe,CAAC,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE;CACxE,CAAC;AAOF;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,UAAU;IA8BlD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAUtC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAtC3B,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,kBAAkB,CAAsC;IAKhE,OAAO,CAAC,oBAAoB,CAAkB;IAE9C,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,0BAA0B,CAAC,CAAqC;IACxE,OAAO,CAAC,aAAa,CAAsB;IAE3C;;;;;;;OAOG;gBAED,YAAY,EAAE,mBAAmB,EAAE,EACnC,aAAa,EAAE,mBAAmB,EAAE,EACpC,iBAAiB,EAAE,mBAAmB,EAAE,EACvB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"CompositeDataSource.d.ts","sourceRoot":"","sources":["../../src/datasource/CompositeDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAOpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,eAAe,CAAC,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE;CACxE,CAAC;AAOF;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,UAAU;IA8BlD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAUtC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAtC3B,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,kBAAkB,CAAsC;IAKhE,OAAO,CAAC,oBAAoB,CAAkB;IAE9C,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,0BAA0B,CAAC,CAAqC;IACxE,OAAO,CAAC,aAAa,CAAsB;IAE3C;;;;;;;OAOG;gBAED,YAAY,EAAE,mBAAmB,EAAE,EACnC,aAAa,EAAE,mBAAmB,EAAE,EACpC,iBAAiB,EAAE,mBAAmB,EAAE,EACvB,OAAO,CAAC,EAAE,QAAQ,YAAA,EAClB,qBAAqB,GAAE,oBASvC,EACgB,QAAQ,GAAE,OAAyC;IAWhE,KAAK,CACT,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,EACjD,cAAc,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,EAC5D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GACxC,OAAO,CAAC,IAAI,CAAC;IAuMV,IAAI;IAMV,OAAO,CAAC,MAAM;IAad;;;;OAIG;IACH,OAAO,CAAC,eAAe;IA0DvB;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,iBAAiB,CAcvB;IAEF,OAAO,CAAC,mBAAmB;IAQ3B;;;;;;OAMG;IACH,OAAO,CAAC,gCAAgC;CAgCzC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Backoff, DefaultBackoff } from './Backoff';
|
|
2
|
-
import { CompositeDataSource } from './CompositeDataSource';
|
|
3
|
-
import { DataSourceErrorKind } from './DataSourceErrorKinds';
|
|
4
|
-
import { LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, StreamingErrorHandler } from './errors';
|
|
5
|
-
import { createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, forPolling, forStreaming, ResetPolicy, RetryState, RetryStateConfig } from './retry';
|
|
1
|
+
import { Backoff, DefaultBackoff } from './Backoff.js';
|
|
2
|
+
import { CompositeDataSource } from './CompositeDataSource.js';
|
|
3
|
+
import { DataSourceErrorKind } from './DataSourceErrorKinds.js';
|
|
4
|
+
import { LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, StreamingErrorHandler } from './errors.js';
|
|
5
|
+
import { createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, forPolling, forStreaming, ResetPolicy, RetryState, RetryStateConfig } from './retry/index.js';
|
|
6
6
|
export { Backoff, CompositeDataSource, createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, DefaultBackoff, DataSourceErrorKind, forPolling, forStreaming, LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, ResetPolicy, RetryState, RetryStateConfig, StreamingErrorHandler, };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LDLogger } from '../../api/logging/LDLogger';
|
|
2
|
-
import { FailureKind } from '../../errors';
|
|
3
|
-
import { ResetPolicy } from './ResetPolicy';
|
|
1
|
+
import { LDLogger } from '../../api/logging/LDLogger.js';
|
|
2
|
+
import { FailureKind } from '../../errors.js';
|
|
3
|
+
import { ResetPolicy } from './ResetPolicy.js';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for a {@link RetryState}.
|
|
6
6
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAfterConsecutiveSuccesses, createAfterHealthyFor, ResetPolicy } from './ResetPolicy';
|
|
2
|
-
import { createRetryState, forPolling, forStreaming, RetryState, RetryStateConfig } from './RetryState';
|
|
1
|
+
import { createAfterConsecutiveSuccesses, createAfterHealthyFor, ResetPolicy } from './ResetPolicy.js';
|
|
2
|
+
import { createRetryState, forPolling, forStreaming, RetryState, RetryStateConfig } from './RetryState.js';
|
|
3
3
|
export { createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, forPolling, forStreaming, ResetPolicy, RetryState, RetryStateConfig, };
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import AttributeReference from './AttributeReference';
|
|
2
|
-
import Context from './Context';
|
|
3
|
-
import ContextFilter from './ContextFilter';
|
|
4
|
-
import { Backoff, CompositeDataSource, createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, DataSourceErrorKind, DefaultBackoff, forPolling, forStreaming, LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, ResetPolicy, RetryState, RetryStateConfig, StreamingErrorHandler } from './datasource';
|
|
5
|
-
export * from './api';
|
|
6
|
-
export * from './validators';
|
|
7
|
-
export * from './logging';
|
|
8
|
-
export * from './options';
|
|
9
|
-
export * from './utils';
|
|
10
|
-
export * as internal from './internal';
|
|
11
|
-
export * from './errors';
|
|
1
|
+
import AttributeReference from './AttributeReference.js';
|
|
2
|
+
import Context from './Context.js';
|
|
3
|
+
import ContextFilter from './ContextFilter.js';
|
|
4
|
+
import { Backoff, CompositeDataSource, createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, DataSourceErrorKind, DefaultBackoff, forPolling, forStreaming, LDFileDataSourceError, LDFlagDeliveryFallbackError, LDPollingError, LDStreamingError, ResetPolicy, RetryState, RetryStateConfig, StreamingErrorHandler } from './datasource/index.js';
|
|
5
|
+
export * from './api/index.js';
|
|
6
|
+
export * from './validators.js';
|
|
7
|
+
export * from './logging/index.js';
|
|
8
|
+
export * from './options/index.js';
|
|
9
|
+
export * from './utils/index.js';
|
|
10
|
+
export * as internal from './internal/index.js';
|
|
11
|
+
export * from './errors.js';
|
|
12
12
|
export { AttributeReference, Context, ContextFilter, CompositeDataSource, DataSourceErrorKind, Backoff, DefaultBackoff, LDPollingError, LDStreamingError, StreamingErrorHandler, LDFileDataSourceError, LDFlagDeliveryFallbackError, createAfterConsecutiveSuccesses, createAfterHealthyFor, createRetryState, forPolling, forStreaming, ResetPolicy, RetryState, RetryStateConfig, };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2647,6 +2647,12 @@ class ClientMessages {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
ClientMessages.MissingContextKeyNoEvent = 'Context was unspecified or had no key; event will not be sent';
|
|
2649
2649
|
|
|
2650
|
+
/**
|
|
2651
|
+
* The Fetch Standard caps the total body size of in-flight keepalive requests at 64 KiB. The
|
|
2652
|
+
* body length is in UTF-16 code units, and each code unit is at least one byte, so a body over
|
|
2653
|
+
* this length is always over the cap. A shorter body with non-ASCII text can still be over it.
|
|
2654
|
+
*/
|
|
2655
|
+
const KEEPALIVE_BODY_LIMIT = 64 * 1024;
|
|
2650
2656
|
class EventSender {
|
|
2651
2657
|
constructor(clientContext, baseHeaders) {
|
|
2652
2658
|
const { basicConfiguration, platform } = clientContext;
|
|
@@ -2672,14 +2678,17 @@ class EventSender {
|
|
|
2672
2678
|
}
|
|
2673
2679
|
let error;
|
|
2674
2680
|
try {
|
|
2681
|
+
const body = JSON.stringify(events);
|
|
2675
2682
|
const { status, headers: resHeaders } = await this._requests.fetch(uri, {
|
|
2676
2683
|
headers,
|
|
2677
|
-
body
|
|
2684
|
+
body,
|
|
2678
2685
|
compressBodyIfPossible: true,
|
|
2679
2686
|
method: 'POST',
|
|
2680
2687
|
// When sending events from browser environments the request should be completed even
|
|
2681
|
-
// if the user is navigating away from the page.
|
|
2682
|
-
|
|
2688
|
+
// if the user is navigating away from the page. A browser rejects a keepalive request
|
|
2689
|
+
// with a large body, so a large body is sent without it. The retry is the last attempt,
|
|
2690
|
+
// so it never asks for keepalive. This lets a body the length check missed get through.
|
|
2691
|
+
keepalive: canRetry && body.length <= KEEPALIVE_BODY_LIMIT,
|
|
2683
2692
|
});
|
|
2684
2693
|
const serverDate = Date.parse(resHeaders.get('date') || '');
|
|
2685
2694
|
if (serverDate) {
|
|
@@ -3398,6 +3407,11 @@ function createProtocolHandler(objProcessors, logger) {
|
|
|
3398
3407
|
let protocolState = 'inactive';
|
|
3399
3408
|
let tempType = 'partial';
|
|
3400
3409
|
let tempUpdates = [];
|
|
3410
|
+
// Only kinds with a registered processor are supported. An own-property check keeps
|
|
3411
|
+
// kinds such as 'constructor' from resolving to inherited members.
|
|
3412
|
+
function isSupportedKind(kind) {
|
|
3413
|
+
return Object.prototype.hasOwnProperty.call(objProcessors, kind);
|
|
3414
|
+
}
|
|
3401
3415
|
function processObj(kind, jsonObj) {
|
|
3402
3416
|
return objProcessors[kind]?.(jsonObj);
|
|
3403
3417
|
}
|
|
@@ -3468,6 +3482,12 @@ function createProtocolHandler(objProcessors, logger) {
|
|
|
3468
3482
|
logger?.warn(`Ignoring put-object with missing fields: kind=${data.kind}, key=${data.key}, version=${data.version}`);
|
|
3469
3483
|
return ACTION_NONE;
|
|
3470
3484
|
}
|
|
3485
|
+
// Objects of unsupported kinds are dropped silently so the protocol can add new kinds
|
|
3486
|
+
// without disrupting older SDKs.
|
|
3487
|
+
if (!isSupportedKind(data.kind)) {
|
|
3488
|
+
logger?.debug(`Ignoring put-object with unsupported kind: '${data.kind}'`);
|
|
3489
|
+
return ACTION_NONE;
|
|
3490
|
+
}
|
|
3471
3491
|
const obj = processObj(data.kind, data.object);
|
|
3472
3492
|
if (!obj) {
|
|
3473
3493
|
logger?.warn(`Unable to process object for kind: '${data.kind}'`);
|
|
@@ -3490,6 +3510,10 @@ function createProtocolHandler(objProcessors, logger) {
|
|
|
3490
3510
|
logger?.warn(`Ignoring delete-object with missing fields: kind=${data.kind}, key=${data.key}, version=${data.version}`);
|
|
3491
3511
|
return ACTION_NONE;
|
|
3492
3512
|
}
|
|
3513
|
+
if (!isSupportedKind(data.kind)) {
|
|
3514
|
+
logger?.debug(`Ignoring delete-object with unsupported kind: '${data.kind}'`);
|
|
3515
|
+
return ACTION_NONE;
|
|
3516
|
+
}
|
|
3493
3517
|
tempUpdates.push({
|
|
3494
3518
|
kind: data.kind,
|
|
3495
3519
|
key: data.key,
|
|
@@ -3672,6 +3696,74 @@ class PayloadStreamReader {
|
|
|
3672
3696
|
}
|
|
3673
3697
|
}
|
|
3674
3698
|
|
|
3699
|
+
/**
|
|
3700
|
+
* The most redirect hops one streaming request follows. When a chain exceeds the cap, the last
|
|
3701
|
+
* redirect response goes to the caller as an ordinary non-200 response. The caller's error
|
|
3702
|
+
* handling decides whether to retry.
|
|
3703
|
+
*/
|
|
3704
|
+
const MAX_STREAMING_REDIRECT_HOPS = 5;
|
|
3705
|
+
/**
|
|
3706
|
+
* Resolves the target of a redirect response. The target can be relative, and it resolves
|
|
3707
|
+
* against the URL of the redirected request. Only an `http:` or `https:` target can carry
|
|
3708
|
+
* the stream; any other scheme, a missing or empty `Location`, and an unparsable value all
|
|
3709
|
+
* resolve to `undefined`, and the redirect response then goes to the caller unfollowed.
|
|
3710
|
+
*/
|
|
3711
|
+
function redirectTarget(headers, baseUrl) {
|
|
3712
|
+
const raw = headers.location;
|
|
3713
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
3714
|
+
if (typeof value !== 'string' || value === '') {
|
|
3715
|
+
return undefined;
|
|
3716
|
+
}
|
|
3717
|
+
try {
|
|
3718
|
+
const resolved = new URL(value, baseUrl);
|
|
3719
|
+
if (resolved.protocol !== 'http:' && resolved.protocol !== 'https:') {
|
|
3720
|
+
return undefined;
|
|
3721
|
+
}
|
|
3722
|
+
return resolved.href;
|
|
3723
|
+
}
|
|
3724
|
+
catch {
|
|
3725
|
+
return undefined;
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
/**
|
|
3729
|
+
* Issues a streaming request and follows up to {@link MAX_STREAMING_REDIRECT_HOPS} hops of
|
|
3730
|
+
* `301` and `307` redirects. Each hop calls `doRequest` again with the target URL, so the
|
|
3731
|
+
* request carries the same method, body, and headers to each target, the `Authorization`
|
|
3732
|
+
* header included. A `302` and every other status return to the caller unfollowed.
|
|
3733
|
+
*
|
|
3734
|
+
* The loop holds no state across calls. A reconnect starts from the original URL again and
|
|
3735
|
+
* re-follows the chain.
|
|
3736
|
+
*
|
|
3737
|
+
* @param url The URL of the initial request.
|
|
3738
|
+
* @param doRequest Issues one request and resolves with its response. The caller builds the
|
|
3739
|
+
* options inside it from the given URL, so each hop gets options for its own target.
|
|
3740
|
+
*/
|
|
3741
|
+
async function followStreamingRedirects(url, doRequest) {
|
|
3742
|
+
let currentUrl = url;
|
|
3743
|
+
let res = await doRequest(currentUrl);
|
|
3744
|
+
let hops = 0;
|
|
3745
|
+
while ((res.statusCode === 301 || res.statusCode === 307) && hops < MAX_STREAMING_REDIRECT_HOPS) {
|
|
3746
|
+
const target = redirectTarget(res.headers, currentUrl);
|
|
3747
|
+
if (target === undefined) {
|
|
3748
|
+
return res;
|
|
3749
|
+
}
|
|
3750
|
+
hops += 1;
|
|
3751
|
+
// The destroy releases the skipped redirect response and its connection at once, so a
|
|
3752
|
+
// redirect body that never ends cannot hold a socket for the life of the attempt.
|
|
3753
|
+
try {
|
|
3754
|
+
res.destroy?.();
|
|
3755
|
+
}
|
|
3756
|
+
catch {
|
|
3757
|
+
// A throwing destroy has nothing left to release.
|
|
3758
|
+
}
|
|
3759
|
+
currentUrl = target;
|
|
3760
|
+
// The hops are sequential. The next request cannot start until this response arrives.
|
|
3761
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3762
|
+
res = await doRequest(currentUrl);
|
|
3763
|
+
}
|
|
3764
|
+
return res;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3675
3767
|
/**
|
|
3676
3768
|
* Wraps the raw headers in the fetch `Headers` shape. Lookups are case-insensitive.
|
|
3677
3769
|
* Multi-value headers are joined with ", ", names that differ only by case merge into one
|
|
@@ -3872,12 +3964,14 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3872
3964
|
InputCustomEvent: InputCustomEvent,
|
|
3873
3965
|
InputEvalEvent: InputEvalEvent,
|
|
3874
3966
|
InputIdentifyEvent: InputIdentifyEvent,
|
|
3967
|
+
MAX_STREAMING_REDIRECT_HOPS: MAX_STREAMING_REDIRECT_HOPS,
|
|
3875
3968
|
NullEventProcessor: NullEventProcessor,
|
|
3876
3969
|
PayloadProcessor: PayloadProcessor,
|
|
3877
3970
|
PayloadStreamReader: PayloadStreamReader,
|
|
3878
3971
|
canonicalize: canonicalize,
|
|
3879
3972
|
createProtocolHandler: createProtocolHandler,
|
|
3880
3973
|
createStreamingResponse: createStreamingResponse,
|
|
3974
|
+
followStreamingRedirects: followStreamingRedirects,
|
|
3881
3975
|
initMetadataFromHeaders: initMetadataFromHeaders,
|
|
3882
3976
|
isLegacyUser: isLegacyUser,
|
|
3883
3977
|
isMultiKind: isMultiKind,
|