@splitsoftware/splitio 10.28.1-rc.4 → 11.0.0-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 +13 -7
- package/{lib → cjs}/factory/browser.js +9 -8
- package/{lib → cjs}/factory/node.js +1 -11
- package/{lib → cjs}/settings/browser.js +1 -3
- package/{lib → cjs}/settings/defaults/version.js +1 -1
- package/{lib → cjs}/settings/storage/browser.js +13 -2
- package/{lib → cjs}/sync/offline/splitsParserFromFile.js +1 -1
- package/client/package.json +2 -2
- package/{es → esm}/factory/browser.js +6 -5
- package/{es → esm}/factory/node.js +1 -11
- package/{es → esm}/settings/browser.js +1 -3
- package/esm/settings/defaults/version.js +1 -0
- package/esm/settings/storage/browser.js +29 -0
- package/{es → esm}/sync/offline/splitsParserFromFile.js +1 -1
- package/package.json +10 -15
- package/server/package.json +2 -2
- package/src/factory/browser.js +6 -6
- package/src/factory/node.js +1 -12
- package/src/settings/browser.js +1 -3
- package/src/settings/defaults/version.js +1 -1
- package/src/settings/storage/browser.js +16 -2
- package/src/sync/offline/splitsParserFromFile.js +1 -1
- package/types/client/index.d.ts +1 -1
- package/types/index.d.ts +3 -3
- package/types/server/index.d.ts +2 -2
- package/types/splitio.d.ts +127 -313
- package/es/settings/defaults/version.js +0 -1
- package/es/settings/storage/browser.js +0 -18
- package/scripts/ga-to-split-autorequire.js +0 -1
- /package/{es → cjs}/factory/package.json +0 -0
- /package/{lib → cjs}/index.js +0 -0
- /package/{lib → cjs}/platform/EventEmitter.js +0 -0
- /package/{lib → cjs}/platform/browser.js +0 -0
- /package/{lib → cjs}/platform/filter/bloomFilter.js +0 -0
- /package/{lib → cjs}/platform/getEventSource/browser.js +0 -0
- /package/{es → cjs}/platform/getEventSource/eventsource.js +0 -0
- /package/{lib → cjs}/platform/getEventSource/node.js +0 -0
- /package/{es → cjs}/platform/getEventSource/package.json +0 -0
- /package/{lib → cjs}/platform/getFetch/browser.js +0 -0
- /package/{lib → cjs}/platform/getFetch/node.js +0 -0
- /package/{es → cjs}/platform/getFetch/package.json +0 -0
- /package/{lib → cjs}/platform/getOptions/node.js +0 -0
- /package/{lib → cjs}/platform/node.js +0 -0
- /package/{es → cjs}/platform/package.json +0 -0
- /package/{lib → cjs}/settings/defaults/browser.js +0 -0
- /package/{lib → cjs}/settings/defaults/node.js +0 -0
- /package/{lib → cjs}/settings/integrations/browser.js +0 -0
- /package/{lib → cjs}/settings/node.js +0 -0
- /package/{es → cjs}/settings/package.json +0 -0
- /package/{lib → cjs}/settings/runtime/node.js +0 -0
- /package/{lib → cjs}/settings/storage/node.js +0 -0
- /package/{lib → cjs}/sync/offline/LocalhostFromFile.js +0 -0
- /package/{lib → cjs}/umd.js +0 -0
- /package/{lib → cjs}/utils/ip.js +0 -0
- /package/{lib → esm}/factory/package.json +0 -0
- /package/{es → esm}/index.js +0 -0
- /package/{es → esm}/platform/EventEmitter.js +0 -0
- /package/{es → esm}/platform/browser.js +0 -0
- /package/{es → esm}/platform/filter/bloomFilter.js +0 -0
- /package/{es → esm}/platform/getEventSource/browser.js +0 -0
- /package/{lib → esm}/platform/getEventSource/eventsource.js +0 -0
- /package/{es → esm}/platform/getEventSource/node.js +0 -0
- /package/{lib → esm}/platform/getEventSource/package.json +0 -0
- /package/{es → esm}/platform/getFetch/browser.js +0 -0
- /package/{es → esm}/platform/getFetch/node.js +0 -0
- /package/{lib → esm}/platform/getFetch/package.json +0 -0
- /package/{es → esm}/platform/getOptions/node.js +0 -0
- /package/{es → esm}/platform/node.js +0 -0
- /package/{lib → esm}/platform/package.json +0 -0
- /package/{es → esm}/settings/defaults/browser.js +0 -0
- /package/{es → esm}/settings/defaults/node.js +0 -0
- /package/{es → esm}/settings/integrations/browser.js +0 -0
- /package/{es → esm}/settings/node.js +0 -0
- /package/{lib → esm}/settings/package.json +0 -0
- /package/{es → esm}/settings/runtime/node.js +0 -0
- /package/{es → esm}/settings/storage/node.js +0 -0
- /package/{es → esm}/sync/offline/LocalhostFromFile.js +0 -0
- /package/{es → esm}/umd.js +0 -0
- /package/{es → esm}/utils/ip.js +0 -0
package/CHANGES.txt
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
- Added
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
11.0.0 (October XX, 2024)
|
|
2
|
+
- Added support for targeting rules based on large segments for browsers.
|
|
3
|
+
- Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
|
|
4
|
+
- Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
|
|
5
|
+
- BREAKING CHANGES:
|
|
6
|
+
- Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for EcmaScript Modules build.
|
|
7
|
+
- Drop support for NodeJS v6. The SDK now requires NodeJS v14 or above.
|
|
8
|
+
- Removed internal ponyfills for `Map`, `Set` and `Array.from` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or to provide a polyfill.
|
|
9
|
+
- Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
|
|
10
|
+
- Removed clients with bound traffic type. the `core.trafficType` configuration option. The SDK now uses the `core.trafficType` value from the factory configuration to create clients.
|
|
11
|
+
- Updated TypeScript definitions.
|
|
12
|
+
- Bugfixing - Removed an overloaded `client` method in the `SplitIO.ISDK` interface that accepted a key and trafficType parameters. This interface corresponds to the SDK factory instance in NodeJS, which, unlike `SplitIO.IBrowserSDK` for the Browser, does not handle multiple client instances based on keys or traffic types.
|
|
7
13
|
|
|
8
14
|
10.28.0 (September 6, 2024)
|
|
9
15
|
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
|
|
@@ -514,7 +520,7 @@
|
|
|
514
520
|
- Bugfixing - Return correct label when consulted Split is not found.
|
|
515
521
|
|
|
516
522
|
9.1.1 (May 03, 2017)
|
|
517
|
-
- Bugfixing - Fixed invalid
|
|
523
|
+
- Bugfixing - Fixed invalid behavior when using native Fetch API and comparing statusText
|
|
518
524
|
instead of resp.ok
|
|
519
525
|
|
|
520
526
|
9.1.0 (April 21, 2017)
|
|
@@ -8,19 +8,21 @@ var pollingManagerCS_1 = require("@splitsoftware/splitio-commons/cjs/sync/pollin
|
|
|
8
8
|
var inLocalStorage_1 = require("@splitsoftware/splitio-commons/cjs/storages/inLocalStorage");
|
|
9
9
|
var InMemoryStorageCS_1 = require("@splitsoftware/splitio-commons/cjs/storages/inMemory/InMemoryStorageCS");
|
|
10
10
|
var sdkManager_1 = require("@splitsoftware/splitio-commons/cjs/sdkManager");
|
|
11
|
-
var
|
|
11
|
+
var sdkClientMethodCS_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethodCS");
|
|
12
12
|
var impressionObserverCS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverCS");
|
|
13
|
-
var
|
|
13
|
+
var storageCS_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/storage/storageCS");
|
|
14
14
|
var sdkFactory_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory");
|
|
15
15
|
var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
|
|
16
16
|
var sdkUserConsent_1 = require("@splitsoftware/splitio-commons/cjs/consent/sdkUserConsent");
|
|
17
|
-
var
|
|
17
|
+
var browser_1 = require("../settings/browser");
|
|
18
18
|
var platform_1 = require("../platform");
|
|
19
19
|
var syncManagerOnlineCSFactory = (0, syncManagerOnline_1.syncManagerOnlineFactory)(pollingManagerCS_1.pollingManagerCSFactory, pushManager_1.pushManagerFactory);
|
|
20
20
|
function getStorage(settings) {
|
|
21
21
|
return settings.storage.type === constants_1.STORAGE_LOCALSTORAGE ?
|
|
22
|
-
(0, inLocalStorage_1.InLocalStorage)(settings.storage)
|
|
23
|
-
|
|
22
|
+
(0, inLocalStorage_1.InLocalStorage)(settings.storage)
|
|
23
|
+
: settings.storage.__originalType === constants_1.STORAGE_LOCALSTORAGE ?
|
|
24
|
+
storageCS_1.__InLocalStorageMockFactory
|
|
25
|
+
: InMemoryStorageCS_1.InMemoryStorageCSFactory;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
*
|
|
@@ -34,9 +36,8 @@ function getModules(settings) {
|
|
|
34
36
|
splitApiFactory: splitApi_1.splitApiFactory,
|
|
35
37
|
syncManagerFactory: syncManagerOnlineCSFactory,
|
|
36
38
|
sdkManagerFactory: sdkManager_1.sdkManagerFactory,
|
|
37
|
-
sdkClientMethodFactory:
|
|
39
|
+
sdkClientMethodFactory: sdkClientMethodCS_1.sdkClientMethodCSFactory,
|
|
38
40
|
SignalListener: platform_1.SignalListener,
|
|
39
|
-
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? browser_1.integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
40
41
|
impressionsObserverFactory: impressionObserverCS_1.impressionObserverCSFactory,
|
|
41
42
|
extraProps: function (params) {
|
|
42
43
|
return {
|
|
@@ -62,7 +63,7 @@ function getModules(settings) {
|
|
|
62
63
|
* @throws Will throw an error if the provided config is invalid.
|
|
63
64
|
*/
|
|
64
65
|
function SplitFactory(config, __updateModules) {
|
|
65
|
-
var settings = (0,
|
|
66
|
+
var settings = (0, browser_1.settingsFactory)(config);
|
|
66
67
|
var modules = getModules(settings);
|
|
67
68
|
if (__updateModules)
|
|
68
69
|
__updateModules(modules);
|
|
@@ -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:
|
|
@@ -8,13 +8,11 @@ var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/off
|
|
|
8
8
|
var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
|
|
9
9
|
var browser_1 = require("./defaults/browser");
|
|
10
10
|
var browser_2 = require("./storage/browser");
|
|
11
|
-
var browser_3 = require("./integrations/browser");
|
|
12
11
|
var params = {
|
|
13
12
|
defaults: browser_1.defaults,
|
|
14
|
-
acceptKey: true,
|
|
13
|
+
acceptKey: true,
|
|
15
14
|
runtime: runtime_1.validateRuntime,
|
|
16
15
|
storage: browser_2.validateStorage,
|
|
17
|
-
integrations: browser_3.validateIntegrations,
|
|
18
16
|
logger: builtinLogger_1.validateLogger,
|
|
19
17
|
localhost: function () { return (0, LocalhostFromObject_1.LocalhostFromObject)(); },
|
|
20
18
|
consent: consent_1.validateConsent,
|
|
@@ -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
|
-
|
|
23
|
+
fallbackToMemory();
|
|
14
24
|
log.error('Invalid or unavailable storage. Fallback 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;
|
|
@@ -27,7 +27,7 @@ function configFilesPath(configFilePath) {
|
|
|
27
27
|
return configFilePath;
|
|
28
28
|
}
|
|
29
29
|
// This function is not pure nor meant to be. Here we apply modifications to cover
|
|
30
|
-
// for
|
|
30
|
+
// for behavior that's ensured by the BE.
|
|
31
31
|
function arrangeConditions(mocksData) {
|
|
32
32
|
// Iterate through each feature flag data
|
|
33
33
|
(0, lang_1.forOwn)(mocksData, function (data) {
|
package/client/package.json
CHANGED
|
@@ -5,9 +5,9 @@ import { pollingManagerCSFactory } from '@splitsoftware/splitio-commons/esm/sync
|
|
|
5
5
|
import { InLocalStorage } from '@splitsoftware/splitio-commons/esm/storages/inLocalStorage';
|
|
6
6
|
import { InMemoryStorageCSFactory } from '@splitsoftware/splitio-commons/esm/storages/inMemory/InMemoryStorageCS';
|
|
7
7
|
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/esm/sdkManager';
|
|
8
|
-
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/
|
|
8
|
+
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethodCS';
|
|
9
9
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
|
|
10
|
-
import {
|
|
10
|
+
import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/storage/storageCS';
|
|
11
11
|
import { sdkFactory } from '@splitsoftware/splitio-commons/esm/sdkFactory';
|
|
12
12
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
13
13
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/esm/consent/sdkUserConsent';
|
|
@@ -16,8 +16,10 @@ import { platform, SignalListener } from '../platform';
|
|
|
16
16
|
var syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);
|
|
17
17
|
function getStorage(settings) {
|
|
18
18
|
return settings.storage.type === STORAGE_LOCALSTORAGE ?
|
|
19
|
-
InLocalStorage(settings.storage)
|
|
20
|
-
|
|
19
|
+
InLocalStorage(settings.storage)
|
|
20
|
+
: settings.storage.__originalType === STORAGE_LOCALSTORAGE ?
|
|
21
|
+
__InLocalStorageMockFactory
|
|
22
|
+
: InMemoryStorageCSFactory;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
*
|
|
@@ -33,7 +35,6 @@ function getModules(settings) {
|
|
|
33
35
|
sdkManagerFactory: sdkManagerFactory,
|
|
34
36
|
sdkClientMethodFactory: sdkClientMethodCSFactory,
|
|
35
37
|
SignalListener: SignalListener,
|
|
36
|
-
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
37
38
|
impressionsObserverFactory: impressionObserverCSFactory,
|
|
38
39
|
extraProps: function (params) {
|
|
39
40
|
return {
|
|
@@ -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:
|
|
@@ -5,13 +5,11 @@ import { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/off
|
|
|
5
5
|
import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
|
|
6
6
|
import { defaults } from './defaults/browser';
|
|
7
7
|
import { validateStorage } from './storage/browser';
|
|
8
|
-
import { validateIntegrations } from './integrations/browser';
|
|
9
8
|
var params = {
|
|
10
9
|
defaults: defaults,
|
|
11
|
-
acceptKey: true,
|
|
10
|
+
acceptKey: true,
|
|
12
11
|
runtime: validateRuntime,
|
|
13
12
|
storage: validateStorage,
|
|
14
|
-
integrations: validateIntegrations,
|
|
15
13
|
logger: validateLogger,
|
|
16
14
|
localhost: function () { return LocalhostFromObject(); },
|
|
17
15
|
consent: validateConsent,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var packageVersion = '11.0.0-rc.0';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isLocalStorageAvailable } from '@splitsoftware/splitio-commons/esm/utils/env/isLocalStorageAvailable';
|
|
2
|
+
import { LOCALHOST_MODE, STORAGE_MEMORY } from '@splitsoftware/splitio-commons/esm/utils/constants';
|
|
3
|
+
var STORAGE_LOCALSTORAGE = 'LOCALSTORAGE';
|
|
4
|
+
export function validateStorage(settings) {
|
|
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
|
+
}
|
|
16
|
+
// If an invalid storage type is provided OR we want to use LOCALSTORAGE and
|
|
17
|
+
// it's not available, fallback into MEMORY
|
|
18
|
+
if (type !== STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
|
|
19
|
+
type === STORAGE_LOCALSTORAGE && !isLocalStorageAvailable()) {
|
|
20
|
+
fallbackToMemory();
|
|
21
|
+
log.error('Invalid or unavailable storage. Fallback into MEMORY storage');
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
type: type,
|
|
25
|
+
options: options,
|
|
26
|
+
prefix: prefix,
|
|
27
|
+
__originalType: __originalType
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -23,7 +23,7 @@ function configFilesPath(configFilePath) {
|
|
|
23
23
|
return configFilePath;
|
|
24
24
|
}
|
|
25
25
|
// This function is not pure nor meant to be. Here we apply modifications to cover
|
|
26
|
-
// for
|
|
26
|
+
// for behavior that's ensured by the BE.
|
|
27
27
|
function arrangeConditions(mocksData) {
|
|
28
28
|
// Iterate through each feature flag data
|
|
29
29
|
forOwn(mocksData, function (data) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splitsoftware/splitio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-rc.0",
|
|
4
4
|
"description": "Split SDK",
|
|
5
5
|
"files": [
|
|
6
6
|
"README.md",
|
|
7
7
|
"CONTRIBUTORS-GUIDE.md",
|
|
8
8
|
"LICENSE",
|
|
9
9
|
"CHANGES.txt",
|
|
10
|
-
"
|
|
10
|
+
"cjs",
|
|
11
11
|
"types",
|
|
12
|
-
"
|
|
12
|
+
"esm",
|
|
13
13
|
"src",
|
|
14
|
-
"scripts/ga-to-split-autorequire.js",
|
|
15
14
|
"client",
|
|
16
15
|
"server"
|
|
17
16
|
],
|
|
@@ -32,16 +31,14 @@
|
|
|
32
31
|
"sdk",
|
|
33
32
|
"javascript"
|
|
34
33
|
],
|
|
35
|
-
"main": "
|
|
36
|
-
"module": "
|
|
34
|
+
"main": "cjs/index.js",
|
|
35
|
+
"module": "esm/index.js",
|
|
37
36
|
"types": "types",
|
|
38
37
|
"engines": {
|
|
39
|
-
"
|
|
40
|
-
"node": ">=6"
|
|
38
|
+
"node": ">=14.0.0"
|
|
41
39
|
},
|
|
42
40
|
"dependencies": {
|
|
43
|
-
"@splitsoftware/splitio-commons": "
|
|
44
|
-
"@types/google.analytics": "0.0.40",
|
|
41
|
+
"@splitsoftware/splitio-commons": "2.0.0-rc.0",
|
|
45
42
|
"@types/ioredis": "^4.28.0",
|
|
46
43
|
"bloom-filters": "^3.0.0",
|
|
47
44
|
"ioredis": "^4.28.0",
|
|
@@ -84,14 +81,13 @@
|
|
|
84
81
|
"webpack-merge": "^5.8.0"
|
|
85
82
|
},
|
|
86
83
|
"scripts": {
|
|
87
|
-
"build-esm": "rimraf
|
|
88
|
-
"postbuild-esm": "cross-env NODE_ENV=
|
|
84
|
+
"build-esm": "rimraf esm && tsc -outDir esm",
|
|
85
|
+
"postbuild-esm": "cross-env NODE_ENV=esm node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh",
|
|
89
86
|
"build-umd:stats": "webpack --progress --env production --json > ./stats/stat_results.json",
|
|
90
|
-
"build-cjs": "rimraf
|
|
87
|
+
"build-cjs": "rimraf cjs && tsc -outDir cjs -m CommonJS",
|
|
91
88
|
"postbuild-cjs": "cross-env NODE_ENV=cjs node scripts/copy.packages.json.js && ./scripts/build_cjs_replace_imports.sh",
|
|
92
89
|
"build-umd": "rimraf umd && webpack --config webpack.dev.js --env branch=$BUILD_BRANCH && webpack --config webpack.prod.js --env branch=$BUILD_BRANCH && ./scripts/clean_umd_build.sh",
|
|
93
90
|
"build:npm": "npm run build-cjs && npm run build-esm",
|
|
94
|
-
"build:ga-to-split-autorequire": "terser ./node_modules/@splitsoftware/splitio-commons/src/integrations/ga/autoRequire.js --mangle --output ./scripts/ga-to-split-autorequire.js && cp ./scripts/ga-to-split-autorequire.js umd/ga-to-split-autorequire.js",
|
|
95
91
|
"build": "npm run build-cjs && npm run build-esm && npm run build-umd",
|
|
96
92
|
"check": "npm run check:lint && npm run check:version",
|
|
97
93
|
"check:lint": "eslint src",
|
|
@@ -104,7 +100,6 @@
|
|
|
104
100
|
"test-browser-e2e-destroy": "cross-env NODE_ENV=test karma start karma/e2e.destroy.karma.conf.js",
|
|
105
101
|
"test-browser-e2e-errorCatching": "cross-env NODE_ENV=test karma start karma/e2e.errorCatching.karma.conf.js",
|
|
106
102
|
"test-browser-e2e-push": "cross-env NODE_ENV=test karma start karma/e2e.push.karma.conf.js",
|
|
107
|
-
"test-browser-e2e-gaIntegration": "cross-env NODE_ENV=test karma start karma/e2e.gaIntegration.karma.conf.js",
|
|
108
103
|
"test-node": "npm run test-node-unit && npm run test-node-e2e",
|
|
109
104
|
"test-node-unit": "cross-env NODE_ENV=test tape -r ./ts-node.register \"src/*/**/__tests__/**/!(browser).spec.js\" | tap-min",
|
|
110
105
|
"test-node-e2e": "npm run test-node-e2e-online && npm run test-node-e2e-offline && npm run test-node-e2e-destroy && npm run test-node-e2e-errorCatching && npm run test-node-e2e-push && npm run test-node-e2e-redis",
|
package/server/package.json
CHANGED
package/src/factory/browser.js
CHANGED
|
@@ -5,9 +5,9 @@ import { pollingManagerCSFactory } from '@splitsoftware/splitio-commons/src/sync
|
|
|
5
5
|
import { InLocalStorage } from '@splitsoftware/splitio-commons/src/storages/inLocalStorage';
|
|
6
6
|
import { InMemoryStorageCSFactory } from '@splitsoftware/splitio-commons/src/storages/inMemory/InMemoryStorageCS';
|
|
7
7
|
import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager';
|
|
8
|
-
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/
|
|
8
|
+
import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS';
|
|
9
9
|
import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS';
|
|
10
|
-
import {
|
|
10
|
+
import { __InLocalStorageMockFactory } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/storage/storageCS';
|
|
11
11
|
import { sdkFactory } from '@splitsoftware/splitio-commons/src/sdkFactory';
|
|
12
12
|
import { LOCALHOST_MODE, STORAGE_LOCALSTORAGE } from '@splitsoftware/splitio-commons/src/utils/constants';
|
|
13
13
|
import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent/sdkUserConsent';
|
|
@@ -19,8 +19,10 @@ const syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFact
|
|
|
19
19
|
|
|
20
20
|
function getStorage(settings) {
|
|
21
21
|
return settings.storage.type === STORAGE_LOCALSTORAGE ?
|
|
22
|
-
InLocalStorage(settings.storage)
|
|
23
|
-
|
|
22
|
+
InLocalStorage(settings.storage)
|
|
23
|
+
: settings.storage.__originalType === STORAGE_LOCALSTORAGE ?
|
|
24
|
+
__InLocalStorageMockFactory
|
|
25
|
+
: InMemoryStorageCSFactory;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -46,8 +48,6 @@ function getModules(settings) {
|
|
|
46
48
|
|
|
47
49
|
SignalListener,
|
|
48
50
|
|
|
49
|
-
integrationsManagerFactory: settings.integrations && settings.integrations.length > 0 ? integrationsManagerFactory.bind(null, settings.integrations) : undefined,
|
|
50
|
-
|
|
51
51
|
impressionsObserverFactory: impressionObserverCSFactory,
|
|
52
52
|
|
|
53
53
|
extraProps: (params) => {
|
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) {
|
package/src/settings/browser.js
CHANGED
|
@@ -6,14 +6,12 @@ import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settin
|
|
|
6
6
|
|
|
7
7
|
import { defaults } from './defaults/browser';
|
|
8
8
|
import { validateStorage } from './storage/browser';
|
|
9
|
-
import { validateIntegrations } from './integrations/browser';
|
|
10
9
|
|
|
11
10
|
const params = {
|
|
12
11
|
defaults,
|
|
13
|
-
acceptKey: true,
|
|
12
|
+
acceptKey: true, // Client with bound key
|
|
14
13
|
runtime: validateRuntime,
|
|
15
14
|
storage: validateStorage,
|
|
16
|
-
integrations: validateIntegrations,
|
|
17
15
|
logger: validateLogger,
|
|
18
16
|
localhost: () => LocalhostFromObject(),
|
|
19
17
|
consent: validateConsent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = '
|
|
1
|
+
export const packageVersion = '11.0.0-rc.0';
|
|
@@ -1,23 +1,36 @@
|
|
|
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
|
-
|
|
33
|
+
fallbackToMemory();
|
|
21
34
|
log.error('Invalid or unavailable storage. Fallback into MEMORY storage');
|
|
22
35
|
}
|
|
23
36
|
|
|
@@ -25,5 +38,6 @@ export function validateStorage(settings) {
|
|
|
25
38
|
type,
|
|
26
39
|
options,
|
|
27
40
|
prefix,
|
|
41
|
+
__originalType
|
|
28
42
|
};
|
|
29
43
|
}
|
|
@@ -31,7 +31,7 @@ function configFilesPath(configFilePath) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// This function is not pure nor meant to be. Here we apply modifications to cover
|
|
34
|
-
// for
|
|
34
|
+
// for behavior that's ensured by the BE.
|
|
35
35
|
function arrangeConditions(mocksData) {
|
|
36
36
|
// Iterate through each feature flag data
|
|
37
37
|
forOwn(mocksData, data => {
|
package/types/client/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export = JsSdk;
|
|
|
6
6
|
|
|
7
7
|
declare module JsSdk {
|
|
8
8
|
/**
|
|
9
|
-
* Split.io
|
|
9
|
+
* Split.io SDK factory function.
|
|
10
10
|
* The settings parameter should be an object that complies with the SplitIO.IBrowserSettings.
|
|
11
11
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
|
|
12
12
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -8,19 +8,19 @@ export = JsSdk;
|
|
|
8
8
|
|
|
9
9
|
declare module JsSdk {
|
|
10
10
|
/**
|
|
11
|
-
* Split.io
|
|
11
|
+
* Split.io SDK factory function.
|
|
12
12
|
* The settings parameter should be an object that complies with the SplitIO.INodeAsyncSettings.
|
|
13
13
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
14
14
|
*/
|
|
15
15
|
export function SplitFactory(settings: SplitIO.INodeAsyncSettings): SplitIO.IAsyncSDK;
|
|
16
16
|
/**
|
|
17
|
-
* Split.io
|
|
17
|
+
* Split.io SDK factory function.
|
|
18
18
|
* The settings parameter should be an object that complies with the SplitIO.INodeSettings.
|
|
19
19
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
20
20
|
*/
|
|
21
21
|
export function SplitFactory(settings: SplitIO.INodeSettings): SplitIO.ISDK;
|
|
22
22
|
/**
|
|
23
|
-
* Split.io
|
|
23
|
+
* Split.io SDK factory function.
|
|
24
24
|
* The settings parameter should be an object that complies with the SplitIO.IBrowserSettings.
|
|
25
25
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
|
|
26
26
|
*/
|
package/types/server/index.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ export = JsSdk;
|
|
|
6
6
|
|
|
7
7
|
declare module JsSdk {
|
|
8
8
|
/**
|
|
9
|
-
* Split.io
|
|
9
|
+
* Split.io SDK factory function.
|
|
10
10
|
* The settings parameter should be an object that complies with the SplitIO.INodeAsyncSettings.
|
|
11
11
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
12
12
|
*/
|
|
13
13
|
export function SplitFactory(settings: SplitIO.INodeAsyncSettings): SplitIO.IAsyncSDK;
|
|
14
14
|
/**
|
|
15
|
-
* Split.io
|
|
15
|
+
* Split.io SDK factory function.
|
|
16
16
|
* The settings parameter should be an object that complies with the SplitIO.INodeSettings.
|
|
17
17
|
* For more information read the corresponding article: @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
|
|
18
18
|
*/
|