@splitsoftware/splitio-browserjs 0.15.0 → 0.15.1-rc.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/CHANGES.txt CHANGED
@@ -1,3 +1,9 @@
1
+ 0.16.0 (September XX, 2024)
2
+ - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
3
+ - Updated @splitsoftware/splitio-commons package to version 1.18.0 that includes minor updates:
4
+ - Added support for targeting rules based on large segments for browsers.
5
+ - Updated some transitive dependencies for vulnerability fixes.
6
+
1
7
  0.15.0 (September 13, 2024)
2
8
  - Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
3
9
  - Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaults = void 0;
4
4
  var index_1 = require("@splitsoftware/splitio-commons/cjs/logger/index");
5
5
  var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
6
- var packageVersion = '0.15.0';
6
+ var packageVersion = '0.15.1-rc.0';
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
9
9
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -28,7 +28,9 @@ exports.defaults = {
28
28
  // Maximum amount of time used before notifies me a timeout.
29
29
  readyTimeout: 10,
30
30
  // Amount of time we will wait before the first push of events.
31
- eventsFirstPushWindow: 10
31
+ eventsFirstPushWindow: 10,
32
+ // Wait for large segments to emit SDK_READY event.
33
+ waitForLargeSegments: true,
32
34
  },
33
35
  // Consent is considered granted by default
34
36
  userConsent: constants_1.CONSENT_GRANTED,
@@ -9,6 +9,7 @@ var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsVali
9
9
  var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
10
10
  var builtin_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/builtin");
11
11
  var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
12
+ var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
12
13
  var params = {
13
14
  defaults: defaults_1.defaults,
14
15
  acceptKey: true,
@@ -20,6 +21,10 @@ var params = {
20
21
  consent: consent_1.validateConsent,
21
22
  };
22
23
  function settingsFactory(config) {
23
- return (0, index_1.settingsValidation)(config, params);
24
+ var settings = (0, index_1.settingsValidation)(config, params);
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== constants_1.STANDALONE_MODE)
27
+ settings.sync.largeSegmentsEnabled = false;
28
+ return settings;
24
29
  }
25
30
  exports.settingsFactory = settingsFactory;
@@ -9,6 +9,7 @@ var pluggable_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsVali
9
9
  var pluggableLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/pluggableLogger");
10
10
  var pluggable_2 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/localhost/pluggable");
11
11
  var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
12
+ var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
12
13
  var params = {
13
14
  defaults: defaults_1.defaults,
14
15
  acceptKey: true,
@@ -20,6 +21,10 @@ var params = {
20
21
  consent: consent_1.validateConsent,
21
22
  };
22
23
  function settingsFactory(config) {
23
- return (0, index_1.settingsValidation)(config, params);
24
+ var settings = (0, index_1.settingsValidation)(config, params);
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== constants_1.STANDALONE_MODE)
27
+ settings.sync.largeSegmentsEnabled = false;
28
+ return settings;
24
29
  }
25
30
  exports.settingsFactory = settingsFactory;
@@ -1,6 +1,6 @@
1
1
  import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/esm/logger/index';
