@splitsoftware/splitio 10.26.2-rc.0 → 10.27.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGES.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  10.27.0 (June 25, 2024)
2
- - Added `sync.requestOptions.agent` property to SDK configuration, to pass a custom HTTP(S) Agent to the SDK requests in NodeJS. This allows the SDK to use a custom agent with specific configurations, like a network proxy or custom TLS settings (See https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#proxy).
2
+ - Added `sync.requestOptions.agent` option to SDK configuration for NodeJS. This allows passing a custom NodeJS HTTP(S) Agent with specific configurations for the SDK requests, like custom TLS settings or a network proxy (See https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#proxy).
3
3
  - Updated some transitive dependencies for vulnerability fixes.
4
4
 
5
5
  10.26.1 (June 14, 2024)
@@ -3,6 +3,7 @@ import { validateRuntime } from '@splitsoftware/splitio-commons/esm/utils/settin
3
3
  import { validateLogger } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/logger/builtinLogger';
4
4
  import { LocalhostFromObject } from '@splitsoftware/splitio-commons/esm/sync/offline/LocalhostFromObject';
5
5
  import { validateConsent } from '@splitsoftware/splitio-commons/esm/utils/settingsValidation/consent';
6
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/esm/utils/constants';
6
7
  import { defaults } from './defaults/browser';
7
8
  import { validateStorage } from './storage/browser';
8
9
  import { validateIntegrations } from './integrations/browser';
@@ -17,5 +18,9 @@ var params = {
17
18
  consent: validateConsent,
18
19
  };
19
20
  export function settingsFactory(config) {
20
- return settingsValidation(config, params);
21
+ var settings = settingsValidation(config, params);
22
+ // Override in localhost mode to properly emit SDK_READY
23
+ if (settings.mode !== STANDALONE_MODE)
24
+ settings.sync.largeSegmentsEnabled = false;
25
+ return settings;
21
26
  }
@@ -9,7 +9,9 @@ export var defaults = {
9
9
  // Maximum amount of time used before notifies me a timeout.
10
10
  readyTimeout: 10,
11
11
  // Amount of time we will wait before the first push of events.
12
- eventsFirstPushWindow: 10
12
+ eventsFirstPushWindow: 10,
13
+ // Wait for large segments to emit SDK_READY event.
14
+ waitForLargeSegments: true,
13
15
  },
14
16
  // Consent is considered granted by default
15
17
  userConsent: CONSENT_GRANTED,
@@ -12,7 +12,9 @@ export var defaults = {
12
12
  // Maximum amount of time used before notifies me a timeout.
13
13
  readyTimeout: 15,
14
14
  // Don't wait a specific time for first flush on Node, no page load here.
15
- eventsFirstPushWindow: 0
15
+ eventsFirstPushWindow: 0,
16
+ // Don't wait for large segments to emit SDK_READY event.
17
+ waitForLargeSegments: false,
16
18
  },
17
19
  features: '.split',
18
20
  // Instance version.
@@ -1 +1 @@
1
- export var packageVersion = '10.26.2-rc.0';
1
+ export var packageVersion = '10.27.1-rc.0';
@@ -10,7 +10,6 @@ var params = {
10
10
  storage: validateStorage,
11
11
  logger: validateLogger,
12
12
  localhost: function () { return LocalhostFromFile(); },
13
- consent: function () { return undefined; }, // resets settings.userConsent to the default
14
13
  // In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
15
14
  };
16
15
  export function settingsFactory(config) {
@@ -18,5 +17,9 @@ export function settingsFactory(config) {
18
17
  // if provided, keeps reference to the `requestOptions` object
19
18
  if (settings.sync.requestOptions)
20
19
  settings.sync.requestOptions = config.sync.requestOptions;
20
+ // Reset config options not supported in Node.js
21
+ if (settings.sync.largeSegmentsEnabled)
22
+ settings.log.warn('Client instantiation: config.sync.largeSegmentsEnabled option is not supported in NodeJS. Ignoring it.');
23
+ settings.sync.largeSegmentsEnabled = false;
21
24
  return settings;
22
25
  }
@@ -18,7 +18,7 @@ export function validateStorage(settings) {
18
18
  if (type !== STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
19
19
  type === STORAGE_LOCALSTORAGE && !isLocalStorageAvailable()) {
20
20
  fallbackToMemory();
21
- log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
21
+ log.error('Invalid or unavailable storage. Fallback into MEMORY storage');
22
22
  }
23
23
  return {
24
24
  type: type,
@@ -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. Fallbacking into default MEMORY storage.');
9
+ log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallback 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. Fallbacking into default MEMORY storage.");
56
+ log.error("The provided '" + type + "' storage type is invalid. Fallback into default MEMORY storage.");
57
57
  return {
58
58
  type: STORAGE_MEMORY,
59
59
  prefix: prefix
@@ -6,6 +6,7 @@ var runtime_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValida
6
6
  var builtinLogger_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/logger/builtinLogger");
7
7
  var LocalhostFromObject_1 = require("@splitsoftware/splitio-commons/cjs/sync/offline/LocalhostFromObject");
8
8
  var consent_1 = require("@splitsoftware/splitio-commons/cjs/utils/settingsValidation/consent");
9
+ var constants_1 = require("@splitsoftware/splitio-commons/cjs/utils/constants");
9
10
  var browser_1 = require("./defaults/browser");
10
11
  var browser_2 = require("./storage/browser");
11
12
  var browser_3 = require("./integrations/browser");
@@ -20,6 +21,10 @@ var params = {
20
21
  consent: consent_1.validateConsent,
21
22
  };
22
23
  function settingsFactory(config) {
23
- return (0, settingsValidation_1.settingsValidation)(config, params);
24
+ var settings = (0, settingsValidation_1.settingsValidation)(config, params);
25
+ // Override in localhost mode to properly emit SDK_READY
26
+ if (settings.mode !== constants_1.STANDALONE_MODE)
27
+ settings.sync.largeSegmentsEnabled = false;
28
+ return settings;
24
29
  }
25
30
  exports.settingsFactory = settingsFactory;
@@ -12,7 +12,9 @@ exports.defaults = {
12
12
  // Maximum amount of time used before notifies me a timeout.
13
13
  readyTimeout: 10,
14
14
  // Amount of time we will wait before the first push of events.
15
- eventsFirstPushWindow: 10
15
+ eventsFirstPushWindow: 10,
16
+ // Wait for large segments to emit SDK_READY event.
17
+ waitForLargeSegments: true,
16
18
  },
17
19
  // Consent is considered granted by default
18
20
  userConsent: constants_1.CONSENT_GRANTED,
@@ -15,7 +15,9 @@ exports.defaults = {
15
15
  // Maximum amount of time used before notifies me a timeout.
16
16
  readyTimeout: 15,
17
17
  // Don't wait a specific time for first flush on Node, no page load here.
18
- eventsFirstPushWindow: 0
18
+ eventsFirstPushWindow: 0,
19
+ // Don't wait for large segments to emit SDK_READY event.
20
+ waitForLargeSegments: false,
19
21
  },
20
22
  features: '.split',
21
23
  // Instance version.
@@ -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.26.2-rc.0';
4
+ exports.packageVersion = '10.27.1-rc.0';
@@ -13,7 +13,6 @@ var params = {
13
13
  storage: node_2.validateStorage,
14
14
  logger: builtinLogger_1.validateLogger,
15
15
  localhost: function () { return (0, LocalhostFromFile_1.LocalhostFromFile)(); },
16
- consent: function () { return undefined; }, // resets settings.userConsent to the default
17
16
  // In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
18
17
  };
19
18
  function settingsFactory(config) {
@@ -21,6 +20,10 @@ function settingsFactory(config) {
21
20
  // if provided, keeps reference to the `requestOptions` object
22
21
  if (settings.sync.requestOptions)
23
22
  settings.sync.requestOptions = config.sync.requestOptions;
23
+ // Reset config options not supported in Node.js
24
+ if (settings.sync.largeSegmentsEnabled)
25
+ settings.log.warn('Client instantiation: config.sync.largeSegmentsEnabled option is not supported in NodeJS. Ignoring it.');
26
+ settings.sync.largeSegmentsEnabled = false;
24
27
  return settings;
25
28
  }
26
29
  exports.settingsFactory = settingsFactory;
@@ -21,7 +21,7 @@ function validateStorage(settings) {
21
21
  if (type !== constants_1.STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
22
22
  type === STORAGE_LOCALSTORAGE && !(0, isLocalStorageAvailable_1.isLocalStorageAvailable)()) {
23
23
  fallbackToMemory();
24
- log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
24
+ log.error('Invalid or unavailable storage. Fallback into MEMORY storage');
25
25
  }
26
26
  return {
27
27
  type: type,
@@ -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. Fallbacking into default MEMORY storage.');
12
+ log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallback 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. Fallbacking into default MEMORY storage.");
59
+ log.error("The provided '" + type + "' storage type is invalid. Fallback 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.26.2-rc.0",
3
+ "version": "10.27.1-rc.0",
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.16.0",
43
+ "@splitsoftware/splitio-commons": "1.16.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",
@@ -3,6 +3,7 @@ import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settin
3
3
  import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
4
4
  import { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
5
5
  import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
6
+ import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';
6
7
 
7
8
  import { defaults } from './defaults/browser';
8
9
  import { validateStorage } from './storage/browser';
@@ -20,5 +21,10 @@ const params = {
20
21
  };
21
22
 
22
23
  export function settingsFactory(config) {
23
- return settingsValidation(config, params);
24
+ const settings = settingsValidation(config, params);
25
+
26
+ // Override in localhost mode to properly emit SDK_READY
27
+ if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;
28
+
29
+ return settings;
24
30
  }
@@ -10,7 +10,9 @@ export const defaults = {
10
10
  // Maximum amount of time used before notifies me a timeout.
11
11
  readyTimeout: 10,
12
12
  // Amount of time we will wait before the first push of events.
13
- eventsFirstPushWindow: 10
13
+ eventsFirstPushWindow: 10,
14
+ // Wait for large segments to emit SDK_READY event.
15
+ waitForLargeSegments: true,
14
16
  },
15
17
 
16
18
  // Consent is considered granted by default
@@ -13,7 +13,9 @@ export const defaults = {
13
13
  // Maximum amount of time used before notifies me a timeout.
14
14
  readyTimeout: 15,
15
15
  // Don't wait a specific time for first flush on Node, no page load here.
16
- eventsFirstPushWindow: 0
16
+ eventsFirstPushWindow: 0,
17
+ // Don't wait for large segments to emit SDK_READY event.
18
+ waitForLargeSegments: false,
17
19
  },
18
20
 
19
21
  features: '.split',
@@ -1 +1 @@
1
- export const packageVersion = '10.26.2-rc.0';
1
+ export const packageVersion = '10.27.1-rc.0';
@@ -12,7 +12,6 @@ const params = {
12
12
  storage: validateStorage,
13
13
  logger: validateLogger,
14
14
  localhost: () => LocalhostFromFile(),
15
- consent: () => undefined, // resets settings.userConsent to the default
16
15
  // In Node.js the SDK ignores `config.integrations`, so a validator for integrations is not required
17
16
  };
18
17
 
@@ -21,5 +20,10 @@ export function settingsFactory(config) {
21
20
 
22
21
  // if provided, keeps reference to the `requestOptions` object
23
22
  if (settings.sync.requestOptions) settings.sync.requestOptions = config.sync.requestOptions;
23
+
24
+ // Reset config options not supported in Node.js
25
+ if (settings.sync.largeSegmentsEnabled) settings.log.warn('Client instantiation: config.sync.largeSegmentsEnabled option is not supported in NodeJS. Ignoring it.');
26
+ settings.sync.largeSegmentsEnabled = false;
27
+
24
28
  return settings;
25
29
  }
@@ -31,7 +31,7 @@ export function validateStorage(settings) {
31
31
  if (type !== STORAGE_MEMORY && type !== STORAGE_LOCALSTORAGE ||
32
32
  type === STORAGE_LOCALSTORAGE && !isLocalStorageAvailable()) {
33
33
  fallbackToMemory();
34
- log.error('Invalid or unavailable storage. Fallbacking into MEMORY storage');
34
+ log.error('Invalid or unavailable storage. Fallback into MEMORY storage');
35
35
  }
36
36
 
37
37
  return {
@@ -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. Fallbacking into default MEMORY storage.');
19
+ log.error('The provided REDIS storage is invalid for this mode. It requires consumer mode. Fallback 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. Fallbacking into default MEMORY storage.`);
77
+ if (type !== STORAGE_MEMORY) log.error(`The provided '${type}' storage type is invalid. Fallback into default MEMORY storage.`);
78
78
  return {
79
79
  type: STORAGE_MEMORY,
80
80
  prefix
@@ -78,6 +78,7 @@ interface ISettings {
78
78
  metricsRefreshRate?: number,
79
79
  telemetryRefreshRate: number,
80
80
  segmentsRefreshRate: number,
81
+ largeSegmentsRefreshRate: number,
81
82
  offlineRefreshRate: number,
82
83
  eventsPushRate: number,
83
84
  eventsQueueSize: number,
@@ -87,7 +88,8 @@ interface ISettings {
87
88
  readyTimeout: number,
88
89
  requestTimeoutBeforeReady: number,
89
90
  retriesOnFailureBeforeReady: number,
90
- eventsFirstPushWindow: number
91
+ eventsFirstPushWindow: number,
92
+ waitForLargeSegments: boolean
91
93
  },
92
94
  readonly storage: {
93
95
  prefix: string,
@@ -111,7 +113,9 @@ interface ISettings {
111
113
  readonly sync: {
112
114
  splitFilters: SplitIO.SplitFilter[],
113
115
  impressionsMode: SplitIO.ImpressionsMode,
114
- enabled: boolean
116
+ enabled: boolean,
117
+ largeSegmentsEnabled: boolean,
118
+ flagSpecVersion: string
115
119
  }
116
120
  /**
117
121
  * User consent status if using in browser. Undefined if using in NodeJS.
@@ -981,6 +985,13 @@ declare namespace SplitIO {
981
985
  * @default 10
982
986
  */
983
987
  eventsFirstPushWindow?: number,
988
+ /**
989
+ * Whether the SDK should wait for large segments to be ready before emitting SDK_READY event.
990
+ * It only applies if largeSegmentsEnabled is true.
991
+ * @property {boolean} waitForLargeSegments
992
+ * @default true
993
+ */
994
+ waitForLargeSegments?: boolean
984
995
  },
985
996
  /**
986
997
  * SDK scheduler settings.
@@ -1025,6 +1036,13 @@ declare namespace SplitIO {
1025
1036
  * @default 60
1026
1037
  */
1027
1038
  segmentsRefreshRate?: number,
1039
+ /**
1040
+ * The SDK polls Split servers for changes to large segment definitions. This parameter controls this polling period in seconds.
1041
+ * It only applies if largeSegmentsEnabled is true.
1042
+ * @property {number} largeSegmentsRefreshRate
1043
+ * @default 60
1044
+ */
1045
+ largeSegmentsRefreshRate?: number,
1028
1046
  /**
1029
1047
  * The SDK posts the queued events data in bulks. This parameter controls the posting rate in seconds.
1030
1048
  * @property {number} eventsPushRate
@@ -1126,7 +1144,15 @@ declare namespace SplitIO {
1126
1144
  * @typedef {string} userConsent
1127
1145
  * @default 'GRANTED'
1128
1146
  */
1129
- userConsent?: ConsentStatus
1147
+ userConsent?: ConsentStatus,
1148
+ sync?: ISharedSettings['sync'] & {
1149
+ /**
1150
+ * Enables synchronization of large segments.
1151
+ * @property {boolean} largeSegmentsEnabled
1152
+ * @default false
1153
+ */
1154
+ largeSegmentsEnabled?: boolean
1155
+ }
1130
1156
  }
1131
1157
  /**
1132
1158
  * Settings interface for SDK instances created on NodeJS.