@splitsoftware/splitio-browserjs 0.14.2-rc.0 → 0.15.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 +4 -2
- package/cjs/settings/defaults.js +2 -4
- package/cjs/settings/full.js +1 -6
- package/cjs/settings/index.js +1 -6
- package/esm/settings/defaults.js +2 -4
- package/esm/settings/full.js +1 -6
- package/esm/settings/index.js +1 -6
- package/package.json +3 -3
- package/src/settings/defaults.ts +2 -4
- package/src/settings/full.ts +1 -7
- package/src/settings/index.ts +1 -7
- package/types/splitio.d.ts +37 -27
package/CHANGES.txt
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
0.
|
|
2
|
-
- Updated
|
|
1
|
+
0.15.0 (September 13, 2024)
|
|
2
|
+
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
|
|
3
|
+
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
|
|
4
|
+
- Updated some transitive dependencies for vulnerability fixes.
|
|
3
5
|
|
|
4
6
|
0.14.1 (June 14, 2024)
|
|
5
7
|
- Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
|
package/cjs/settings/defaults.js
CHANGED
|
@@ -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.
|
|
6
|
+
var packageVersion = '0.15.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,9 +28,7 @@ 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
|
|
32
|
-
// Wait for large segments to emit SDK_READY event.
|
|
33
|
-
waitForLargeSegments: true,
|
|
31
|
+
eventsFirstPushWindow: 10
|
|
34
32
|
},
|
|
35
33
|
// Consent is considered granted by default
|
|
36
34
|
userConsent: constants_1.CONSENT_GRANTED,
|
package/cjs/settings/full.js
CHANGED
|
@@ -9,7 +9,6 @@ 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");
|
|
13
12
|
var params = {
|
|
14
13
|
defaults: defaults_1.defaults,
|
|
15
14
|
acceptKey: true,
|
|
@@ -21,10 +20,6 @@ var params = {
|
|
|
21
20
|
consent: consent_1.validateConsent,
|
|
22
21
|
};
|
|
23
22
|
function settingsFactory(config) {
|
|
24
|
-
|
|
25
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
26
|
-
if (settings.mode !== constants_1.STANDALONE_MODE)
|
|
27
|
-
settings.sync.largeSegmentsEnabled = false;
|
|
28
|
-
return settings;
|
|
23
|
+
return (0, index_1.settingsValidation)(config, params);
|
|
29
24
|
}
|
|
30
25
|
exports.settingsFactory = settingsFactory;
|
package/cjs/settings/index.js
CHANGED
|
@@ -9,7 +9,6 @@ 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");
|
|
13
12
|
var params = {
|
|
14
13
|
defaults: defaults_1.defaults,
|
|
15
14
|
acceptKey: true,
|
|
@@ -21,10 +20,6 @@ var params = {
|
|
|
21
20
|
consent: consent_1.validateConsent,
|
|
22
21
|
};
|
|
23
22
|
function settingsFactory(config) {
|
|
24
|
-
|
|
25
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
26
|
-
if (settings.mode !== constants_1.STANDALONE_MODE)
|
|
27
|
-
settings.sync.largeSegmentsEnabled = false;
|
|
28
|
-
return settings;
|
|
23
|
+
return (0, index_1.settingsValidation)(config, params);
|
|
29
24
|
}
|
|
30
25
|
exports.settingsFactory = settingsFactory;
|
package/esm/settings/defaults.js
CHANGED
|
@@ -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.
|
|
3
|
+
var packageVersion = '0.15.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,9 +25,7 @@ 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
|
|
29
|
-
// Wait for large segments to emit SDK_READY event.
|
|
30
|
-
waitForLargeSegments: true,
|
|
28
|
+
eventsFirstPushWindow: 10
|
|
31
29
|
},
|
|
32
30
|
// Consent is considered granted by default
|
|
33
31
|
userConsent: CONSENT_GRANTED,
|
package/esm/settings/full.js
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
var params = {
|
|
11
10
|
defaults: defaults,
|
|
12
11
|
acceptKey: true,
|
|
@@ -18,9 +17,5 @@ var params = {
|
|
|
18
17
|
consent: validateConsent,
|
|
19
18
|
};
|
|
20
19
|
export function settingsFactory(config) {
|
|
21
|
-
|
|
22
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
23
|
-
if (settings.mode !== STANDALONE_MODE)
|
|
24
|
-
settings.sync.largeSegmentsEnabled = false;
|
|
25
|
-
return settings;
|
|
20
|
+
return settingsValidation(config, params);
|
|
26
21
|
}
|
package/esm/settings/index.js
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
var params = {
|
|
11
10
|
defaults: defaults,
|
|
12
11
|
acceptKey: true,
|
|
@@ -18,9 +17,5 @@ var params = {
|
|
|
18
17
|
consent: validateConsent,
|
|
19
18
|
};
|
|
20
19
|
export function settingsFactory(config) {
|
|
21
|
-
|
|
22
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
23
|
-
if (settings.mode !== STANDALONE_MODE)
|
|
24
|
-
settings.sync.largeSegmentsEnabled = false;
|
|
25
|
-
return settings;
|
|
20
|
+
return settingsValidation(config, params);
|
|
26
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio-browserjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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.
|
|
67
|
+
"@splitsoftware/splitio-commons": "1.17.0",
|
|
68
68
|
"@types/google.analytics": "0.0.40",
|
|
69
69
|
"tslib": "^2.3.1",
|
|
70
70
|
"unfetch": "^4.2.0"
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"eslint": "^8.48.0",
|
|
82
82
|
"eslint-plugin-compat": "^4.2.0",
|
|
83
83
|
"eslint-plugin-import": "^2.25.4",
|
|
84
|
-
"fetch-mock": "^
|
|
84
|
+
"fetch-mock": "^11.1.3",
|
|
85
85
|
"jest": "^27.2.3",
|
|
86
86
|
"karma": "^6.4.1",
|
|
87
87
|
"karma-chrome-launcher": "^3.1.1",
|
package/src/settings/defaults.ts
CHANGED
|
@@ -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.
|
|
5
|
+
const packageVersion = '0.15.0';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
|
|
@@ -30,9 +30,7 @@ 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
|
|
34
|
-
// Wait for large segments to emit SDK_READY event.
|
|
35
|
-
waitForLargeSegments: true,
|
|
33
|
+
eventsFirstPushWindow: 10
|
|
36
34
|
},
|
|
37
35
|
|
|
38
36
|
// Consent is considered granted by default
|
package/src/settings/full.ts
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
|
|
11
10
|
const params = {
|
|
12
11
|
defaults,
|
|
@@ -20,10 +19,5 @@ const params = {
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
export function settingsFactory(config: any) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
26
|
-
if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
|
|
27
|
-
|
|
28
|
-
return settings;
|
|
22
|
+
return settingsValidation(config, params);
|
|
29
23
|
}
|
package/src/settings/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
|
|
11
10
|
const params = {
|
|
12
11
|
defaults,
|
|
@@ -20,10 +19,5 @@ const params = {
|
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
export function settingsFactory(config: any) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// @ts-ignore, Override in localhost and consumer modes to properly emit SDK_READY
|
|
26
|
-
if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
|
|
27
|
-
|
|
28
|
-
return settings;
|
|
22
|
+
return settingsValidation(config, params);
|
|
29
23
|
}
|
package/types/splitio.d.ts
CHANGED
|
@@ -61,7 +61,6 @@ interface ISettings {
|
|
|
61
61
|
impressionsQueueSize: number,
|
|
62
62
|
telemetryRefreshRate: number,
|
|
63
63
|
segmentsRefreshRate: number,
|
|
64
|
-
largeSegmentsRefreshRate: number,
|
|
65
64
|
offlineRefreshRate: number,
|
|
66
65
|
eventsPushRate: number,
|
|
67
66
|
eventsQueueSize: number,
|
|
@@ -71,8 +70,7 @@ interface ISettings {
|
|
|
71
70
|
readyTimeout: number,
|
|
72
71
|
requestTimeoutBeforeReady: number,
|
|
73
72
|
retriesOnFailureBeforeReady: number,
|
|
74
|
-
eventsFirstPushWindow: number
|
|
75
|
-
waitForLargeSegments: boolean
|
|
73
|
+
eventsFirstPushWindow: number
|
|
76
74
|
},
|
|
77
75
|
readonly storage?: SplitIO.StorageSyncFactory | SplitIO.StorageAsyncFactory,
|
|
78
76
|
readonly urls: {
|
|
@@ -94,9 +92,11 @@ interface ISettings {
|
|
|
94
92
|
splitFilters: SplitIO.SplitFilter[],
|
|
95
93
|
impressionsMode: SplitIO.ImpressionsMode,
|
|
96
94
|
enabled: boolean,
|
|
97
|
-
largeSegmentsEnabled: boolean,
|
|
98
95
|
flagSpecVersion: string,
|
|
99
|
-
localhostMode?: SplitIO.LocalhostFactory
|
|
96
|
+
localhostMode?: SplitIO.LocalhostFactory,
|
|
97
|
+
requestOptions?: {
|
|
98
|
+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
|
|
99
|
+
},
|
|
100
100
|
},
|
|
101
101
|
readonly userConsent: SplitIO.ConsentStatus
|
|
102
102
|
}
|
|
@@ -256,6 +256,38 @@ interface ISharedSettings {
|
|
|
256
256
|
* @default true
|
|
257
257
|
*/
|
|
258
258
|
enabled?: boolean
|
|
259
|
+
/**
|
|
260
|
+
* Custom options object for HTTP(S) requests in the Browser.
|
|
261
|
+
* If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
|
|
262
|
+
* This configuration has no effect in "consumer" mode, as no HTTP(S) requests are made by the SDK.
|
|
263
|
+
*/
|
|
264
|
+
requestOptions?: {
|
|
265
|
+
/**
|
|
266
|
+
* Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
|
|
267
|
+
* Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
|
|
268
|
+
* To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
|
|
269
|
+
* Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
|
|
270
|
+
*
|
|
271
|
+
* NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
|
|
272
|
+
* like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and will be ignored.
|
|
273
|
+
*
|
|
274
|
+
* @property getHeaderOverrides
|
|
275
|
+
* @default undefined
|
|
276
|
+
*
|
|
277
|
+
* @param context - The context for the request.
|
|
278
|
+
* @param context.headers - The current headers in the request.
|
|
279
|
+
* @returns A set of headers to be merged with the current headers.
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* const getHeaderOverrides = (context) => {
|
|
283
|
+
* return {
|
|
284
|
+
* 'Authorization': context.headers['Authorization'] + ', other-value',
|
|
285
|
+
* 'custom-header': 'custom-value'
|
|
286
|
+
* };
|
|
287
|
+
* };
|
|
288
|
+
*/
|
|
289
|
+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
|
|
290
|
+
},
|
|
259
291
|
}
|
|
260
292
|
}
|
|
261
293
|
/**
|
|
@@ -967,13 +999,6 @@ declare namespace SplitIO {
|
|
|
967
999
|
* @default 10
|
|
968
1000
|
*/
|
|
969
1001
|
eventsFirstPushWindow?: number,
|
|
970
|
-
/**
|
|
971
|
-
* Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
|
|
972
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
973
|
-
* @property {boolean} waitForLargeSegments
|
|
974
|
-
* @default true
|
|
975
|
-
*/
|
|
976
|
-
waitForLargeSegments?: boolean
|
|
977
1002
|
},
|
|
978
1003
|
/**
|
|
979
1004
|
* SDK scheduler settings.
|
|
@@ -1011,13 +1036,6 @@ declare namespace SplitIO {
|
|
|
1011
1036
|
* @default 60
|
|
1012
1037
|
*/
|
|
1013
1038
|
segmentsRefreshRate?: number,
|
|
1014
|
-
/**
|
|
1015
|
-
* The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
|
|
1016
|
-
* It only applies if largeSegmentsEnabled is true.
|
|
1017
|
-
* @property {number} largeSegmentsRefreshRate
|
|
1018
|
-
* @default 60
|
|
1019
|
-
*/
|
|
1020
|
-
largeSegmentsRefreshRate?: number,
|
|
1021
1039
|
/**
|
|
1022
1040
|
* The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
|
|
1023
1041
|
* @property {number} eventsPushRate
|
|
@@ -1045,14 +1063,6 @@ declare namespace SplitIO {
|
|
|
1045
1063
|
* @default 1
|
|
1046
1064
|
*/
|
|
1047
1065
|
pushRetryBackoffBase?: number,
|
|
1048
|
-
},
|
|
1049
|
-
sync?: ISharedSettings['sync'] & {
|
|
1050
|
-
/**
|
|
1051
|
-
* Enables synchronization of large segments.
|
|
1052
|
-
* @property {boolean} largeSegmentsEnabled
|
|
1053
|
-
* @default false
|
|
1054
|
-
*/
|
|
1055
|
-
largeSegmentsEnabled?: boolean
|
|
1056
1066
|
}
|
|
1057
1067
|
}
|
|
1058
1068
|
/**
|