2
2
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/esm/utils/constants';
3
- var packageVersion = '0.15.0';
3
+ var packageVersion = '0.15.1-rc.0';
4
4
  /**
5
5
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
6
6
  * Acceptable values are: 'DEBUG', 'INFO', 'WARN', 'ERROR', 'NONE'.
@@ -25,7 +25,9 @@ export var defaults = {
25
25
  // Maximum amount of time used before notifies me a timeout.
26
26
  readyTimeout: 10,
27
27
  // Amount of time we will wait before the first push of events.
28
- eventsFirstPushWindow: 10
28
+ eventsFirstPushWindow: 10,
29
+ // Wait for large segments to emit SDK_READY event.
30
+ waitForLargeSegments: true,
29
31
  },
30
32
  // Consent is considered granted by default
31
33
  userConsent: CONSENT_GRANTED,
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/es
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/builtin';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
9
10
  var params = {
10
11
  defaults: defaults,
11
12
  acceptKey: true,
@@ -17,5 +18,9 @@ var params = {
17
18
  consent: validateConsent,
18
19
  };
19
20
  export function settingsFactory(config) {
20
- return settingsValidation(config, params);
21
+ var settings = settingsValidation(config, params);
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
+ if (settings.mode !== STANDALONE_MODE)
24
+ settings.sync.largeSegmentsEnabled = false;
25
+ return settings;
21
26
  }
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/es
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhost } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/localhost/pluggable';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
9
10
  var params = {
10
11
  defaults: defaults,
11
12
  acceptKey: true,
@@ -17,5 +18,9 @@ var params = {
17
18
  consent: validateConsent,
18
19
  };
19
20
  export function settingsFactory(config) {
20
- return settingsValidation(config, params);
21
+ var settings = settingsValidation(config, params);
22
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
23
+ if (settings.mode !== STANDALONE_MODE)
24
+ settings.sync.largeSegmentsEnabled = false;
25
+ return settings;
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-browserjs",
3
- "version": "0.15.0",
3
+ "version": "0.15.1-rc.0",
4
4
  "description": "Split SDK for JavaScript on Browser",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -64,7 +64,7 @@
64
64
  "bugs": "https://github.com/splitio/javascript-browser-client/issues",
65
65
  "homepage": "https://github.com/splitio/javascript-browser-client#readme",
66
66
  "dependencies": {
67
- "@splitsoftware/splitio-commons": "1.17.0",
67
+ "@splitsoftware/splitio-commons": "1.17.1-rc.1",
68
68
  "@types/google.analytics": "0.0.40",
69
69
  "tslib": "^2.3.1",
70
70
  "unfetch": "^4.2.0"
@@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
2
2
  import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
3
3
  import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';
4
4
 
5
- const packageVersion = '0.15.0';
5
+ const packageVersion = '0.15.1-rc.0';
6
6
 
7
7
  /**
8
8
  * In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
@@ -30,7 +30,9 @@ export const defaults = {
30
30
  // Maximum amount of time used before notifies me a timeout.
31
31
  readyTimeout: 10,
32
32
  // Amount of time we will wait before the first push of events.
33
- eventsFirstPushWindow: 10
33
+ eventsFirstPushWindow: 10,
34
+ // Wait for large segments to emit SDK_READY event.
35
+ waitForLargeSegments: true,
34
36
  },
35
37
 
36
38
  // Consent is considered granted by default
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhostWithDefault } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/builtin';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
9
10
 
10
11
  const params = {
11
12
  defaults,
@@ -19,5 +20,10 @@ const params = {
19
20
  };
20
21
 
21
22
  export function settingsFactory(config: any) {
22
- return settingsValidation(config, params);
23
+ const settings = settingsValidation(config, params);
24
+
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
+
28
+ return settings;
23
29
  }
@@ -6,6 +6,7 @@ import { validatePluggableIntegrations } from '@splitsoftware/splitio-commons/sr
6
6
  import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/pluggableLogger';
7
7
  import { validateLocalhost } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/localhost/pluggable';
8
8
  import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
9
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
9
10
 
10
11
  const params = {
11
12
  defaults,
@@ -19,5 +20,10 @@ const params = {
19
20
  };
20
21
 
21
22
  export function settingsFactory(config: any) {
22
- return settingsValidation(config, params);
23
+ const settings = settingsValidation(config, params);
24
+
25
+ // @ts-ignore, Override in localhost and consumer modes to emit SDK_READY event
26
+ if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
27
+
28
+ return settings;
23
29
  }
@@ -61,6 +61,7 @@ interface ISettings {
61
61
  impressionsQueueSize: number,
62
62
  telemetryRefreshRate: number,
63
63
  segmentsRefreshRate: number,
64
+ largeSegmentsRefreshRate: number,
64
65
  offlineRefreshRate: number,
65
66
  eventsPushRate: number,
66
67
  eventsQueueSize: number,
@@ -70,7 +71,8 @@ interface ISettings {
70
71
  readyTimeout: number,
71
72
  requestTimeoutBeforeReady: number,
72
73
  retriesOnFailureBeforeReady: number,
73
- eventsFirstPushWindow: number
74
+ eventsFirstPushWindow: number,
75
+ waitForLargeSegments: boolean
74
76
  },
75
77
  readonly storage?: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory,
76
78
  readonly urls: {
@@ -359,7 +361,13 @@ interface IBasicSDK {
359
361
  * User consent API.
360
362
  * @property UserConsent
361
363
  */
362
- UserConsent: IUserConsentAPI
364
+ UserConsent: IUserConsentAPI,
365
+ /**
366
+ * Destroys all the clients created by this factory.
367
+ * @function destroy
368
+ * @returns {Promise<void>}
369
+ */
370
+ destroy(): Promise<void>
363
371
  }
364
372
  /****** Exposed namespace ******/
365
373
  /**
@@ -999,6 +1007,13 @@ declare namespace SplitIO {
999
1007
  * @default 10
1000
1008
  */
1001
1009
  eventsFirstPushWindow?: number,
1010
+ /**
1011
+ * Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
1012
+ * It only applies if largeSegmentsEnabled is true.
1013
+ * @property {boolean} waitForLargeSegments
1014
+ * @default true
1015
+ */
1016
+ waitForLargeSegments?: boolean
1002
1017
  },
1003
1018
  /**
1004
1019
  * SDK scheduler settings.
@@ -1036,6 +1051,13 @@ declare namespace SplitIO {
1036
1051
  * @default 60
1037
1052
  */
1038
1053
  segmentsRefreshRate?: number,
1054
+ /**
1055
+ * The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
1056
+ * It only applies if largeSegmentsEnabled is true.
1057
+ * @property {number} largeSegmentsRefreshRate
1058
+ * @default 60
1059
+ */
1060
+ largeSegmentsRefreshRate?: number,
1039
1061
  /**
1040
1062
  * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1041
1063
  * @property {number} eventsPushRate
@@ -1063,6 +1085,14 @@ declare namespace SplitIO {
1063
1085
  * @default 1
1064
1086
  */
1065
1087
  pushRetryBackoffBase?: number,
1088
+ },
1089
+ sync?: ISharedSettings['sync'] & {
1090
+ /**
1091
+ * Enables synchronization of large segments.
1092
+ * @property {boolean} largeSegmentsEnabled
1093
+ * @default false
1094
+ */
1095
+ largeSegmentsEnabled?: boolean
1066
1096
  }
1067
1097
  }
1068
1098
  /**