@launchdarkly/js-sdk-common 2.0.0 → 2.2.0-alpha
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 +7 -0
- package/dist/api/platform/EventSource.d.ts +3 -5
- package/dist/api/platform/EventSource.d.ts.map +1 -1
- package/dist/api/platform/Platform.d.ts +6 -0
- package/dist/api/platform/Platform.d.ts.map +1 -1
- package/dist/api/platform/Requests.d.ts +5 -1
- package/dist/api/platform/Requests.d.ts.map +1 -1
- package/dist/api/platform/Storage.d.ts +6 -0
- package/dist/api/platform/Storage.d.ts.map +1 -0
- package/dist/api/platform/Storage.js +3 -0
- package/dist/api/platform/Storage.js.map +1 -0
- package/dist/api/platform/index.d.ts +1 -0
- package/dist/api/platform/index.d.ts.map +1 -1
- package/dist/api/platform/index.js +1 -0
- package/dist/api/platform/index.js.map +1 -1
- package/dist/internal/events/EventSender.d.ts.map +1 -1
- package/dist/internal/events/EventSender.js +4 -4
- package/dist/internal/events/EventSender.js.map +1 -1
- package/dist/internal/events/LDInternalOptions.d.ts +16 -0
- package/dist/internal/events/LDInternalOptions.d.ts.map +1 -0
- package/dist/internal/events/LDInternalOptions.js +3 -0
- package/dist/internal/events/LDInternalOptions.js.map +1 -0
- package/dist/internal/events/index.d.ts +2 -1
- package/dist/internal/events/index.d.ts.map +1 -1
- package/dist/internal/events/index.js.map +1 -1
- package/dist/internal/stream/StreamingProcessor.d.ts +10 -0
- package/dist/internal/stream/StreamingProcessor.d.ts.map +1 -1
- package/dist/internal/stream/StreamingProcessor.js +25 -18
- package/dist/internal/stream/StreamingProcessor.js.map +1 -1
- package/dist/options/ServiceEndpoints.d.ts +14 -1
- package/dist/options/ServiceEndpoints.d.ts.map +1 -1
- package/dist/options/ServiceEndpoints.js +4 -1
- package/dist/options/ServiceEndpoints.js.map +1 -1
- package/dist/utils/clone.d.ts +1 -1
- package/dist/utils/clone.d.ts.map +1 -1
- package/dist/utils/clone.js.map +1 -1
- package/dist/utils/fast-deep-equal/index.d.ts +2 -0
- package/dist/utils/fast-deep-equal/index.d.ts.map +1 -0
- package/dist/utils/fast-deep-equal/index.js +90 -0
- package/dist/utils/fast-deep-equal/index.js.map +1 -0
- package/dist/utils/http.d.ts +15 -7
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +23 -3
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.1.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.0.0...js-sdk-common-v2.1.0) (2023-11-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* edge sdks should send events to bulk/environment endpoint ([#256](https://github.com/launchdarkly/js-core/issues/256)) ([f45910f](https://github.com/launchdarkly/js-core/commit/f45910f171d434ca080bb6486331fbfbd2793985))
|
|
11
|
+
|
|
5
12
|
## [2.0.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.1.0...js-sdk-common-v2.0.0) (2023-10-16)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HttpErrorResponse } from './Requests';
|
|
1
2
|
export type EventName = 'delete' | 'patch' | 'ping' | 'put';
|
|
2
3
|
export type EventListener = (event?: {
|
|
3
4
|
data?: any;
|
|
@@ -8,7 +9,7 @@ export type ProcessStreamResponse = {
|
|
|
8
9
|
};
|
|
9
10
|
export interface EventSource {
|
|
10
11
|
onclose: (() => void) | undefined;
|
|
11
|
-
onerror: (() => void) | undefined;
|
|
12
|
+
onerror: ((err?: HttpErrorResponse) => void) | undefined;
|
|
12
13
|
onopen: (() => void) | undefined;
|
|
13
14
|
onretrying: ((e: {
|
|
14
15
|
delayMillis: number;
|
|
@@ -17,10 +18,7 @@ export interface EventSource {
|
|
|
17
18
|
close(): void;
|
|
18
19
|
}
|
|
19
20
|
export interface EventSourceInitDict {
|
|
20
|
-
errorFilter: (err:
|
|
21
|
-
status: number;
|
|
22
|
-
message: string;
|
|
23
|
-
}) => boolean;
|
|
21
|
+
errorFilter: (err: HttpErrorResponse) => boolean;
|
|
24
22
|
headers: {
|
|
25
23
|
[key: string]: string | string[];
|
|
26
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventSource.d.ts","sourceRoot":"","sources":["../../../src/api/platform/EventSource.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,KAAK,IAAI,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IACvC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"EventSource.d.ts","sourceRoot":"","sources":["../../../src/api/platform/EventSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,KAAK,IAAI,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IACvC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAE/D,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IACjE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC;IACjD,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9C,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wBAAwB,EAAE,MAAM,CAAC;CAClC"}
|
|
@@ -3,6 +3,7 @@ import { Encoding } from './Encoding';
|
|
|
3
3
|
import { Filesystem } from './Filesystem';
|
|
4
4
|
import { Info } from './Info';
|
|
5
5
|
import { Requests } from './Requests';
|
|
6
|
+
import { Storage } from './Storage';
|
|
6
7
|
export interface Platform {
|
|
7
8
|
/**
|
|
8
9
|
* The interface for performing encoding operations.
|
|
@@ -26,5 +27,10 @@ export interface Platform {
|
|
|
26
27
|
* The interface for performing http/https requests.
|
|
27
28
|
*/
|
|
28
29
|
requests: Requests;
|
|
30
|
+
/**
|
|
31
|
+
* The interface for session specific storage object. If the platform does not
|
|
32
|
+
* support local storage access, this may be undefined.
|
|
33
|
+
*/
|
|
34
|
+
storage?: Storage;
|
|
29
35
|
}
|
|
30
36
|
//# sourceMappingURL=Platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventSource, EventSourceInitDict } from './EventSource';
|
|
1
|
+
import type { EventSource, EventSourceInitDict } from './EventSource';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for headers that are part of a fetch response.
|
|
4
4
|
*/
|
|
@@ -72,4 +72,8 @@ export interface Requests {
|
|
|
72
72
|
*/
|
|
73
73
|
usingProxyAuth?(): boolean;
|
|
74
74
|
}
|
|
75
|
+
export interface HttpErrorResponse {
|
|
76
|
+
message: string;
|
|
77
|
+
status?: number;
|
|
78
|
+
}
|
|
75
79
|
//# sourceMappingURL=Requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../../src/api/platform/Requests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,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,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;CAC5B;A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AAI,CAAC,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../../src/api/platform/Storage.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./Info"), exports);
|
|
|
21
21
|
__exportStar(require("./Platform"), exports);
|
|
22
22
|
__exportStar(require("./Requests"), exports);
|
|
23
23
|
__exportStar(require("./EventSource"), exports);
|
|
24
|
+
__exportStar(require("./Storage"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventSender.d.ts","sourceRoot":"","sources":["../../../src/internal/events/EventSender.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,mBAAmB,EACnB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa;IACvD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,cAAc,CAEpB;IACF,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAW;gBAEf,aAAa,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"EventSender.d.ts","sourceRoot":"","sources":["../../../src/internal/events/EventSender.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,mBAAmB,EACnB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa;IACvD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,cAAc,CAEpB;IACF,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAW;gBAEf,aAAa,EAAE,aAAa;YAqB1B,gBAAgB;IA8DxB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAMhF"}
|
|
@@ -6,11 +6,11 @@ const utils_1 = require("../../utils");
|
|
|
6
6
|
class EventSender {
|
|
7
7
|
constructor(clientContext) {
|
|
8
8
|
const { basicConfiguration, platform } = clientContext;
|
|
9
|
-
const { sdkKey, serviceEndpoints, tags } = basicConfiguration;
|
|
9
|
+
const { sdkKey, serviceEndpoints: { events, analyticsEventPath, diagnosticEventPath, includeAuthorizationHeader, }, tags, } = basicConfiguration;
|
|
10
10
|
const { crypto, info, requests } = platform;
|
|
11
|
-
this.defaultHeaders = (0, utils_1.defaultHeaders)(sdkKey, info, tags);
|
|
12
|
-
this.eventsUri = `${
|
|
13
|
-
this.diagnosticEventsUri = `${
|
|
11
|
+
this.defaultHeaders = (0, utils_1.defaultHeaders)(sdkKey, info, tags, includeAuthorizationHeader);
|
|
12
|
+
this.eventsUri = `${events}${analyticsEventPath}`;
|
|
13
|
+
this.diagnosticEventsUri = `${events}${diagnosticEventPath}`;
|
|
14
14
|
this.requests = requests;
|
|
15
15
|
this.crypto = crypto;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventSender.js","sourceRoot":"","sources":["../../../src/internal/events/EventSender.ts"],"names":[],"mappings":";;AACA,mDAK6B;AAC7B,yCAA4E;AAE5E,uCAAsE;AAEtE,MAAqB,WAAW;IAS9B,YAAY,aAA4B;QACtC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;QACvD,MAAM,
|
|
1
|
+
{"version":3,"file":"EventSender.js","sourceRoot":"","sources":["../../../src/internal/events/EventSender.ts"],"names":[],"mappings":";;AACA,mDAK6B;AAC7B,yCAA4E;AAE5E,uCAAsE;AAEtE,MAAqB,WAAW;IAS9B,YAAY,aAA4B;QACtC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;QACvD,MAAM,EACJ,MAAM,EACN,gBAAgB,EAAE,EAChB,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC3B,EACD,IAAI,GACL,GAAG,kBAAkB,CAAC;QACvB,MAAM,EAAE,MAAM,EAA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@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is for internal use only.
|
|
3
|
+
*
|
|
4
|
+
* Edge sdks use clientSideID to query feature stores. They also send analytics
|
|
5
|
+
* using this clientSideID. This is a hybrid behavior because they are based
|
|
6
|
+
* on js-server-common, but uses the clientSideID instead of the sdkKey for the
|
|
7
|
+
* above reasons. These internal options allow the edge sdks to use the
|
|
8
|
+
* EventSender to send analytics to the correct LD endpoints using
|
|
9
|
+
* the clientSideId.
|
|
10
|
+
*/
|
|
11
|
+
export type LDInternalOptions = {
|
|
12
|
+
analyticsEventPath?: string;
|
|
13
|
+
diagnosticEventPath?: string;
|
|
14
|
+
includeAuthorizationHeader?: boolean;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=LDInternalOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDInternalOptions.d.ts","sourceRoot":"","sources":["../../../src/internal/events/LDInternalOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LDInternalOptions.js","sourceRoot":"","sources":["../../../src/internal/events/LDInternalOptions.ts"],"names":[],"mappings":""}
|
|
@@ -5,7 +5,8 @@ import InputEvalEvent from './InputEvalEvent';
|
|
|
5
5
|
import InputEvent from './InputEvent';
|
|
6
6
|
import InputIdentifyEvent from './InputIdentifyEvent';
|
|
7
7
|
import InputMigrationEvent from './InputMigrationEvent';
|
|
8
|
+
import type { LDInternalOptions } from './LDInternalOptions';
|
|
8
9
|
import NullEventProcessor from './NullEventProcessor';
|
|
9
10
|
import shouldSample from './sampling';
|
|
10
|
-
export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, shouldSample, NullEventProcessor, };
|
|
11
|
+
export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, shouldSample, NullEventProcessor, LDInternalOptions, };
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,YAAY,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,YAAY,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":";;;AAAA,qDAA8C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":";;;AAAA,qDAA8C;AAY5C,yBAZK,wBAAc,CAYL;AAXhB,qDAA8C;AAiB5C,yBAjBK,wBAAc,CAiBL;AAhBhB,yDAAkD;AAWhD,2BAXK,0BAAgB,CAWL;AAVlB,qDAA8C;AAW5C,yBAXK,wBAAc,CAWL;AAThB,6DAAsD;AAWpD,6BAXK,4BAAkB,CAWL;AARpB,6DAAsD;AAYpD,6BAZK,4BAAkB,CAYL;AAXpB,yCAAsC;AAUpC,uBAVK,kBAAY,CAUL"}
|
|
@@ -17,6 +17,16 @@ declare class StreamingProcessor implements LDStreamProcessor {
|
|
|
17
17
|
constructor(sdkKey: string, clientContext: ClientContext, streamUriPath: string, listeners: Map<EventName, ProcessStreamResponse>, diagnosticsManager?: DiagnosticsManager | undefined, errorHandler?: StreamingErrorHandler | undefined, streamInitialReconnectDelay?: number);
|
|
18
18
|
private logConnectionStarted;
|
|
19
19
|
private logConnectionResult;
|
|
20
|
+
/**
|
|
21
|
+
* This is a wrapper around the passed errorHandler which adds additional
|
|
22
|
+
* diagnostics and logging logic.
|
|
23
|
+
*
|
|
24
|
+
* @param err The error to be logged and handled.
|
|
25
|
+
* @return boolean whether to retry the connection.
|
|
26
|
+
*
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
private retryAndHandleError;
|
|
20
30
|
start(): void;
|
|
21
31
|
stop(): void;
|
|
22
32
|
close(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingProcessor.d.ts","sourceRoot":"","sources":["../../../src/internal/stream/StreamingProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"StreamingProcessor.d.ts","sourceRoot":"","sources":["../../../src/internal/stream/StreamingProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,qBAAqB,EAEtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAahD,cAAM,kBAAmB,YAAW,iBAAiB;IAajD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAf9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAW;IAEnC,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,0BAA0B,CAAC,CAAS;gBAG1C,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,MAAM,EACJ,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,qBAAqB,CAAC,EAChD,kBAAkB,CAAC,gCAAoB,EACvC,YAAY,CAAC,mCAAuB,EACpC,2BAA2B,SAAI;IAYlD,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,mBAAmB;IAY3B;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAc3B,KAAK;IAkDL,IAAI;IAKJ,KAAK;CAGN;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const errors_1 = require("../../errors");
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
-
const STREAM_READ_TIMEOUT_MS = 5 * 60 * 1000;
|
|
6
|
-
const RETRY_RESET_INTERVAL_MS = 60 * 1000;
|
|
7
5
|
const reportJsonError = (type, data, logger, errorHandler) => {
|
|
8
6
|
logger === null || logger === void 0 ? void 0 : logger.error(`Stream received invalid data in "${type}" message`);
|
|
9
7
|
logger === null || logger === void 0 ? void 0 : logger.debug(`Invalid JSON follows: ${data}`);
|
|
@@ -32,28 +30,37 @@ class StreamingProcessor {
|
|
|
32
30
|
}
|
|
33
31
|
this.connectionAttemptStartTime = undefined;
|
|
34
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* This is a wrapper around the passed errorHandler which adds additional
|
|
35
|
+
* diagnostics and logging logic.
|
|
36
|
+
*
|
|
37
|
+
* @param err The error to be logged and handled.
|
|
38
|
+
* @return boolean whether to retry the connection.
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
retryAndHandleError(err) {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
if (!(0, utils_1.shouldRetry)(err)) {
|
|
45
|
+
this.logConnectionResult(false);
|
|
46
|
+
(_a = this.errorHandler) === null || _a === void 0 ? void 0 : _a.call(this, new errors_1.LDStreamingError(err.message, err.status));
|
|
47
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.error((0, utils_1.httpErrorMessage)(err, 'streaming request'));
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.warn((0, utils_1.httpErrorMessage)(err, 'streaming request', 'will retry'));
|
|
51
|
+
this.logConnectionResult(false);
|
|
52
|
+
this.logConnectionStarted();
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
35
55
|
start() {
|
|
36
56
|
this.logConnectionStarted();
|
|
37
|
-
const errorFilter = (err) => {
|
|
38
|
-
var _a, _b, _c;
|
|
39
|
-
if (err.status && !(0, errors_1.isHttpRecoverable)(err.status)) {
|
|
40
|
-
this.logConnectionResult(false);
|
|
41
|
-
(_a = this.errorHandler) === null || _a === void 0 ? void 0 : _a.call(this, new errors_1.LDStreamingError(err.message, err.status));
|
|
42
|
-
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.error((0, utils_1.httpErrorMessage)(err, 'streaming request'));
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.warn((0, utils_1.httpErrorMessage)(err, 'streaming request', 'will retry'));
|
|
46
|
-
this.logConnectionResult(false);
|
|
47
|
-
this.logConnectionStarted();
|
|
48
|
-
return true;
|
|
49
|
-
};
|
|
50
57
|
// TLS is handled by the platform implementation.
|
|
51
58
|
const eventSource = this.requests.createEventSource(this.streamUri, {
|
|
52
59
|
headers: this.headers,
|
|
53
|
-
errorFilter,
|
|
60
|
+
errorFilter: (error) => this.retryAndHandleError(error),
|
|
54
61
|
initialRetryDelayMillis: 1000 * this.streamInitialReconnectDelay,
|
|
55
|
-
readTimeoutMillis:
|
|
56
|
-
retryResetIntervalMillis:
|
|
62
|
+
readTimeoutMillis: 5 * 60 * 1000,
|
|
63
|
+
retryResetIntervalMillis: 60 * 1000,
|
|
57
64
|
});
|
|
58
65
|
this.eventSource = eventSource;
|
|
59
66
|
eventSource.onclose = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingProcessor.js","sourceRoot":"","sources":["../../../src/internal/stream/StreamingProcessor.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"StreamingProcessor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,eAAe,CAAC,IAAI,CAAC,CAAC;oBAEvC,IAAI,CAAC,QAAQ,EAAE;wBACb,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;wBACjE,OAAO;qBACR;oBACD,WAAW,CAAC,QAAQ,CAAC,CAAC;iBACvB;qBAAM;oBACL,MAAA,IAAI,CAAC,YAAY,qDAAG,IAAI,yBAAgB,CAAC,sCAAsC,CAAC,CAAC,CAAC;iBACnF;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI;;QACF,MAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -6,6 +6,19 @@ export default class ServiceEndpoints {
|
|
|
6
6
|
readonly streaming: string;
|
|
7
7
|
readonly polling: string;
|
|
8
8
|
readonly events: string;
|
|
9
|
-
|
|
9
|
+
/** Valid paths are:
|
|
10
|
+
* /bulk
|
|
11
|
+
* /events/bulk/envId
|
|
12
|
+
* /mobile
|
|
13
|
+
*/
|
|
14
|
+
readonly analyticsEventPath: string;
|
|
15
|
+
/** Valid paths are:
|
|
16
|
+
* /diagnostic
|
|
17
|
+
* /events/diagnostic/envId
|
|
18
|
+
* /mobile/events/diagnostic
|
|
19
|
+
*/
|
|
20
|
+
readonly diagnosticEventPath: string;
|
|
21
|
+
readonly includeAuthorizationHeader: boolean;
|
|
22
|
+
constructor(streaming: string, polling: string, events?: string, analyticsEventPath?: string, diagnosticEventPath?: string, includeAuthorizationHeader?: boolean);
|
|
10
23
|
}
|
|
11
24
|
//# sourceMappingURL=ServiceEndpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceEndpoints.d.ts","sourceRoot":"","sources":["../../src/options/ServiceEndpoints.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,OAAc,cAAc,SAAqC;IAEjE,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ServiceEndpoints.d.ts","sourceRoot":"","sources":["../../src/options/ServiceEndpoints.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,OAAc,cAAc,SAAqC;IAEjE,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B;;;;OAIG;IACH,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAE3C;;;;OAIG;IACH,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAG5C,SAAgB,0BAA0B,EAAE,OAAO,CAAC;gBAGlD,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAwC,EAChD,kBAAkB,GAAE,MAAgB,EACpC,mBAAmB,GAAE,MAAsB,EAC3C,0BAA0B,GAAE,OAAc;CAS7C"}
|
|
@@ -7,10 +7,13 @@ function canonicalizeUri(uri) {
|
|
|
7
7
|
* Specifies the base service URIs used by SDK components.
|
|
8
8
|
*/
|
|
9
9
|
class ServiceEndpoints {
|
|
10
|
-
constructor(streaming, polling, events = ServiceEndpoints.DEFAULT_EVENTS) {
|
|
10
|
+
constructor(streaming, polling, events = ServiceEndpoints.DEFAULT_EVENTS, analyticsEventPath = '/bulk', diagnosticEventPath = '/diagnostic', includeAuthorizationHeader = true) {
|
|
11
11
|
this.streaming = canonicalizeUri(streaming);
|
|
12
12
|
this.polling = canonicalizeUri(polling);
|
|
13
13
|
this.events = canonicalizeUri(events);
|
|
14
|
+
this.analyticsEventPath = analyticsEventPath;
|
|
15
|
+
this.diagnosticEventPath = diagnosticEventPath;
|
|
16
|
+
this.includeAuthorizationHeader = includeAuthorizationHeader;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
ServiceEndpoints.DEFAULT_EVENTS = 'https://events.launchdarkly.com';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceEndpoints.js","sourceRoot":"","sources":["../../src/options/ServiceEndpoints.ts"],"names":[],"mappings":";;AAAA,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAqB,gBAAgB;
|
|
1
|
+
{"version":3,"file":"ServiceEndpoints.js","sourceRoot":"","sources":["../../src/options/ServiceEndpoints.ts"],"names":[],"mappings":";;AAAA,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAqB,gBAAgB;IAwBnC,YACE,SAAiB,EACjB,OAAe,EACf,SAAiB,gBAAgB,CAAC,cAAc,EAChD,qBAA6B,OAAO,EACpC,sBAA8B,aAAa,EAC3C,6BAAsC,IAAI;QAE1C,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;;AArCa,+BAAc,GAAG,iCAAiC,CAAC;kBAD9C,gBAAgB"}
|
package/dist/utils/clone.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function clone(obj: any):
|
|
1
|
+
export default function clone<T>(obj: any): T;
|
|
2
2
|
//# sourceMappingURL=clone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/utils/clone.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/utils/clone.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,KAExC"}
|
package/dist/utils/clone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../src/utils/clone.ts"],"names":[],"mappings":";;AAAA,SAAwB,KAAK,
|
|
1
|
+
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../src/utils/clone.ts"],"names":[],"mappings":";;AAAA,SAAwB,KAAK,CAAI,GAAQ;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAM,CAAC;AAC9C,CAAC;AAFD,wBAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/fast-deep-equal/index.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,WAsEnD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// Ripped from https://github.com/epoberezkin/fast-deep-fastDeepEqual
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
// {{? it.es6 }}
|
|
6
|
+
// var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
|
|
7
|
+
// {{?}}
|
|
8
|
+
function fastDeepEqual(a, b) {
|
|
9
|
+
if (a === b)
|
|
10
|
+
return true;
|
|
11
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
12
|
+
if (a.constructor !== b.constructor)
|
|
13
|
+
return false;
|
|
14
|
+
var length, i, keys;
|
|
15
|
+
if (Array.isArray(a)) {
|
|
16
|
+
length = a.length;
|
|
17
|
+
if (length != b.length)
|
|
18
|
+
return false;
|
|
19
|
+
for (i = length; i-- !== 0;)
|
|
20
|
+
if (!fastDeepEqual(a[i], b[i]))
|
|
21
|
+
return false;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
// {{? it.es6 }}
|
|
25
|
+
if (a instanceof Map && b instanceof Map) {
|
|
26
|
+
if (a.size !== b.size)
|
|
27
|
+
return false;
|
|
28
|
+
for (i of a.entries())
|
|
29
|
+
if (!b.has(i[0]))
|
|
30
|
+
return false;
|
|
31
|
+
for (i of a.entries())
|
|
32
|
+
if (!fastDeepEqual(i[1], b.get(i[0])))
|
|
33
|
+
return false;
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (a instanceof Set && b instanceof Set) {
|
|
37
|
+
if (a.size !== b.size)
|
|
38
|
+
return false;
|
|
39
|
+
for (i of a.entries())
|
|
40
|
+
if (!b.has(i[0]))
|
|
41
|
+
return false;
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
length = a.length;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
if (length != b.length)
|
|
49
|
+
return false;
|
|
50
|
+
for (i = length; i-- !== 0;) {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
if (a[i] !== b[i])
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
// {{?}}
|
|
58
|
+
if (a.constructor === RegExp)
|
|
59
|
+
return a.source === b.source && a.flags === b.flags;
|
|
60
|
+
if (a.valueOf !== Object.prototype.valueOf)
|
|
61
|
+
return a.valueOf() === b.valueOf();
|
|
62
|
+
if (a.toString !== Object.prototype.toString)
|
|
63
|
+
return a.toString() === b.toString();
|
|
64
|
+
keys = Object.keys(a);
|
|
65
|
+
length = keys.length;
|
|
66
|
+
if (length !== Object.keys(b).length)
|
|
67
|
+
return false;
|
|
68
|
+
for (i = length; i-- !== 0;)
|
|
69
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
70
|
+
return false;
|
|
71
|
+
for (i = length; i-- !== 0;) {
|
|
72
|
+
var key = keys[i];
|
|
73
|
+
// {{? it.react }}
|
|
74
|
+
// if (key === '_owner' && a.$$typeof) {
|
|
75
|
+
// // React-specific: avoid traversing React elements' _owner.
|
|
76
|
+
// // _owner contains circular references
|
|
77
|
+
// // and is not needed when comparing the actual elements (and not their owners)
|
|
78
|
+
// continue;
|
|
79
|
+
// }
|
|
80
|
+
// {{?}}
|
|
81
|
+
if (!fastDeepEqual(a[key], b[key]))
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
// true if both NaN, false otherwise
|
|
87
|
+
return a !== a && b !== b;
|
|
88
|
+
}
|
|
89
|
+
exports.default = fastDeepEqual;
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/fast-deep-equal/index.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,qEAAqE;;AAErE,gBAAgB;AAChB,kEAAkE;AAClE,QAAQ;AAER,SAAwB,aAAa,CAAC,CAAM,EAAE,CAAM;IAClD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEzB,IAAI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CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAEnD,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;QAEtE,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,GAAI;YAC5B,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,kBAAkB;YAClB,wCAAwC;YACxC,gEAAgE;YAChE,4CAA4C;YAC5C,mFAAmF;YACnF,cAAc;YACd,IAAI;YACJ,QAAQ;YACR,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;SAClD;QAED,OAAO,IAAI,CAAC;KACb;IAED,oCAAoC;IACpC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAtED,gCAsEC"}
|
package/dist/utils/http.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { Info } from '../api';
|
|
1
|
+
import { Encoding, HttpErrorResponse, Info } from '../api';
|
|
2
2
|
import { ApplicationTags } from '../options';
|
|
3
3
|
export type LDHeaders = {
|
|
4
|
-
authorization
|
|
4
|
+
authorization?: string;
|
|
5
5
|
'user-agent': string;
|
|
6
6
|
'x-launchdarkly-wrapper'?: string;
|
|
7
7
|
'x-launchdarkly-tags'?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function defaultHeaders(sdkKey: string, info: Info, tags?: ApplicationTags): LDHeaders;
|
|
10
|
-
export declare function httpErrorMessage(err:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export declare function defaultHeaders(sdkKey: string, info: Info, tags?: ApplicationTags, includeAuthorizationHeader?: boolean): LDHeaders;
|
|
10
|
+
export declare function httpErrorMessage(err: HttpErrorResponse, context: string, retryMessage?: string): string;
|
|
11
|
+
export declare function shouldRetry({ status }: HttpErrorResponse): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* In react-native use base64-js to polyfill btoa. This is safe
|
|
14
|
+
* because the react-native repo uses it too. Set the global.btoa to the encode
|
|
15
|
+
* function of base64-js.
|
|
16
|
+
* https://github.com/beatgammit/base64-js
|
|
17
|
+
* https://github.com/axios/axios/issues/2235#issuecomment-512204616
|
|
18
|
+
*
|
|
19
|
+
* Ripped from https://thewoods.blog/base64url/
|
|
20
|
+
*/
|
|
21
|
+
export declare const base64UrlEncode: (s: string, encoding: Encoding) => string;
|
|
14
22
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/utils/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
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,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,eAAe,EACtB,0BAA0B,GAAE,OAAc,GACzC,SAAS,CAwBX;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,MAAO,MAAM,YAAY,QAAQ,KAAG,MACa,CAAC"}
|
package/dist/utils/http.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpErrorMessage = exports.defaultHeaders = void 0;
|
|
4
|
-
|
|
3
|
+
exports.base64UrlEncode = exports.shouldRetry = exports.httpErrorMessage = exports.defaultHeaders = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
function defaultHeaders(sdkKey, info, tags, includeAuthorizationHeader = true) {
|
|
5
6
|
const { userAgentBase, version, wrapperName, wrapperVersion } = info.sdkData();
|
|
6
7
|
const headers = {
|
|
7
|
-
authorization: sdkKey,
|
|
8
8
|
'user-agent': `${userAgentBase !== null && userAgentBase !== void 0 ? userAgentBase : 'NodeJSClient'}/${version}`,
|
|
9
9
|
};
|
|
10
|
+
// edge sdks sets this to false because they use the clientSideID
|
|
11
|
+
// and they don't need the authorization header
|
|
12
|
+
if (includeAuthorizationHeader) {
|
|
13
|
+
headers.authorization = sdkKey;
|
|
14
|
+
}
|
|
10
15
|
if (wrapperName) {
|
|
11
16
|
headers['x-launchdarkly-wrapper'] = wrapperVersion
|
|
12
17
|
? `${wrapperName}/${wrapperVersion}`
|
|
@@ -30,4 +35,19 @@ function httpErrorMessage(err, context, retryMessage) {
|
|
|
30
35
|
return `Received ${desc} for ${context} - ${action}`;
|
|
31
36
|
}
|
|
32
37
|
exports.httpErrorMessage = httpErrorMessage;
|
|
38
|
+
function shouldRetry({ status }) {
|
|
39
|
+
return status ? (0, errors_1.isHttpRecoverable)(status) : true;
|
|
40
|
+
}
|
|
41
|
+
exports.shouldRetry = shouldRetry;
|
|
42
|
+
/**
|
|
43
|
+
* In react-native use base64-js to polyfill btoa. This is safe
|
|
44
|
+
* because the react-native repo uses it too. Set the global.btoa to the encode
|
|
45
|
+
* function of base64-js.
|
|
46
|
+
* https://github.com/beatgammit/base64-js
|
|
47
|
+
* https://github.com/axios/axios/issues/2235#issuecomment-512204616
|
|
48
|
+
*
|
|
49
|
+
* Ripped from https://thewoods.blog/base64url/
|
|
50
|
+
*/
|
|
51
|
+
const base64UrlEncode = (s, encoding) => encoding.btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
52
|
+
exports.base64UrlEncode = base64UrlEncode;
|
|
33
53
|
//# sourceMappingURL=http.js.map
|
package/dist/utils/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;AACA,sCAA8C;AAU9C,SAAgB,cAAc,CAC5B,MAAc,EACd,IAAU,EACV,IAAsB,EACtB,6BAAsC,IAAI;IAE1C,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAE/E,MAAM,OAAO,GAAc;QACzB,YAAY,EAAE,GAAG,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,cAAc,IAAI,OAAO,EAAE;KAC9D,CAAC;IAEF,iEAAiE;IACjE,+CAA+C;IAC/C,IAAI,0BAA0B,EAAE;QAC9B,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC;KAChC;IAED,IAAI,WAAW,EAAE;QACf,OAAO,CAAC,wBAAwB,CAAC,GAAG,cAAc;YAChD,CAAC,CAAC,GAAG,WAAW,IAAI,cAAc,EAAE;YACpC,CAAC,CAAC,WAAW,CAAC;KACj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ToMillis } from './date';
|
|
3
|
-
import
|
|
3
|
+
import fastDeepEqual from './fast-deep-equal';
|
|
4
|
+
import { base64UrlEncode, defaultHeaders, httpErrorMessage, LDHeaders, shouldRetry } from './http';
|
|
4
5
|
import noop from './noop';
|
|
5
6
|
import sleep from './sleep';
|
|
6
7
|
import { VoidFunction } from './VoidFunction';
|
|
7
|
-
export { clone, defaultHeaders, httpErrorMessage, noop, LDHeaders, secondsToMillis, sleep, VoidFunction, };
|
|
8
|
+
export { base64UrlEncode, clone, defaultHeaders, fastDeepEqual, httpErrorMessage, noop, LDHeaders, shouldRetry, secondsToMillis, sleep, VoidFunction, };
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,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,gBAAgB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,KAAK,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,EACL,YAAY,GACb,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sleep = exports.secondsToMillis = exports.noop = exports.httpErrorMessage = exports.defaultHeaders = exports.clone = void 0;
|
|
3
|
+
exports.sleep = exports.secondsToMillis = exports.shouldRetry = exports.noop = exports.httpErrorMessage = exports.fastDeepEqual = exports.defaultHeaders = exports.clone = exports.base64UrlEncode = void 0;
|
|
4
4
|
const clone_1 = require("./clone");
|
|
5
5
|
exports.clone = clone_1.default;
|
|
6
6
|
const date_1 = require("./date");
|
|
7
7
|
Object.defineProperty(exports, "secondsToMillis", { enumerable: true, get: function () { return date_1.secondsToMillis; } });
|
|
8
|
+
const fast_deep_equal_1 = require("./fast-deep-equal");
|
|
9
|
+
exports.fastDeepEqual = fast_deep_equal_1.default;
|
|
8
10
|
const http_1 = require("./http");
|
|
11
|
+
Object.defineProperty(exports, "base64UrlEncode", { enumerable: true, get: function () { return http_1.base64UrlEncode; } });
|
|
9
12
|
Object.defineProperty(exports, "defaultHeaders", { enumerable: true, get: function () { return http_1.defaultHeaders; } });
|
|
10
13
|
Object.defineProperty(exports, "httpErrorMessage", { enumerable: true, get: function () { return http_1.httpErrorMessage; } });
|
|
14
|
+
Object.defineProperty(exports, "shouldRetry", { enumerable: true, get: function () { return http_1.shouldRetry; } });
|
|
11
15
|
const noop_1 = require("./noop");
|
|
12
16
|
exports.noop = noop_1.default;
|
|
13
17
|
const sleep_1 = require("./sleep");
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAU1B,gBAVK,eAAK,CAUL;AATP,iCAAyC;AAgBvC,gGAhBO,sBAAe,OAgBP;AAfjB,uDAA8C;AAU5C,wBAVK,yBAAa,CAUL;AATf,iCAAmG;AAMjG,gGANO,sBAAe,OAMP;AAEf,+FARwB,qBAAc,OAQxB;AAEd,iGAVwC,uBAAgB,OAUxC;AAGhB,4FAbqE,kBAAW,OAarE;AAZb,iCAA0B;AAUxB,eAVK,cAAI,CAUL;AATN,mCAA4B;AAa1B,gBAbK,eAAK,CAaL"}
|