@splitsoftware/splitio 10.17.4-rc.3 → 10.18.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 +16 -12
- package/es/factory/browser.js +6 -2
- package/es/settings/browser.js +3 -3
- package/es/settings/defaults/version.js +1 -1
- package/es/settings/node.js +3 -3
- package/lib/factory/browser.js +6 -2
- package/lib/settings/browser.js +3 -3
- package/lib/settings/defaults/version.js +1 -1
- package/lib/settings/node.js +5 -5
- package/package.json +2 -2
- package/src/factory/browser.js +6 -2
- package/src/settings/browser.js +4 -3
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/node.js +4 -3
- package/types/splitio.d.ts +39 -22
package/CHANGES.txt
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
10.18.0 (
|
|
2
|
-
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
10.18.0 (April 7, 2022)
|
|
2
|
+
- Added user consent feature to allow delaying or disabling the data tracking from SDK until user consent is explicitly granted or declined. Read more in our docs.
|
|
3
|
+
- Added `scheduler.impressionsQueueSize` property to SDK configuration to limit the amount of impressions tracked in memory. Read more in our docs.
|
|
4
|
+
- Added support to accept TLS configuration options to the Redis storage in NodeJS. Read more in our docs.
|
|
5
|
+
- Updated type definitions to specialize the type of the `storage.options` object for Redis storage in NodeJS.
|
|
6
|
+
- Updated some dependencies for vulnerability fixes.
|
|
7
|
+
- Bugfixing - Updated internal isObject utility function, to avoid unexpected behaviors on frameworks and libraries that uses multiple VM contexts, like NuxtJS dev server.
|
|
8
|
+
- Bugfixing - Logging settings (i.e., the `debug` SDK configuration param and factory logger methods) are configurable per factory instance, instead of affecting all factories globally.
|
|
9
|
+
- Bugfixing - Fixed an issue with `connectionTimeout` options params of Redis storage, that was being ignored and not passed down to the underlying ioredis client.
|
|
10
|
+
- Bugfixing - Updated the validation of some SDK configuration params to log errors and throw exceptions with clear descriptions of the invalid setup:
|
|
11
|
+
- If passing a non-string value to `sync.impressionsMode`, the SDK logs the error: "you passed an invalid impressionsMode config param. It should be one of the following values: 'OPTIMIZED', 'DEBUG'. Defaulting to 'OPTIMIZED'.".
|
|
12
|
+
- If passing 'REDIS' storage type without setting `mode` to 'consumer', the SDK logs the error: "The provided REDIS storage is invalid for this mode. It requires 'consumer' mode. Fallbacking into default MEMORY storage.".
|
|
13
|
+
- If passing 'consumer' mode without setting `storage.type` to 'REDIS', the SDK throws an exception with message: "A REDIS storage is required on consumer mode.".
|
|
14
|
+
|
|
15
|
+
- NOTABLE CHANGE: since version 10.18.0, the SDK has been refactored to use @splitsoftware/splitio-commons package in order to reuse core modules shared across all JavaScript-based SDKs. Most internal modules have been moved and renamed,
|
|
16
|
+
but it does not imply a breaking change as long as the library is imported via its main entrypoint (e.g., `const { SplitFactory } = require('@splitsoftware/splitio')` or `import { SplitFactory } from '@splitsoftware/splitio'`).
|
|
13
17
|
|
|
14
18
|
10.17.3 (February 25, 2022)
|
|
15
19
|
- Updated format for MySegments keys in LocalStorage, keeping backwards compatibility (issue https://github.com/splitio/javascript-client/issues/638).
|
package/es/factory/browser.js
CHANGED
|
@@ -12,7 +12,7 @@ import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/esm/
|
|
|
12
12
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory';
|
|
13
13
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
14
14
|
import { shouldAddPt } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/utils';
|
|
15
|
-
import {
|
|
15
|
+
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/esm/consent/sdkUserConsent';
|
|
16
16
|
import { settingsFactory } from '../settings/browser';
|
|
17
17
|
import { platform, SignalListener } from '../platform';
|
|
18
18
|
var syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
@@ -39,7 +39,11 @@ function getModules(settings) {
|
|
|
39
39
|
SignalListener: SignalListener,
|
|
40
40
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
41
41
|
impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
|
|
42
|
-
extraProps:
|
|
42
|
+
extraProps: function (params) {
|
|
43
|
+
return {
|
|
44
|
+
UserConsent: createUserConsentAPI(params)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
43
47
|
};
|
|
44
48
|
switch (settings.mode) {
|
|
45
49
|
case LOCALHOST_MODE:
|
package/es/settings/browser.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation';
|
|
2
|
-
import { defaults } from './defaults/browser';
|
|
3
2
|
import { validateRuntime } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/runtime';
|
|
4
|
-
import { validateStorage } from './storage/browser';
|
|
5
|
-
import { validateIntegrations } from './integrations/browser';
|
|
6
3
|
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/builtinLogger';
|
|
7
4
|
import { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
|
|
8
5
|
import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
|
|
6
|
+
import { defaults } from './defaults/browser';
|
|
7
|
+
import { validateStorage } from './storage/browser';
|
|
8
|
+
import { validateIntegrations } from './integrations/browser';
|
|
9
9
|
var params = {
|
|
10
10
|
defaults: defaults,
|
|
11
11
|
acceptKey: true, acceptTT: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var packageVersion = '10.
|
|
1
|
+
export var packageVersion = '10.18.1-rc.0';
|
package/es/settings/node.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation';
|
|
2
|
-
import { defaults } from './defaults/node';
|
|
3
|
-
import { validateRuntime } from './runtime/node';
|
|
4
|
-
import { validateStorage } from './storage/node';
|
|
5
2
|
import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/builtinLogger';
|
|
6
3
|
import { LocalhostFromFile } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromFile';
|
|
4
|
+
import { defaults } from './defaults/node';
|
|
5
|
+
import { validateStorage } from './storage/node';
|
|
6
|
+
import { validateRuntime } from './runtime/node';
|
|
7
7
|
var params = {
|
|
8
8
|
defaults: defaults,
|
|
9
9
|
runtime: validateRuntime,
|
package/lib/factory/browser.js
CHANGED
|
@@ -15,7 +15,7 @@ var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsVali
|
|
|
15
15
|
var sdkFactory_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory");
|
|
16
16
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
17
17
|
var utils_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/utils");
|
|
18
|
-
var
|
|
18
|
+
var sdkUserConsent_1 = require("@splitsoftware/splitio-commons/cjs/consent/sdkUserConsent");
|
|
19
19
|
var browser_2 = require("../settings/browser");
|
|
20
20
|
var platform_1 = require("../platform");
|
|
21
21
|
var syncManagerOnlineCSFactory = (0, syncManagerOnline_1.syncManagerOnlineFactory)(pollingManagerCS_1.pollingManagerCSFactory, pushManager_1.pushManagerFactory);
|
|
@@ -42,7 +42,11 @@ function getModules(settings) {
|
|
|
42
42
|
SignalListener: platform_1.SignalListener,
|
|
43
43
|
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? browser_1.integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
44
44
|
impressionsObserverFactory: (0, utils_1.shouldAddPt)(settings) ? impressionObserverCS_1.impressionObserverCSFactory : undefined,
|
|
45
|
-
extraProps:
|
|
45
|
+
extraProps: function (params) {
|
|
46
|
+
return {
|
|
47
|
+
UserConsent: (0, sdkUserConsent_1.createUserConsentAPI)(params)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
46
50
|
};
|
|
47
51
|
switch (settings.mode) {
|
|
48
52
|
case constants_1.LOCALHOST_MODE:
|
package/lib/settings/browser.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.settingsFactory = void 0;
|
|
4
4
|
var settingsValidation_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation");
|
|
5
|
-
var browser_1 = require("./defaults/browser");
|
|
6
5
|
var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/runtime");
|
|
7
|
-
var browser_2 = require("./storage/browser");
|
|
8
|
-
var browser_3 = require("./integrations/browser");
|
|
9
6
|
var builtinLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/builtinLogger");
|
|
10
7
|
var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromObject");
|
|
11
8
|
var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
|
|
9
|
+
var browser_1 = require("./defaults/browser");
|
|
10
|
+
var browser_2 = require("./storage/browser");
|
|
11
|
+
var browser_3 = require("./integrations/browser");
|
|
12
12
|
var params = {
|
|
13
13
|
defaults: browser_1.defaults,
|
|
14
14
|
acceptKey: true, acceptTT: true,
|
package/lib/settings/node.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.settingsFactory = void 0;
|
|
4
4
|
var settingsValidation_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation");
|
|
5
|
-
var node_1 = require("./defaults/node");
|
|
6
|
-
var node_2 = require("./runtime/node");
|
|
7
|
-
var node_3 = require("./storage/node");
|
|
8
5
|
var builtinLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/builtinLogger");
|
|
9
6
|
var LocalhostFromFile_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromFile");
|
|
7
|
+
var node_1 = require("./defaults/node");
|
|
8
|
+
var node_2 = require("./storage/node");
|
|
9
|
+
var node_3 = require("./runtime/node");
|
|
10
10
|
var params = {
|
|
11
11
|
defaults: node_1.defaults,
|
|
12
|
-
runtime:
|
|
13
|
-
storage:
|
|
12
|
+
runtime: node_3.validateRuntime,
|
|
13
|
+
storage: node_2.validateStorage,
|
|
14
14
|
logger: builtinLogger_1.validateLogger,
|
|
15
15
|
localhost: function () { return (0, LocalhostFromFile_1.LocalhostFromFile)(); },
|
|
16
16
|
consent: function () { return undefined; }, // resets settings.userConsent to the default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.18.1-rc.0",
|
|
4
4
|
"description": "Split SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"README.md",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=6"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@splitsoftware/splitio-commons": "1.
|
|
35
|
+
"@splitsoftware/splitio-commons": "1.3.1-rc.0",
|
|
36
36
|
"@types/google.analytics": "0.0.40",
|
|
37
37
|
"@types/ioredis": "^4.28.0",
|
|
38
38
|
"ioredis": "^4.28.0",
|
package/src/factory/browser.js
CHANGED
|
@@ -12,7 +12,7 @@ import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/src/
|
|
|
12
12
|
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory';
|
|
13
13
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
14
14
|
import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/utils';
|
|
15
|
-
import {
|
|
15
|
+
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent/sdkUserConsent';
|
|
16
16
|
|
|
17
17
|
import { settingsFactory } from '../settings/browser';
|
|
18
18
|
import { platform, SignalListener } from '../platform';
|
|
@@ -54,7 +54,11 @@ function getModules(settings) {
|
|
|
54
54
|
|
|
55
55
|
impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined,
|
|
56
56
|
|
|
57
|
-
extraProps:
|
|
57
|
+
extraProps: (params) => {
|
|
58
|
+
return {
|
|
59
|
+
UserConsent: createUserConsentAPI(params)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
switch (settings.mode) {
|
package/src/settings/browser.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
|
-
import { defaults } from './defaults/browser';
|
|
3
2
|
import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/runtime';
|
|
4
|
-
import { validateStorage } from './storage/browser';
|
|
5
|
-
import { validateIntegrations } from './integrations/browser';
|
|
6
3
|
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
7
4
|
import { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
|
|
8
5
|
import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
|
|
9
6
|
|
|
7
|
+
import { defaults } from './defaults/browser';
|
|
8
|
+
import { validateStorage } from './storage/browser';
|
|
9
|
+
import { validateIntegrations } from './integrations/browser';
|
|
10
|
+
|
|
10
11
|
const params = {
|
|
11
12
|
defaults,
|
|
12
13
|
acceptKey: true, acceptTT: true, // Client with bound key and optional TT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = '10.
|
|
1
|
+
export const packageVersion = '10.18.1-rc.0';
|
package/src/settings/node.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { settingsValidation } from '@splitsoftware/splitio-commons/src/utils/settingsValidation';
|
|
2
|
-
import { defaults } from './defaults/node';
|
|
3
|
-
import { validateRuntime } from './runtime/node';
|
|
4
|
-
import { validateStorage } from './storage/node';
|
|
5
2
|
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
|
|
6
3
|
import { LocalhostFromFile } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromFile';
|
|
7
4
|
|
|
5
|
+
import { defaults } from './defaults/node';
|
|
6
|
+
import { validateStorage } from './storage/node';
|
|
7
|
+
import { validateRuntime } from './runtime/node';
|
|
8
|
+
|
|
8
9
|
const params = {
|
|
9
10
|
defaults,
|
|
10
11
|
runtime: validateRuntime,
|
package/types/splitio.d.ts
CHANGED
|
@@ -143,7 +143,38 @@ interface ILoggerAPI {
|
|
|
143
143
|
* Log level constants. Use this to pass them to setLogLevel function.
|
|
144
144
|
*/
|
|
145
145
|
LogLevel: {
|
|
146
|
-
[level
|
|
146
|
+
[level in LogLevel]: LogLevel
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* User consent API
|
|
151
|
+
* @interface IUserConsentAPI
|
|
152
|
+
*/
|
|
153
|
+
interface IUserConsentAPI {
|
|
154
|
+
/**
|
|
155
|
+
* Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively.
|
|
156
|
+
* - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud.
|
|
157
|
+
* - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
|
|
158
|
+
*
|
|
159
|
+
* NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
|
|
160
|
+
*
|
|
161
|
+
* @function setStatus
|
|
162
|
+
* @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
|
|
163
|
+
* @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
|
|
164
|
+
*/
|
|
165
|
+
setStatus(userConsent: boolean): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Get the user consent status.
|
|
168
|
+
*
|
|
169
|
+
* @function getStatus
|
|
170
|
+
* @returns {ConsentStatus} The user consent status.
|
|
171
|
+
*/
|
|
172
|
+
getStatus(): SplitIO.ConsentStatus;
|
|
173
|
+
/**
|
|
174
|
+
* Consent status constants. Use this to compare with the getStatus function result.
|
|
175
|
+
*/
|
|
176
|
+
Status: {
|
|
177
|
+
[status in SplitIO.ConsentStatus]: SplitIO.ConsentStatus
|
|
147
178
|
}
|
|
148
179
|
}
|
|
149
180
|
/**
|
|
@@ -1017,10 +1048,10 @@ declare namespace SplitIO {
|
|
|
1017
1048
|
integrations?: BrowserIntegration[],
|
|
1018
1049
|
/**
|
|
1019
1050
|
* User consent status. Possible values are `'GRANTED'`, which is the default, `'DECLINED'` or `'UNKNOWN'`.
|
|
1020
|
-
* - `'GRANTED'`: the user
|
|
1021
|
-
* - `'DECLINED'`: the user
|
|
1022
|
-
* - `'UNKNOWN'`: the user
|
|
1023
|
-
* them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `
|
|
1051
|
+
* - `'GRANTED'`: the user grants consent for tracking events and impressions. The SDK sends them to Split cloud.
|
|
1052
|
+
* - `'DECLINED'`: the user declines consent for tracking events and impressions. The SDK does not send them to Split cloud.
|
|
1053
|
+
* - `'UNKNOWN'`: the user neither grants nor declines consent for tracking events and impressions. The SDK tracks them in its internal storage, and eventually either sends
|
|
1054
|
+
* them or not if the consent status is updated to 'GRANTED' or 'DECLINED' respectively. The status can be updated at any time with the `UserConsent.setStatus` factory method.
|
|
1024
1055
|
*
|
|
1025
1056
|
* @typedef {string} userConsent
|
|
1026
1057
|
* @default 'GRANTED'
|
|
@@ -1215,24 +1246,10 @@ declare namespace SplitIO {
|
|
|
1215
1246
|
*/
|
|
1216
1247
|
client(key: SplitKey, trafficType?: string): IBrowserClient
|
|
1217
1248
|
/**
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
* - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud.
|
|
1221
|
-
*
|
|
1222
|
-
* NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory.
|
|
1223
|
-
*
|
|
1224
|
-
* @function setUserConsent
|
|
1225
|
-
* @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'.
|
|
1226
|
-
* @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not.
|
|
1227
|
-
*/
|
|
1228
|
-
setUserConsent(userConsent: boolean): boolean;
|
|
1229
|
-
/**
|
|
1230
|
-
* Get the user consent status.
|
|
1231
|
-
*
|
|
1232
|
-
* @function getUserConsent
|
|
1233
|
-
* @returns {ConsentStatus} The user consent status.
|
|
1249
|
+
* User consent API.
|
|
1250
|
+
* @property UserConsent
|
|
1234
1251
|
*/
|
|
1235
|
-
|
|
1252
|
+
UserConsent: IUserConsentAPI
|
|
1236
1253
|
}
|
|
1237
1254
|
/**
|
|
1238
1255
|
* This represents the interface for the SDK instance with asynchronous storage.
|