@splitsoftware/splitio 10.28.1-rc.3 → 10.28.1-rc.5
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 +8 -6
- package/LICENSE +1 -1
- package/README.md +3 -2
- package/es/factory/browser.js +5 -2
- package/es/factory/node.js +1 -11
- package/es/platform/getEventSource/eventsource.js +1 -1
- package/es/settings/defaults/version.js +1 -1
- package/es/settings/node.js +1 -2
- package/es/settings/storage/browser.js +15 -4
- package/es/settings/storage/node.js +2 -2
- package/lib/factory/browser.js +5 -2
- package/lib/factory/node.js +1 -11
- package/lib/platform/getEventSource/eventsource.js +1 -1
- package/lib/settings/defaults/version.js +1 -1
- package/lib/settings/node.js +1 -2
- package/lib/settings/storage/browser.js +14 -3
- package/lib/settings/storage/node.js +2 -2
- package/package.json +2 -2
- package/src/factory/browser.js +5 -2
- package/src/factory/node.js +1 -12
- package/src/platform/getEventSource/eventsource.js +1 -1
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/node.js +1 -3
- package/src/settings/storage/browser.js +17 -3
- package/src/settings/storage/node.js +2 -2
- package/types/splitio.d.ts +12 -19
package/CHANGES.txt
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
10.
|
|
2
|
-
-
|
|
3
|
-
- Updated
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
1
|
+
10.28.1 (July 25, 2025)
|
|
2
|
+
- Updated @splitsoftware/splitio-commons package to version 1.17.1 that includes some vulnerability and bug fixes.
|
|
3
|
+
- Updated the Redis storage to avoid lazy require of the `ioredis` dependency when the SDK is initialized.
|
|
4
|
+
- Bugfix - Enhanced HTTP client module to implement timeouts for failing requests that might otherwise remain pending indefinitely on some Fetch API implementations, pausing the SDK synchronization process.
|
|
5
|
+
- Bugfix - Properly handle rejected promises when using targeting rules with segment matchers in consumer modes (e.g., Redis and Pluggable storages).
|
|
6
|
+
- Bugfix - Sanitize the `SplitSDKMachineName` header value to avoid exceptions on HTTP/S requests when it contains non ISO-8859-1 characters (Related to issue https://github.com/splitio/javascript-client/issues/847).
|
|
7
|
+
- Bugfix - Fixed an issue with the SDK_UPDATE event on server-side, where it was not being emitted if there was an empty segment and the SDK received a feature flag update notification.
|
|
8
|
+
- Bugfix - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
|
|
7
9
|
|
|
8
10
|
10.28.0 (September 6, 2024)
|
|
9
11
|
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -65,13 +65,14 @@ Split has built and maintains SDKs for:
|
|
|
65
65
|
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
|
|
66
66
|
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
|
|
67
67
|
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
|
|
68
|
+
* Elixir thin-client [Github](https://github.com/splitio/elixir-thin-client) [Docs](https://help.split.io/hc/en-us/articles/26988707417869-Elixir-Thin-Client-SDK)
|
|
68
69
|
* Flutter [Github](https://github.com/splitio/flutter-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin)
|
|
69
70
|
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
|
|
70
71
|
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
|
|
71
72
|
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
|
|
72
73
|
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
|
|
73
74
|
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
|
|
74
|
-
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
|
|
75
|
+
* Node.js [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
|
|
75
76
|
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
|
|
76
77
|
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK)
|
|
77
78
|
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
|
|
@@ -84,4 +85,4 @@ For a comprehensive list of open source projects visit our [Github page](https:/
|
|
|
84
85
|
|
|
85
86
|
**Learn more about Split:**
|
|
86
87
|
|
|
87
|
-
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](
|
|
88
|
+
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](https://help.split.io) for more detailed information.
|
package/es/factory/browser.js
CHANGED
|
@@ -8,6 +8,7 @@ import { sdkManagerFactory } from '@splitsoftware/splitio-commons/esm/sdkManager
|
|
|
8
8
|
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethodCSWithTT';
|
|
9
9
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
|
|
10
10
|
import { integrationsManagerFactory } from '@splitsoftware/splitio-commons/esm/integrations/browser';
|
|
11
|
+
import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
11
12
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory';
|
|
12
13
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
13
14
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/esm/consent/sdkUserConsent';
|
|
@@ -16,8 +17,10 @@ import { platform, SignalListener } from '../platform';
|
|
|
16
17
|
var syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
17
18
|
function getStorage(settings) {
|
|
18
19
|
return settings.storage.type === STORAGE_LOCALSTORAGE ?
|
|
19
|
-
InLocalStorage(settings.storage)
|
|
20
|
-
|
|
20
|
+
InLocalStorage(settings.storage)
|
|
21
|
+
: settings.storage.__originalType === STORAGE_LOCALSTORAGE ?
|
|
22
|
+
__InLocalStorageMockFactory
|
|
23
|
+
: InMemoryStorageCSFactory;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
*
|
package/es/factory/node.js
CHANGED
|
@@ -4,7 +4,6 @@ import { pushManagerFactory } from '@splitsoftware/splitio-commons/esm/sync/stre
|
|
|
4
4
|
import { pollingManagerSSFactory } from '@splitsoftware/splitio-commons/esm/sync/polling/pollingManagerSS';
|
|
5
5
|
import { InRedisStorage } from '@splitsoftware/splitio-commons/esm/storages/inRedis';
|
|
6
6
|
import { InMemoryStorageFactory } from '@splitsoftware/splitio-commons/esm/storages/inMemory/InMemoryStorage';
|
|
7
|
-
import { getSnapshot } from '@splitsoftware/splitio-commons/esm/storages/dataLoader';
|
|
8
7
|
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/esm/sdkManager';
|
|
9
8
|
import { sdkClientMethodFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethod';
|
|
10
9
|
import { impressionObserverSSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverSS';
|
|
@@ -34,16 +33,7 @@ function getModules(settings) {
|
|
|
34
33
|
sdkClientMethodFactory: sdkClientMethodFactory,
|
|
35
34
|
SignalListener: SignalListener,
|
|
36
35
|
impressionsObserverFactory: impressionObserverSSFactory,
|
|
37
|
-
filterAdapterFactory: bloomFilterFactory
|
|
38
|
-
extraProps: function (params) {
|
|
39
|
-
if (params.settings.mode !== CONSUMER_MODE) {
|
|
40
|
-
return {
|
|
41
|
-
getState: function (userKeys) {
|
|
42
|
-
return getSnapshot(params.storage, userKeys);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
36
|
+
filterAdapterFactory: bloomFilterFactory
|
|
47
37
|
};
|
|
48
38
|
switch (settings.mode) {
|
|
49
39
|
case LOCALHOST_MODE:
|
|
@@ -7,7 +7,7 @@ that accepts a custom agent.
|
|
|
7
7
|
|
|
8
8
|
The MIT License
|
|
9
9
|
|
|
10
|
-
Copyright (c) EventSource GitHub
|
|
10
|
+
Copyright (c) EventSource GitHub organization
|
|
11
11
|
|
|
12
12
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
13
|
a copy of this software and associated documentation files (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var packageVersion = '10.28.1-rc.
|
|
1
|
+
export var packageVersion = '10.28.1-rc.5';
|
package/es/settings/node.js
CHANGED
|
@@ -4,14 +4,13 @@ import { LocalhostFromFile } from '../sync/offline/LocalhostFromFile';
|
|
|
4
4
|
import { defaults } from './defaults/node';
|
|
5
5
|
import { validateStorage } from './storage/node';
|
|
6
6
|
import { validateRuntime } from './runtime/node';
|
|
7
|
-
var FLAG_SPEC_VERSION = '1.1';
|
|
8
7
|
var params = {
|
|
9
8
|
defaults: defaults,
|
|
10
9
|
runtime: validateRuntime,
|
|
11
10
|
storage: validateStorage,
|
|
12
11
|
logger: validateLogger,
|
|
13
12
|
localhost: function () { return LocalhostFromFile(); },
|
|
14
|
-
|
|
13
|
+
consent: function () { return undefined; }, // resets settings.userConsent to the default
|
|
15
14
|
// In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
|
|
16
15
|
};
|
|
17
16
|
export function settingsFactory(config) {
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { isLocalStorageAvailable } from '@splitsoftware/splitio-commons/esm/utils/env/isLocalStorageAvailable';
|
|
2
|
-
import { STORAGE_MEMORY } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
2
|
+
import { LOCALHOST_MODE, STORAGE_MEMORY } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
3
3
|
var STORAGE_LOCALSTORAGE = 'LOCALSTORAGE';
|
|
4
4
|
export function validateStorage(settings) {
|
|
5
|
-
var log = settings.log, _a = settings.storage, _b = _a === void 0 ? { type: STORAGE_MEMORY } : _a, type = _b.type, _c = _b.options, options = _c === void 0 ? {} : _c, prefix = _b.prefix;
|
|
5
|
+
var log = settings.log, mode = settings.mode, _a = settings.storage, _b = _a === void 0 ? { type: STORAGE_MEMORY } : _a, type = _b.type, _c = _b.options, options = _c === void 0 ? {} : _c, prefix = _b.prefix;
|
|
6
|
+
var __originalType;
|
|
7
|
+
var fallbackToMemory = function () {
|
|
8
|
+
__originalType = type;
|
|
9
|
+
type = STORAGE_MEMORY;
|
|
10
|
+
};
|
|
11
|
+
// In localhost mode, fallback to Memory storage and track original type to emit SDK_READY_FROM_CACHE if corresponds.
|
|
12
|
+
// ATM, other mode settings (e.g., 'consumer') are ignored in client-side API, and so treated as standalone.
|
|
13
|
+
if (mode === LOCALHOST_MODE && type === STORAGE_LOCALSTORAGE) {
|
|
14
|
+
fallbackToMemory();
|
|
15
|
+
}
|
|
6
16
|
// If an invalid storage type is provided OR we want to use LOCALSTORAGE and
|
|
7
17
|
// it's not available, fallback into MEMORY
|
|
8
18
|
if (type !== STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
|
|
9
19
|
type === STORAGE_LOCALSTORAGE && !isLocalStorageAvailable()) {
|
|
10
|
-
|
|
11
|
-
log.error('Invalid or unavailable storage.
|
|
20
|
+
fallbackToMemory();
|
|
21
|
+
log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
|
|
12
22
|
}
|
|
13
23
|
return {
|
|
14
24
|
type: type,
|
|
15
25
|
options: options,
|
|
16
26
|
prefix: prefix,
|
|
27
|
+
__originalType: __originalType
|
|
17
28
|
};
|
|
18
29
|
}
|
|
@@ -6,7 +6,7 @@ export function validateStorage(settings) {
|
|
|
6
6
|
case STORAGE_REDIS: {
|
|
7
7
|
// If passing REDIS storage in localhost or standalone mode, we log an error and fallback to MEMORY storage
|
|
8
8
|
if (mode === STANDALONE_MODE || mode === LOCALHOST_MODE) {
|
|
9
|
-
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode.
|
|
9
|
+
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallbacking into default MEMORY storage.');
|
|
10
10
|
return {
|
|
11
11
|
type: STORAGE_MEMORY,
|
|
12
12
|
prefix: prefix
|
|
@@ -53,7 +53,7 @@ export function validateStorage(settings) {
|
|
|
53
53
|
throw new Error('A REDIS storage is required on consumer mode');
|
|
54
54
|
// If passing an invalid storage type, log an error
|
|
55
55
|
if (type !== STORAGE_MEMORY)
|
|
56
|
-
log.error("The provided '" + type + "' storage type is invalid.
|
|
56
|
+
log.error("The provided '" + type + "' storage type is invalid. Fallbacking into default MEMORY storage.");
|
|
57
57
|
return {
|
|
58
58
|
type: STORAGE_MEMORY,
|
|
59
59
|
prefix: prefix
|
package/lib/factory/browser.js
CHANGED
|
@@ -11,6 +11,7 @@ var sdkManager_1 = require("@splitsoftware/splitio-commons/cjs/sdkManager");
|
|
|
11
11
|
var sdkClientMethodCSWithTT_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethodCSWithTT");
|
|
12
12
|
var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverCS");
|
|
13
13
|
var browser_1 = require("@splitsoftware/splitio-commons/cjs/integrations/browser");
|
|
14
|
+
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
14
15
|
var sdkFactory_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory");
|
|
15
16
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
16
17
|
var sdkUserConsent_1 = require("@splitsoftware/splitio-commons/cjs/consent/sdkUserConsent");
|
|
@@ -19,8 +20,10 @@ var platform_1 = require("../platform");
|
|
|
19
20
|
var syncManagerOnlineCSFactory = (0, syncManagerOnline_1.syncManagerOnlineFactory)(pollingManagerCS_1.pollingManagerCSFactory, pushManager_1.pushManagerFactory);
|
|
20
21
|
function getStorage(settings) {
|
|
21
22
|
return settings.storage.type === constants_1.STORAGE_LOCALSTORAGE ?
|
|
22
|
-
(0, inLocalStorage_1.InLocalStorage)(settings.storage)
|
|
23
|
-
|
|
23
|
+
(0, inLocalStorage_1.InLocalStorage)(settings.storage)
|
|
24
|
+
: settings.storage.__originalType === constants_1.STORAGE_LOCALSTORAGE ?
|
|
25
|
+
storageCS_1.__InLocalStorageMockFactory
|
|
26
|
+
: InMemoryStorageCS_1.InMemoryStorageCSFactory;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
*
|
package/lib/factory/node.js
CHANGED
|
@@ -7,7 +7,6 @@ var pushManager_1 = require("@splitsoftware/splitio-commons/cjs/sync/streaming/p
|
|
|
7
7
|
var pollingManagerSS_1 = require("@splitsoftware/splitio-commons/cjs/sync/polling/pollingManagerSS");
|
|
8
8
|
var inRedis_1 = require("@splitsoftware/splitio-commons/cjs/storages/inRedis");
|
|
9
9
|
var InMemoryStorage_1 = require("@splitsoftware/splitio-commons/cjs/storages/inMemory/InMemoryStorage");
|
|
10
|
-
var dataLoader_1 = require("@splitsoftware/splitio-commons/cjs/storages/dataLoader");
|
|
11
10
|
var sdkManager_1 = require("@splitsoftware/splitio-commons/cjs/sdkManager");
|
|
12
11
|
var sdkClientMethod_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethod");
|
|
13
12
|
var impressionObserverSS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverSS");
|
|
@@ -37,16 +36,7 @@ function getModules(settings) {
|
|
|
37
36
|
sdkClientMethodFactory: sdkClientMethod_1.sdkClientMethodFactory,
|
|
38
37
|
SignalListener: platform_1.SignalListener,
|
|
39
38
|
impressionsObserverFactory: impressionObserverSS_1.impressionObserverSSFactory,
|
|
40
|
-
filterAdapterFactory: bloomFilter_1.bloomFilterFactory
|
|
41
|
-
extraProps: function (params) {
|
|
42
|
-
if (params.settings.mode !== constants_1.CONSUMER_MODE) {
|
|
43
|
-
return {
|
|
44
|
-
getState: function (userKeys) {
|
|
45
|
-
return (0, dataLoader_1.getSnapshot)(params.storage, userKeys);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
39
|
+
filterAdapterFactory: bloomFilter_1.bloomFilterFactory
|
|
50
40
|
};
|
|
51
41
|
switch (settings.mode) {
|
|
52
42
|
case constants_1.LOCALHOST_MODE:
|
|
@@ -7,7 +7,7 @@ that accepts a custom agent.
|
|
|
7
7
|
|
|
8
8
|
The MIT License
|
|
9
9
|
|
|
10
|
-
Copyright (c) EventSource GitHub
|
|
10
|
+
Copyright (c) EventSource GitHub organization
|
|
11
11
|
|
|
12
12
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
13
|
a copy of this software and associated documentation files (the
|
package/lib/settings/node.js
CHANGED
|
@@ -7,14 +7,13 @@ var LocalhostFromFile_1 = require("../sync/offline/LocalhostFromFile");
|
|
|
7
7
|
var node_1 = require("./defaults/node");
|
|
8
8
|
var node_2 = require("./storage/node");
|
|
9
9
|
var node_3 = require("./runtime/node");
|
|
10
|
-
var FLAG_SPEC_VERSION = '1.1';
|
|
11
10
|
var params = {
|
|
12
11
|
defaults: node_1.defaults,
|
|
13
12
|
runtime: node_3.validateRuntime,
|
|
14
13
|
storage: node_2.validateStorage,
|
|
15
14
|
logger: builtinLogger_1.validateLogger,
|
|
16
15
|
localhost: function () { return (0, LocalhostFromFile_1.LocalhostFromFile)(); },
|
|
17
|
-
|
|
16
|
+
consent: function () { return undefined; }, // resets settings.userConsent to the default
|
|
18
17
|
// In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
|
|
19
18
|
};
|
|
20
19
|
function settingsFactory(config) {
|
|
@@ -5,18 +5,29 @@ var isLocalStorageAvailable_1 = require("@splitsoftware/splitio-commons/cjs/util
|
|
|
5
5
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
6
6
|
var STORAGE_LOCALSTORAGE = 'LOCALSTORAGE';
|
|
7
7
|
function validateStorage(settings) {
|
|
8
|
-
var log = settings.log, _a = settings.storage, _b = _a === void 0 ? { type: constants_1.STORAGE_MEMORY } : _a, type = _b.type, _c = _b.options, options = _c === void 0 ? {} : _c, prefix = _b.prefix;
|
|
8
|
+
var log = settings.log, mode = settings.mode, _a = settings.storage, _b = _a === void 0 ? { type: constants_1.STORAGE_MEMORY } : _a, type = _b.type, _c = _b.options, options = _c === void 0 ? {} : _c, prefix = _b.prefix;
|
|
9
|
+
var __originalType;
|
|
10
|
+
var fallbackToMemory = function () {
|
|
11
|
+
__originalType = type;
|
|
12
|
+
type = constants_1.STORAGE_MEMORY;
|
|
13
|
+
};
|
|
14
|
+
// In localhost mode, fallback to Memory storage and track original type to emit SDK_READY_FROM_CACHE if corresponds.
|
|
15
|
+
// ATM, other mode settings (e.g., 'consumer') are ignored in client-side API, and so treated as standalone.
|
|
16
|
+
if (mode === constants_1.LOCALHOST_MODE && type === STORAGE_LOCALSTORAGE) {
|
|
17
|
+
fallbackToMemory();
|
|
18
|
+
}
|
|
9
19
|
// If an invalid storage type is provided OR we want to use LOCALSTORAGE and
|
|
10
20
|
// it's not available, fallback into MEMORY
|
|
11
21
|
if (type !== constants_1.STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
|
|
12
22
|
type === STORAGE_LOCALSTORAGE && !(0, isLocalStorageAvailable_1.isLocalStorageAvailable)()) {
|
|
13
|
-
|
|
14
|
-
log.error('Invalid or unavailable storage.
|
|
23
|
+
fallbackToMemory();
|
|
24
|
+
log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
|
|
15
25
|
}
|
|
16
26
|
return {
|
|
17
27
|
type: type,
|
|
18
28
|
options: options,
|
|
19
29
|
prefix: prefix,
|
|
30
|
+
__originalType: __originalType
|
|
20
31
|
};
|
|
21
32
|
}
|
|
22
33
|
exports.validateStorage = validateStorage;
|
|
@@ -9,7 +9,7 @@ function validateStorage(settings) {
|
|
|
9
9
|
case constants_1.STORAGE_REDIS: {
|
|
10
10
|
// If passing REDIS storage in localhost or standalone mode, we log an error and fallback to MEMORY storage
|
|
11
11
|
if (mode === constants_1.STANDALONE_MODE || mode === constants_1.LOCALHOST_MODE) {
|
|
12
|
-
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode.
|
|
12
|
+
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallbacking into default MEMORY storage.');
|
|
13
13
|
return {
|
|
14
14
|
type: constants_1.STORAGE_MEMORY,
|
|
15
15
|
prefix: prefix
|
|
@@ -56,7 +56,7 @@ function validateStorage(settings) {
|
|
|
56
56
|
throw new Error('A REDIS storage is required on consumer mode');
|
|
57
57
|
// If passing an invalid storage type, log an error
|
|
58
58
|
if (type !== constants_1.STORAGE_MEMORY)
|
|
59
|
-
log.error("The provided '" + type + "' storage type is invalid.
|
|
59
|
+
log.error("The provided '" + type + "' storage type is invalid. Fallbacking into default MEMORY storage.");
|
|
60
60
|
return {
|
|
61
61
|
type: constants_1.STORAGE_MEMORY,
|
|
62
62
|
prefix: prefix
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio",
|
|
3
|
-
"version": "10.28.1-rc.
|
|
3
|
+
"version": "10.28.1-rc.5",
|
|
4
4
|
"description": "Split SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"README.md",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"node": ">=6"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@splitsoftware/splitio-commons": "1.17.1-rc.
|
|
43
|
+
"@splitsoftware/splitio-commons": "1.17.1-rc.5",
|
|
44
44
|
"@types/google.analytics": "0.0.40",
|
|
45
45
|
"@types/ioredis": "^4.28.0",
|
|
46
46
|
"bloom-filters": "^3.0.0",
|
package/src/factory/browser.js
CHANGED
|
@@ -8,6 +8,7 @@ import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager
|
|
|
8
8
|
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCSWithTT';
|
|
9
9
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS';
|
|
10
10
|
import { integrationsManagerFactory } from '@splitsoftware/splitio-commons/src/integrations/browser';
|
|
11
|
+
import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS';
|
|
11
12
|
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory';
|
|
12
13
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
13
14
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent/sdkUserConsent';
|
|
@@ -19,8 +20,10 @@ const syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFact
|
|
|
19
20
|
|
|
20
21
|
function getStorage(settings) {
|
|
21
22
|
return settings.storage.type === STORAGE_LOCALSTORAGE ?
|
|
22
|
-
InLocalStorage(settings.storage)
|
|
23
|
-
|
|
23
|
+
InLocalStorage(settings.storage)
|
|
24
|
+
: settings.storage.__originalType === STORAGE_LOCALSTORAGE ?
|
|
25
|
+
__InLocalStorageMockFactory
|
|
26
|
+
: InMemoryStorageCSFactory;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
/**
|
package/src/factory/node.js
CHANGED
|
@@ -4,7 +4,6 @@ import { pushManagerFactory } from '@splitsoftware/splitio-commons/src/sync/stre
|
|
|
4
4
|
import { pollingManagerSSFactory } from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerSS';
|
|
5
5
|
import { InRedisStorage } from '@splitsoftware/splitio-commons/src/storages/inRedis';
|
|
6
6
|
import { InMemoryStorageFactory } from '@splitsoftware/splitio-commons/src/storages/inMemory/InMemoryStorage';
|
|
7
|
-
import { getSnapshot } from '@splitsoftware/splitio-commons/src/storages/dataLoader';
|
|
8
7
|
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager';
|
|
9
8
|
import { sdkClientMethodFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethod';
|
|
10
9
|
import { impressionObserverSSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverSS';
|
|
@@ -48,17 +47,7 @@ function getModules(settings) {
|
|
|
48
47
|
|
|
49
48
|
impressionsObserverFactory: impressionObserverSSFactory,
|
|
50
49
|
|
|
51
|
-
filterAdapterFactory: bloomFilterFactory
|
|
52
|
-
|
|
53
|
-
extraProps: (params) => {
|
|
54
|
-
if (params.settings.mode !== CONSUMER_MODE) {
|
|
55
|
-
return {
|
|
56
|
-
getState(userKeys) {
|
|
57
|
-
return getSnapshot(params.storage, userKeys);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
50
|
+
filterAdapterFactory: bloomFilterFactory
|
|
62
51
|
};
|
|
63
52
|
|
|
64
53
|
switch (settings.mode) {
|
|
@@ -6,7 +6,7 @@ that accepts a custom agent.
|
|
|
6
6
|
|
|
7
7
|
The MIT License
|
|
8
8
|
|
|
9
|
-
Copyright (c) EventSource GitHub
|
|
9
|
+
Copyright (c) EventSource GitHub organization
|
|
10
10
|
|
|
11
11
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
12
12
|
a copy of this software and associated documentation files (the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = '10.28.1-rc.
|
|
1
|
+
export const packageVersion = '10.28.1-rc.5';
|
package/src/settings/node.js
CHANGED
|
@@ -6,15 +6,13 @@ import { defaults } from './defaults/node';
|
|
|
6
6
|
import { validateStorage } from './storage/node';
|
|
7
7
|
import { validateRuntime } from './runtime/node';
|
|
8
8
|
|
|
9
|
-
const FLAG_SPEC_VERSION = '1.1';
|
|
10
|
-
|
|
11
9
|
const params = {
|
|
12
10
|
defaults,
|
|
13
11
|
runtime: validateRuntime,
|
|
14
12
|
storage: validateStorage,
|
|
15
13
|
logger: validateLogger,
|
|
16
14
|
localhost: () => LocalhostFromFile(),
|
|
17
|
-
|
|
15
|
+
consent: () => undefined, // resets settings.userConsent to the default
|
|
18
16
|
// In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
|
|
19
17
|
};
|
|
20
18
|
|
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
import { isLocalStorageAvailable } from '@splitsoftware/splitio-commons/src/utils/env/isLocalStorageAvailable';
|
|
2
|
-
import { STORAGE_MEMORY } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
2
|
+
import { LOCALHOST_MODE, STORAGE_MEMORY } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
3
3
|
|
|
4
4
|
const STORAGE_LOCALSTORAGE = 'LOCALSTORAGE';
|
|
5
5
|
|
|
6
6
|
export function validateStorage(settings) {
|
|
7
7
|
let {
|
|
8
8
|
log,
|
|
9
|
+
mode,
|
|
9
10
|
storage: {
|
|
10
11
|
type,
|
|
11
12
|
options = {},
|
|
12
13
|
prefix
|
|
13
14
|
} = { type: STORAGE_MEMORY },
|
|
14
15
|
} = settings;
|
|
16
|
+
let __originalType;
|
|
17
|
+
|
|
18
|
+
const fallbackToMemory = () => {
|
|
19
|
+
__originalType = type;
|
|
20
|
+
type = STORAGE_MEMORY;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// In localhost mode, fallback to Memory storage and track original type to emit SDK_READY_FROM_CACHE if corresponds.
|
|
24
|
+
// ATM, other mode settings (e.g., 'consumer') are ignored in client-side API, and so treated as standalone.
|
|
25
|
+
if (mode === LOCALHOST_MODE && type === STORAGE_LOCALSTORAGE) {
|
|
26
|
+
fallbackToMemory();
|
|
27
|
+
}
|
|
15
28
|
|
|
16
29
|
// If an invalid storage type is provided OR we want to use LOCALSTORAGE and
|
|
17
30
|
// it's not available, fallback into MEMORY
|
|
18
31
|
if (type !== STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
|
|
19
32
|
type === STORAGE_LOCALSTORAGE && !isLocalStorageAvailable()) {
|
|
20
|
-
|
|
21
|
-
log.error('Invalid or unavailable storage.
|
|
33
|
+
fallbackToMemory();
|
|
34
|
+
log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
return {
|
|
25
38
|
type,
|
|
26
39
|
options,
|
|
27
40
|
prefix,
|
|
41
|
+
__originalType
|
|
28
42
|
};
|
|
29
43
|
}
|
|
@@ -16,7 +16,7 @@ export function validateStorage(settings) {
|
|
|
16
16
|
case STORAGE_REDIS: {
|
|
17
17
|
// If passing REDIS storage in localhost or standalone mode, we log an error and fallback to MEMORY storage
|
|
18
18
|
if (mode === STANDALONE_MODE || mode === LOCALHOST_MODE) {
|
|
19
|
-
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode.
|
|
19
|
+
log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallbacking into default MEMORY storage.');
|
|
20
20
|
return {
|
|
21
21
|
type: STORAGE_MEMORY,
|
|
22
22
|
prefix
|
|
@@ -74,7 +74,7 @@ export function validateStorage(settings) {
|
|
|
74
74
|
// If passing MEMORY storage in consumer mode, throw an error (no way to fallback to REDIS storage)
|
|
75
75
|
if (mode === CONSUMER_MODE) throw new Error('A REDIS storage is required on consumer mode');
|
|
76
76
|
// If passing an invalid storage type, log an error
|
|
77
|
-
if (type !== STORAGE_MEMORY) log.error(`The provided '${type}' storage type is invalid.
|
|
77
|
+
if (type !== STORAGE_MEMORY) log.error(`The provided '${type}' storage type is invalid. Fallbacking into default MEMORY storage.`);
|
|
78
78
|
return {
|
|
79
79
|
type: STORAGE_MEMORY,
|
|
80
80
|
prefix
|
package/types/splitio.d.ts
CHANGED
|
@@ -94,7 +94,6 @@ interface ISettings {
|
|
|
94
94
|
options: Object,
|
|
95
95
|
type: StorageType
|
|
96
96
|
},
|
|
97
|
-
readonly preloadedData?: SplitIO.PreloadedData,
|
|
98
97
|
readonly urls: {
|
|
99
98
|
events: string,
|
|
100
99
|
sdk: string,
|
|
@@ -492,12 +491,6 @@ interface IBasicSDK {
|
|
|
492
491
|
* @property Logger
|
|
493
492
|
*/
|
|
494
493
|
Logger: ILoggerAPI
|
|
495
|
-
/**
|
|
496
|
-
* Destroys all the clients created by this factory.
|
|
497
|
-
* @function destroy
|
|
498
|
-
* @returns {Promise<void>}
|
|
499
|
-
*/
|
|
500
|
-
destroy(): Promise<void>
|
|
501
494
|
}
|
|
502
495
|
/****** Exposed namespace ******/
|
|
503
496
|
/**
|
|
@@ -954,10 +947,6 @@ declare namespace SplitIO {
|
|
|
954
947
|
* @typedef {string} ConsentStatus
|
|
955
948
|
*/
|
|
956
949
|
type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
|
|
957
|
-
/**
|
|
958
|
-
* Defines the format of rollout plan data to preload on the factory storage (cache).
|
|
959
|
-
*/
|
|
960
|
-
type PreloadedData = Object;
|
|
961
950
|
/**
|
|
962
951
|
* Settings interface for SDK instances created on the browser
|
|
963
952
|
* @interface IBrowserSettings
|
|
@@ -1385,23 +1374,27 @@ declare namespace SplitIO {
|
|
|
1385
1374
|
* @returns {IClient} The client instance.
|
|
1386
1375
|
*/
|
|
1387
1376
|
client(): IClient,
|
|
1377
|
+
/**
|
|
1378
|
+
* Returns a shared client of the SDK. For usage on the browser.
|
|
1379
|
+
* @function client
|
|
1380
|
+
* @param {SplitKey} key The key for the new client instance.
|
|
1381
|
+
* @param {string=} trafficType The traffic type of the provided key.
|
|
1382
|
+
* @returns {IClient} The client instance.
|
|
1383
|
+
*/
|
|
1384
|
+
client(key: SplitKey, trafficType?: string): IClient,
|
|
1388
1385
|
/**
|
|
1389
1386
|
* Returns a manager instance of the SDK to explore available information.
|
|
1390
1387
|
* @function manager
|
|
1391
1388
|
* @returns {IManager} The manager instance.
|
|
1392
1389
|
*/
|
|
1393
|
-
manager(): IManager
|
|
1394
|
-
/**
|
|
1395
|
-
* @TODO add description
|
|
1396
|
-
*/
|
|
1397
|
-
getState(): PreloadedData,
|
|
1390
|
+
manager(): IManager
|
|
1398
1391
|
}
|
|
1399
1392
|
/**
|
|
1400
1393
|
* This represents the interface for the SDK instance with synchronous storage.
|
|
1401
1394
|
* @interface IBrowserSDK
|
|
1402
|
-
* @extends
|
|
1395
|
+
* @extends ISDK
|
|
1403
1396
|
*/
|
|
1404
|
-
interface IBrowserSDK extends
|
|
1397
|
+
interface IBrowserSDK extends ISDK {
|
|
1405
1398
|
/**
|
|
1406
1399
|
* Returns the default client instance of the SDK.
|
|
1407
1400
|
* @function client
|
|
@@ -1409,7 +1402,7 @@ declare namespace SplitIO {
|
|
|
1409
1402
|
*/
|
|
1410
1403
|
client(): IBrowserClient,
|
|
1411
1404
|
/**
|
|
1412
|
-
* Returns a shared client of the SDK.
|
|
1405
|
+
* Returns a shared client of the SDK. For usage on the browser.
|
|
1413
1406
|
* @function client
|
|
1414
1407
|
* @param {SplitKey} key The key for the new client instance.
|
|
1415
1408
|
* @param {string=} trafficType The traffic type of the provided key.
|