@splitsoftware/splitio-commons 2.3.1-rc.0 → 2.4.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,6 +1,9 @@
1
- 2.4.0 (May 20, 2025)
2
- - Added support for targeting rules based on rule-based segments.
3
- - Added support for feature flag prerequisites.
1
+ 2.4.1 (June 3, 2025)
2
+ - Bugfix - Improved the Proxy fallback to flag spec version 1.2 to handle cases where the Proxy does not return an end-of-stream marker in 400 status code responses.
3
+
4
+ 2.4.0 (May 27, 2025)
5
+ - Added support for rule-based segments. These segments determine membership at runtime by evaluating their configured rules against the user attributes provided to the SDK.
6
+ - Added support for feature flag prerequisites. This allows customers to define dependency conditions between flags, which are evaluated before any allowlists or targeting rules.
4
7
 
5
8
  2.3.0 (May 16, 2025)
6
9
  - Updated the Redis storage to:
@@ -26,9 +26,9 @@ function splitChangesFetcherFactory(fetchSplitChanges, settings, storage) {
26
26
  settings.sync.flagSpecVersion = constants_1.FLAG_SPEC_VERSION;
27
27
  }
28
28
  var splitsPromise = fetchSplitChanges(since, noCache, till, settings.sync.flagSpecVersion === constants_1.FLAG_SPEC_VERSION ? rbSince : undefined)
29
- // Handle proxy error with spec 1.3
30
29
  .catch(function (err) {
31
- if (err.statusCode === 400 && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === constants_1.FLAG_SPEC_VERSION) {
30
+ // Handle proxy error with spec 1.3
31
+ if ((!err.statusCode || err.statusCode === 400) && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === constants_1.FLAG_SPEC_VERSION) {
32
32
  log.error(constants_2.LOG_PREFIX_SYNC_SPLITS + 'Proxy error detected. Retrying with spec 1.2. If you are using Split Proxy, please upgrade to latest version');
33
33
  lastProxyCheckTimestamp = Date.now();
34
34
  settings.sync.flagSpecVersion = '1.2'; // fallback to 1.2 spec
@@ -23,9 +23,9 @@ export function splitChangesFetcherFactory(fetchSplitChanges, settings, storage)
23
23
  settings.sync.flagSpecVersion = FLAG_SPEC_VERSION;
24
24
  }
25
25
  var splitsPromise = fetchSplitChanges(since, noCache, till, settings.sync.flagSpecVersion === FLAG_SPEC_VERSION ? rbSince : undefined)
26
- // Handle proxy error with spec 1.3
27
26
  .catch(function (err) {
28
- if (err.statusCode === 400 && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === FLAG_SPEC_VERSION) {
27
+ // Handle proxy error with spec 1.3
28
+ if ((!err.statusCode || err.statusCode === 400) && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === FLAG_SPEC_VERSION) {
29
29
  log.error(LOG_PREFIX_SYNC_SPLITS + 'Proxy error detected. Retrying with spec 1.2. If you are using Split Proxy, please upgrade to latest version');
30
30
  lastProxyCheckTimestamp = Date.now();
31
31
  settings.sync.flagSpecVersion = '1.2'; // fallback to 1.2 spec
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "2.3.1-rc.0",
3
+ "version": "2.4.1",
4
4
  "description": "Split JavaScript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -39,8 +39,8 @@ export function ruleBasedSegmentMatcherContext(segmentName: string, storage: ISt
39
39
  storage.segments.isInSegment(name, matchingKey) :
40
40
  type === RULE_BASED_SEGMENT ?
41
41
  ruleBasedSegmentMatcherContext(name, storage, log)({ key, attributes }, splitEvaluator) :
42
- type === LARGE_SEGMENT && (storage as IStorageSync).largeSegments ?
43
- (storage as IStorageSync).largeSegments!.isInSegment(name, matchingKey) :
42
+ type === LARGE_SEGMENT && storage.largeSegments ?
43
+ storage.largeSegments.isInSegment(name, matchingKey) :
44
44
  false;
45
45
  }
46
46
 
@@ -458,6 +458,7 @@ export interface IStorageBase<
458
458
  splits: TSplitsCache,
459
459
  rbSegments: TRBSegmentsCache,
460
460
  segments: TSegmentsCache,
461
+ largeSegments?: TSegmentsCache,
461
462
  impressions: TImpressionsCache,
462
463
  impressionCounts: TImpressionsCountCache,
463
464
  events: TEventsCache,
@@ -40,9 +40,9 @@ export function splitChangesFetcherFactory(fetchSplitChanges: IFetchSplitChanges
40
40
  }
41
41
 
42
42
  let splitsPromise = fetchSplitChanges(since, noCache, till, settings.sync.flagSpecVersion === FLAG_SPEC_VERSION ? rbSince : undefined)
43
- // Handle proxy error with spec 1.3
44
43
  .catch((err) => {
45
- if (err.statusCode === 400 && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === FLAG_SPEC_VERSION) {
44
+ // Handle proxy error with spec 1.3
45
+ if ((!err.statusCode || err.statusCode === 400) && sdkEndpointOverridden(settings) && settings.sync.flagSpecVersion === FLAG_SPEC_VERSION) {
46
46
  log.error(LOG_PREFIX_SYNC_SPLITS + 'Proxy error detected. Retrying with spec 1.2. If you are using Split Proxy, please upgrade to latest version');
47
47
  lastProxyCheckTimestamp = Date.now();
48
48
  settings.sync.flagSpecVersion = '1.2'; // fallback to 1.2 spec