@splitsoftware/splitio 10.23.1-rc.1 → 10.23.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.
package/CHANGES.txt CHANGED
@@ -1,11 +1,14 @@
1
+ 10.23.1 (September 22, 2023)
2
+ - Updated @splitsoftware/splitio-commons package to version 1.9.1. This update removes the handler for 'unload' DOM events, that can prevent browsers from being able to put pages in the back/forward cache for faster back and forward loads (Related to issue https://github.com/splitio/javascript-client/issues/759).
3
+
1
4
  10.23.0 (July 18, 2023)
2
- - Updated @splitsoftware/splitio-commons package to version 1.9.0 that includes minor improvements:
5
+ - Updated @splitsoftware/splitio-commons package to version 1.8.4 that includes minor improvements:
3
6
  - Updated streaming architecture implementation to apply feature flag updates from the notification received which is now enhanced, improving efficiency and reliability of the whole update system.
4
7
 
5
8
  10.22.6 (July 6, 2023)
6
9
  - Updated some transitive dependencies for vulnerability fixes.
7
10
  - Updated @splitsoftware/splitio-commons package to version 1.8.3 that includes the following bug fix:
8
- - Bugfix - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent access to the storage when `getTreatment` and `track` methods are called after the SDK is destroyed.
11
+ - Bugfixing - The `destroy` method has been updated to immediately flag the SDK client as destroyed, to prevent access to the storage when `getTreatment` and `track` methods are called after the SDK is destroyed.
9
12
 
10
13
  10.22.5 (May 15, 2023)
11
14
  - Updated @splitsoftware/splitio-commons package to version 1.8.2 that includes minor improvements.
@@ -46,6 +46,7 @@ function ProcessEmitWarning(warning) {
46
46
  if (console && console.warn)
47
47
  console.warn(warning);
48
48
  }
49
+ // eslint-disable-next-line compat/compat
49
50
  var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
50
51
  return value !== value;
51
52
  };
@@ -1 +1 @@
1
- export var packageVersion = '10.23.1-rc.1';
1
+ export var packageVersion = '10.23.1';
@@ -49,6 +49,7 @@ function ProcessEmitWarning(warning) {
49
49
  if (console && console.warn)
50
50
  console.warn(warning);
51
51
  }
52
+ // eslint-disable-next-line compat/compat
52
53
  var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
53
54
  return value !== value;
54
55
  };
@@ -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.23.1-rc.1';
4
+ exports.packageVersion = '10.23.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio",
3
- "version": "10.23.1-rc.1",
3
+ "version": "10.23.1",
4
4
  "description": "Split SDK",
5
5
  "files": [
6
6
  "README.md",
@@ -12,7 +12,6 @@
12
12
  "es",
13
13
  "src",
14
14
  "scripts/ga-to-split-autorequire.js",
15
- "suite",
16
15
  "client",
17
16
  "server"
18
17
  ],
@@ -41,8 +40,7 @@
41
40
  "node": ">=6"
42
41
  },
