@splitsoftware/splitio 10.28.1-rc.4 → 11.0.0-rc.1

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.
Files changed (78) hide show
  1. package/CHANGES.txt +16 -7
  2. package/{lib → cjs}/factory/browser.js +9 -8
  3. package/{lib → cjs}/settings/browser.js +1 -3
  4. package/{lib → cjs}/settings/defaults/version.js +1 -1
  5. package/{lib → cjs}/settings/storage/browser.js +13 -2
  6. package/{lib → cjs}/sync/offline/splitsParserFromFile.js +1 -1
  7. package/client/package.json +2 -2
  8. package/{es → esm}/factory/browser.js +6 -5
  9. package/{es → esm}/settings/browser.js +1 -3
  10. package/esm/settings/defaults/version.js +1 -0
  11. package/esm/settings/storage/browser.js +29 -0
  12. package/{es → esm}/sync/offline/splitsParserFromFile.js +1 -1
  13. package/package.json +10 -15
  14. package/server/package.json +2 -2
  15. package/src/factory/browser.js +6 -6
  16. package/src/settings/browser.js +1 -3
  17. package/src/settings/defaults/version.js +1 -1
  18. package/src/settings/storage/browser.js +16 -2
  19. package/src/sync/offline/splitsParserFromFile.js +1 -1
  20. package/types/client/index.d.ts +1 -1
  21. package/types/index.d.ts +3 -3
  22. package/types/server/index.d.ts +2 -2
  23. package/types/splitio.d.ts +125 -288
  24. package/es/settings/defaults/version.js +0 -1
  25. package/es/settings/storage/browser.js +0 -18
  26. package/scripts/ga-to-split-autorequire.js +0 -1
  27. /package/{lib → cjs}/factory/node.js +0 -0
  28. /package/{es → cjs}/factory/package.json +0 -0
  29. /package/{lib → cjs}/index.js +0 -0
  30. /package/{lib → cjs}/platform/EventEmitter.js +0 -0
  31. /package/{lib → cjs}/platform/browser.js +0 -0
  32. /package/{lib → cjs}/platform/filter/bloomFilter.js +0 -0
  33. /package/{lib → cjs}/platform/getEventSource/browser.js +0 -0
  34. /package/{es → cjs}/platform/getEventSource/eventsource.js +0 -0
  35. /package/{lib → cjs}/platform/getEventSource/node.js +0 -0
  36. /package/{es → cjs}/platform/getEventSource/package.json +0 -0
  37. /package/{lib → cjs}/platform/getFetch/browser.js +0 -0
  38. /package/{lib → cjs}/platform/getFetch/node.js +0 -0
  39. /package/{es → cjs}/platform/getFetch/package.json +0 -0
  40. /package/{lib → cjs}/platform/getOptions/node.js +0 -0
  41. /package/{lib → cjs}/platform/node.js +0 -0
  42. /package/{es → cjs}/platform/package.json +0 -0
  43. /package/{lib → cjs}/settings/defaults/browser.js +0 -0
  44. /package/{lib → cjs}/settings/defaults/node.js +0 -0
  45. /package/{lib → cjs}/settings/integrations/browser.js +0 -0
  46. /package/{lib → cjs}/settings/node.js +0 -0
  47. /package/{es → cjs}/settings/package.json +0 -0
  48. /package/{lib → cjs}/settings/runtime/node.js +0 -0
  49. /package/{lib → cjs}/settings/storage/node.js +0 -0
  50. /package/{lib → cjs}/sync/offline/LocalhostFromFile.js +0 -0
  51. /package/{lib → cjs}/umd.js +0 -0
  52. /package/{lib → cjs}/utils/ip.js +0 -0
  53. /package/{es → esm}/factory/node.js +0 -0
  54. /package/{lib → esm}/factory/package.json +0 -0
  55. /package/{es → esm}/index.js +0 -0
  56. /package/{es → esm}/platform/EventEmitter.js +0 -0
  57. /package/{es → esm}/platform/browser.js +0 -0
  58. /package/{es → esm}/platform/filter/bloomFilter.js +0 -0
  59. /package/{es → esm}/platform/getEventSource/browser.js +0 -0
  60. /package/{lib → esm}/platform/getEventSource/eventsource.js +0 -0
  61. /package/{es → esm}/platform/getEventSource/node.js +0 -0
  62. /package/{lib → esm}/platform/getEventSource/package.json +0 -0
  63. /package/{es → esm}/platform/getFetch/browser.js +0 -0
  64. /package/{es → esm}/platform/getFetch/node.js +0 -0
  65. /package/{lib → esm}/platform/getFetch/package.json +0 -0
  66. /package/{es → esm}/platform/getOptions/node.js +0 -0
  67. /package/{es → esm}/platform/node.js +0 -0
  68. /package/{lib → esm}/platform/package.json +0 -0
  69. /package/{es → esm}/settings/defaults/browser.js +0 -0
  70. /package/{es → esm}/settings/defaults/node.js +0 -0
  71. /package/{es → esm}/settings/integrations/browser.js +0 -0
  72. /package/{es → esm}/settings/node.js +0 -0
  73. /package/{lib → esm}/settings/package.json +0 -0
  74. /package/{es → esm}/settings/runtime/node.js +0 -0
  75. /package/{es → esm}/settings/storage/node.js +0 -0
  76. /package/{es → esm}/sync/offline/LocalhostFromFile.js +0 -0
  77. /package/{es → esm}/umd.js +0 -0
  78. /package/{es → esm}/utils/ip.js +0 -0
