@launchdarkly/js-sdk-common 2.3.0 → 2.4.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 CHANGED
@@ -2,6 +2,25 @@
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.4.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.3.1...js-sdk-common-v2.4.0) (2024-04-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * Add identify timeout to client-sdk. ([#420](https://github.com/launchdarkly/js-core/issues/420)) ([5d73dfe](https://github.com/launchdarkly/js-core/commit/5d73dfeb0d5cdacf620e65e214dd2e334363490e))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Identify incorrectly rejected in client-sdk ([#426](https://github.com/launchdarkly/js-core/issues/426)) ([a019dd6](https://github.com/launchdarkly/js-core/commit/a019dd66b1b852d888e10b78aec9693d7de195fe))
16
+
17
+ ## [2.3.1](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.3.0...js-sdk-common-v2.3.1) (2024-03-25)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Send identify event. ([#407](https://github.com/launchdarkly/js-core/issues/407)) ([1d73462](https://github.com/launchdarkly/js-core/commit/1d73462914cd35925d34a84b61492a52406b4083))
23
+
5
24
  ## [2.3.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.2.0...js-sdk-common-v2.3.0) (2024-03-15)
6
25
 
7
26
 
package/README.md CHANGED
@@ -6,8 +6,6 @@
6
6
 
7
7
  This project contains Typescript classes and interfaces that are applicable to client-side and server-side JavaScript SDKs.
8
8
 
9
- This library is a beta version and should not be considered ready for production use while this message is visible.
10
-
11
9
  ## Contributing
12
10
 
13
11
  See [Contributing](../CONTRIBUTING.md).
@@ -22,7 +20,8 @@ LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply
22
20
  - Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
23
21
  - Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
24
22
  - Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
25
- - Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
23
+ - Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan).
24
+ - Disable parts of your application to facilitate maintenance, without taking everything offline.
26
25
  - LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
27
26
  - Explore LaunchDarkly
28
27
  - [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
@@ -12,5 +12,13 @@ export type LDInternalOptions = {
12
12
  analyticsEventPath?: string;
13
13
  diagnosticEventPath?: string;
14
14
  includeAuthorizationHeader?: boolean;
15
+ /**
16
+ * In seconds. Log a warning if identifyTimeout is greater than this value.
17
+ *
18
+ * Mobile - 15s.
19
+ * Browser - 5s.
20
+ * Server - 60s.
21
+ */
22
+ highTimeoutThreshold?: number;
15
23
  };
16
24
  //# sourceMappingURL=LDInternalOptions.d.ts.map
@@ -1 +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"}
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;IAErC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import ClientMessages from './ClientMessages';
2
- import EventProcessor from './EventProcessor';
2
+ import EventProcessor, { EventProcessorOptions } from './EventProcessor';
3
3
  import InputCustomEvent from './InputCustomEvent';
4
4
  import InputEvalEvent from './InputEvalEvent';
5
5
  import InputEvent from './InputEvent';
@@ -8,5 +8,5 @@ import InputMigrationEvent from './InputMigrationEvent';
8
8
  import type { LDInternalOptions } from './LDInternalOptions';
9
9
  import NullEventProcessor from './NullEventProcessor';
10
10
  import shouldSample from './sampling';
11
- export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, shouldSample, NullEventProcessor, LDInternalOptions, };
11
+ export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, EventProcessorOptions, shouldSample, NullEventProcessor, LDInternalOptions, };
12
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,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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,EAAE,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzE,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,qBAAqB,EACrB,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;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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/events/index.ts"],"names":[],"mappings":";;;AAAA,qDAA8C;AAY5C,yBAZK,wBAAc,CAYL;AAXhB,qDAAyE;AAiBvE,yBAjBK,wBAAc,CAiBL;AAhBhB,yDAAkD;AAWhD,2BAXK,0BAAgB,CAWL;AAVlB,qDAA8C;AAW5C,yBAXK,wBAAc,CAWL;AAThB,6DAAsD;AAWpD,6BAXK,4BAAkB,CAWL;AARpB,6DAAsD;AAapD,6BAbK,4BAAkB,CAaL;AAZpB,yCAAsC;AAWpC,uBAXK,kBAAY,CAWL"}
@@ -6,6 +6,7 @@ import fastDeepEqual from './fast-deep-equal';
6
6
  import { base64UrlEncode, defaultHeaders, httpErrorMessage, LDHeaders, shouldRetry } from './http';
7
7
  import noop from './noop';
8
8
  import sleep from './sleep';
9
+ import timedPromise from './timedPromise';
9
10
  import { VoidFunction } from './VoidFunction';
10
- export { base64UrlEncode, clone, debounce, deepCompact, defaultHeaders, fastDeepEqual, httpErrorMessage, noop, LDHeaders, shouldRetry, secondsToMillis, sleep, VoidFunction, };
11
+ export { base64UrlEncode, clone, debounce, deepCompact, defaultHeaders, fastDeepEqual, httpErrorMessage, noop, LDHeaders, shouldRetry, secondsToMillis, sleep, timedPromise, VoidFunction, };
11
12
  //# 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,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,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,GACb,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,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,GACb,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sleep = exports.secondsToMillis = exports.shouldRetry = exports.noop = exports.httpErrorMessage = exports.fastDeepEqual = exports.defaultHeaders = exports.deepCompact = exports.debounce = exports.clone = exports.base64UrlEncode = void 0;
3
+ exports.timedPromise = exports.sleep = exports.secondsToMillis = exports.shouldRetry = exports.noop = exports.httpErrorMessage = exports.fastDeepEqual = exports.defaultHeaders = exports.deepCompact = exports.debounce = 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");
@@ -20,4 +20,6 @@ const noop_1 = require("./noop");
20
20
  exports.noop = noop_1.default;
21
21
  const sleep_1 = require("./sleep");
22
22
  exports.sleep = sleep_1.default;
23
+ const timedPromise_1 = require("./timedPromise");
24
+ exports.timedPromise = timedPromise_1.default;
23
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAY1B,gBAZK,eAAK,CAYL;AAXP,iCAAyC;AAoBvC,gGApBO,sBAAe,OAoBP;AAnBjB,yCAAkC;AAWhC,mBAXK,kBAAQ,CAWL;AAVV,+CAAwC;AAWtC,sBAXK,qBAAW,CAWL;AAVb,uDAA8C;AAY5C,wBAZK,yBAAa,CAYL;AAXf,iCAAmG;AAMjG,gGANO,sBAAe,OAMP;AAIf,+FAVwB,qBAAc,OAUxB;AAEd,iGAZwC,uBAAgB,OAYxC;AAGhB,4FAfqE,kBAAW,OAerE;AAdb,iCAA0B;AAYxB,eAZK,cAAI,CAYL;AAXN,mCAA4B;AAe1B,gBAfK,eAAK,CAeL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAa1B,gBAbK,eAAK,CAaL;AAZP,iCAAyC;AAqBvC,gGArBO,sBAAe,OAqBP;AApBjB,yCAAkC;AAYhC,mBAZK,kBAAQ,CAYL;AAXV,+CAAwC;AAYtC,sBAZK,qBAAW,CAYL;AAXb,uDAA8C;AAa5C,wBAbK,yBAAa,CAaL;AAZf,iCAAmG;AAOjG,gGAPO,sBAAe,OAOP;AAIf,+FAXwB,qBAAc,OAWxB;AAEd,iGAbwC,uBAAgB,OAaxC;AAGhB,4FAhBqE,kBAAW,OAgBrE;AAfb,iCAA0B;AAaxB,eAbK,cAAI,CAaL;AAZN,mCAA4B;AAgB1B,gBAhBK,eAAK,CAgBL;AAfP,iDAA0C;AAgBxC,uBAhBK,sBAAY,CAgBL"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a promise which errors after t seconds.
3
+ *
4
+ * @param t Timeout in seconds.
5
+ * @param taskName Name of task being timed for logging and error reporting.
6
+ */
7
+ declare const timedPromise: (t: number, taskName: string) => Promise<void>;
8
+ export default timedPromise;
9
+ //# sourceMappingURL=timedPromise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timedPromise.d.ts","sourceRoot":"","sources":["../../src/utils/timedPromise.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,QAAA,MAAM,YAAY,MAAO,MAAM,YAAY,MAAM,kBAM7C,CAAC;AAEL,eAAe,YAAY,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Returns a promise which errors after t seconds.
5
+ *
6
+ * @param t Timeout in seconds.
7
+ * @param taskName Name of task being timed for logging and error reporting.
8
+ */
9
+ const timedPromise = (t, taskName) => new Promise((_res, reject) => {
10
+ setTimeout(() => {
11
+ const e = `${taskName} timed out after ${t} seconds.`;
12
+ reject(new Error(e));
13
+ }, t * 1000);
14
+ });
15
+ exports.default = timedPromise;
16
+ //# sourceMappingURL=timedPromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timedPromise.js","sourceRoot":"","sources":["../../src/utils/timedPromise.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,QAAgB,EAAE,EAAE,CACnD,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,GAAG,GAAG,QAAQ,oBAAoB,CAAC,WAAW,CAAC;QACtD,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AACf,CAAC,CAAC,CAAC;AAEL,kBAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@launchdarkly/js-sdk-common",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",