43
42
  "dependencies": {
44
- "@splitsoftware/browser-rum-agent": "0.3.0",
45
- "@splitsoftware/splitio-commons": "1.9.1-rc.0",
43
+ "@splitsoftware/splitio-commons": "1.9.1",
46
44
  "@types/google.analytics": "0.0.40",
47
45
  "@types/ioredis": "^4.28.0",
48
46
  "bloom-filters": "^3.0.0",
@@ -60,8 +58,8 @@
60
58
  "copyfiles": "^2.4.1",
61
59
  "cross-env": "^7.0.3",
62
60
  "csv-streamify": "4.0.0",
63
- "eslint": "^8.0.1",
64
- "eslint-plugin-compat": "^4.1.4",
61
+ "eslint": "^8.48.0",
62
+ "eslint-plugin-compat": "^4.2.0",
65
63
  "eslint-plugin-import": "^2.25.4",
66
64
  "fetch-mock": "^9.11.0",
67
65
  "karma": "^6.3.16",
@@ -102,14 +100,13 @@
102
100
  "check:version": "cross-env NODE_ENV=test tape -r ./ts-node.register src/settings/__tests__/defaults.spec.js",
103
101
  "test-browser": "npm run test-browser-unit && npm run test-browser-e2e",
104
102
  "test-browser-unit": "cross-env NODE_ENV=test karma start karma/unit.karma.conf.js",
105
- "test-browser-e2e": "npm run test-browser-e2e-online && npm run test-browser-e2e-offline && npm run test-browser-e2e-destroy && npm run test-browser-e2e-errorCatching && npm run test-browser-e2e-push && npm run test-browser-e2e-gaIntegration && npm run test-browser-e2e-suite",
103
+ "test-browser-e2e": "npm run test-browser-e2e-online && npm run test-browser-e2e-offline && npm run test-browser-e2e-destroy && npm run test-browser-e2e-errorCatching && npm run test-browser-e2e-push && npm run test-browser-e2e-gaIntegration",
106
104
  "test-browser-e2e-online": "cross-env NODE_ENV=test karma start karma/e2e.online.karma.conf.js",
107
105
  "test-browser-e2e-offline": "cross-env NODE_ENV=test karma start karma/e2e.offline.karma.conf.js",
108
106
  "test-browser-e2e-destroy": "cross-env NODE_ENV=test karma start karma/e2e.destroy.karma.conf.js",
109
107
  "test-browser-e2e-errorCatching": "cross-env NODE_ENV=test karma start karma/e2e.errorCatching.karma.conf.js",
110
108
  "test-browser-e2e-push": "cross-env NODE_ENV=test karma start karma/e2e.push.karma.conf.js",
111
109
  "test-browser-e2e-gaIntegration": "cross-env NODE_ENV=test karma start karma/e2e.gaIntegration.karma.conf.js",
112
- "test-browser-e2e-suite": "cross-env NODE_ENV=test karma start karma/e2e.suite.karma.conf.js",
113
110
  "test-node": "npm run test-node-unit && npm run test-node-e2e",
114
111
  "test-node-unit": "cross-env NODE_ENV=test tape -r ./ts-node.register \"src/*/**/__tests__/**/!(browser).spec.js\" | tap-min",
115
112
  "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",
@@ -48,6 +48,7 @@ function ProcessEmitWarning(warning) {
48
48
  if (console && console.warn) console.warn(warning);
49
49
  }
50
50
 
51
+ // eslint-disable-next-line compat/compat
51
52
  var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
52
53
  return value !== value;
53
54
  };
@@ -1 +1 @@
1
- export const packageVersion = '10.23.1-rc.1';
1
+ export const packageVersion = '10.23.1';
@@ -4,7 +4,6 @@
4
4
 
5
5
  /// <reference types="google.analytics" />
6
6
  import { RedisOptions } from "ioredis";
7
- import { SplitRumAgentConfig, EventCollector } from '@splitsoftware/browser-rum-agent';
8
7
 
9
8
  export as namespace SplitIO;
10
9
  export = SplitIO;