package/CHANGES.txt CHANGED
@@ -1,9 +1,18 @@
1
- 10.29.0 (September XX, 2024)
2
- - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
3
- - Updated @splitsoftware/splitio-commons package to version 1.18.0 that includes minor updates:
4
- - Added support for targeting rules based on large segments for browsers.
5
- - Updated some transitive dependencies for vulnerability fixes.
6
- - 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.
1
+ 11.0.0 (October XX, 2024)
2
+ - Added support for targeting rules based on large segments for browsers.
3
+ - Added `factory.getState()` method for standalone server-side SDKs, which returns the rollout plan snapshot from the storage.
4
+ - Added `preloadedData` configuration option for standalone client-side SDKs, which allows preloading the SDK storage with a snapshot of the rollout plan.
5
+ - Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
6
+ - Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
7
+ - Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for EcmaScript Modules build.
8
+ - BREAKING CHANGES:
9
+ - Dropped support for NodeJS v6. The SDK now requires NodeJS v14 or above.
10
+ - Removed internal ponyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or provide a polyfill.
11
+ - Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations. The `integrations` configuration option has been removed from the SDK factory configuration, along with the associated interfaces in the TypeScript definitions.
12
+ - Removed the `core.trafficType` configuration option (`SplitIO.IBrowserSettings['core']['trafficType]`) and the `trafficType` parameter from the SDK `client()` method in Browser (`SplitIO.IBrowserSDK['client']`). As a result, traffic types can no longer be bound to SDK clients, and the traffic type must be provided in the `track` method.
13
+ - TypeScript definitions:
14
+ - Removed an overloaded `client` method in the `SplitIO.ISDK` interface that accepted `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.
15
+ - Updated the `SplitIO.IBrowserSDK` and `SplitIO.IBrowserClient` interfaces to no longer extend the `SplitIO.ISDK` and `SplitIO.IClient` interfaces respectively, as the SDK factory instance in NodeJS or server-side (`SplitIO.ISDK`) has a different API than the SDK client instance in the Browser or client-side (`SplitIO.IBrowserClient`).
7
16
 
8
17
  10.28.0 (September 6, 2024)
9
18
  - Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
@@ -514,7 +523,7 @@
514
523
  - Bugfixing - Return correct label when consulted Split is not found.
515
524
 
516
525
  9.1.1 (May 03, 2017)
517
- - Bugfixing - Fixed invalid behaviour when using native Fetch API and comparing statusText
526
+ - Bugfixing - Fixed invalid behavior when using native Fetch API and comparing statusText
518
527
  instead of resp.ok
519
528
 
520
529
  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 sdkClientMethodCSWithTT_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethodCSWithTT");
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 browser_1 = require("@splitsoftware/splitio-commons/cjs/integrations/browser");
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 browser_2 = require("../settings/browser");
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
- InMemoryStorageCS_1.InMemoryStorageCSFactory;
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: sdkClientMethodCSWithTT_1.sdkClientMethodCSFactory,
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, browser_2.settingsFactory)(config);
66
+ var settings = (0, browser_1.settingsFactory)(config);
66
67
  var modules = getModules(settings);
67
68
  if (__updateModules)
68
69
  __updateModules(modules);
@@ -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, acceptTT: 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,
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageVersion = void 0;
4
- exports.packageVersion = '10.28.1-rc.4';
4
+ exports.packageVersion = '11.0.0-rc.1';
@@ -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
- type = constants_1.STORAGE_MEMORY;
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 behaviour that's ensured by the BE.
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) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "main": "../lib/factory/browser.js",
3
- "module": "../es/factory/browser.js",
2
+ "main": "../cjs/factory/browser.js",
3
+ "module": "../esm/factory/browser.js",
4
4
  "types": "../types/client/index.d.ts"
5
5
  }
@@ -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/sdkClientMethodCSWithTT';
8
+ import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethodCS';
9
9
  import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverCS';
10
- import { integrationsManagerFactory } from '@splitsoftware/splitio-commons/esm/integrations/browser';
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
- InMemoryStorageCSFactory;
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 {
@@ -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, acceptTT: 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.1';
@@ -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 behaviour that's ensured by the BE.
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": "10.28.1-rc.4",
3
+ "version": "11.0.0-rc.1",
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
- "lib",
10
+ "cjs",
11
11
  "types",
12
- "es",
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": "lib/index.js",
36
- "module": "es/index.js",
34
+ "main": "cjs/index.js",
35
+ "module": "esm/index.js",
37
36
  "types": "types",
38
37
  "engines": {
39
- "npm": ">=3",
40
- "node": ">=6"
38
+ "node": ">=14.0.0"
41
39
  },
42
40
  "dependencies": {
43
- "@splitsoftware/splitio-commons": "1.17.1-rc.3",
44
- "@types/google.analytics": "0.0.40",
41
+ "@splitsoftware/splitio-commons": "2.0.0-rc.2",
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 es && tsc -outDir es",
88
- "postbuild-esm": "cross-env NODE_ENV=es node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh",
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 lib && tsc -outDir lib -m CommonJS",
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",
@@ -1,5 +1,5 @@
1
1
  {
2
- "main": "../lib/factory/node.js",
3
- "module": "../es/factory/node.js",
2
+ "main": "../cjs/factory/node.js",
3
+ "module": "../esm/factory/node.js",
4
4
  "types": "../types/server/index.d.ts"
5
5
  }
@@ -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/sdkClientMethodCSWithTT';
8
+ import { sdkClientMethodCSFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethodCS';
9
9
  import { impressionObserverCSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverCS';
10
- import { integrationsManagerFactory } from '@splitsoftware/splitio-commons/src/integrations/browser';
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
- InMemoryStorageCSFactory;
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) => {
@@ -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, acceptTT: true, // Client with bound key and optional TT
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 = '10.28.1-rc.4';
1
+ export const packageVersion = '11.0.0-rc.1';
@@ -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
- type = STORAGE_MEMORY;
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 behaviour that's ensured by the BE.
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 => {
@@ -6,7 +6,7 @@ export = JsSdk;
6
6
 
7
7
  declare module JsSdk {
8
8
  /**
9
- * Split.io sdk factory function.
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 sdk factory function.
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 sdk factory function.
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 sdk factory function.
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
  */
@@ -6,13 +6,13 @@ export = JsSdk;
6
6
 
7
7
  declare module JsSdk {
8
8
  /**
9
- * Split.io sdk factory function.
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 sdk factory function.
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
  */