@@ -190,8 +189,14 @@ interface IUserConsentAPI {
190
189
  */
191
190
  interface ISharedSettings {
192
191
  /**
193
- * Whether the logger should be enabled or disabled by default.
194
- * @property {Boolean} debug
192
+ * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
193
+ *
194
+ * Examples:
195
+ * ```javascript
196
+ * config.debug = true
197
+ * config.debug = 'WARN'
198
+ * ```
199
+ * @property {boolean | LogLevel} debug
195
200
  * @default false
196
201
  */
197
202
  debug?: boolean | LogLevel,
@@ -1114,19 +1119,6 @@ declare namespace SplitIO {
1114
1119
  */
1115
1120
  userConsent?: ConsentStatus
1116
1121
  }
1117
- /**
1118
- * Settings interface for Suite instances created on the browser.
1119
- * @interface IBrowserSuiteSettings
1120
- * @extends IBrowserSettings
1121
- * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
1122
- */
1123
- interface IBrowserSuiteSettings extends IBrowserSettings {
1124
- /**
1125
- * Optional configuration object for the RUM agent.
1126
- * @see {@link https://help.split.io/hc/en-us/articles/360030898431-Browser-RUM-agent#configuration}
1127
- */
1128
- rumAgent?: SplitRumAgentConfig
1129
- }
1130
1122
  /**
1131
1123
  * Settings interface for SDK instances created on NodeJS.
1132
1124
  * If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
@@ -1296,8 +1288,8 @@ declare namespace SplitIO {
1296
1288
  }
1297
1289
  /**
1298
1290
  * This represents the interface for the SDK instance with synchronous storage.
1299
- * @interface IBrowserSDK
1300
- * @extends ISDK
1291
+ * @interface ISDK
1292
+ * @extends IBasicSDK
1301
1293
  */
1302
1294
  interface IBrowserSDK extends ISDK {
1303
1295
  /**
@@ -1320,41 +1312,6 @@ declare namespace SplitIO {
1320
1312
  */
1321
1313
  UserConsent: IUserConsentAPI
1322
1314
  }
1323
- /**
1324
- * This represents the interface for the Suite instance, that is an extension of the SDK interface.
1325
- * @interface IBrowserSuiteSDK
1326
- * @extends IBrowserSDK
1327
- */
1328
- interface IBrowserSuiteSDK extends IBrowserSDK {
1329
- /**
1330
- * Returns the default client instance of the SDK, and adds its identity (i.e., user key and traffic type pair) to the RUM agent to track events for it.
1331
- *
1332
- * NOTE: if no traffic type was provided to the config, 'user' will be used as default for the RUM Agent.
1333
- *
1334
- * @function client
1335
- * @returns {IBrowserClient} The client instance.
1336
- */
1337
- client(): IBrowserClient,
1338
- /**
1339
- * Returns a shared client of the SDK, and adds its identity (i.e., user key and traffic type pair) to the RUM agent to track events for it.
1340
- *
1341
- * NOTE: if no traffic type is provided as second argument, 'user' will be used as default for the RUM Agent.
1342
- *
1343
- * @function client
1344
- * @param {SplitKey} key The key for the new client instance.
1345
- * @param {string=} trafficType The traffic type of the provided key.
1346
- * @returns {IBrowserClient} The client instance.
1347
- */
1348
- client(key: SplitKey, trafficType?: string): IBrowserClient
1349
- /**
1350
- * Destroys all client instances and remove identities from the RUM agent to stop tracking events for them.
1351
- * This method will flush any pending impressions and events, and stop the synchronization of feature flag definitions with the backend.
1352
- *
1353
- * @function destroy
1354
- * @returns {Promise<void>} A promise that resolves once the client is destroyed.
1355
- */
1356
- destroy(): Promise<void>
1357
- }
1358
1315
  /**
1359
1316
  * This represents the interface for the SDK instance with asynchronous storage.
1360
1317
  * @interface IAsyncSDK
@@ -1,57 +0,0 @@
1
- import { objectAssign } from '@splitsoftware/splitio-commons/esm/utils/lang/objectAssign';
2
- import { _Set, setToArray } from '@splitsoftware/splitio-commons/esm/utils/lang/sets';
3
- import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
4
- // @TODO import RumAgent automatically or users should import it?
5
- import { SplitRumAgent } from '@splitsoftware/browser-rum-agent';
6
- import { SplitFactory } from './browser';
7
- var DEFAULT_TRAFFIC_TYPE = 'user';
8
- /**
9
- * SplitFactory for client-side with RUM Agent.
10
- *
11
- * @param {import('../../types/splitio').IBrowserSuiteSettings} config configuration object used to instantiate the Suite
12
- * @param {Function=} __updateModules optional function that lets redefine internal SDK modules. Use with
13
- * caution since, unlike `config`, this param is not validated neither considered part of the public API.
14
- * @throws Will throw an error if the provided config is invalid.
15
- */
16
- export function SplitSuite(config, __updateModules) {
17
- var sdk = SplitFactory(config, __updateModules);
18
- /** @type {import('../../types/splitio').IBrowserSuiteSettings} */
19
- var settings = sdk.settings;
20
- // Do not setup RUM Agent if not in standalone mode
21
- if (settings.mode !== STANDALONE_MODE)
22
- return sdk;
23
- // Setup RUM Agent
24
- SplitRumAgent.__getConfig().log = settings.log;
25
- SplitRumAgent.setup(settings.core.authorizationKey, objectAssign({
26
- url: settings.urls.events,
27
- pushRate: settings.scheduler.eventsPushRate,
28
- queueSize: settings.scheduler.eventsQueueSize
29
- }, settings.rumAgent));
30
- var clients = new _Set();
31
- // Create Suite instance extending SDK
32
- return objectAssign({}, sdk, {
33
- client: function () {
34
- var client = sdk.client.apply(sdk, arguments);
35
- if (!clients.has(client)) {
36
- clients.add(client);
37
- SplitRumAgent.addIdentity({
38
- key: client.key,
39
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
40
- });
41
- // override client.destroy to remove identity from RUM Agent
42
- var originalDestroy_1 = client.destroy;
43
- client.destroy = function () {
44
- SplitRumAgent.removeIdentity({
45
- key: client.key,
46
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
47
- });
48
- return originalDestroy_1.apply(client, arguments);
49
- };
50
- }
51
- return client;
52
- },
53
- destroy: function () {
54
- return Promise.all(setToArray(clients).map(function (client) { return client.destroy(); }));
55
- }
56
- });
57
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SplitSuite = void 0;
4
- var objectAssign_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang/objectAssign");
5
- var sets_1 = require("@splitsoftware/splitio-commons/cjs/utils/lang/sets");
6
- var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
7
- // @TODO import RumAgent automatically or users should import it?
8
- var browser_rum_agent_1 = require("@splitsoftware/browser-rum-agent");
9
- var browser_1 = require("./browser");
10
- var DEFAULT_TRAFFIC_TYPE = 'user';
11
- /**
12
- * SplitFactory for client-side with RUM Agent.
13
- *
14
- * @param {import('../../types/splitio').IBrowserSuiteSettings} config configuration object used to instantiate the Suite
15
- * @param {Function=} __updateModules optional function that lets redefine internal SDK modules. Use with
16
- * caution since, unlike `config`, this param is not validated neither considered part of the public API.
17
- * @throws Will throw an error if the provided config is invalid.
18
- */
19
- function SplitSuite(config, __updateModules) {
20
- var sdk = (0, browser_1.SplitFactory)(config, __updateModules);
21
- /** @type {import('../../types/splitio').IBrowserSuiteSettings} */
22
- var settings = sdk.settings;
23
- // Do not setup RUM Agent if not in standalone mode
24
- if (settings.mode !== constants_1.STANDALONE_MODE)
25
- return sdk;
26
- // Setup RUM Agent
27
- browser_rum_agent_1.SplitRumAgent.__getConfig().log = settings.log;
28
- browser_rum_agent_1.SplitRumAgent.setup(settings.core.authorizationKey, (0, objectAssign_1.objectAssign)({
29
- url: settings.urls.events,
30
- pushRate: settings.scheduler.eventsPushRate,
31
- queueSize: settings.scheduler.eventsQueueSize
32
- }, settings.rumAgent));
33
- var clients = new sets_1._Set();
34
- // Create Suite instance extending SDK
35
- return (0, objectAssign_1.objectAssign)({}, sdk, {
36
- client: function () {
37
- var client = sdk.client.apply(sdk, arguments);
38
- if (!clients.has(client)) {
39
- clients.add(client);
40
- browser_rum_agent_1.SplitRumAgent.addIdentity({
41
- key: client.key,
42
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
43
- });
44
- // override client.destroy to remove identity from RUM Agent
45
- var originalDestroy_1 = client.destroy;
46
- client.destroy = function () {
47
- browser_rum_agent_1.SplitRumAgent.removeIdentity({
48
- key: client.key,
49
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
50
- });
51
- return originalDestroy_1.apply(client, arguments);
52
- };
53
- }
54
- return client;
55
- },
56
- destroy: function () {
57
- return Promise.all((0, sets_1.setToArray)(clients).map(function (client) { return client.destroy(); }));
58
- }
59
- });
60
- }
61
- exports.SplitSuite = SplitSuite;
@@ -1,68 +0,0 @@
1
- import { objectAssign } from '@splitsoftware/splitio-commons/src/utils/lang/objectAssign';
2
- import { _Set, setToArray } from '@splitsoftware/splitio-commons/src/utils/lang/sets';
3
- import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
4
- // @TODO import RumAgent automatically or users should import it?
5
- import { SplitRumAgent } from '@splitsoftware/browser-rum-agent';
6
- import { SplitFactory } from './browser';
7
-
8
- const DEFAULT_TRAFFIC_TYPE = 'user';
9
-
10
- /**
11
- * SplitFactory for client-side with RUM Agent.
12
- *
13
- * @param {import('../../types/splitio').IBrowserSuiteSettings} config configuration object used to instantiate the Suite
14
- * @param {Function=} __updateModules optional function that lets redefine internal SDK modules. Use with
15
- * caution since, unlike `config`, this param is not validated neither considered part of the public API.
16
- * @throws Will throw an error if the provided config is invalid.
17
- */
18
- export function SplitSuite(config, __updateModules) {
19
- const sdk = SplitFactory(config, __updateModules);
20
-
21
- /** @type {import('../../types/splitio').IBrowserSuiteSettings} */
22
- const settings = sdk.settings;
23
-
24
- // Do not setup RUM Agent if not in standalone mode
25
- if (settings.mode !== STANDALONE_MODE) return sdk;
26
-
27
- // Setup RUM Agent
28
- SplitRumAgent.__getConfig().log = settings.log;
29
- SplitRumAgent.setup(settings.core.authorizationKey, objectAssign({
30
- url: settings.urls.events,
31
- pushRate: settings.scheduler.eventsPushRate,
32
- queueSize: settings.scheduler.eventsQueueSize
33
- }, settings.rumAgent));
34
-
35
- const clients = new _Set();
36
-
37
- // Create Suite instance extending SDK
38
- return objectAssign({}, sdk, {
39
- client() {
40
- const client = sdk.client.apply(sdk, arguments);
41
-
42
- if (!clients.has(client)) {
43
- clients.add(client);
44
-
45
- SplitRumAgent.addIdentity({
46
- key: client.key,
47
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
48
- });
49
-
50
- // override client.destroy to remove identity from RUM Agent
51
- const originalDestroy = client.destroy;
52
- client.destroy = function () {
53
- SplitRumAgent.removeIdentity({
54
- key: client.key,
55
- trafficType: client.trafficType || DEFAULT_TRAFFIC_TYPE
56
- });
57
- return originalDestroy.apply(client, arguments);
58
- };
59
- }
60
-
61
- return client;
62
- },
63
-
64
- destroy() {
65
- return Promise.all(setToArray(clients).map(client => client.destroy()));
66
- }
67
- });
68
- }
@@ -1,5 +0,0 @@
1
- {
2
- "main": "../lib/factory/browserSuite.js",
3
- "module": "../es/factory/browserSuite.js",
4
- "types": "../types/suite/index.d.ts"
5
- }
@@ -1,12 +0,0 @@
1
- // Declaration file for JavaScript Split Software SDK
2
- // Project: http://www.split.io/
3
-
4
- /// <reference path="../splitio.d.ts" />
5
- export = JsSdk;
6
-
7
- declare module JsSdk {
8
- /**
9
- * @TODO
10
- */
11
- export function SplitSuite(settings: SplitIO.IBrowserSuiteSettings): SplitIO.IBrowserSuiteSDK;
12
- }